Last week I was trying to setup AWS CodeDeploy on an On-Prem Ubuntu Server 16.04. Unfortunately CodeDeploy supports only
ruby2.0 version. Whereas Ubuntu 16.04 and above ship with
Eventually I decided to write my own S3CodeDeployer in GoLang. It has no dependencies. Its just a binary file that runs as service on your Linux machine.
Note: You’ll need to have
versioning enabled for respective S3 Bucket.
This program will check for latest version and download tar ball / zip from S3 and extract all the files into respective Application directories as defined in your
config.yml . This agent will also run
AfterInstall hooks once the application is deployed successfully.
A detailed document for Debian, Ubuntu and RPM is located at: https://miradnan.github.io/s3-code-deployer/
For demo purpose ill be using Ubuntu 16.04 (Xenial) .
First we need to add GnuPG Public Key:
$ wget — no-cache -O — https://api.bintray.com/users/miradnanali/keys/gpg/public.key | sudo apt-key add -
Add Source for Ubuntu 16.04
$ echo “deb [arch=amd64] https://dl.bintray.com/miradnanali/S3CodeDeployerDebian xenial main” > /etc/apt/sources.list.d/s3-codedeployer.list
$ apt-get install s3-code-deployer
revision_check_duration: 10 // in minutesaws:
region: YOUR_AWS_REGIONdeployments:- application: staging.example.com
s3_revision_file: example.com/staging.tar.gz- application: www.example.com
s3_revision_file: example.com/prod.tar.gz# You can add as many applications as you want.
Thats it, now restart
$ service s3-code-deployer restart
That’s it! Your applications will now be auto-deployed once a tar ball is updated on your S3 Bucket.