diff --git a/.gitignore b/.gitignore index 34a2268..29149cb 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,9 @@ rust-toolchain # Config files **/*.yaml +# Allow docker-compose.yaml +!docker-compose.yaml + # Data **/*.csv **/*.jpg @@ -37,6 +40,3 @@ rust-toolchain # VS Code **/.vscode - -# Docker -docker-compose.yaml diff --git a/README.md b/README.md index 76e77b8..14c32af 100644 --- a/README.md +++ b/README.md @@ -445,23 +445,25 @@ Sendgrid | equals monthly limit ## Testing -Some integration tests require a locally running database, and an AWS SES account. -Specify the following environment variables: - -- SMTP - - `SMTP_SERVER` - - `SMTP_USERNAME` - - `SMTP_PASSWORD` -- AWS SES - - `AWS_ACCESS_KEY_ID` - - `AWS_SECRET_ACCESS_KEY` - - `AWS_REGION` -- Postgres - - `DB_HOST` - - `DB_PORT` - - `DB_USER` - - `DB_PASSWORD` - - `DB_NAME` +Some integration tests require a locally running database, and an AWS SES +account: + +1. Specify the following environment variables: + - SMTP + - `SMTP_SERVER` + - `SMTP_USERNAME` + - `SMTP_PASSWORD` + - AWS SES + - `AWS_ACCESS_KEY_ID` + - `AWS_SECRET_ACCESS_KEY` + - `AWS_REGION` + - Postgres + - `DB_HOST` + - `DB_PORT` + - `DB_USER` + - `DB_PASSWORD` + - `DB_NAME` +2. Set up a temporary postgres db: `docker-compose run --rm --service-ports postgres` ``` bash # Run unit tests and integration tests diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..deb4c2f --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,15 @@ +version: '3' +services: + postgres: + env_file: + - .env + volumes: + - ./test_data:/docker-entrypoint-initdb.d + image: postgres:16-alpine + restart: "no" + ports: + - "${DB_PORT}:5432" + environment: + POSTGRES_USER: "${DB_USER}" + POSTGRES_PASSWORD: "${DB_PASSWORD}" + POSTGRES_DB: "${DB_NAME}"