Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: do not force sslmode at infrastructure level #337

Merged
merged 3 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@ FROM node:${NODE_VERSION}-alpine as base
ARG PNPM_VERSION=8.14.3

# Install python deps for node-gyp
RUN apk add g++ make py3-pip
RUN apk add g++ make py3-pip ca-certificates curl

# Setup RDS CA Certificates

RUN curl -L \
-o /usr/local/share/ca-certificates/rds-global-bundle.pem \
https://truststore.pki.rds.amazonaws.com/global/global-bundle.pem \
&& update-ca-certificates

# Set working directory for all build stages.
WORKDIR /usr/src/app
Expand Down
2 changes: 1 addition & 1 deletion core/.env.docker
Original file line number Diff line number Diff line change
@@ -1 +1 @@
DATABASE_URL=postgresql://${PGUSER}:${PGPASSWORD}@${PGHOST}:${PGPORT}/${PGDATABASE}?sslmode=require
DATABASE_URL=postgresql://${PGUSER}:${PGPASSWORD}@${PGHOST}:${PGPORT}/${PGDATABASE}
5 changes: 5 additions & 0 deletions infrastructure/nginx/default.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ server {

location / {
proxy_pass $scheme://nextjs;

proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}

location /legacy_healthcheck {
Expand Down
6 changes: 0 additions & 6 deletions infrastructure/terraform/modules/core-services/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ locals {
db_user = aws_db_instance.core_postgres.username
db_name = aws_db_instance.core_postgres.db_name
db_host = aws_db_instance.core_postgres.address
db_sslmode = "require"
}

output "secrets" {
Expand All @@ -23,17 +22,12 @@ output "asset_uploader_key_id" {
value = aws_iam_access_key.asset_uploader.id
}

output "rds_connection_string_sans_password" {
value = "postgresql://${local.db_user}@${local.db_host}:5432/${local.db_name}?sslmode=${local.db_sslmode}"
}

output "rds_connection_components" {
value = {
user = local.db_user
database = local.db_name
host = local.db_host
port = "5432"
sslmode = local.db_sslmode
id = aws_db_instance.core_postgres.id
}
}
2 changes: 0 additions & 2 deletions infrastructure/terraform/modules/deployment/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ module "service_core" {
configuration = {
container_port = 3000
environment = [
# { name = "DATABASE_URL", value = module.core_dependency_services.rds_connection_string_sans_password },
{ name = "PGUSER", value = module.core_dependency_services.rds_connection_components.user },
{ name = "PGDATABASE", value = module.core_dependency_services.rds_connection_components.database },
{ name = "PGHOST", value = module.core_dependency_services.rds_connection_components.host },
Expand Down Expand Up @@ -213,7 +212,6 @@ module "service_flock" {

configuration = {
environment = [
# { name = "DATABASE_URL", value = module.core_dependency_services.rds_connection_string_sans_password },
{ name = "PGUSER", value = module.core_dependency_services.rds_connection_components.user },
{ name = "PGDATABASE", value = module.core_dependency_services.rds_connection_components.database },
{ name = "PGHOST", value = module.core_dependency_services.rds_connection_components.host },
Expand Down