How I use Codeship and DigitalOcean to deploy websites

Nov 06, 2018 permalink

Services like GitHub and Gitlab allow users to deploy static sites with a push commit. You can even add a custom domain and have the site served from it instead of the standard *.github.io and *.gitlab.io domains. But what if you have your own VPS and want the same experience?

I have been a long-time user of Codeship. I, initially started using it to deploy coding challenges when applying to various companies but then, one weekend, I realised I could do the same with this site as well.

This article will guide you through my way of deploying static sites. I want to be able to do a push commit, and the site should automatically be live in a few minutes. If you want a similar experience, read on.

Ingredients

Recipe

At this point, I’m assuming that you have a static site that you want to deploy stored in a repository somewhere. I’ll be using Bitbucket in this case, but any git provider will do.

Setting up Codeship

git@<provider>:<username>/<repository>.git

Deployment

Once a build is triggered and successfully finished, you want to deploy your site to a VPS. As mentioned previously, I will be using a DigitalOcean droplet.

scp -rp ~/clone/* user@droplet:/var/www/html/<folder>

Helpful links: