Deploy Verigreen as a Docker Container - Verigreen/verigreen GitHub Wiki
Docker is a light-weight virtualization solution. Docker allows for quick and easy deployments of application and services.
The Verigreen release includes a docker image. Please use this guide to deploy the Verigreen docker image and configure it.
- Ubuntu 14.04 or higher OR CentOs/RHEL 6.5 or higher.
- Docker 1.8.x or higher
- See the Generic Prerequisites
- Install Docker as per their guide.
Note: If proxy configuration is needed, please update the /etc/default/docker file (Ubuntu), and restart the docker service. - Install git.
- We recommend configuring SSH keys for the required user, and add the public key to the git provider.
The git user Verigreen is utilizing must have Write permissions to the required repository. - For HTTP(S) authentication, please see below, use use Git's Credentials Helper
- We recommend configuring SSH keys for the required user, and add the public key to the git provider.
- Download the Verigreen docker image.
docker pull verigreen/vg-collector
- Create the folders to hold the required data. Two folders are needed:
- The config folder, which holds the configuration files.
- The git repository folder.
- Download the config.properties file:
cd /opt/verigreen/MyProject/config
wget https://raw.githubusercontent.com/Verigreen/verigreen/master/verigreen-collector-webapp/resources/config.properties
- Configure the parameters within the config.properties file using this guide.
- In the same folder, create a new file named run.yml, as follows:
echo 'repository:' > run.yml
echo '# please provide the git remote repository url used in git clone (e.g. ssh://<user>@<domain>:<port>/path/to/repo.git)' >> run.yml
echo 'remote_url: "ssh://git@MyGitHost:port/MyRepo.git"' >> run.yml
Note: If using HTTP(S), please provide the user/password pair on the remote URL as follows:
echo ' remote_url: "https://user:password@MyGitHost:port/MyRepo.git"' >> run.yml
Usually, different ports are used for each protocol - HTTP, HTTPS or SSH. - Now, clone the required git repository Verigreen will protect branches in:
cd /opt/verigreen/MyProject
git clone ssh://git@MyGitHost:port/MyRepo.git
- The Verigreen collector can now be started. However, we can set a few environment variables first:
For the BASH shell:
export VG_NAME=Verigreen
export CONFIG_DIR=/opt/verigreen/MyProject/config
export REPO_DIR=/opt/verigreen/MyProject/MyRepo
/usr/bin/docker run -d --hostname="$VG_NAME" --name="$VG_NAME" -v $SSH_DIR:/ssh -v $CONFIG_DIR:/vg -v $REPO_DIR:/repo -p $PORT:8080 verigreen/vg-collector
Note: the Verigreen cache folder, holding its processed commit history is located within the config folder as of version 2.5.6.
It is highly recommended to set up Verigreen as a service. A daemon script for Verigreen is provided as part of our source-code.
- Get the service script
cd /etc/init.d
wget https://raw.githubusercontent.com/Verigreen/verigreen/master/utils/service-script/verigreen
Set permissions for the scriptchmod 755 verigreen
- Modify the service script as indicated above - See the last step of the Installation section.
- Configure the RESTART_OPT as follows:
- Leave it blank until Verigreen is configured correctly
RESTART_OPT=
- Once The Vreigreen collector is up and running OK, set the parameter to auto-restart the docker container if on failure. This is needed as currently docker container may fail to start correctly after machine reboot or startup.
RESTART_OPT="--restart=always"
The Verigreen log files are available within the container, and can be viewed in one of two ways:
- Use the docker logs command:
docker logs $VG_NAME
VG_NAME is set above, and is the name of the container that was spun off the verigreen/vg-collector image. - Log into the container, and view the log
docker exec -ti $VG_NAME bash
less /app/logs/verigreen.log