commit
e10781dc08
5 changed files with 37 additions and 77 deletions
|
@ -104,11 +104,11 @@ jobs:
|
|||
- deploy:
|
||||
command: |
|
||||
if [ "${CIRCLE_BRANCH}" == "dev" ]; then
|
||||
bundle exec rake deploy_ha
|
||||
bundle exec rake deploy to=staging
|
||||
fi
|
||||
|
||||
if [ "${CIRCLE_BRANCH}" == "master" ]; then
|
||||
bundle exec rake deploy_ha to=production
|
||||
bundle exec rake deploy to=production
|
||||
fi
|
||||
|
||||
workflows:
|
||||
|
|
37
Rakefile
37
Rakefile
|
@ -4,40 +4,3 @@
|
|||
require File.expand_path('config/application', __dir__)
|
||||
|
||||
Rails.application.load_tasks
|
||||
|
||||
task :lint do
|
||||
sh "bundle exec rubocop"
|
||||
sh "bundle exec haml-lint app/views/"
|
||||
sh "bundle exec scss-lint app/assets/stylesheets/"
|
||||
sh "bundle exec brakeman --no-pager"
|
||||
sh "yarn lint:js"
|
||||
end
|
||||
|
||||
task :deploy do
|
||||
domains = %w(37.187.249.111 149.202.72.152 149.202.198.6)
|
||||
domains.each do |domain|
|
||||
sh "mina deploy domain=#{domain}"
|
||||
end
|
||||
end
|
||||
|
||||
task :deploy_ha do
|
||||
domains = %w(149.202.72.152 149.202.198.6)
|
||||
domains.each do |domain|
|
||||
sh "mina deploy domain=#{domain}"
|
||||
end
|
||||
end
|
||||
|
||||
task :deploy_old do
|
||||
domains = %w(37.187.154.237 37.187.249.111)
|
||||
domains.each do |domain|
|
||||
sh "mina deploy domain=#{domain}"
|
||||
end
|
||||
end
|
||||
|
||||
task :deploy_test do
|
||||
domains = %w(192.168.0.116)
|
||||
branch = 'clamav'
|
||||
domains.each do |domain|
|
||||
sh "mina deploy domain=#{domain} branch=#{branch}"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
require 'mina/bundler'
|
||||
require 'mina/rails'
|
||||
require 'mina/git'
|
||||
require 'mina/rbenv' # for rbenv support. (http://rbenv.org)
|
||||
# require 'mina/rvm' # for rvm support. (http://rvm.io)
|
||||
require 'mina/rbenv'
|
||||
|
||||
# Basic settings:
|
||||
# domain - The hostname to SSH to.
|
||||
|
@ -10,37 +9,20 @@ require 'mina/rbenv' # for rbenv support. (http://rbenv.org)
|
|||
# repository - Git repo to clone from. (needed by mina/git)
|
||||
# branch - Branch name to deploy. (needed by mina/git)
|
||||
|
||||
ENV['to'] ||= "staging"
|
||||
raise "Bad to=#{+ENV['to']}" if !["staging", "production"].include?(ENV['to'])
|
||||
if !["staging", "production"].include?(ENV['to'])
|
||||
raise "missing or incorrect `to` (should be 'staging' or 'production')"
|
||||
end
|
||||
|
||||
raise "missing domain, run with 'rake deploy domain=37.187.154.237'" if ENV['domain'].nil?
|
||||
if ENV['domain'].nil?
|
||||
raise "missing `domain`"
|
||||
end
|
||||
|
||||
# set :domain, '5.135.190.60'
|
||||
set :domain, ENV['domain']
|
||||
set :repository, 'https://github.com/betagouv/tps.git'
|
||||
set :port, 2200
|
||||
|
||||
set :deploy_to, '/var/www/tps_dev'
|
||||
|
||||
case ENV["to"]
|
||||
when "staging"
|
||||
set :branch, ENV['branch'] || 'dev'
|
||||
set :deploy_to, '/var/www/tps_dev'
|
||||
set :user, 'tps_dev' # Username in the server to SSH to.
|
||||
appname = 'tps_dev'
|
||||
when "production"
|
||||
set :branch, ENV['branch'] || 'master'
|
||||
set :deploy_to, '/var/www/tps'
|
||||
set :user, 'tps' # Username in the server to SSH to.
|
||||
appname = 'tps'
|
||||
end
|
||||
|
||||
print "Deploy to #{ENV['to']} environment branch #{branch}\n"
|
||||
|
||||
set :rails_env, 'production'
|
||||
|
||||
# For system-wide RVM install.
|
||||
# set :rvm_path, '/usr/local/rvm/bin/rvm'
|
||||
set :rbenv_path, "/usr/local/rbenv/bin/rbenv"
|
||||
set :forward_agent, true # SSH forward_agent.
|
||||
|
||||
# Manually create these paths in shared/ (eg: shared/config/database.yml) in your server.
|
||||
# They will be linked in the 'deploy:link_shared_paths' step.
|
||||
|
@ -56,12 +38,20 @@ set :shared_paths, [
|
|||
'config/unicorn.rb'
|
||||
]
|
||||
|
||||
set :rbenv_path, "/usr/local/rbenv/bin/rbenv"
|
||||
case ENV["to"]
|
||||
when "staging"
|
||||
set :branch, ENV['branch'] || 'dev'
|
||||
set :deploy_to, '/var/www/tps_dev'
|
||||
set :user, 'tps_dev' # Username in the server to SSH to.
|
||||
appname = 'tps_dev'
|
||||
when "production"
|
||||
set :branch, ENV['branch'] || 'master'
|
||||
set :deploy_to, '/var/www/tps'
|
||||
set :user, 'tps' # Username in the server to SSH to.
|
||||
appname = 'tps'
|
||||
end
|
||||
|
||||
# Optional settings:
|
||||
# set :user, 'foobar' # Username in the server to SSH to.
|
||||
# set :port, '30000' # SSH port number.
|
||||
set :forward_agent, true # SSH forward_agent.
|
||||
print "Deploy to #{ENV['to']} environment branch #{branch}\n"
|
||||
|
||||
# This task is the environment that is loaded for most commands, such as
|
||||
# `mina deploy` or `mina rake`.
|
||||
|
@ -144,9 +134,3 @@ task :deploy => :environment do
|
|||
end
|
||||
end
|
||||
end
|
||||
# For help in making your deploy script, see the Mina documentation:
|
||||
#
|
||||
# - http://nadarei.co/mina
|
||||
# - http://nadarei.co/mina/tasks
|
||||
# - http://nadarei.co/mina/settings
|
||||
# - http://nadarei.co/mina/helpers
|
||||
|
|
6
lib/tasks/deploy.rake
Normal file
6
lib/tasks/deploy.rake
Normal file
|
@ -0,0 +1,6 @@
|
|||
task :deploy do
|
||||
domains = %w(149.202.72.152 149.202.198.6)
|
||||
domains.each do |domain|
|
||||
sh "mina deploy domain=#{domain}"
|
||||
end
|
||||
end
|
7
lib/tasks/lint.rake
Normal file
7
lib/tasks/lint.rake
Normal file
|
@ -0,0 +1,7 @@
|
|||
task :lint do
|
||||
sh "bundle exec rubocop"
|
||||
sh "bundle exec haml-lint app/views/"
|
||||
sh "bundle exec scss-lint app/assets/stylesheets/"
|
||||
sh "bundle exec brakeman --no-pager"
|
||||
sh "yarn lint:js"
|
||||
end
|
Loading…
Reference in a new issue