Skip to content
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
uptime.
- Fix issue with EDD metrics being nested under each other in the `/api/metrics`
generated-page.
- Add `./deploy/deploy` script for use with
[garrison](https://bitbucket.org/nsidc/garrison) deployment system at NSIDC.

# v1.0.1

Expand Down
22 changes: 22 additions & 0 deletions deploy/deploy
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
set -e

ENVIRONMENT=$1

THISDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
COMPOSE_FILE=$THISDIR/../docker-compose.yml

if [ "${ENVIRONMENT}" = "dev" ]; then
echo "Dev does not support stack deploy with garrison."
exit 1
elif [ "${ENVIRONMENT}" = "integration" ]; then
OVERRIDE_FILE=$THISDIR/../docker-compose.integration.yml
else
OVERRIDE_FILE=$THISDIR/../docker-compose.production.yml
fi

source /etc/profile.d/envvars.sh

cd $THISDIR/../
docker compose -f $COMPOSE_FILE -f $OVERRIDE_FILE up --detach
docker system prune -af
2 changes: 2 additions & 0 deletions doc/envvars.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ Environment variables are exposed to the DAT's components through
<https://flask.palletsprojects.com/en/stable/quickstart/#sessions>.
- `LOGS_SHARE_PATH`: Local path to directory where logs are stored. See
[Logs](logs.md) for more information.
- `LOGS_SHARE_BACKUP_PATH`: Path to directory where logs are backed-up for
long-term storage. See [Logs](logs.md) for more information.
4 changes: 2 additions & 2 deletions doc/logs.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ The Data Access Tool backend produces logs from two primary sources:

## NGINX Server logs

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

It is expected that these logs be backed-up to a networked share drive (defined
through the `LOGS_SHARE_PATH` [environment variable](envvars.md)) through
through the `LOGS_SHARE_BACKUP_PATH` [environment variable](envvars.md)) through
`logrotation`. The `dat.access.log` is intended to be used for application
metrics, and these data should be retained for recordkeeping. The
[data-access-tool-vm](https://github.com/nsidc/data-access-tool-vm) project sets
Expand Down
23 changes: 21 additions & 2 deletions doc/releasing.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,24 @@ To release a new version:
- Tag latest commit on `main` with the version, and push. This will trigger a
build of the `data-access-tool-api` and `data-access-tool-server` images with
the given version tag.
- Deploy the latest change with the
[data-access-tool-vm](https://github.com/nsidc/data-access-tool-vm).
- Deploy the latest change with
[garrison](https://bitbucket.org/nsidc/garrison). See the
[section on garrison](#garrison) below for more info.

## garrison

[garrison](https://bitbucket.org/nsidc/garrison) is a deployment system for
NSIDC applications deployed to a VM on NSIDC infrastructure.

The [jenkins-cd](http://ci.jenkins-cd.apps.int.nsidc.org:8080) Jenkins VM
provides a mechanism for doing garrison deployments of the
`data-access-tool-backend` to integration and QA.

The
[Deploy Project with Garrison](https://ci.jenkins-ops-2022.apps.int.nsidc.org/job/Deploy_Project_with_Garrison/)
job defined in the Ops Jenkins is used by Ops to deploy to staging and
production.

See the [data-access-tool-vm](https://github.com/nsidc/data-access-tool-vm)
project for additional details and VM configuration for the
`data-access-tool-backend`.
6 changes: 0 additions & 6 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
services:
api:
build: .
volumes:
- "./src:/tmp/"
# live logs written directly by the nginx server
- "./logs/server:/tmp/server_logs/live/:ro"
command: '/bin/bash -c "PYTHONPATH=./ python dat_backend/dev_server.py"'

server:
build: ./nginx
volumes:
- ./logs/server:/var/log/nginx/
6 changes: 0 additions & 6 deletions docker-compose.local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,9 @@ services:
api:
build: .
volumes:
- "./src:/tmp/"
# live logs written directly by the nginx server
- "./logs/server:/tmp/server_logs/live/:ro"
command: '/bin/bash -c "PYTHONPATH=./ python dat_backend/dev_server.py"'

server:
build: ./nginx
volumes:
- ./logs/server:/var/log/nginx/
# Run server as root locally. This works for systems that do not have the
# `vagrant` user defined
user: ":"
8 changes: 5 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ services:
restart: always
volumes:
# live logs written directly by the nginx server
- "./logs/server:/tmp/server_logs/live/:ro"
# backup logs rotated onto NFS
- "${LOGS_SHARE_PATH:?LOGS_SHARE_PATH must be
set}/server:/tmp/server_logs/live/:ro"
# backup logs rotated onto NFS
- "${LOGS_SHARE_BACKUP_PATH:?LOGS_SHARE_PATH must be
set}/server:/tmp/server_logs/backup/:ro"
logging:
options:
Expand All @@ -37,7 +38,8 @@ services:
# Setting the user explicitly ensures that the logs are written out as vagrant.
user: "vagrant:vagrant"
volumes:
- ./logs/server:/var/log/nginx/
- "${LOGS_SHARE_PATH:?LOGS_SHARE_PATH must be
set}/server:/var/log/nginx/:rw"
logging:
options:
max-size: "20m"
Expand Down