Skip to content

Commit

Permalink
Merge branch 'staging'
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenvdlinde committed Dec 5, 2019
2 parents f5307e8 + ba44c7d commit 762706d
Show file tree
Hide file tree
Showing 15 changed files with 389 additions and 189 deletions.
7 changes: 7 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,20 @@ APP_VERSION=V.0.1
APP_DEBUG=1
# What is the enviroment type you want to use for local production? (choose between dec,stag,prod, acce or test)
APP_ENV=dev
# We use a build to tag images, this is swithced to the version on master and to env on other branches
APP_BUILD=dev
# The description for this api
APP_DESCRIPTION='Naast deze JSON rest API is er ook een [graphql](/graphql) interface beschikbaar.'

# The urls on wich this api is available
TRUSTED_PROXIES=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
TRUSTED_HOSTS='^(.+\.)?conduction\.nl$|^(.+\.)?huwelijksplanner\.online$|^(.+\.)?larping\.eu$|^(.+\.)?common-ground\.nl$|^(.+\.)?trouwplanner\.online$|^(.+\.)?zaakonline\.nl$|localhost'

##################################################
# Documentation settings
##################################################

APP_DOMAIN=conduction.nl
APP_DEMO=pc.zaakonline.nl
APP_REPRO=https://github.com/ConductionNL/Proto-component-commonground

Expand Down
51 changes: 49 additions & 2 deletions .github/workflows/dockerimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,38 @@ jobs:
- uses: actions/checkout@v1
- name: Pulling old images, if any
run: docker-compose pull --ignore-pull-failures
- name: Setting APP_NAME
run: |
export NAME=$(grep APP_NAME= .env | cut -d '=' -f2)
echo ::set-env name=APP_NAME::$NAME
- name: Print app name
run: echo "APP_NAME = $APP_NAME"
- name: Setting APP_ENV to dev
run: |
echo ::set-env name=APP_ENV::dev
echo ::set-env name=APP_BUILD::dev
echo "set APP_ENV to $APP_ENV"
- name: Setting APP_ENV to prod
if: contains( github.ref, 'master' ) || contains( github.base_ref, 'master' )
run: |
echo ::set-env name=APP_ENV::prod
echo "set APP_ENV to $APP_ENV"
- name: Set APP_BUILD to APP_VERSION
if: contains( github.ref, 'master' )
run: |
export VERSION=$(grep APP_VERSION= .env | cut -d '=' -f2)
echo ::set-env name=APP_BUILD::$VERSION
echo "set APP_BUILD to $APP_BUILD"
- name: Setting APP_ENV to stag
if: contains( github.ref, 'staging' ) || contains( github.base_ref, 'staging' )
run: |
echo ::set-env name=APP_ENV::stag
echo ::set-env name=APP_BUILD::stag
echo "set APP_ENV to $APP_ENV"
- name: Print definitive APP_ENV
run: echo "APP_ENV is now $APP_ENV"
- name: Build the Docker image
run: docker-compose build --pull --build-arg APP_ENV=$APP_ENV
run: docker-compose build --pull --build-arg APP_ENV=$APP_ENV --build-arg APP_BUILD=$APP_BUILD
- name: Run the docker image
run: docker-compose up -d
- name: Taking some sleep
Expand Down Expand Up @@ -77,5 +91,38 @@ jobs:
if: (contains( github.ref, 'master' ) || contains( github.ref, 'staging' ) || contains( github.ref, 'development' )) && steps.kubeconfig.outputs.success == 'true'
run: helm init --upgrade --kubeconfig="kubeconfig.yaml"
- name: Deploy through helm
id: helm-install
if: (contains( github.ref, 'master' ) || contains( github.ref, 'staging' ) || contains( github.ref, 'development' )) && steps.kubeconfig.outputs.success == 'true'
run: helm upgrade pc-$APP_ENV ./api/helm --kubeconfig="kubeconfig.yaml" --namespace=$APP_ENV --set settings.env=$APP_ENV,settings.debug=1,settings.loadbalancerEnabled=true
run: helm upgrade $APP_NAME-$APP_ENV ./api/helm --kubeconfig="kubeconfig.yaml" --namespace=$APP_ENV --set settings.env=$APP_ENV,settings.debug=1
- name: Install through helm
if: failure()
run: helm install --name $APP_NAME-$APP_ENV ./api/helm --kubeconfig="kubeconfig.yaml" --namespace=$APP_ENV --set settings.env=$APP_ENV,settings.debug=1
- name: Rollout new containers
if: (contains( github.ref, 'master' ) || contains( github.ref, 'staging' ) || contains( github.ref, 'development' )) && steps.kubeconfig.outputs.success == 'true' && success()
run: |
kubectl rollout restart deployment/$APP_NAME-php --kubeconfig="kubeconfig.yaml" --namespace=$APP_ENV
kubectl rollout restart deployment/$APP_NAME-nginx --kubeconfig="kubeconfig.yaml" --namespace=$APP_ENV
kubectl rollout restart deployment/$APP_NAME-varnish --kubeconfig="kubeconfig.yaml" --namespace=$APP_ENV
- name: Export release code
if: (success() || failure())
id: releasecode
run: |
export RELEASE=$APP_BUILD-$(git rev-parse --short $GITHUB_SHA)
echo "##[set-output name=releasename]$RELEASE"
- name: Print release name
if: (success() || failure())
run: echo $RELEASENAME
env:
RELEASENAME: ${{ steps.releasecode.outputs.releasename }}
- name: Create Release
if: contains( github.ref, 'master' ) && steps.kubeconfig.outputs.success == 'true' && ( success() || failure() )
id: create_release
uses: actions/create-release@v1
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ steps.releasecode.outputs.releasename }}
release_name: ${{ steps.releasecode.outputs.releasename }}
draft: false
prerelease: false
152 changes: 148 additions & 4 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 762706d

Please sign in to comment.