This application is built using TravisCI.
The environment creation scripts were tested first using this machine devops-test-vm
The specification is here Technical test
The build will:
- Run the tests
- Provision a environment in GCP (every branch gets it's own environment)
- Deploy the application
- Start the application
- Wait until it is available on a public IP
There are two modes, classic with computes instances etc, and kubernetes with GKE.
Branches that start with feature will trigger a Classic deployment.
Branches that start with gke_feature will trigger a Kubernetes deployment.
-
The build is configured to run against my personal GCP account
- to make it run against another account:
- create a GCP project
- create a service account with owner permissions
- create a key for that account
- encrypt the key for Travis using
travis encrypt-file --pro ${key_file}- you will need to be have the travis cli installed and travis needs to be aware of the repo under which you want to encrypt
- replace the line just below
before_install:in.travis.ymlwith the one in the output of that command - more details about this here
- edit the
.travis.ymlglobal variables to point to your project (project name, service account name, etc)
- to make it run against another account:
-
When a branch is created or a commit is pushed to a branch, this build will create a environment specific to that branch
- The name of the environment is the branch name with all characters but letters and numbers removed (due to GCP naming restrictions for various resources)
- The build will first attempt to delete the branch specific environment before creating it
- This is the output of a successful build: https://travis-ci.com/github/brobert83/devops-test/builds/186913415
- KILLED due to no feedback I will keep this one alive for a while http://35.190.76.97
- All branches are deployed in a single cluster but with the resources namespaced
- A namespace is created for each branch
- If the cluster does not exist it will be created
- This is the output of a successful build: https://travis-ci.com/github/brobert83/devops-test/builds/187123554
- KILLED due to no feedback This one is also live being served from the GKE cluster http://35.232.58.146
- On branch delete the environment will NOT be deleted (I don't know how to do that yet)
- to delete:
- run
travis/classic/delete.sh ${branch_name} ${project} ${zone}for classic - run
travis/kubernetes/delete.sh ${branch_name}for gke - use the dev environment machine devops-test-vm or another environment where you have gcloud access
- run
- to delete:
- The Kubernetes deployment is missing liveness and readiness probes, will add later
