From 3ed94b92e04f9199fa9a77b02ed6c086b7e352a5 Mon Sep 17 00:00:00 2001 From: Evan Strat <5790137+evan10s@users.noreply.github.com> Date: Sun, 24 Mar 2024 18:27:25 -0400 Subject: [PATCH] feat: YAML hygiene improvements (#110) Co-authored-by: Evan Strat --- .github/ISSUE_TEMPLATE/{1-bug.yml => 1-bug.yaml} | 0 .../{2-feedback.yml => 2-feedback.yaml} | 0 .github/ISSUE_TEMPLATE/{config.yml => config.yaml} | 0 .github/workflows/{pr-ci.yml => pr-ci.yaml} | 0 .github/workflows/{release.yml => release.yaml} | 0 .../{task-list-checker.yml => task-list-checker.yaml} | 0 README.md | 11 ++++++----- docker-compose.dev.yml => docker-compose.dev.yaml | 6 +++--- docker-compose.yml => docker-compose.yaml | 7 ++----- 9 files changed, 11 insertions(+), 13 deletions(-) rename .github/ISSUE_TEMPLATE/{1-bug.yml => 1-bug.yaml} (100%) rename .github/ISSUE_TEMPLATE/{2-feedback.yml => 2-feedback.yaml} (100%) rename .github/ISSUE_TEMPLATE/{config.yml => config.yaml} (100%) rename .github/workflows/{pr-ci.yml => pr-ci.yaml} (100%) rename .github/workflows/{release.yml => release.yaml} (100%) rename .github/workflows/{task-list-checker.yml => task-list-checker.yaml} (100%) rename docker-compose.dev.yml => docker-compose.dev.yaml (83%) rename docker-compose.yml => docker-compose.yaml (89%) diff --git a/.github/ISSUE_TEMPLATE/1-bug.yml b/.github/ISSUE_TEMPLATE/1-bug.yaml similarity index 100% rename from .github/ISSUE_TEMPLATE/1-bug.yml rename to .github/ISSUE_TEMPLATE/1-bug.yaml diff --git a/.github/ISSUE_TEMPLATE/2-feedback.yml b/.github/ISSUE_TEMPLATE/2-feedback.yaml similarity index 100% rename from .github/ISSUE_TEMPLATE/2-feedback.yml rename to .github/ISSUE_TEMPLATE/2-feedback.yaml diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yaml similarity index 100% rename from .github/ISSUE_TEMPLATE/config.yml rename to .github/ISSUE_TEMPLATE/config.yaml diff --git a/.github/workflows/pr-ci.yml b/.github/workflows/pr-ci.yaml similarity index 100% rename from .github/workflows/pr-ci.yml rename to .github/workflows/pr-ci.yaml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yaml similarity index 100% rename from .github/workflows/release.yml rename to .github/workflows/release.yaml diff --git a/.github/workflows/task-list-checker.yml b/.github/workflows/task-list-checker.yaml similarity index 100% rename from .github/workflows/task-list-checker.yml rename to .github/workflows/task-list-checker.yaml diff --git a/README.md b/README.md index 839f47f..4171465 100644 --- a/README.md +++ b/README.md @@ -13,9 +13,10 @@ To get started: 1. Clone this repo locally. You don't actually need the source code, but it's the easiest way to get the directory structure for the required Docker volumes. 2. Copy [`server/env/production.env.example`](server/env/production.env.example) to `server/env/production.env` and fill in the values using the descriptions in [Environment variables](#environment-variables) below. -3. Adjust `docker-compose.yml` as needed (additional details in comments on the relevant lines): +3. Adjust `docker-compose.yaml` as needed (additional details in comments on the relevant lines): 1. Set the port you want to access the web client on by editing the `port` property on the `web` container - 2. Adjust the path to your videos directory by editing the `volumes` property on the `web` container + 2. Adjust the path to your videos directory by editing the `volumes` property on the `web` and `worker` containers + 1. The default docker-compose.yaml file uses a YAML anchor to keep the volumes in sync between the `web` and `worker` containers. In that case, you only have to update the volumes for the `web` container, and the `worker` container will use those volumes as well. 4. Run `docker compose up` to start the containers. 1. If there's a new version of Match Uploader available, you can pull the latest version by running `docker compose pull` before `docker compose up`. 2. The first time you run Match Uploader, Docker containers are pulled and database migrations are run. This can take a few minutes. @@ -97,7 +98,7 @@ containers should be started in this order (the default Docker Compose setup pro #### Environment variables -For simplicity, and to keep secrets out of `docker-compose.yml`, all 3 containers mentioned above will +For simplicity, and to keep secrets out of `docker-compose.yaml`, all 3 containers mentioned above will pull environment variables from the `server/env/production.env` file. As a result, not all containers use all the environment variables, and you need to provide values for database information in two different environment variables. There are some additional environment variables defined in the file that are not specified below; please leave those intact. @@ -109,7 +110,7 @@ defined in the file that are not specified below; please leave those intact. | Variable | Description | Sample value | |-----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `PORT` | Determines the port the backend server runs on _inside of its container_. (To change the external container port, you'd want to edit the `port` property on the `web` container in `docker-compose.yml`.) | Leave set to default: `8080` | +| `PORT` | Determines the port the backend server runs on _inside of its container_. (To change the external container port, you'd want to edit the `port` property on the `web` container in `docker-compose.yaml`.) | Leave set to default: `8080` | | `POSTGRES_DB` | Used by the `db` container. The name of the Postgres database to create. | Leave set to default: `match_uploader` | | `POSTGRES_USER` | Used by the `db` container. Determines the username of the user created to access the Postgres server, so you can put anything here as long as you use the same value in `DB_CONNECTION_STRING`. | Leave set to default: `match_uploader` | | `POSTGRES_PASSWORD` | Used by the `db` container. Determines the password of the user created to access the Postgres server, so you can put anything here as long as you use the same value in `DB_CONNECTION_STRING`. | Pick any random string to use as a password | @@ -127,7 +128,7 @@ There are 3 required Docker volumes for the `web` and `worker` containers: - **Settings:** Mount a directory to persist settings files to `/home/node/app/server/settings` - You can leave the directory empty initially and Match Uploader will create settings files for you -Examples of how to provide these volumes are in [`docker-compose.yml`](docker-compose.yml). +Examples of how to provide these volumes are in [`docker-compose.yaml`](docker-compose.yaml). The Postgres container requires a volume to persist the database in. The default Docker Compose setup is set up so that Docker will create this volume for you. diff --git a/docker-compose.dev.yml b/docker-compose.dev.yaml similarity index 83% rename from docker-compose.dev.yml rename to docker-compose.dev.yaml index 50b66d3..b105c69 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yaml @@ -2,7 +2,7 @@ services: web: extends: - file: docker-compose.yml + file: docker-compose.yaml service: web image: !reset null build: @@ -11,7 +11,7 @@ services: target: prod worker: extends: - file: docker-compose.yml + file: docker-compose.yaml service: worker image: !reset null build: @@ -20,7 +20,7 @@ services: target: prod db: extends: - file: docker-compose.yml + file: docker-compose.yaml service: db ports: - 5432:5432 diff --git a/docker-compose.yml b/docker-compose.yaml similarity index 89% rename from docker-compose.yml rename to docker-compose.yaml index f7aba9c..d52e6ea 100644 --- a/docker-compose.yml +++ b/docker-compose.yaml @@ -5,7 +5,7 @@ services: - 80:8080 # host:container. Change `host` to change the port Match Uploader is accessible on from the host machine env_file: - ./server/env/production.env - volumes: + volumes: &common_volumes - ./server/settings:/home/node/app/server/settings - ./server/env:/home/node/app/server/env - ./server/videos:/home/node/app/server/videos # Adjust the first part of this value (e.g., `./server/videos`) to change the videos directory Match Uploader looks in to find videos to upload @@ -20,10 +20,7 @@ services: worker: image: ghcr.io/gafirst/match-uploader:latest command: yarn start:worker - volumes: - - ./server/settings:/home/node/app/server/settings - - ./server/env:/home/node/app/server/env - - ./server/videos:/home/node/app/server/videos + volumes: *common_volumes env_file: - ./server/env/production.env depends_on: