I have a Ruby web application hosted on Digital Ocean VPS. In the current setup, I have a bash script that lives on a VPS that does the following:
- Stops the application server
- Cloning the latest git repository code on the local server
- Performs database migration
- Application Server Launch
- Cleaning
Obviously, this approach is not scalable (or even good). Therefore, I am trying to configure the deployment pipeline using Travis CI + Capistrano, which automatically installs, builds, tests and deploys this web application after pressing git.
So far, we have Travis CI that installs, builds, and tests our code each time git is pressed, but we come across the best way to complete the deployment step. Since we have JS and SASS files that need to be created using gulp, we cannot just pull it directly from git to the server and run it. And since Travis CI is already creating these files, we are curious whether it is possible to use the embedded files from Travis CI and send them directly from Travis CI to our servers.
Some options that we examined:
SCP + direct transmission
As an example of a custom FTP deployment on Travis CI, we could SCP create files on our server and invoke a bash script that starts the migration and restarts the application server.
Capistrano + direct transmission
We could install Capistrano on Travis CI and use it to directly transfer files that were built on Travis CI to our servers. Before packing and sending, we will need to clean any files / directories that do not need to be transferred (node_modules, gazebo, etc.). After migrating the package, we can again use Capistrano to retrieve it, start the database migration and restart the application server.
To do this, how do we minimize deployment downtime? And how can we manage bugs and rollbacks?
Capistrano + git
We could pull the Travis CI embedded files into the git tag on github and use Capistrano to pull the git tag on the server, start the database migration, and restart the application server.
For this, it seems that git releases should only be for prod, so how do we manage different environments (dev, stage and prod)?
In any case, we learned quite a lot on the Internet and could not find a solution for our needs that sets the best approach to deployment from Travis CI to an unsupported deployment provider.
Given the above situation, what is the best way to install from Travis CI to VPS?