Auto Deployment with Docker Image (1)

Branch-Oriented Deployment

Each new feature should a separate branch. Each branch should have its own image which can be deployed to the QA server for testing.

After fully testing, the branch should be merged with development and deployed to Dev Server

If everyone is satisfied with Dev Server version, then we deploy it to Staging Server.

Docker Image Repository

During the QA and Deployment process, docker image should be passed between different server in order to control the env difference

DB backup and replication

There should be an easy method to replicate the real data from Staging server and deploy it into the Dev and QA server.

Entire Workflow

Create a new branch

  • Create a new feature branch from development within bitbucket
  • The branch name should explain the current version, Jira task number, and date

Init Gcloud and Docker

  • Install the gcloud on your local
  • Update gcloud command line tools to the latest version
  • Install Docker on your local
  • Make sure the Docker is running

Check the Deployment Tool package for QA Deployment

/deploymentToolBox
 /QA
  /createAndPushImagesToContainerRepository.sh
  /Dockerfile
   

Execute the command

A Cluster has been created for QA and Staging

gcloud container clusters get-credentials sl-qa-staging-api-cluster --zone asia-east1-a --project stream-lending

An issue about ruby

In ruby symbol is different compared with string. You cannot directly use the string to call the attribute within on hash array.

The data type of hash array keys is symbol. Therefore, we need to convert string to the symbol to check if it’s existing in the array.

to_sym() public
Returns the Symbol corresponding to str, creating the symbol if it did not previously exist. See Symbol#id2name.

"Koala".intern         #=> :Koala
s = 'cat'.to_sym       #=> :cat
s == :cat              #=> true
s = '@cat'.to_sym      #=> :@cat
s == :@cat             #=> true
This can also be used to create symbols that cannot be represented using the :xxx notation.

'cat and dog'.to_sym   #=> :"cat and dog"

Leave a Reply

Your email address will not be published. Required fields are marked *