Skip to content

Commit b93b7b4

Browse files
Merge pull request #24 from nsidc/da113-garrison-deploy
Support garrison deployments at NSIDC
2 parents ed79dd0 + 3da8687 commit b93b7b4

File tree

8 files changed

+54
-19
lines changed

8 files changed

+54
-19
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
uptime.
77
- Fix issue with EDD metrics being nested under each other in the `/api/metrics`
88
generated-page.
9+
- Add `./deploy/deploy` script for use with
10+
[garrison](https://bitbucket.org/nsidc/garrison) deployment system at NSIDC.
911

1012
# v1.0.1
1113

deploy/deploy

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
set -e
3+
4+
ENVIRONMENT=$1
5+
6+
THISDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7+
COMPOSE_FILE=$THISDIR/../docker-compose.yml
8+
9+
if [ "${ENVIRONMENT}" = "dev" ]; then
10+
echo "Dev does not support stack deploy with garrison."
11+
exit 1
12+
elif [ "${ENVIRONMENT}" = "integration" ]; then
13+
OVERRIDE_FILE=$THISDIR/../docker-compose.integration.yml
14+
else
15+
OVERRIDE_FILE=$THISDIR/../docker-compose.production.yml
16+
fi
17+
18+
source /etc/profile.d/envvars.sh
19+
20+
cd $THISDIR/../
21+
docker compose -f $COMPOSE_FILE -f $OVERRIDE_FILE up --detach
22+
docker system prune -af

doc/envvars.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ Environment variables are exposed to the DAT's components through
2121
<https://flask.palletsprojects.com/en/stable/quickstart/#sessions>.
2222
- `LOGS_SHARE_PATH`: Local path to directory where logs are stored. See
2323
[Logs](logs.md) for more information.
24+
- `LOGS_SHARE_BACKUP_PATH`: Path to directory where logs are backed-up for
25+
long-term storage. See [Logs](logs.md) for more information.

doc/logs.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ The Data Access Tool backend produces logs from two primary sources:
1212

1313
## NGINX Server logs
1414

15-
Logs are written to local disk, in `./logs/server/`.
15+
Logs are written to local disk, in a directory defined by `LOGS_SHARE_PATH`.
1616

1717
It is expected that these logs be backed-up to a networked share drive (defined
18-
through the `LOGS_SHARE_PATH` [environment variable](envvars.md)) through
18+
through the `LOGS_SHARE_BACKUP_PATH` [environment variable](envvars.md)) through
1919
`logrotation`. The `dat.access.log` is intended to be used for application
2020
metrics, and these data should be retained for recordkeeping. The
2121
[data-access-tool-vm](https://github.com/nsidc/data-access-tool-vm) project sets

doc/releasing.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,24 @@ To release a new version:
99
- Tag latest commit on `main` with the version, and push. This will trigger a
1010
build of the `data-access-tool-api` and `data-access-tool-server` images with
1111
the given version tag.
12-
- Deploy the latest change with the
13-
[data-access-tool-vm](https://github.com/nsidc/data-access-tool-vm).
12+
- Deploy the latest change with
13+
[garrison](https://bitbucket.org/nsidc/garrison). See the
14+
[section on garrison](#garrison) below for more info.
15+
16+
## garrison
17+
18+
[garrison](https://bitbucket.org/nsidc/garrison) is a deployment system for
19+
NSIDC applications deployed to a VM on NSIDC infrastructure.
20+
21+
The [jenkins-cd](http://ci.jenkins-cd.apps.int.nsidc.org:8080) Jenkins VM
22+
provides a mechanism for doing garrison deployments of the
23+
`data-access-tool-backend` to integration and QA.
24+
25+
The
26+
[Deploy Project with Garrison](https://ci.jenkins-ops-2022.apps.int.nsidc.org/job/Deploy_Project_with_Garrison/)
27+
job defined in the Ops Jenkins is used by Ops to deploy to staging and
28+
production.
29+
30+
See the [data-access-tool-vm](https://github.com/nsidc/data-access-tool-vm)
31+
project for additional details and VM configuration for the
32+
`data-access-tool-backend`.

docker-compose.dev.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
services:
22
api:
33
build: .
4-
volumes:
5-
- "./src:/tmp/"
6-
# live logs written directly by the nginx server
7-
- "./logs/server:/tmp/server_logs/live/:ro"
84
command: '/bin/bash -c "PYTHONPATH=./ python dat_backend/dev_server.py"'
95

106
server:
117
build: ./nginx
12-
volumes:
13-
- ./logs/server:/var/log/nginx/

docker-compose.local.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,9 @@ services:
99
api:
1010
build: .
1111
volumes:
12-
- "./src:/tmp/"
13-
# live logs written directly by the nginx server
14-
- "./logs/server:/tmp/server_logs/live/:ro"
1512
command: '/bin/bash -c "PYTHONPATH=./ python dat_backend/dev_server.py"'
1613

1714
server:
1815
build: ./nginx
1916
volumes:
20-
- ./logs/server:/var/log/nginx/
21-
# Run server as root locally. This works for systems that do not have the
22-
# `vagrant` user defined
2317
user: ":"

docker-compose.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ services:
1717
restart: always
1818
volumes:
1919
# live logs written directly by the nginx server
20-
- "./logs/server:/tmp/server_logs/live/:ro"
21-
# backup logs rotated onto NFS
2220
- "${LOGS_SHARE_PATH:?LOGS_SHARE_PATH must be
21+
set}/server:/tmp/server_logs/live/:ro"
22+
# backup logs rotated onto NFS
23+
- "${LOGS_SHARE_BACKUP_PATH:?LOGS_SHARE_PATH must be
2324
set}/server:/tmp/server_logs/backup/:ro"
2425
logging:
2526
options:
@@ -37,7 +38,8 @@ services:
3738
# Setting the user explicitly ensures that the logs are written out as vagrant.
3839
user: "vagrant:vagrant"
3940
volumes:
40-
- ./logs/server:/var/log/nginx/
41+
- "${LOGS_SHARE_PATH:?LOGS_SHARE_PATH must be
42+
set}/server:/var/log/nginx/:rw"
4143
logging:
4244
options:
4345
max-size: "20m"

0 commit comments

Comments
 (0)