mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Implement DigitalOcean Kubernetes deployment on publishing
This commit is contained in:
parent
ced38f552c
commit
485e6986b8
57
.github/workflows/publish.yml
vendored
57
.github/workflows/publish.yml
vendored
@ -246,6 +246,63 @@ jobs:
|
||||
- name: Push maintenance
|
||||
run: docker push --all-tags ocelotsocialnetwork/maintenance
|
||||
|
||||
##############################################################################
|
||||
# JOB: KUBERNETES DEPLOY LATEST VERSION ######################################
|
||||
##############################################################################
|
||||
kubernetes_deploy:
|
||||
# see example https://github.com/do-community/example-doctl-action
|
||||
# see example https://github.com/do-community/example-doctl-action/blob/main/.github/workflows/workflow.yaml
|
||||
name: Kubernetes deploy of latest version to stage.ocelot.social cluster at DigitalOcean
|
||||
runs-on: ubuntu-latest
|
||||
needs: [upload_to_dockerhub]
|
||||
steps:
|
||||
##########################################################################
|
||||
# CHECKOUT CODE ##########################################################
|
||||
##########################################################################
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
##########################################################################
|
||||
# SET ENVS ###############################################################
|
||||
##########################################################################
|
||||
- name: ENV - VERSION
|
||||
run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV
|
||||
- name: ENV - BUILD_VERSION
|
||||
run: echo "BUILD_VERSION=${VERSION}-${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV
|
||||
##########################################################################
|
||||
# Install DigitalOceans doctl and set kubeconfig #########################
|
||||
##########################################################################
|
||||
- name: Install doctl
|
||||
uses: digitalocean/action-doctl@v2
|
||||
with:
|
||||
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
|
||||
- name: Save DigitalOcean kubeconfig with short-lived credentials
|
||||
run: doctl kubernetes cluster kubeconfig save --expiry-seconds 600 cluster-stage-ocelot-social
|
||||
##########################################################################
|
||||
# Deploy new Docker images to DigitalOcean Kubernetes cluster ############
|
||||
##########################################################################
|
||||
# - name: Deploy 'latest' to DigitalOcean Kubernetes
|
||||
# run: |
|
||||
# kubectl set image deployment/ocelot-webapp container-ocelot-webapp=ocelotsocialnetwork/webapp:latest
|
||||
# kubectl rollout restart deployment/ocelot-webapp
|
||||
# kubectl set image deployment/ocelot-backend container-ocelot-backend=ocelotsocialnetwork/backend:latest
|
||||
# kubectl rollout restart deployment/ocelot-backend
|
||||
# kubectl set image deployment/ocelot-maintenance container-ocelot-maintenance=ocelotsocialnetwork/maintenance:latest
|
||||
# kubectl rollout restart deployment/ocelot-backend
|
||||
# kubectl set image deployment/ocelot-neo4j container-ocelot-neo4j=ocelotsocialnetwork/neo4j-community:latest
|
||||
# kubectl rollout restart deployment/ocelot-neo4j
|
||||
- name: Deploy actual version '$BUILD_VERSION' to DigitalOcean Kubernetes
|
||||
run: |
|
||||
kubectl set image deployment/ocelot-webapp container-ocelot-webapp=ocelotsocialnetwork/webapp:$BUILD_VERSION
|
||||
kubectl set image deployment/ocelot-backend container-ocelot-backend=ocelotsocialnetwork/backend:$BUILD_VERSION
|
||||
kubectl set image deployment/ocelot-maintenance container-ocelot-maintenance=ocelotsocialnetwork/maintenance:$BUILD_VERSION
|
||||
kubectl set image deployment/ocelot-neo4j container-ocelot-neo4j=ocelotsocialnetwork/neo4j-community:$BUILD_VERSION
|
||||
# - name: Verify deployment
|
||||
# run: |
|
||||
# kubectl rollout status deployment/ocelot-webapp
|
||||
# kubectl rollout status deployment/ocelot-backend
|
||||
# kubectl rollout status deployment/ocelot-backend
|
||||
# kubectl rollout status deployment/ocelot-neo4j
|
||||
|
||||
##############################################################################
|
||||
# JOB: GITHUB TAG LATEST VERSION #############################################
|
||||
##############################################################################
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user