From d247be4b1201629a415ad76cd7b1fa2b34c28be3 Mon Sep 17 00:00:00 2001 From: Omar Date: Tue, 5 May 2026 20:59:28 +0100 Subject: [PATCH 1/5] add contributing.md --- .gitignore | 1 + CONTRIBUTING.md | 1 + 2 files changed, 2 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/.gitignore b/.gitignore index 9017604..b5e64f1 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ node_modules/ .sqlite/ .env out/ +.idea/ \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..7d26655 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1 @@ +The `master` branch is used purely for deploying to production. All work should be done on the `development` branch but branching off of it following the naming scheme `/-`, for example, `feature/58-fix-test-environment` \ No newline at end of file From a539e74e55ab22cc7c07eafeaaa1efe70d396ff8 Mon Sep 17 00:00:00 2001 From: Omar Date: Tue, 2 Jun 2026 19:20:30 +0100 Subject: [PATCH 2/5] add local testing section to contributing.md --- .gitignore | 4 +++- CONTRIBUTING.md | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index b5e64f1..ba5067a 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,6 @@ node_modules/ .sqlite/ .env out/ -.idea/ \ No newline at end of file +.idea/ +email_pass +email_user \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7d26655..e5de3cc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1 +1,5 @@ -The `master` branch is used purely for deploying to production. All work should be done on the `development` branch but branching off of it following the naming scheme `/-`, for example, `feature/58-fix-test-environment` \ No newline at end of file +# WorkFlow +The `master` branch is used purely for deploying to production. All work should be done on the `development` branch but branching off of it following the naming scheme `/-`, for example, `feature/58-fix-test-environment` + +# LocalHosting/Testing +To run the project through docker, 'email_user' and 'email_pass' files need to exist in the root directory, populated only be a valid email address that can recieve emails and dummy password. You should copy the '.test.env' file into a proper '.env' file and populate it for the docker compose file to inherit the values. From 9ea20bb2f042d9629067a86db55d034790aec8fc Mon Sep 17 00:00:00 2001 From: Omar Date: Tue, 2 Jun 2026 20:22:52 +0100 Subject: [PATCH 3/5] define image versions in docker compose properly --- .github/workflows/deploy-to-production.yaml | 1 - CONTRIBUTING.md | 5 +++++ docker-compose.yml | 4 +++- website/Dockerfile | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy-to-production.yaml b/.github/workflows/deploy-to-production.yaml index 832f854..597732c 100644 --- a/.github/workflows/deploy-to-production.yaml +++ b/.github/workflows/deploy-to-production.yaml @@ -9,7 +9,6 @@ on: jobs: # We should add a job to run the tests first... - deploy: name: Deploy to organisers.doesliverpool.com runs-on: ubuntu-latest diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e5de3cc..69981a2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,3 +3,8 @@ The `master` branch is used purely for deploying to production. All work should # LocalHosting/Testing To run the project through docker, 'email_user' and 'email_pass' files need to exist in the root directory, populated only be a valid email address that can recieve emails and dummy password. You should copy the '.test.env' file into a proper '.env' file and populate it for the docker compose file to inherit the values. + +Ensure that the file permissions for the project matches the permissiond defined in the 'docker-compose.yml' file and ensure that the database is populated and migrated properly by running +'docker-compose exec api npx knex migrate:latest --env production' + + diff --git a/docker-compose.yml b/docker-compose.yml index 6b5c112..c08d06d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ services: db: - image: postgres + image: postgres:17.10-bookworm container_name: optimism_db environment: POSTGRES_PASSWORD: topsecret @@ -19,6 +19,7 @@ services: OPTIMISM_SMTP_PORT: "587" OPTIMISM_SMTP_SECURE: "false" container_name: optimism_api + user: "${UID-1000}:${GID-1000}" ports: - 127.0.0.1:3001:3001 links: @@ -33,6 +34,7 @@ services: args: OPTIMISM_API_CLIENT_SIDE_URL: "http://localhost:3001/api" container_name: optimism_website + user: "${UID-1000}:${GID-1000}" ports: - 127.0.0.1:3000:3000 links: diff --git a/website/Dockerfile b/website/Dockerfile index 304cdf6..0d69e38 100644 --- a/website/Dockerfile +++ b/website/Dockerfile @@ -1,5 +1,5 @@ # Simple docker setup for the web server -FROM node:16 +FROM node:20-alpine EXPOSE 3001 From e104e2f6cf302d7c0d69f2f3e9674261265905a3 Mon Sep 17 00:00:00 2001 From: Omar Date: Tue, 2 Jun 2026 20:30:23 +0100 Subject: [PATCH 4/5] correct db migration command --- CONTRIBUTING.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 69981a2..149c802 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,6 +5,4 @@ The `master` branch is used purely for deploying to production. All work should To run the project through docker, 'email_user' and 'email_pass' files need to exist in the root directory, populated only be a valid email address that can recieve emails and dummy password. You should copy the '.test.env' file into a proper '.env' file and populate it for the docker compose file to inherit the values. Ensure that the file permissions for the project matches the permissiond defined in the 'docker-compose.yml' file and ensure that the database is populated and migrated properly by running -'docker-compose exec api npx knex migrate:latest --env production' - - +'docker-compose exec api npx knex seed:run --env production' \ No newline at end of file From 58f8b79a6d5984f0ea0c24ad6e8fcb5b70d53e84 Mon Sep 17 00:00:00 2001 From: Adrian McEwen Date: Tue, 2 Jun 2026 21:30:06 +0100 Subject: [PATCH 5/5] Update docs to use `docker compose` rather than `docker-compose`. Part of #56 --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a69f17e..427fbca 100644 --- a/README.md +++ b/README.md @@ -79,12 +79,12 @@ The `bootstrap` folder contains the site scss file (optimism.scss) and a subfold For production we're running the `api` and `website` components as separate Docker containers, with an off-the-shelf Postgres container to provide the database. Their interactions are orchestrated with `docker compose`, so getting it running should just be a case of running: - * `docker-compose build` - * `docker-compose up` + * `docker compose build` + * `docker compose up` For the email username and password, the docker compose setup expects two files `email_user` and `email_pass` in the root folder. -To run any database migrations, once things are running then run: `docker-compose exec api npx knex migrate:latest --env production` +To run any database migrations, once things are running then run: `docker compose exec api npx knex migrate:latest --env production` Any time things are pushed to the `master` branch, the [live site will automatically deploy the new version](https://github.com/DoESLiverpool/optimism/issues/48).