Skip to content

Commit

Permalink
Updating deployment to use Secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
Ubuntu committed Oct 18, 2023
1 parent 5ff0d70 commit 71ac3e2
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
4 changes: 2 additions & 2 deletions alerting/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ services:
- POSTGRES_DB=postgres
- POSTGRES_PASSWORD=!ChangeMe!
- DATABASE_URL
- EMAIL_PASSWORD
- EMAIL_USER
- EMAIL_PASSWORD=${ALERTING_EMAIL_PASSWORD} # Set from secrets in api/set_envs.sh
- EMAIL_USER=${ALERTING_EMAIL_USER}
8 changes: 4 additions & 4 deletions api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,21 +106,21 @@ Generate a geotiff for any wfp raster using the stac API and saves it in S3. It
To run the api locally, run:

```
make api
source set_envs.sh && make api
```

To run flask api together with database within same network, run:

```
docker-compose -f ./docker-compose.develop.yml -f ../alerting/docker-compose.yml up
source set_envs.sh && docker-compose -f ./docker-compose.develop.yml -f ../alerting/docker-compose.yml up
```

### Tests

To run linting and tests, run:

```
make test
source set_envs.sh && make test
```

## Deployments
Expand All @@ -132,7 +132,7 @@ Specifically, update `[email protected]` with a domain admin email and `prism-api.ov
To deploy, run:

```
make deploy
source set_envs.sh && make deploy
```

There are a few known issues happening from time to time
Expand Down
2 changes: 1 addition & 1 deletion api/docker-compose.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ services:
- "80:80"
labels:
- "traefik.enable=true"
- "traefik.http.routers.whoami.rule=Host(`prism-api.ovio.org`)"
- "traefik.http.routers.whoami.rule=Host(${HOSTNAME:?'Must provide hostname'})"
- "traefik.http.routers.whoami.entrypoints=websecure"
- "traefik.http.routers.whoami.tls.certresolver=myresolver"
environment:
Expand Down
10 changes: 9 additions & 1 deletion api/set_envs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,12 @@ export KOBO_PASSWORD=$(aws secretsmanager get-secret-value --secret-id KOBO_
export PRISM_ALERTS_DATABASE_URL=$(aws secretsmanager get-secret-value --secret-id PRISM_ALERTS_DATABASE_URL | jq .SecretString | jq fromjson | jq .PRISM_ALERTS_DATABASE_URL)

# HDC Token
export HDC_TOKEN=$(aws secretsmanager get-secret-value --secret-id HDC_TOKEN | jq .SecretString | jq fromjson | jq .HDC_TOKEN)
export HDC_TOKEN=$(aws secretsmanager get-secret-value --secret-id HDC_TOKEN | jq .SecretString | jq fromjson | jq .HDC_TOKEN)

# Alerting Email
export ALERTING_EMAIL_USER=$(aws secretsmanager get-secret-value --secret-id ALERTING_EMAIL | jq .SecretString | jq fromjson | jq .ALERTING_EMAIL_USER)
export ALERTING_EMAIL_PASSWORD=$(aws secretsmanager get-secret-value --secret-id ALERTING_EMAIL | jq .SecretString | jq fromjson | jq .ALERTING_EMAIL_PASSWORD)

# Commenting out for now while I get Eric's advice on deploying
# HOSTNAME_SUFFIX=${1:?"Must set deployment env as first arg"}
# export HOSTNAME=prism-api${HOSTNAME_SUFFIX}.ovio.org

0 comments on commit 71ac3e2

Please sign in to comment.