From 747249e12a937fb9fc9ae3aa2a2370a785540fb8 Mon Sep 17 00:00:00 2001 From: Evan Date: Sat, 4 May 2024 20:31:56 -0400 Subject: [PATCH] Migrate to docker compose v2 --- .github/workflows/docker.yml | 4 ++-- README.md | 10 +++++----- dmoj/scripts/copy_static | 2 +- dmoj/scripts/enter_site | 2 +- dmoj/scripts/manage.py | 2 +- dmoj/scripts/migrate | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 16e9279..eefe629 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -13,12 +13,12 @@ jobs: run: | git submodule update --init --recursive - name: Build images - run: docker-compose build + run: docker compose build working-directory: dmoj - name: Test images run: | ./scripts/initialize - docker-compose up -d + docker compose up -d sleep 10 COMPOSE_EXEC_FLAGS="-T" ./scripts/copy_static COMPOSE_EXEC_FLAGS="-T" ./scripts/migrate diff --git a/README.md b/README.md index 773c176..a0164cc 100644 --- a/README.md +++ b/README.md @@ -25,12 +25,12 @@ Configure the environment variables in the files in `dmoj/environment/`. In part Next, build the images: ```sh -$ docker-compose build +$ docker compose build ``` Start up the site, so you can perform the initial migrations and generate the static files: ```sh -$ docker-compose up -d site +$ docker compose up -d site ``` You will need to generate the schema for the database, since it is currently empty: @@ -52,7 +52,7 @@ $ ./scripts/manage.py loaddata demo ## Usage ``` -$ docker-compose up -d +$ docker compose up -d ``` ## Notes @@ -74,13 +74,13 @@ Updating various sections of the site requires different images to be rebuilt. If any prerequisites were modified, you will need to rebuild most of the images: ```sh -$ docker-compose up -d --build base site celery bridged wsevent +$ docker compose up -d --build base site celery bridged wsevent ``` If the static files are modified, read the section on [Managing Static Files](#managing-static-files). If only the source code is modified, a restart is sufficient: ```sh -$ docker-compose restart site celery bridged wsevent +$ docker compose restart site celery bridged wsevent ``` ### Multiple Nginx Instances diff --git a/dmoj/scripts/copy_static b/dmoj/scripts/copy_static index b66cb46..219953f 100755 --- a/dmoj/scripts/copy_static +++ b/dmoj/scripts/copy_static @@ -1,7 +1,7 @@ #!/bin/bash cd $(dirname $(dirname $0)) || exit -docker-compose exec $COMPOSE_EXEC_FLAGS site /bin/bash -c "\ +docker compose exec $COMPOSE_EXEC_FLAGS site /bin/bash -c "\ bash make_style.sh && \ python3 manage.py collectstatic --noinput && \ python3 manage.py compilemessages && \ diff --git a/dmoj/scripts/enter_site b/dmoj/scripts/enter_site index d69d008..f5a92e2 100755 --- a/dmoj/scripts/enter_site +++ b/dmoj/scripts/enter_site @@ -1,4 +1,4 @@ #!/bin/bash cd $(dirname $(dirname $0)) || exit -docker-compose exec $COMPOSE_EXEC_FLAGS site /bin/bash +docker compose exec $COMPOSE_EXEC_FLAGS site /bin/bash diff --git a/dmoj/scripts/manage.py b/dmoj/scripts/manage.py index a777fb5..c2e14e0 100755 --- a/dmoj/scripts/manage.py +++ b/dmoj/scripts/manage.py @@ -1,4 +1,4 @@ #!/bin/bash cd $(dirname $(dirname $0)) || exit -docker-compose exec $COMPOSE_EXEC_FLAGS site python3 manage.py $@ +docker compose exec $COMPOSE_EXEC_FLAGS site python3 manage.py $@ diff --git a/dmoj/scripts/migrate b/dmoj/scripts/migrate index d0c2cf7..a7fad5a 100755 --- a/dmoj/scripts/migrate +++ b/dmoj/scripts/migrate @@ -1,4 +1,4 @@ #!/bin/bash cd $(dirname $(dirname $0)) || exit -docker-compose exec $COMPOSE_EXEC_FLAGS site python3 manage.py migrate $@ +docker compose exec $COMPOSE_EXEC_FLAGS site python3 manage.py migrate $@