Skip to content
/ getgo Public

Continous Deployment tool that aims to help you deploy your Docker images to your web server.

License

Notifications You must be signed in to change notification settings

moby-it/getgo

Repository files navigation

GetGo Continous Deployment Tool

GetGo is a tool that aims to help you deploy your Dockerhub Repositories to your virtual machine. It is based on Dockerhub Webhooks.

Motivation

After moving resources away from mainstream cloud provider infrastructure and started using VPS on multiple providers online, I was in lack of a tool to automaticaly deploy my container from Dockerhub to my VPS and since I wanted to do something in Go either way, I decided to create this tool for myself. After a short while I realized that it's definitely easier to update your container via a remote ssh through Github Actions for solving my CD issue but nevertheless I created a stable version for this tool to sharpen my Go skills, before archiving it. It also has some value if someone want to completely decouple his Deployment Circle from his Source Control repository.

How it Works

  • GetGo runs as a systemd service inside your Debian-Based Virtual Machice. It exposes a simple HTTP POST endpoint at localhost:32041/deploy. The endpoint expects a json body similar to what dockerhub uses for its webhooks.

  • If there is a running container with a name that matches the repository.repo_name-push_tag.tag then GetGo pulls the new image, destroys and recreates the container, exposing the same ports.

Install and Configure

Requirements

For GetGo to work, it is expected that you have at least ssh access to a remote machine with the following:

  1. Docker installed. Install docker
  2. Go installed (sudo snap install go --classic)
  3. make installed (sudo apt-get install build-essential)
  4. listening to http calls. (Install and configure NGINX)

Install instructions

  1. Connect yo your remote machine.
  2. Clone this repository - How to clone a repository
  3. Open a terminal and navigate inside the above repository folder.
  4. run sudo make install.

Now the service should already be active. To check this, run sudo systemctl status getgo. If you want to enable this service to run on startup, run sudo systemctl enable getgo.

For the installation to be complete, you need to provide a DOCKER_USERNAME and DOCKER_PASSWORD as an environment variable for your systemd service. To do that run sudo systemctl edit getgo. You should add the following lines :

[Service]
Environment="DOCKER_USERNAME=YOUR_DOCKER_USERNAME"
Environment="DOCKER_PASSWORD=YOUR_DOCKER_ACCESS_TOKEN"`

Suggested way of adding environment variables to systemd

After saving make sure to run sudo systemctl daemon-reload

Configure

After installing you have a service running in your system that exposes a simple HTTP POST endpoint at http://locahost:31042/deploy.

Since this is a Continious Deployment tool, it only makes sense if you can hit this endpoint via the internet. At this point you should make sure that http://locahost:31042/deploy is accessible from the outside world. If you use NGINX you can read more on how to do this here.

The last piece of the puzzle is configuring the source of the "to-be-deployed" container. GetGo was written for consuming calls made from DockerHub Webhooks. If you've wired up your web-server to correctly forward calls from https://your-web-server-address.com/deploy to http://localhost:31042/deploy then GetGo will start a deployment process if the following criteria are met:

  1. The HTTP POST request has a body that follows the DockerHub Webhook schema.
  2. There is a container running on your machine, with a container name that matches the repo_name-pushed_tag.

What NOT to expect from GetGo

  • GetGo does not deploy your containers for the first time. It expects of you to set the container up for the first time, with a container-name=repository.repo_name-push_data.tag and networking properties of your choice.
  • It is your responsibility to expose the port of this service to the internet on any of your VMs if you want to trigger it from an online container registry (like Dockerhub)

Build by Moby IT

About

Continous Deployment tool that aims to help you deploy your Docker images to your web server.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published