How to deploy docker compose project to digital ocean using the GIT CLI

How to deploy docker compose project to digital ocean

Create a new droplet on digital ocean, make sure you have added your ssh key. Commands in this guide are for Ubuntu.

https://docs.digitalocean.com/products/droplets/how-to/create/

SSH into your new droplet

ssh [email protected]

Install the GIT CLI

Follow install instructions here ( I am not including it incase it changes )

[https://github.com/cli/cli/blob/trunk/docs/install_linux.md]

Authenticate the GIT CLI

gh auth login

Choose the ssh key option and create a new key

Clone your repo

gh repo clone horizon3

Install docker-compose

apt install docker-compose

Domain

You need to point your domain address at the ip address of your droplet. Make sure also that your docker setup is set to the correct url.

Open the port

You may need to open the relevant ports with

sudo ufw allow proto tcp from any to any port 80,443

Run your project

Then as you do on local, cd into your project and run docker-compose up

In order to have it run in the background

docker-compose up -d