Skip to content

Commit

Permalink
Merge pull request #70 from tnc-ca-geo/maintenance-mode
Browse files Browse the repository at this point in the history
Update README
  • Loading branch information
nathanielrindlaub authored Sep 19, 2023
2 parents f84747a + cf764b6 commit 95fdc3a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Lambda function for ingesting and processing camera trap images.
- Animl base program http://github.com/tnc-ca-geo/animl-base
- Animl ingest function http://github.com/tnc-ca-geo/animl-ingest
- Animl ML resources http://github.com/tnc-ca-geo/animl-ml
- Animl desktop app https://github.com/tnc-ca-geo/animl-desktop
- Animl analytics http://github.com/tnc-ca-geo/animl-analytics

## About

Expand Down Expand Up @@ -47,7 +47,7 @@ cd animl-ingest
npm install
```

## Deployment
## Dev deployment
From project root folder (where ```serverless.yml``` lives), run the following to deploy or update the stack:

```
Expand All @@ -58,3 +58,17 @@ serverless deploy --stage dev
serverless deploy --stage prod
```

## Prod deployment
Use caution when deploying to production, as the application involves multiple stacks (animl-ingest, animl-api, animl-frontend), and often the deployments need to be synchronized. For major deployments to prod in which there are breaking changes that affect the other components of the stack, follow these steps:

1. Set the frontend `IN_MAINTENANCE_MODE` to `true` (in `animl-frontend/src/config.js`), deploy to prod, then invalidate its cloudfront cache. This will temporarily prevent users from interacting with the frontend (editing labels, bulk uploading images, etc.) while the rest of the updates are being deployed.

2. Set ingest-image's `IN_MAINTENANCE_MODE` to `true` (in `animl-ingest/ingest-image/task.js`) and deploy to prod. This will temporarily route any images from wireless cameras that happen to get send to the ingestion bucket to the `animl-images-parkinglot-prod` bucket so that Animl isn't trying to process new images while the updates are being deployed.

3. Backup prod DB by running `npm run export-db-prod` from the `animl-api` project root.

4. Deploy animl-api to prod.

5. Turn off `IN_MAINTENANCE_MODE` in animl-frontend and animl-ingest, and deploy both to prod

6. Copy any image that happened to land in `animl-images-parkinglot-prod` while the stacks were being deployed to `animl-images-ingestion-prod`
2 changes: 1 addition & 1 deletion ingest-zip/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "ingest-zip",
"private": true,
"type": "module",
"version": "1.0.0",
"version": "2.0.0",
"description": "Unzip Batch Zips and explode them into a directory of single images on S3",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 95fdc3a

Please sign in to comment.