Skip to content

Instantly share code, notes, and snippets.

@jackfiallos
Last active August 22, 2018 19:02
Show Gist options
  • Save jackfiallos/9217225aa279d8e794979b8ddc92866a to your computer and use it in GitHub Desktop.
Save jackfiallos/9217225aa279d8e794979b8ddc92866a to your computer and use it in GitHub Desktop.
Mina deploy configuration file
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/deploy'
set :application_name, 'NodeJS API'
set :domain, 'your-domain.com'
set :deploy_to, '/home/public/your-domain/api'
set :repository, 'ssh://[email protected]/organization-name/project.git'
set :branch, 'dev'
set :keep_releases, 1
set :user, 'deployer'
set :environment, 'development'
task :staging do
set :branch, 'dev'
set :environment, 'development'
end
task :production do
set :branch, 'master'
set :environment, 'production'
end
task :deploy do
deploy do
# Preparations here
invoke :'git:clone'
invoke :'deploy:cleanup'
on :launch do
invoke :'api:install'
invoke :'api:logs'
invoke :'api:pm2'
end
end
end
namespace :api do
desc "Installing"
task :install do
puts "-----> Installing package dependencies"
command 'npm install'
end
desc "Setting up logs"
task :logs do
puts "-----> Setting up the right folder permissions"
command 'chmod -R 777 ./logs'
end
desc "Restarting pm2 process"
task :pm2 do
puts "-----> Restarting PM2 process"
command 'npm run pm2 --env #{environment}'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment