From bc7ec623f3583dbd95ba1ef9575a017ea6de1104 Mon Sep 17 00:00:00 2001 From: Harpo Date: Fri, 9 Sep 2022 08:15:31 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=BE=20`./deploy`=20db=20(#39)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Deploy database Adds `./deploy -d [TAG]` option. - `--db` long form - Deploys postgres database version tag to `db` via `kubectl` - Only runs single update step, no build / push Closes #38 ## Labels Changed labels to use emojis directly, instead of github's `:emoji:` syntax. This fixes the labels on the Zenhub board. ## milestones Added [v0.2.1 Upgrade ๐Ÿ”จ](https://github.com/WGBH-MLA/ov-deploy/milestone/6) Milestone ## submodules - Updates [`ov-wag` to v0.2.1](https://github.com/WGBH-MLA/ov-wag/releases/tag/v0.2.1) - Updates [`ov-frontend` to v0.2.1](https://github.com/WGBH-MLA/ov-frontend/releases/tag/v0.2.1) --- .github/release.yml | 16 +++++----- cli.py | 8 +++++ deployer.py | 7 ++++- docker-compose.yml | 2 +- docs/deploy.md | 2 ++ docs/setup.md | 4 ++- ov-frontend | 2 +- ov-wag | 2 +- sync-labels.json | 71 +++++++++++++++++++++++++++----------------- sync-milestones.json | 14 ++++++--- 10 files changed, 83 insertions(+), 45 deletions(-) diff --git a/.github/release.yml b/.github/release.yml index c66dadd..73cd966 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -2,21 +2,21 @@ changelog: categories: - title: Breaking Changes ๐Ÿช… labels: - - 'breaking :broken_heart:' + - 'breaking ๐Ÿ’”' - title: New Features ๐ŸŽ‰ labels: - - 'enhancement :heavy_plus_sign:' + - 'enhancement โž•' - - title: 'Bugfixes :bug:' + - title: 'Bugfixes ๐Ÿ›' labels: - - 'bug :bug:' + - 'bug ๐Ÿ›' - - title: 'Maintenance :nut_and_bolt:' + - title: 'Maintenance ๐Ÿ”ฉ' labels: - - 'maintenance :wrench:' - - 'CI :test_tube:' - - 'CD :building_construction:' + - 'maintenance ๐Ÿ”ง' + - 'CI ๐Ÿฆพ' + - 'CD ๐Ÿ—๏ธ' - title: Other Changes labels: diff --git a/cli.py b/cli.py index 9c7399b..64dd09b 100644 --- a/cli.py +++ b/cli.py @@ -24,6 +24,14 @@ def cli(): help='version of the ov-wag headless CMS backend to be deployed', ) + parser.add_argument( + '-d', + '--db', + type=str, + metavar='TAG', + help='version of the database to be deployed', + ) + parser.add_argument( '-f', '--ov-frontend', diff --git a/deployer.py b/deployer.py index 8f3229a..e9fa062 100644 --- a/deployer.py +++ b/deployer.py @@ -36,6 +36,7 @@ class Deployer(BaseModel): """ context: str + db: str = None ov_wag: str = None ov_wag_env: str = None ov_wag_secrets: str = None @@ -66,7 +67,9 @@ def deploy(self): Run the full deployer process using the current context""" print(f'Starting deployment using context "{self.context}"') - if not any([self.ov_wag, self.ov_frontend, self.ov_nginx, self.jumpbox]): + if not any( + [self.ov_wag, self.ov_frontend, self.ov_nginx, self.jumpbox, self.db] + ): raise Exception(f'Nothing specified for deployment.') if self.ov_wag: self._deploy('ov-wag', self.ov_wag, src=f'{OV_WAG_URL}#{self.ov_wag}') @@ -80,5 +83,7 @@ def deploy(self): self._deploy('ov-nginx', self.ov_nginx) if self.jumpbox: self._deploy('jumpbox', self.jumpbox) + if self.db: + run(f'kubectl set image deployment.apps/db db=postgres:{self.db}') print('Done!') diff --git a/docker-compose.yml b/docker-compose.yml index 2542bc1..eef09ea 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,4 +22,4 @@ services: OV_API_URL: http://wagtail db: - image: postgres:14.2-alpine + image: postgres:14.5-alpine diff --git a/docs/deploy.md b/docs/deploy.md index 10d2d8a..0e6389b 100644 --- a/docs/deploy.md +++ b/docs/deploy.md @@ -83,6 +83,8 @@ The script can be called with several arguments: : Backend: `-b VERSION` : Frontend: `-f VERSION` : Proxy: `-p VERSION` + : Jumpbox: `-j VERSION` + : db: `-d VERSION` 1. Run command diff --git a/docs/setup.md b/docs/setup.md index a412772..5c83a5a 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -178,8 +178,10 @@ The following services are needed to run the stack: OV_DB_NAME=postgres OV_DB_USER=postgres + OV_BASE_URL=http://ovfrontend.k8s.wgbhdigital.org + OV_ADMIN_BASE_URL=http://ov-admin.k8s.wgbhdigital.org + OV_TRUSTED_ORIGINS=http://ov-admin.k8s.wgbhdigital.org OV_ALLOWED_HOSTS=ov-wag - OV_TRUSTED_ORIGINS=http://ov-admin.k8s.wgbhdigital.org/ ``` - secrets: diff --git a/ov-frontend b/ov-frontend index dd40484..eafafa2 160000 --- a/ov-frontend +++ b/ov-frontend @@ -1 +1 @@ -Subproject commit dd404847fc77fbe2a0220c8139d5444edf118b96 +Subproject commit eafafa2cca1a7165edaefa6d590bfa335731a11f diff --git a/ov-wag b/ov-wag index bad37af..784d1bc 160000 --- a/ov-wag +++ b/ov-wag @@ -1 +1 @@ -Subproject commit bad37af131a81aa1e20f6c0b8db96a9ce49fd400 +Subproject commit 784d1bcad289048ce3d1e9e292ae1e48012153aa diff --git a/sync-labels.json b/sync-labels.json index 19c468e..198a042 100644 --- a/sync-labels.json +++ b/sync-labels.json @@ -1,79 +1,94 @@ [ { "repositories": [ - "WGBH-MLA/ov_deploy", + "WGBH-MLA/ov-deploy", "WGBH-MLA/ov-wag", "WGBH-MLA/ov-frontend" ], "labels": [ { - "previousNames": ["bug"], - "name": "bug :bug:", + "previousNames": ["bug", "bug :bug:"], + "name": "bug ๐Ÿ›", "color": "d73a4a" }, { - "previousNames": ["CD"], - "name": "CD :building_construction:", + "previousNames": ["CD", "CD :building_construction:"], + "name": "CD ๐Ÿ—๏ธ", "description": "Relating to Continuous Deployment", "color": "732487" }, { - "previousNames": ["CI"], - "name": "CI :test_tube:", + "previousNames": ["CI", "CI :test_tube:"], + "name": "CI ๐Ÿฆพ", "description": "Relating to Continuous Integration", "color": "E09B24" }, { - "previousNames": ["breaking"], - "name": "breaking :broken_heart:", + "previousNames": ["production"], + "name": "production ๐ŸŽญ", + "description": "Relating to the production deployment", + "color": "772b8d" + }, + { + "previousNames": ["test"], + "name": "test ๐Ÿงช", + "description": "Tests and testing", + "color": "38C5D6" + }, + { + "previousNames": ["breaking", "breaking :broken_heart:"], + "name": "breaking ๐Ÿ’”", "description": "Breaking changes", "color": "BF0212" }, { - "previousNames": ["documentation"], - "name": "documentation :scroll:", + "previousNames": ["documentation", "documentation :scroll:"], + "name": "documentation ๐Ÿ“œ", "color": "0075ca" }, { - "previousNames": ["duplicate"], - "name": "duplicate :gemini:", + "previousNames": ["duplicate", "duplicate :gemini:"], + "name": "duplicate โ™Š", "color": "cfd3d7" }, { - "previousNames": ["enhancement"], - "name": "enhancement :heavy_plus_sign:", + "previousNames": ["enhancement", "enhancement :heavy_plus_sign:"], + "name": "enhancement โž•", "color": "a2eeef" }, { - "previousNames": ["good first issue"], - "name": "good first issue :new_moon_with_face:", + "previousNames": [ + "good first issue", + "good first issue :new_moon_with_face:" + ], + "name": "good first issue ๐ŸŒš", "color": "7057ff" }, { - "previousNames": ["help wanted"], - "name": "help wanted :information_source:", + "previousNames": ["help wanted", "help wanted :information_source:"], + "name": "help wanted โ„น๏ธ", "color": "008672" }, { - "previousNames": ["invalid"], - "name": "invalid :exclamation:", + "previousNames": ["invalid", "invalid :exclamation:"], + "name": "invalid โ—", "color": "e4e669" }, { - "previousNames": ["maintenance"], - "name": "maintenance :wrench:", + "previousNames": ["maintenance", "maintenance :wrench:"], + "name": "maintenance ๐Ÿ”ง", "description": "Updates and upgrades", "color": "F87431" }, { - "previousNames": ["question"], - "name": "question :grey_question:", + "previousNames": ["question", "question :grey_question:"], + "name": "question โ”", "color": "d876e3" }, { - "previousNames": ["wontfix"], - "name": "wontfix :x:", - "color": "ffffff" + "previousNames": ["wontfix", "wontfix :x:"], + "name": "wontfix โœ–๏ธ", + "color": "000000" } ] } diff --git a/sync-milestones.json b/sync-milestones.json index 21dbad6..58ee462 100644 --- a/sync-milestones.json +++ b/sync-milestones.json @@ -1,7 +1,7 @@ [ { "repositories": [ - "WGBH-MLA/ov_deploy", + "WGBH-MLA/ov-deploy", "WGBH-MLA/ov-wag", "WGBH-MLA/ov-frontend" ], @@ -15,16 +15,22 @@ { "previousTitles": ["v0.2.0"], "title": "v0.2.0 Deploy ๐ŸŒ‡", - "state": "open", - "description": "# Deploy\n#### *The self-titled album*\n\nIncludes:\n- [ ] deploy documentation\n- [x] `nginx` image\n- [x] `jumpbox` image", + "description": "# Deploy\n#### *The self-titled album*\n\nIncludes:\n- [x] deploy documentation\n- [x] `nginx` image\n- [x] `jumpbox` image", "due_on": "2022-08-01T23:59:59Z" }, + { + "previousTitles": ["v0.2.1"], + "title": "v0.2.1 Upgrade ๐Ÿ”จ", + "state": "open", + "description": "# Upgrade\nUpgrades to back, front, and deploy\n- [x] Upgrade to Wagtail 4.0\n- [x] Upgrade to Remix 1.7\n- [x] Upgrade to Postgres 14.5\n- [x] Add deploy db\n- [x] Upgrade github labels", + "due_on": "2022-09-02T23:59:59Z" + }, { "previousTitles": ["v0.3.0"], "title": "v0.3.0 Collections ๐Ÿ–ผ๏ธ", "state": "open", "description": "# Collections\n- [ ] Special Collections\n- [ ] Other Exhibits\n- [ ] Embed images", - "due_on": "2022-09-01T23:59:59Z" + "due_on": "2022-09-16T23:59:59Z" }, { "previousTitles": ["v0.4.0"],