Skip to content

Commit aa637d8

Browse files
committed
#125 Docker configuration changes
1 parent 099abdf commit aa637d8

File tree

6 files changed

+29
-21
lines changed

6 files changed

+29
-21
lines changed

.env.local

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# this file is used to set environment variables for the local development environment. If you need to override any of these
2-
# values then source this file in your shell before bringing up fastapi.
1+
# This file is used to set environment variables for the local development environment. If you need to override any of these
2+
# values, source this file in your shell before bringing up fastapi.
33
export ACCESS_TOKEN_EXPIRE_SECONDS=60
44
export AWS_ACCESS_KEY_ID=test
55
export AWS_SECRET_ACCESS_KEY=test
@@ -10,4 +10,4 @@ export ENP_ADMIN_SECRET_KEY=not-very-secret
1010
export ENP_DB_PORT=5433
1111
export ENV=local
1212
export NAPI_DB_READ_URI=postgresql+psycopg://postgres:LocalPassword@localhost:5432/notification_api
13-
export NAPI_DB_WRITE_URI=postgresql+psycopg://postgres:LocalPassword@localhost:5432/notification_api
13+
export NAPI_DB_WRITE_URI=postgresql+psycopg://postgres:LocalPassword@localhost:5432/notification_api

.talismanrc

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
fileignoreconfig:
22
- filename: .env.example
33
checksum: f04bd8b8a51131d412bea4b8098e714ca01f4c7475eeb0a40d196d922070ba43
4-
- filename: .env.local
5-
checksum: 60e7f10e36a8635b33bc26945e6336ae183fe603a15169e462027339360a00f4
64
- filename: .github/workflows/deploy.yml
75
checksum: fc90179b23528cc9668f868361e0889635deb8ebd4b78ff738f4143a151b3e64
86
- filename: app/auth.py
@@ -18,11 +16,9 @@ fileignoreconfig:
1816
- filename: cd/perf.env
1917
checksum: 5c50afeea60016a131f94dacd3086db9cbb4c6af573be19c7de91bbb51e04db7
2018
- filename: ci/.env.docker
21-
checksum: 89c9897e4d29e36b9c001d98a0c0cd28b08858d367771b5e1ec50e398bc19e23
22-
- filename: ci/.env.local
23-
checksum: b9a695faea7f7f98ad3b1f221938144cc70667f70a8ab9e3828499fe1005d556
24-
- filename: ci/.local.env
25-
checksum: 47e9f19fdfb3655ceb51cfee25242e87d45bb05618a1cca6ac2bc8a709e0cdf9
19+
checksum: ff5147be5734e677fcb8bfbeaaa59e54d5b395f531ac371fb183494eaf954582
20+
- filename: .env.local
21+
checksum: d3c7432f462f22fd75aaad2619858447819fd484214dabd4f1e421690d6d9b2e
2622
- filename: ci/docker-compose-local.yml
2723
checksum: c73beda98c39232441d86f6d6f6f2858274f9703f8a462eac1effacfbb9aa39d
2824
- filename: poetry.lock

app/db/db_init.py

+13-5
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,20 @@ async def init_db() -> None:
3333
# call to "run_sync" will not create anything.
3434
import app.db.models # noqa
3535

36-
# These methods are copy/paste due to globals.
37-
await create_write_engine()
38-
await create_read_engine()
36+
try:
37+
# These methods are copy/paste due to globals.
38+
await create_write_engine()
39+
await create_read_engine()
40+
except:
41+
logger.exception('Uncaught exception during ENP database initialization')
42+
raise
3943

40-
# notification_api database connections
41-
await init_napi_metadata()
44+
try:
45+
# notification_api database connections
46+
await init_napi_metadata()
47+
except:
48+
logger.exception('Uncaught exception during NAPI database metadata initialization')
49+
raise
4250

4351
logger.info('...database engines initialized.')
4452

app/main.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ def create_app() -> CustomFastAPI:
8888
app.include_router(v2_legacy_notification_router)
8989
app.include_router(v2_notification_router)
9090

91-
# Static site for MkDocs. If unavailable locally, run `mkdocs build` to create the site files
92-
# Or run the application locally with Docker.
91+
# Static site for MkDocs. If unavailable locally, run `mkdocs build` to create the site files,
92+
# or run the application locally with Docker.
9393
if os.path.exists(MKDOCS_DIRECTORY):
9494
app.mount('/mkdocs', StaticFiles(directory=MKDOCS_DIRECTORY, html=True), name='mkdocs')
9595

ci/.env.docker

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# this file is used by docker-compose-local.yml to set environment variables for the local development environment
1+
# This file is used by docker-compose-local.yml to set environment variables for the local development environment.
22
AWS_ACCESS_KEY_ID=test
33
AWS_REGION_NAME=us-east-1
44
AWS_SECRET_ACCESS_KEY=test
@@ -8,5 +8,9 @@ ENP_ADMIN_SECRET_KEY=not-very-secret
88
ENP_DB_NAME=va_enp_api
99
ENP_DB_PORT=5432
1010
ENV=local
11-
NAPI_DB_READ_URI=postgresql://postgres:[email protected]:5432/notification_api
12-
NAPI_DB_WRITE_URI=postgresql://postgres:[email protected]:5432/notification_api
11+
12+
# These values assume the a notification-api database container is running with the name "ci-db-1".
13+
# The running containers should be part of the Docker "ci_default" network, and the container
14+
# name should resolve to an IP address.
15+
NAPI_DB_READ_URI=postgresql://postgres:LocalPassword@ci-db-1:5432/notification_api
16+
NAPI_DB_WRITE_URI=postgresql://postgres:LocalPassword@ci-db-1:5432/notification_api

run_app_local.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""File for running the app locally with uvicorn. Simply run this file in debug mode to debug the app locally."""
1+
"""File for running the app locally with uvicorn. Run this file in debug mode to debug the app locally."""
22

33
import uvicorn
44
from dotenv import load_dotenv

0 commit comments

Comments
 (0)