-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add sandbox deployment scripts (#3817)
* chore: add sandbox deployment scripts * fix: tweak cli * fix: use versioned image
- Loading branch information
Showing
8 changed files
with
476 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,16 @@ on: | |
- Skip | ||
- Staging Only | ||
- Staging + Prod | ||
sandbox: | ||
description: 'Deploy to Sandbox' | ||
default: false | ||
required: true | ||
type: boolean | ||
sandboxNoDbRefresh: | ||
description: 'Sandbox Disable Daily DB Refresh' | ||
default: false | ||
required: true | ||
type: boolean | ||
|
||
jobs: | ||
publish: | ||
|
@@ -241,3 +251,43 @@ jobs: | |
wait-for-completion: true | ||
wait-for-completion-timeout: 10m | ||
display-workflow-run-url: false | ||
|
||
# ----------------------------------------------------------------- | ||
# SANDBOX | ||
# ----------------------------------------------------------------- | ||
sandbox: | ||
name: Deploy to Sandbox | ||
if: ${{ !failure() && !cancelled() && github.event.inputs.sandbox == 'true' }} | ||
needs: [prepare, release] | ||
runs-on: [self-hosted, dev-server] | ||
environment: | ||
name: sandbox | ||
env: | ||
PKG_VERSION: ${{needs.prepare.outputs.pkg_version}} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Download a Release Artifact | ||
uses: actions/[email protected] | ||
with: | ||
name: release-${{ env.PKG_VERSION }} | ||
|
||
- name: Deploy to containers | ||
env: | ||
DEBIAN_FRONTEND: noninteractive | ||
run: | | ||
# echo "Reset production flags in settings.py..." | ||
# sed -i -r -e 's/^DEBUG *= *.*$/DEBUG = True/' -e "s/^SERVER_MODE *= *.*\$/SERVER_MODE = 'development'/" backend/mlarchive/settings/base.py | ||
echo "Install Deploy to Container CLI dependencies..." | ||
cd dev/deploy-to-container | ||
npm ci | ||
cd ../.. | ||
echo "Start Deploy..." | ||
node ./dev/deploy-to-container/cli.js --branch ${{ github.ref_name }} --domain dev.ietf.org --appversion ${{ env.PKG_VERSION }} --commit ${{ github.sha }} --ghrunid ${{ github.run_id }} --nodbrefresh ${{ github.event.inputs.sandboxNoDbRefresh }} | ||
- name: Cleanup old docker resources | ||
env: | ||
DEBIAN_FRONTEND: noninteractive | ||
run: | | ||
docker image prune -a -f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
audit = false | ||
fund = false | ||
save-exact = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Mail Archive Deploy to Container Tool | ||
|
||
This tool takes a release.tar.gz build file and deploys it as a container, along with its own database container. | ||
|
||
## Requirements | ||
|
||
- Node `16.x` or later | ||
- Docker | ||
|
||
## Usage | ||
|
||
1. From the `dev/deploy-to-container` directory, run the command: | ||
```sh | ||
npm install | ||
``` | ||
2. Make sure you have a `release.tar.gz` tarball in the project root directory. | ||
3. From the project root directory (back up 2 levels), run the command: (replacing the `branch` and `domain` arguments) | ||
```sh | ||
node ./dev/deploy-to-container/cli.js --branch main --domain something.com | ||
``` | ||
|
||
A container named `ma-app-BRANCH` and `ma-db-BRANCH` (where BRANCH is the argument provided above) will be created. |
Oops, something went wrong.