At work, I was working on a PTE project. The frontend was in vuejs and the backend was in rails api. As usual, we deployed the backend with capistrano.
For frontend, my boss wanted it to be deployed just like capistrano did, with a release folder, shared folder, rollbacks, etc. He also wanted only the compile folder to go in the server and not the whole repo.
I looked into a couple of tools that deployed static site but I could not wrap my head around it.
Since I knew capistrano and have been using it for all of my projects I decided to use it to deploy the frontend. I created a gem called Static which is an SCM plugin for capistrano.
Create a gemfile in your project's folder.
# Gemfile.rb group :development do gem "capistrano", "~> 3.10", require: false gem 'capistrano-scm-static', '~> 0.0.2', require: false end
bundle exec cap install . It will install all the necessary files and folder in your project.
# Capfile require 'capistrano/scm/static' install_plugin Capistrano::SCM::Static # deploy.rb set :dist, 'path to your static template compilation folder'
Let's say you are working with reactjs on frontend then your compilation folder will be
build, so just set
set :dist, 'build' # in case for reactjs
If you are working with vuejs
set :dist, 'dist' # in case for vuejs
To deploy it, run
cap production deploy or if your have set other environments, then
cap <environemnt> deploy