-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from osuAkatsuki/AKAT-443-prod-deploys-from-ci
Prod deploys from CI
- Loading branch information
Showing
5 changed files
with
38 additions
and
128 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 |
---|---|---|
@@ -1,55 +1,26 @@ | ||
name: production-deploy | ||
|
||
on: workflow_dispatch | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
production-deploy: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out latest commit | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install digitalocean command line interface | ||
uses: digitalocean/action-doctl@v2 | ||
with: | ||
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} | ||
|
||
- name: Log-in to digitalocean container registry | ||
run: doctl registry login --expiry-seconds 600 | ||
|
||
- name: Build container image | ||
run: docker build -t registry.digitalocean.com/akatsuki/akatsuki-api:latest . | ||
|
||
- name: Push image to digitalocean container registry | ||
run: docker push registry.digitalocean.com/akatsuki/akatsuki-api:latest | ||
|
||
- name: Save kubeconfig from digitalocean | ||
run: doctl k8s cluster kubeconfig save --expiry-seconds 600 akatsuki-staging | ||
|
||
- name: Install helm | ||
uses: azure/setup-helm@v3 | ||
with: | ||
version: 'latest' | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
id: install | ||
|
||
- name: Install helm-diff | ||
run: helm plugin install https://github.com/databus23/helm-diff | ||
|
||
- name: Checkout common-helm-charts repo | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: osuAkatsuki/common-helm-charts | ||
token: ${{ secrets.COMMON_HELM_CHARTS_PAT }} | ||
path: common-helm-charts | ||
|
||
- name: Show manifest diff since previous release | ||
run: helm diff upgrade --allow-unreleased --values chart/values.yaml akatsuki-api-staging common-helm-charts/microservice-base/ | ||
|
||
- name: Deploy service to staging cluster | ||
run: helm upgrade --install --atomic --values chart/values.yaml akatsuki-api-staging common-helm-charts/microservice-base/ | ||
- name: Run deploy on production | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.SSH_HOST }} | ||
username: ${{ secrets.SSH_USERNAME }} | ||
key: ${{ secrets.SSH_KEY }} | ||
port: ${{ secrets.SSH_PORT }} | ||
script_stop: true | ||
script: | | ||
cd /home/akatsuki/akatsuki-api | ||
git pull origin master | ||
docker build -t akatsuki-api:latest . | ||
cd /home/akatsuki/workbench | ||
docker-compose restart \ | ||
akatsuki-api |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
FROM golang:1.20 | ||
|
||
RUN apt update && apt install -y python3-pip | ||
|
||
WORKDIR /srv/root | ||
|
||
COPY go.mod go.sum ./ | ||
|
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 |
---|---|---|
@@ -1,19 +1,11 @@ | ||
#!/usr/bin/make | ||
|
||
build: | ||
docker build -t akatsuki-api:latest -t registry.digitalocean.com/akatsuki/akatsuki-api:latest . | ||
|
||
push: | ||
docker push registry.digitalocean.com/akatsuki/akatsuki-api:latest | ||
|
||
install: | ||
helm install --values chart/values.yaml akatsuki-api-staging ../common-helm-charts/microservice-base/ | ||
|
||
uninstall: | ||
helm uninstall akatsuki-api-staging | ||
|
||
diff-upgrade: | ||
helm diff upgrade --allow-unreleased --values chart/values.yaml akatsuki-api-staging ../common-helm-charts/microservice-base/ | ||
|
||
upgrade: | ||
helm upgrade --atomic --values chart/values.yaml akatsuki-api-staging ../common-helm-charts/microservice-base/ | ||
docker build -t akatsuki-api:latest . | ||
|
||
run-api: | ||
docker run \ | ||
--env APP_COMPONENT=api \ | ||
--network=host \ | ||
--env-file=.env \ | ||
-it akatsuki-api:latest |
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