Skip to content

Commit

Permalink
Merge pull request #1999 from dandi/fix-docker-compose
Browse files Browse the repository at this point in the history
Replace `docker-compose` with `docker compose` to fix newly failing CI tests
  • Loading branch information
waxlamp authored Aug 9, 2024
2 parents 83d0c44 + 5f48851 commit 09f2152
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cli-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
26 changes: 13 additions & 13 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,33 @@
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,
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).
Expand All @@ -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`
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion dev/django.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 09f2152

Please sign in to comment.