Skip to content

Commit

Permalink
feat(rds): add updated ca bundle for rds connections
Browse files Browse the repository at this point in the history
  • Loading branch information
briancaffey committed Feb 28, 2024
1 parent 85bac3c commit d25b261
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ htmlcov
node_modules
notes
.env
.venv
cdk.out
.raspberrypi.env
cdk.context.json
Expand Down
2 changes: 1 addition & 1 deletion backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ RUN pip install "poetry==$POETRY_VERSION"
COPY poetry.lock pyproject.toml /code/

FROM base AS prod
RUN curl https://s3.amazonaws.com/rds-downloads/rds-ca-2019-root.pem -o /usr/local/share/rds-ca-2019-root.pem
RUN curl https://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem -o /usr/local/share/rds-combined-ca-bundle.pem
RUN POETRY_VIRTUALENVS_CREATE=false poetry install --only main
COPY . /code
RUN chown -R app:app /code
Expand Down
2 changes: 1 addition & 1 deletion backend/backend/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

DATABASES["default"]["OPTIONS"] = {
"sslmode": "verify-full",
"sslrootcert": "/usr/local/share/rds-ca-2019-root.pem",
"sslrootcert": "/usr/local/share/rds-combined-ca-bundle.pem",
}

# add django-storages to INSTALLED_APPS
Expand Down
22 changes: 22 additions & 0 deletions cli/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import boto3
import subprocess


def main():

aws_command = [
'aws', 'ecs', 'execute-command',
'--cluster', 'alpha-cluster',
'--task', '',
'--command', 'bash',
'--interactive'
]

try:
subprocess.run(aws_command, capture_output=False, text=True)
except subprocess.CalledProcessError as e:
print(f"Error executing command: {e}")


if __name__ == "__main__":
main()

0 comments on commit d25b261

Please sign in to comment.