Skip to content

resmio/featuredeploy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Featuredeploy

Overview

featuredeploy allows to deploy specific commits of an application for testing by e.g. QA

To deploy the latest commit of the current branch run:

$ featuredeploy deploy
Deploying d8332a057cc09deebb6c4c7a1a35d576d8189866 "Adding file" (branch my-branch)
Waiting for ip address ...
178.62.231.207

The feature will be deployed to the printed ip, the build process can be monitored over HTTP, basic authentication is used.

To list deployed instances run:

$ featuredeploy ls
50918708 | 188.166.76.183 | 5f590f20 | master                        | 06.06 12:38 | active
50924872 | 188.166.92.121 | 9db8968a | 5061-my-awesome-branch        | 06.06 13:50 | active
50927969 | 178.62.214.231 | d80d3dff | 5064-my-not-so-awesome-branch | 06.06 14:23 | active

You can also delete, schedule a delete and do other actions on deployed instances:

$ featuredeploy -h
USAGE: featuredeploy (deploy | ls | rm $id | rmbranch $branch | rmall | ttl $ip $hours | logs $ip)

An instance will be removed after two days or when its branch gets merged.

Configuration

Featuredeploy is application independent, everything application specific like credentials is configured inside a .featuredeploy folder at the project root folder of the application you wish do deploy.

The .featuredeploy/ folder consists of the following files:

.featuredeploy/
├── config.ini
├── environment.ini
└── startup

.featuredeploy/startup is an executable file that has to start your app at port 8000, you get an ubuntu 18.04 but it is recommended to only rely on the docker and docker-compose installation to run the app. Probably you also want to create test data at this step at this step.

.featuredeploy/environment.ini Are optional environment variables that are exported for the startup script. This is an ad-hoc solution to maintain secret configurations, it's a vim encrypted file make sure to use the blowfish2 encryption method or newer if available. Also put the key in an .encrypt_key file or in the SECRET_KEY environemnt variable so the configuration can be read on featuredeploy invocations.

.featuredeploy/config.ini are configuration keys, also vim encrypted. See the table for configuration options:

Key Description
DIGITAL_OCEAN_TOKEN The token of a digital ocean account to start the machine where the deployment happens.
GITHUB_INSTALLATION_ID A Github installation id for the featuredeploy server.
GIT_CLONE The app to clone
HIPCHAT_TOKEN A hipchat token to send a success message after deployment.
HIPCHAT_ROOM_ID A Hipchat room to post the success message.
HTTP_AUTH_USER the user for the http authentification.
HTTP_AUTH_PASS The password for the http authentification.
PRIVATE_SSH_KEY A private ssh key that you probably need for the git clone, see https://developer.github.com/v3/guides/managing-deploy-keys/
STATUS_SERVER_FULL_NAME The github user- and repo name separated by a slash, e.g. docker/compose (Sombrero needs that)
STATUS_SERVER_SECRET a secret shared with the featuredeyploy server status server to authenticate http callbacks.
STATUS_SERVER_URL the url of the status server ending with a trailing slash.

The feature deploy status server

The feature deploy status server is an integration of this featuredeploy command line interface with github. Its source code can be found here: https://github.com/resmio/featuredeploy-server. The feature deploy status server gets input over http callbacks and updates the pull request at github. With the Sombrero integration you can start the deployment of the last commit of a github pull request by just adding a label to it. The status of the deployment will be updated on the pull request and appropiate GIFs will be posted for general amusement.

For a better overview of how feature deploy server plays with the featuredeploy CLI you can open this Diagram

Misc notes

Featuredeploy is used regularly at resmio and designed as a general purpose application, nevertheless the The Rule of Three applies. Meaning that it fits very well the needs of the company it was designed for but may need adaptations to work for you. Also note that the code did not get more dedication than it needs to fulfill its purpose. Also note furthermore that of course the digital ocean account associated with the digital ocean token from the configuration file will be billed. There is no rate limiting of deployment invocations by adding the github label or calling the featuredeploy CLI directly.