From 2ef26e5d026b04352565d26e3da48e7de0e6cf72 Mon Sep 17 00:00:00 2001 From: acelinkio <31336038+acelinkio@users.noreply.github.com> Date: Fri, 28 Nov 2025 11:52:10 -0800 Subject: [PATCH] add devspace (#1173) --- .gitignore | 1 + api/devspace.yaml | 23 ++++++++++++++++++++++ auth/devspace.yaml | 18 ++++++++++++++++++ devspace.yaml | 18 ++++++++++++++++++ front/devspace.yaml | 29 ++++++++++++++++++++++++++++ scanner/devspace.yaml | 25 ++++++++++++++++++++++++ shell.nix | 4 ++++ transcoder/devspace.yaml | 41 ++++++++++++++++++++++++++++++++++++++++ 8 files changed, 159 insertions(+) create mode 100644 api/devspace.yaml create mode 100644 auth/devspace.yaml create mode 100644 devspace.yaml create mode 100644 front/devspace.yaml create mode 100644 scanner/devspace.yaml create mode 100644 transcoder/devspace.yaml diff --git a/.gitignore b/.gitignore index 6738538d..1c2736c1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /video +.devspace/ .env .venv .idea diff --git a/api/devspace.yaml b/api/devspace.yaml new file mode 100644 index 00000000..244475b2 --- /dev/null +++ b/api/devspace.yaml @@ -0,0 +1,23 @@ +version: v2beta1 +name: api +dev: + api: + imageSelector: ghcr.io/zoriya/kyoo_api + devImage: docker.io/oven/bun:latest + workingDir: /app + sync: + - path: .:/app + excludePaths: + - node_modules + startContainer: true + onUpload: + exec: + - command: bun install --frozen-lockfile + onChange: + - "./bun.lock" + command: + - bash + - -c + - "bun install && bun dev" + ports: + - port: "3567" \ No newline at end of file diff --git a/auth/devspace.yaml b/auth/devspace.yaml new file mode 100644 index 00000000..7da5af76 --- /dev/null +++ b/auth/devspace.yaml @@ -0,0 +1,18 @@ +version: v2beta1 +name: auth +dev: + auth: + imageSelector: ghcr.io/zoriya/kyoo_auth + devImage: docker.io/golang:1.25 + workingDir: /app + sync: + - path: .:/app + startContainer: true + onUpload: + restartContainer: true + command: + - bash + - -c + - "go mod download; go run -race ." + ports: + - port: "4568" \ No newline at end of file diff --git a/devspace.yaml b/devspace.yaml new file mode 100644 index 00000000..078935bc --- /dev/null +++ b/devspace.yaml @@ -0,0 +1,18 @@ +version: v2beta1 +name: kyoo-devspace +dependencies: + api: + path: ./api + pipeline: dev + auth: + path: ./auth + pipeline: dev + front: + path: ./front + pipeline: dev + scanner: + path: ./scanner + pipeline: dev + transcoder: + path: ./transcoder + pipeline: dev \ No newline at end of file diff --git a/front/devspace.yaml b/front/devspace.yaml new file mode 100644 index 00000000..121ae161 --- /dev/null +++ b/front/devspace.yaml @@ -0,0 +1,29 @@ +version: v2beta1 +name: front +dev: + front: + imageSelector: ghcr.io/zoriya/kyoo_front + devImage: docker.io/oven/bun:latest + workingDir: /app + sync: + - path: .:/app + excludePaths: + - node_modules + startContainer: true + onUpload: + exec: + - command: bun install --frozen-lockfile + onChange: + - "./bun.lock" + # increased sysctl limits for file watching + # front uses Metro javascript bundler which watches a lot of files + # these are node level settings that should be raised + # example values: + # fs.inotify.max_user_instances = 8192 + # fs.inotify.max_user_watches = 1048576 + command: + - bash + - -c + - "bun install --frozen-lockfile; bun dev --port 8901" + ports: + - port: "8901" \ No newline at end of file diff --git a/scanner/devspace.yaml b/scanner/devspace.yaml new file mode 100644 index 00000000..010a486c --- /dev/null +++ b/scanner/devspace.yaml @@ -0,0 +1,25 @@ +version: v2beta1 +name: scanner +dev: + scanner: + imageSelector: ghcr.io/zoriya/kyoo_scanner + devImage: docker.io/astral/uv:python3.13-trixie + workingDir: /app + sync: + - path: .:/app + excludePaths: + - __pycache__ + - .venv + startContainer: true + onUpload: + restartContainer: true + command: + - bash + - -c + - | + echo "Running uv sync..." + uv sync --locked || (echo 'uv sync failed' && exit 1) + echo "Starting FastAPI..." + /app/.venv/bin/fastapi run scanner --port 4389 + ports: + - port: "4389" \ No newline at end of file diff --git a/shell.nix b/shell.nix index 11835154..7958fce3 100644 --- a/shell.nix +++ b/shell.nix @@ -10,6 +10,10 @@ pkgs.mkShell { (import ./transcoder/shell.nix {inherit pkgs;}) ]; + packages = [ + pkgs.devspace + ]; + # env vars aren't inherited from the `inputsFrom` SHARP_FORCE_GLOBAL_LIBVIPS = 1; UV_PYTHON_PREFERENCE = "only-system"; diff --git a/transcoder/devspace.yaml b/transcoder/devspace.yaml new file mode 100644 index 00000000..09c04423 --- /dev/null +++ b/transcoder/devspace.yaml @@ -0,0 +1,41 @@ +version: v2beta1 +name: transcoder +dev: + transcoder: + imageSelector: ghcr.io/zoriya/kyoo_transcoder + # would be good to publish the kyoo_transcoder builder image with all deps installed + devImage: golang:1.25 + workingDir: /app + sync: + - path: .:/app + startContainer: true + onUpload: + restartContainer: true + command: + - bash + - -c + - | + echo "Determining architecture..." + ARCH=$(dpkg --print-architecture) + echo "Container architecture: $ARCH" + echo "Updating apt and installing transcoder dependencies..." + apt-get update && \ + apt-get install --no-install-recommends --no-install-suggests -y \ + ffmpeg \ + libavformat-dev libavutil-dev libswscale-dev \ + vainfo mesa-va-drivers \ + ca-certificates + if [ "$ARCH" = "amd64" ]; then + echo "Installing Intel VAAPI drivers (amd64 only)..." + apt-get install -y intel-media-va-driver-non-free i965-va-driver-shaders + else + echo "Skipping Intel VAAPI drivers for arch $ARCH" + fi + + echo "Downloading Go dependencies..." + go mod download + + echo "Starting transcoder..." + go run -race . + ports: + - port: "7666" \ No newline at end of file