Skip to content

Commit

Permalink
feat: YAML hygiene improvements (#110)
Browse files Browse the repository at this point in the history
Co-authored-by: Evan Strat <[email protected]>
  • Loading branch information
evan10s and evan10s authored Mar 24, 2024
1 parent b027e03 commit 3ed94b9
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 13 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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 |
Expand All @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.dev.yml → docker-compose.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
services:
web:
extends:
file: docker-compose.yml
file: docker-compose.yaml
service: web
image: !reset null
build:
Expand All @@ -11,7 +11,7 @@ services:
target: prod
worker:
extends:
file: docker-compose.yml
file: docker-compose.yaml
service: worker
image: !reset null
build:
Expand All @@ -20,7 +20,7 @@ services:
target: prod
db:
extends:
file: docker-compose.yml
file: docker-compose.yaml
service: db
ports:
- 5432:5432
Expand Down
7 changes: 2 additions & 5 deletions docker-compose.yml → docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit 3ed94b9

Please sign in to comment.