Development and Deployment - robe16/HomeControl-documentation GitHub Wiki

Work is underway to automate the continuous development and continuous development of the HomeControl environments.

The following demonstrations the high level process that has been implemented: Dev and Deploy Process

SSH passwordless login has been setup between the CICD server and the server(s) that the Docker images will be deployed on as per the instructions detailed here. It is to be noted that the private key must be placed in the /var/lib/jenkins/.ssh directory with the relevant permissions set in order for passwordless access to be granted.

It should be noted that to date no tests have been written for any of the HomeControl applications

Jenkins

Each repository will contain a Jenkinsfile that is broken down into the following stages:

  • Parameters - set the variables passed through from the pipeline configuration
  • Checkout - retrieve the repository files from GitHub
  • Build - build Docker image and store in Docker registry
  • Deploy - run the newly created Docker image on the destination server
  • Start Container - start a Docker container from the image created as part of the pipeline build

For simplicity, Jenkins has been configured to poll the GitHub repository as opposed to setting up a hook back to the Jenkins server.

Parameters

The following section details the parameters configured as part of the pipeline to be passed into the Jenkinsfile for each of the project applications:

HomeControl-server

  • githubUrl - String Parameter: GitHub URL for checking out project
  • appName - String Parameter: Name of application for Docker image and container
  • deploymentServer - String Parameter: Server to deploy the Docker container
  • deploymentUsername - String Parameter: Username for the server the Docker container will be deployed to (used for ssh/scp)
  • portApplication - String Parameter: Port number for python application running within container
  • portMapped - String Parameter: Port number to map portApplication to
  • fileConfigBindings - String Parameter: Location of bindings config file on host device
  • fileConfigUsers - String Parameter: Location of user config file on host device
  • fileLog - String Parameter: Location of log file on host device

HomeControl-webserver

  • githubUrl - String Parameter: GitHub URL for checking out project
  • appName - String Parameter: Name of application for Docker image and container
  • deploymentServer - String Parameter: Server to deploy the Docker container
  • deploymentUsername - String Parameter: Username for the server the Docker container will be deployed to (used for ssh/scp)
  • portApplication - String Parameter: Port number for python application running within container
  • portMapped - String Parameter: Port number to map portApplication to
  • serverIp - String Parameter: IP address for that the core server is running on
  • serverPort - String Parameter: Port number that the core server application listens on
  • fileLog - String Parameter: Location of log file on host device

Docker

Each repository will contain a Dockerfile that has the required Docker instructions to create an image for deployment to a Raspberry Pi running Raspbian Jessie.


Useful Links