Reputation: 97
What I'm trying to do: use a continuous integration tool like CircleCI or GitLab to deploy to a DigitalOcean droplet. Locally I'm able to use Docker Machine to run something like
$ eval $(docker-machine env my-droplet)
to connect to an already created droplet and then docker run foo
.
Is it possible to do such an action via the traditional deploy.yml file? Assume that I have a digitalocean-access-token
and a droplet already created.
Upvotes: 1
Views: 125
Reputation: 6222
If I understood your question correctly you can use this command to achieve what you want:
docker-machine create \
--driver generic \
--generic-ip-address=<your vm IP> \
--generic-ssh-key ~/.ssh/id_rsa \
my-droplet
And then you can do as you want:
$ eval $(docker-machine env my-droplet)
This will register the machine. Otherwise you have to provide all certs and configs from your dev env to your CI which is not secure and recommended.
Upvotes: 0
Reputation: 1324977
The integration proposed by DigitalOcean is more with Docker Cloud, meaning your CI should push your image to Docker Cloud, for DigitalOcean to use in a Droplet.
See "Deploy Horizon Using Docker Cloud & DigitalOcean" from Chris Asche
log into Docker Cloud and link your DigitalOcean account. To do this, click on 'Cloud Settings' at the bottom left. You should now see a list of Cloud Providers on the page. Click on the plug icon next to DigitalOcean to link your accounts. Note that, at the time of writing, there is a $20 credit added to your DigitalOcean account when linked with Docker Cloud.
Once your accounts are linked, create a new DigitalOcean Node Cluster. I'm going to call mine,
horizon-with-docker
in the regionToronto 1
.
The newly created node cluster can be used to run a stack. A stack is a collection of services and each service is a collection of containers. Stacks are created with the
stack-yaml
file.
Once created, revisit the node cluster created earlier to grab the IP address of your DigitalOcean droplet - my droplet IP is 159.203.61.66. Go ahead and visit your freshly deployed Horizon application at the IP address.
Upvotes: 0