Skip to content

Commit

Permalink
Merge pull request #900 from alphagov/1881-2-fix-docker-compose-stack
Browse files Browse the repository at this point in the history
1881-2: Updated Postgres in copilot and fixed docker compose stack
  • Loading branch information
richardbored authored Feb 12, 2025
2 parents 022f4a4 + d9fdbca commit f451401
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ data/localstack-data/*
filehash.txt
20210823_cleaned_case_record.csv
**/data/s3_files/*
**/data/postgres-data-full-stack/*
cases.csv
temp_manifest.yml
backup.sql
Expand Down
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ test:
int_test:
docker compose --file stack_tests/integration_tests/docker-compose.yml up --abort-on-container-exit

local_stack_up:
docker compose --file docker-compose-full-stack.yml up --build

local_stack_make_admin:
docker compose exec web sh -c "echo \"from django.contrib.auth import get_user_model; User = get_user_model(); User.objects.create_superuser('[email protected]', '[email protected]', 'secret')\" | python manage.py shell"

local_stack_cleanup:
rm -r data/postgres-data-full-stack

deploy_prototype:
python aws_prototype/main.py -b up

Expand Down
2 changes: 1 addition & 1 deletion accessibility_monitoring_platform/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@
CSP_IMG_SRC = ("'self'", "data:")

AWS_PROTOTYPE_FILE: Path = Path("aws_prototype.json")
if AWS_PROTOTYPE_FILE.exists():
if AWS_PROTOTYPE_FILE.exists() and UNDER_TEST is False:
aws_prototype_text: str = AWS_PROTOTYPE_FILE.read_text()
aws_prototype_data: dict = json.loads(aws_prototype_text)
AMP_PROTOTYPE_NAME = aws_prototype_data["prototype_name"]
Expand Down
2 changes: 1 addition & 1 deletion amp_platform.DockerFile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ RUN npm install
EXPOSE 8001
CMD make static_files_process \
&& python manage.py collectstatic --noinput \
&& python manage.py clearsessions \
&& python manage.py migrate \
&& python manage.py recache_statuses \
&& python manage.py clearsessions \
&& waitress-serve --port=8001 --threads=5 accessibility_monitoring_platform.wsgi:application
2 changes: 1 addition & 1 deletion copilot/environments/addons/amp-db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Resources:
!Join [ "", [ '{{resolve:secretsmanager:', !Ref ampdbAuroraSecret, ":SecretString:password}}" ]]
DatabaseName: !Ref ampdbDBName
Engine: 'aurora-postgresql'
EngineVersion: '14.4'
EngineVersion: '14.13'
DBClusterParameterGroupName: !Ref ampdbDBClusterParameterGroup
DBSubnetGroupName: !Ref ampdbDBSubnetGroup
Port: 5432
Expand Down
11 changes: 5 additions & 6 deletions docker-compose-full-stack.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
version: "3.7"
services:
db:
image: postgres:14.4
image: postgres:14.13
restart: always
environment:
POSTGRES_DB: postgres
POSTGRES_USER: admin
POSTGRES_PASSWORD: secret
PGDATA: /var/lib/postgresql/data
volumes:
- ./data/postgres-data:/var/lib/postgresql/data
- ./data/postgres-data-full-stack:/var/lib/postgresql/data
ports:
- "5432:5432"

web:
build:
dockerfile: ./amp_platform.Dockerfile
dockerfile: ./amp_platform.DockerFile
image: "amp_platform"
ports:
- "8001:8001"
depends_on:
- db
- localstack
environment:
- ALLOWED_HOSTS='* localhost 0.0.0.0 0.0.0.0:8001 web web:8001'
- ALLOWED_HOSTS='* localhost 0.0.0.0 0.0.0.0:8001 web web:8001' # Only localhost:8001 works for localstack
- SECRET_KEY='123456789'
- DEBUG=FALSE
- INTEGRATION_TEST=FALSE
Expand All @@ -36,7 +35,7 @@ services:

report_viewer:
build:
dockerfile: ./amp_viewer.Dockerfile
dockerfile: ./amp_viewer.DockerFile
image: "amp_viewer"
ports:
- "8002:8001"
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3.7"
services:
db:
image: postgres:14.4
image: postgres:14.13
restart: always
environment:
POSTGRES_DB: postgres
Expand Down
2 changes: 1 addition & 1 deletion stack_tests/integration_tests/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3.7"
services:
db:
image: postgres:14.4
image: postgres:14.13
restart: always
environment:
POSTGRES_DB: postgres
Expand Down

0 comments on commit f451401

Please sign in to comment.