diff --git a/.github/workflows/deploy-to-production.yaml b/.github/workflows/deploy-to-production.yaml index 442ee37..dcef6aa 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/.gitignore b/.gitignore index 9017604..ba5067a 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,6 @@ node_modules/ .sqlite/ .env out/ +.idea/ +email_pass +email_user \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..149c802 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,8 @@ +# 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. + +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 seed:run --env production' \ No newline at end of file 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). 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