does anyone know how to deploy code from c9 to digitalocean using git? If so can you break down the steps for me, very difficult to find a solid solution on how this process is done.
Hey @bvcxtds ,
The way I work with DigitalOcean with Cloud9 is just by creating an C9 SSH Workspace and working directly in the droplet. The SSH workspace will have better resources but you still have the full Cloud9 IDE and can still collaborate and everything. It’s my favorite way to work on C9.
See the official C9 doc on it at: Running your Own SSH Workspace.
This approach would be much less complex than pushing to git and then having DigitalOcean pull down the new code (which I guess you could code some GitHub webhooks and DigitalOcean’s API to do it). I recommend an SSH Workspace if you can do it this way under your circumstances, much simpler, more direct, faster.
The method @mikeumus mentioned is definitely doable and will work. If you’d like to stick with just deploying via git then here’s a simplified version of how you might do it.
- Push code from workspace to repo
- SSH into DigitalOcean droplet
- Pull code from repo into appropriate folder
The appropriate folder I mention above will depend on what configuration/server you have running. Lots of people use Apache to serve their applications and that would be normally be in
I know the issue is resolved, but there’s another way to do deployments which I personally really like. Here’s an excellent write-up about it from DigitalOcean.
Basically, this is very similar to how Heroku does it. You would set up a git hook on your DO droplet, and set it to place the repo to a certain folder in your machine (e.g. /var/www) and then you can simply do something like
git push deploy master and it would work.