From 49a61f665c825f07f57d9a7e77ec786bee72c6e4 Mon Sep 17 00:00:00 2001 From: Roni Choudhury Date: Fri, 9 Aug 2024 09:56:24 -0400 Subject: [PATCH 1/2] Change `docker-compose` to `docker compose` in CI specs This change fixes failing tests in CI (where the `docker-compose` program has been replaced with the `docker compose` suite of commands). --- .github/workflows/cli-integration.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cli-integration.yml b/.github/workflows/cli-integration.yml index 7853a2628..b459b60da 100644 --- a/.github/workflows/cli-integration.yml +++ b/.github/workflows/cli-integration.yml @@ -84,12 +84,12 @@ jobs: - name: Dump Docker Compose logs if: failure() run: | - docker-compose \ + docker compose \ -f "$pythonLocation/lib/python${{ matrix.python }}/site-packages/dandi/tests/data/dandiarchive-docker/docker-compose.yml" \ logs --timestamps - name: Shut down Docker Compose run: | - docker-compose \ + docker compose \ -f "$pythonLocation/lib/python${{ matrix.python }}/site-packages/dandi/tests/data/dandiarchive-docker/docker-compose.yml" \ down -v From 5f488516649dc0da8469f7add712257d627ef6cb Mon Sep 17 00:00:00 2001 From: Roni Choudhury Date: Fri, 9 Aug 2024 16:10:14 -0400 Subject: [PATCH 2/2] Change "docker-compose" to "docker compose" throughout documentation --- DEVELOPMENT.md | 26 +++++++++++++------------- dev/django.Dockerfile | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index a6efafff4..3484b8c9d 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -4,25 +4,25 @@ This is the simplest configuration for developers to start with. ### Initial Setup -1. Run `docker-compose run --rm django ./manage.py migrate` -2. Run `docker-compose run --rm django ./manage.py createcachetable` -3. Run `docker-compose run --rm django ./manage.py createsuperuser --email $(git config user.email)` +1. Run `docker compose run --rm django ./manage.py migrate` +2. Run `docker compose run --rm django ./manage.py createcachetable` +3. Run `docker compose run --rm django ./manage.py createsuperuser --email $(git config user.email)` and follow the prompts to create your own user. This sets your username to your git email to ensure parity with how GitHub logins work. You can also replace the command substitution expression with a literal email address, or omit the `--email` option entirely to run the command in interactive mode. -4. Run `docker-compose run --rm django ./manage.py create_dev_dandiset --owner $(git config user.email)` +4. Run `docker compose run --rm django ./manage.py create_dev_dandiset --owner $(git config user.email)` to create a dummy dandiset to start working with. ### Run Application -1. Run `docker-compose up` +1. Run `docker compose up` 2. Access the site, starting at http://localhost:8000/admin/ 3. When finished, use `Ctrl+C` ### Application Maintenance Occasionally, new package dependencies or schema changes will necessitate maintenance. To non-destructively update your development stack at any time: -1. Run `docker-compose pull` -2. Run `docker-compose build --pull --no-cache` -3. Run `docker-compose run --rm django ./manage.py migrate` +1. Run `docker compose pull` +2. Run `docker compose build --pull --no-cache` +3. Run `docker compose run --rm django ./manage.py migrate` ## Develop Natively (advanced) This configuration still uses Docker to run attached services in the background, @@ -30,7 +30,7 @@ but allows developers to run Python code on their native system. ### Initial Setup 1. Install [Docker](https://docs.docker.com/engine/install/) and [Docker Compose](https://docs.docker.com/compose/install/) -2. Run `docker-compose -f ./docker-compose.yml up -d` +2. Run `docker compose -f ./docker-compose.yml up -d` 3. Install Python 3.11 4. Install [`psycopg2` build prerequisites](https://www.psycopg.org/docs/install.html#build-prerequisites). @@ -50,20 +50,20 @@ but allows developers to run Python code on their native system. to create a dummy dandiset to start working with. ### Run Application -1. Ensure `docker-compose -f ./docker-compose.yml up -d` is still active +1. Ensure `docker compose -f ./docker-compose.yml up -d` is still active 2. Run: 1. `source ./dev/export-env.sh` 2. `./manage.py runserver` 3. Run in a separate terminal: 1. `source ./dev/export-env.sh` 2. `celery --app dandiapi.celery worker --loglevel INFO --without-heartbeat -Q celery,calculate_sha256,ingest_zarr_archive -B` -4. When finished, run `docker-compose stop` +4. When finished, run `docker compose stop` ## Remap Service Ports (optional) Attached services may be exposed to the host system via alternative ports. Developers who work on multiple software projects concurrently may find this helpful to avoid port conflicts. -To do so, before running any `docker-compose` commands, set any of the environment variables: +To do so, before running any `docker compose` commands, set any of the environment variables: * `DOCKER_POSTGRES_PORT` * `DOCKER_RABBITMQ_PORT` * `DOCKER_MINIO_PORT` @@ -87,7 +87,7 @@ To install the tox pytest dependencies into your environment, run `pip install - These are useful for IDE autocompletion or if you want to run `pytest` directly (not recommended). When running the "Develop with Docker" configuration, all tox commands must be run as -`docker-compose run --rm django tox`; extra arguments may also be appended to this form. +`docker compose run --rm django tox`; extra arguments may also be appended to this form. ### Running Tests Run `tox` to launch the full test suite. diff --git a/dev/django.Dockerfile b/dev/django.Dockerfile index 9ac4d9ac2..069a9105d 100644 --- a/dev/django.Dockerfile +++ b/dev/django.Dockerfile @@ -20,7 +20,7 @@ COPY ./setup.py /opt/django-project/setup.py # Copy git folder for setuptools_scm COPY ./.git/ /opt/django-project/.git/ -# Don't install as editable, so that when the directory is mounted over with docker-compose, the +# Don't install as editable, so that when the directory is mounted over with `docker compose`, the # installation still exists (otherwise the dandiapi.egg-info/ directory would be overwritten, and # the installation would no longer exist) RUN pip install /opt/django-project[dev]