diff --git a/.github/workflows/deploy-production.yml b/.github/workflows/deploy-production.yml index b26a006..fd11900 100644 --- a/.github/workflows/deploy-production.yml +++ b/.github/workflows/deploy-production.yml @@ -28,5 +28,5 @@ jobs: steps: - name: Checkout uses: actions/checkout@v6 - - run: docker compose -f docker-compose.yml --project-name ${{ secrets.STACK_NAME_PRODUCTION }} build - - run: docker compose -f docker-compose.yml --project-name ${{ secrets.STACK_NAME_PRODUCTION }} up -d + - run: docker compose -f compose.yml --project-name ${{ secrets.STACK_NAME_PRODUCTION }} build + - run: docker compose -f compose.yml --project-name ${{ secrets.STACK_NAME_PRODUCTION }} up -d diff --git a/.github/workflows/deploy-staging.yml b/.github/workflows/deploy-staging.yml index f33d9c5..7968f95 100644 --- a/.github/workflows/deploy-staging.yml +++ b/.github/workflows/deploy-staging.yml @@ -28,5 +28,5 @@ jobs: steps: - name: Checkout uses: actions/checkout@v6 - - run: docker compose -f docker-compose.yml --project-name ${{ secrets.STACK_NAME_STAGING }} build - - run: docker compose -f docker-compose.yml --project-name ${{ secrets.STACK_NAME_STAGING }} up -d + - run: docker compose -f compose.yml --project-name ${{ secrets.STACK_NAME_STAGING }} build + - run: docker compose -f compose.yml --project-name ${{ secrets.STACK_NAME_STAGING }} up -d diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 43cc53a..2a309ce 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -32,7 +32,7 @@ jobs: - backend/** - frontend/** - .env - - docker-compose*.yml + - compose*.yml - .github/workflows/playwright.yml test-playwright: diff --git a/backend/README.md b/backend/README.md index c217000..c4256fe 100644 --- a/backend/README.md +++ b/backend/README.md @@ -37,7 +37,7 @@ The setup is also already configured so you can run the tests through the VS Cod ## Docker Compose Override -During development, you can change Docker Compose settings that will only affect the local development environment in the file `docker-compose.override.yml`. +During development, you can change Docker Compose settings that will only affect the local development environment in the file `compose.override.yml`. The changes to that file only affect the local development environment, not the production environment. So, you can add "temporary" changes that help the development workflow. diff --git a/docker-compose.override.yml b/compose.override.yml similarity index 97% rename from docker-compose.override.yml rename to compose.override.yml index d30b8d0..779cc82 100644 --- a/docker-compose.override.yml +++ b/compose.override.yml @@ -12,7 +12,7 @@ services: ports: - "80:80" - "8090:8080" - # Duplicate the command from docker-compose.yml to add --api.insecure=true + # Duplicate the command from compose.yml to add --api.insecure=true command: # Enable Docker in Traefik, so that it reads labels from Docker services - --providers.docker diff --git a/docker-compose.traefik.yml b/compose.traefik.yml similarity index 100% rename from docker-compose.traefik.yml rename to compose.traefik.yml diff --git a/docker-compose.yml b/compose.yml similarity index 100% rename from docker-compose.yml rename to compose.yml diff --git a/deployment.md b/deployment.md index 970032b..2a285ff 100644 --- a/deployment.md +++ b/deployment.md @@ -32,7 +32,7 @@ mkdir -p /root/code/traefik-public/ Copy the Traefik Docker Compose file to your server. You could do it by running the command `rsync` in your local terminal: ```bash -rsync -a docker-compose.traefik.yml root@your-server.example.com:/root/code/traefik-public/ +rsync -a compose.traefik.yml root@your-server.example.com:/root/code/traefik-public/ ``` ### Traefik Public Network @@ -97,10 +97,10 @@ Go to the directory where you copied the Traefik Docker Compose file in your rem cd /root/code/traefik-public/ ``` -Now with the environment variables set and the `docker-compose.traefik.yml` in place, you can start the Traefik Docker Compose running the following command: +Now with the environment variables set and the `compose.traefik.yml` in place, you can start the Traefik Docker Compose running the following command: ```bash -docker compose -f docker-compose.traefik.yml up -d +docker compose -f compose.traefik.yml up -d ``` ## Deploy the FastAPI Project @@ -168,10 +168,10 @@ Copy the content and use that as password / secret key. And run that again to ge With the environment variables in place, you can deploy with Docker Compose: ```bash -docker compose -f docker-compose.yml up -d +docker compose -f compose.yml up -d ``` -For production you wouldn't want to have the overrides in `docker-compose.override.yml`, that's why we explicitly specify `docker-compose.yml` as the file to use. +For production you wouldn't want to have the overrides in `compose.override.yml`, that's why we explicitly specify `compose.yml` as the file to use. ## Continuous Deployment (CD) diff --git a/development.md b/development.md index 24a1506..7879ffc 100644 --- a/development.md +++ b/development.md @@ -105,13 +105,13 @@ After you update it, run again: docker compose watch ``` -When deploying, for example in production, the main Traefik is configured outside of the Docker Compose files. For local development, there's an included Traefik in `docker-compose.override.yml`, just to let you test that the domains work as expected, for example with `api.localhost.tiangolo.com` and `dashboard.localhost.tiangolo.com`. +When deploying, for example in production, the main Traefik is configured outside of the Docker Compose files. For local development, there's an included Traefik in `compose.override.yml`, just to let you test that the domains work as expected, for example with `api.localhost.tiangolo.com` and `dashboard.localhost.tiangolo.com`. ## Docker Compose files and env vars -There is a main `docker-compose.yml` file with all the configurations that apply to the whole stack, it is used automatically by `docker compose`. +There is a main `compose.yml` file with all the configurations that apply to the whole stack, it is used automatically by `docker compose`. -And there's also a `docker-compose.override.yml` with overrides for development, for example to mount the source code as a volume. It is used automatically by `docker compose` to apply overrides on top of `docker-compose.yml`. +And there's also a `compose.override.yml` with overrides for development, for example to mount the source code as a volume. It is used automatically by `docker compose` to apply overrides on top of `compose.yml`. These Docker Compose files use the `.env` file containing configurations to be injected as environment variables in the containers. @@ -129,7 +129,7 @@ The `.env` file is the one that contains all your configurations, generated keys Depending on your workflow, you could want to exclude it from Git, for example if your project is public. In that case, you would have to make sure to set up a way for your CI tools to obtain it while building or deploying your project. -One way to do it could be to add each environment variable to your CI/CD system, and updating the `docker-compose.yml` file to read that specific env var instead of reading the `.env` file. +One way to do it could be to add each environment variable to your CI/CD system, and updating the `compose.yml` file to read that specific env var instead of reading the `.env` file. ## Pre-commits and code linting diff --git a/frontend/README.md b/frontend/README.md index 9bf09ad..74724e5 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -25,9 +25,9 @@ If you are developing an API-only app and want to remove the frontend, you can d * Remove the `./frontend` directory. -* In the `docker-compose.yml` file, remove the whole service / section `frontend`. +* In the `compose.yml` file, remove the whole service / section `frontend`. -* In the `docker-compose.override.yml` file, remove the whole service / section `frontend` and `playwright`. +* In the `compose.override.yml` file, remove the whole service / section `frontend` and `playwright`. Done, you have a frontend-less (api-only) app. 🤓 diff --git a/scripts/build-push.sh b/scripts/build-push.sh index 3fa3aa7..2911162 100644 --- a/scripts/build-push.sh +++ b/scripts/build-push.sh @@ -7,4 +7,4 @@ TAG=${TAG?Variable not set} \ FRONTEND_ENV=${FRONTEND_ENV-production} \ sh ./scripts/build.sh -docker-compose -f docker-compose.yml push +docker compose -f compose.yml push diff --git a/scripts/build.sh b/scripts/build.sh index 21528c5..42fc8cf 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -6,5 +6,5 @@ set -e TAG=${TAG?Variable not set} \ FRONTEND_ENV=${FRONTEND_ENV-production} \ docker-compose \ --f docker-compose.yml \ +-f compose.yml \ build diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 99faa96..018bd92 100644 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -7,7 +7,7 @@ DOMAIN=${DOMAIN?Variable not set} \ STACK_NAME=${STACK_NAME?Variable not set} \ TAG=${TAG?Variable not set} \ docker-compose \ --f docker-compose.yml \ +-f compose.yml \ config > docker-stack.yml docker-auto-labels docker-stack.yml