Declare Studio's dev container for agent-containers

Aberta
#6,461 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
5/5
Tempo estimado
Mais de uma semana
Facilidade para iniciantes
15/100
Tipo de issue
Funcionalidade
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
docker, docker-compose, github-actions, python

Direção de pesquisa

Start with docker-compose.yml, docker/Dockerfile.dev, and docker/studio-dev/entrypoint.py, then read the linked agent-containers declaration and publish workflow docs. Trace the stated container, sidecar, GCS, and setup constraints before making changes. Done means the listed compose and agent-containers flows meet the acceptance criteria, including tests, uploads, publishing, uid ownership, and image publishing.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

DEV: dev-ops

❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Overview

Agents running in a sandbox can't start containers, and rtibblesbot keeps its own copy of Studio's dev setup for QA. That copy drifts from Studio and breaks when a branch changes the setup, as #6450's GCS branch did on the copy's minio steps. Studio should declare its dev container so any agent can build, test, lint and serve Studio through agent-containers, a tool that starts the container from outside the sandbox. The same docker-compose.yml keeps serving engineers who run docker compose up.

Complexity: High
Target branch: unstable

Context
  • docker/Dockerfile.dev runs only as root: Python in root-owned system site-packages, node_modules in /src, and no ENTRYPOINT (L1-57).
  • agent-containers runs the container as the invoking user, mounts the worktree at the target's working_dir (else /workspace), and runs the image's entrypoint, never compose's entrypoint:.
  • docker/studio-dev/entrypoint.py waits about 10s for postgres and storage, runs manage.py setup on every start ignoring its exit code, and runs the command as a child, not via exec (L20-105).
  • A sidecar gets only its image, environment, command, healthcheck and named volumes. The tool waits for a sidecar only through its healthcheck, and none of Studio's services declares one. A target's ports can forward a host port to a sidecar's port ("gcs:4443").
  • studio-nginx has build but no image, which is an error (declaration.py L163-174), and celery-worker would pull learningequality/studio-app-dev, which is not published.
  • Webpack's bind and public ports are already separate through WEBPACK_DEV_PUBLIC_HOST/_PORT (webpackDevServerAddress.js L9-56).
  • Under #6450, the browser fetches files and uploads from the GCS emulator directly: file_server redirects to <request host>:<emulator port>, resumable upload URIs carry the emulator's -public-host, and the bucket is created by a compose entrypoint:.
  • Publishing a channel needs a running celery worker, or it sits at 0%.
  • make runs git rev-parse (Makefile L150), and the container mounts the git dir read-only.
The Change
  • studio-app in docker-compose.yml should declare an x-agent block, as described in the agent-containers README:
    • commands for serving, testing (make test, pnpm test) and linting;
    • PyPI, npm, and the GitHub hosts that git dependencies, node-sass's binary and the prek hook repos download from, as its allowed hosts;
    • port 8080, port 4000 mapped to WEBPACK_DEV_PUBLIC_PORT, and the GCS emulator's port 4443 forwarded from its sidecar as GCS_PUBLIC_PORT.
  • Every emulator URL the browser receives (file_server redirects and resumable upload session URIs) should name localhost:${GCS_PUBLIC_PORT}; the emulator itself builds them from the Host it was called on.
  • serve should run the dev server and a celery worker together. If either one exits, serve stops.
  • postgres, redis and gcs should declare healthchecks, the GCS bucket should exist without compose's entrypoint:, and studio-nginx and celery-worker should not break the declaration.
  • The dev image should run as any non-root uid. Its venv, node_modules, and pnpm, corepack and prek homes should sit outside the worktree mount and be writable by that user.
  • The image should carry prek with Studio's hook environments installed.
  • The image's entrypoint should install a branch's requirements and lockfile changes, migrate on each start, run setup once per database, then exec the command. docker compose up and agent-containers then share one setup path.
  • A workflow on unstable should publish the image through agent-containers' reusable publish workflow (agent-containers init writes it).
  • AGENTS.md should direct agents to run Studio's commands through agent-containers. A QA guide in the repo should give the login ([email protected] / a at /accounts/login/), the seeded channels, and what to check.
How to Get There
  • Engineer flow: run docker compose up in a Studio checkout.
  • Agent flow: run agent-containers serve and agent-containers run -- make test from a Studio checkout. A sandboxed agent first needs agent-containers install run once outside its sandbox, with the checkout under one of its roots.
Out of Scope
  • rtibblesbot's switch to Studio's target and removal of its own Studio setup, tracked in coding-agent.
  • Moving from minio to the GCS emulator: #6445.
  • The rest of #6459's linting changes.
  • Images for hotfixes or PRs: only unstable publishes.
  • Dockerfile.prod and the production deploy.
Acceptance Criteria

Each from a fresh clone of unstable:

  • docker compose up serves Studio at http://localhost:8080 with its JS bundles loading, and [email protected] / a signs in at /accounts/login/.
  • The same holds for agent-containers serve at the URL it prints.
  • Under both, a file uploaded to a channel finishes uploading, its preview loads, and publishing that channel reaches 100%.
  • make test, pnpm test and the lint command pass when run through agent-containers run.
  • A file agent-containers run writes in the worktree is owned by you.
  • On a branch that adds a Python and an npm dependency, both import inside the container without a rebuilt image.
  • A second start on the same database doesn't run setup again, and data from the first run is still there.
  • A push to unstable touching only source files publishes nothing. One touching a Dockerfile, a requirements file, pnpm-lock.yaml or docker-compose.yml publishes ghcr.io/learningequality/studio/studio-app:default.
  • A fresh agent session given only the repo runs the tests through agent-containers, following AGENTS.md.
References
  • learningequality/kolibri-data-portal#1247, the first repo declared: an entrypoint that drops to the checkout's owner, installs each branch's lockfile and runs first-run setup once, and caches shared with any uid.
  • The agent-containers README.

AI usage

I used Claude Code to design this with me and draft the issue. I chose GCS over minio, a forwarded emulator port over a Django proxy, prek as a separate step, and unstable alone. Claude Code read Studio's compose file, Dockerfile, entrypoint and settings, agent-containers' sidecar handling and rtibblesbot's Studio recipe, and drafted the sections.

Linguagem predominante
JavaScript
Estrelas
214
Forks
327
Merge médio
17h 5min
PRs com merge (30d)
25

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de learningequality/studio

Todas as issues de learningequality/studio

Issues semelhantes

Mais issues de JavaScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.