diff options
| -rw-r--r-- | Capfile | 19 | ||||
| -rw-r--r-- | Gemfile | 8 | ||||
| -rw-r--r-- | Gemfile.lock | 37 | ||||
| -rw-r--r-- | config/deploy.rb | 60 | ||||
| -rw-r--r-- | config/deploy/production.rb | 62 | ||||
| -rw-r--r-- | config/deploy/staging.rb | 61 |
6 files changed, 247 insertions, 0 deletions
| diff --git a/Capfile b/Capfile new file mode 100644 index 0000000..1ace4ce --- /dev/null +++ b/Capfile | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | # Load DSL and set up stages | ||
| 2 | require "capistrano/setup" | ||
| 3 | |||
| 4 | # Include default deployment tasks | ||
| 5 | require "capistrano/deploy" | ||
| 6 | |||
| 7 | # Load the SCM plugin appropriate to your project: | ||
| 8 | require "capistrano/scm/git" | ||
| 9 | install_plugin Capistrano::SCM::Git | ||
| 10 | |||
| 11 | # Include tasks from other gems included in your Gemfile | ||
| 12 | require "capistrano/rvm" | ||
| 13 | require "capistrano/bundler" | ||
| 14 | require "capistrano/rails/assets" | ||
| 15 | require "capistrano/rails/migrations" | ||
| 16 | require "capistrano/passenger" | ||
| 17 | |||
| 18 | # Load custom tasks from `lib/capistrano/tasks` if you have any defined | ||
| 19 | Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r } | ||
| diff --git a/Gemfile b/Gemfile index 0e5e139..9912440 100644 --- a/Gemfile +++ b/Gemfile | |||
| @@ -64,6 +64,14 @@ group :development do | |||
| 64 | 64 | ||
| 65 | # Speed up commands on slow machines / big apps [https://github.com/rails/spring] | 65 | # Speed up commands on slow machines / big apps [https://github.com/rails/spring] |
| 66 | # gem "spring" | 66 | # gem "spring" |
| 67 | |||
| 68 | # Use Capistrano for deployment | ||
| 69 | gem 'capistrano', '~> 3.0', require: false | ||
| 70 | gem 'capistrano-rvm', require: false | ||
| 71 | gem 'capistrano-rails', require: false | ||
| 72 | gem 'capistrano-bundler', require: false | ||
| 73 | gem 'capistrano-passenger', require: false | ||
| 74 | gem 'highline', require: false | ||
| 67 | end | 75 | end |
| 68 | 76 | ||
| 69 | group :test do | 77 | group :test do |
| diff --git a/Gemfile.lock b/Gemfile.lock index 236483c..9bb96e3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock | |||
| @@ -81,6 +81,8 @@ GEM | |||
| 81 | tzinfo (~> 2.0) | 81 | tzinfo (~> 2.0) |
| 82 | addressable (2.8.7) | 82 | addressable (2.8.7) |
| 83 | public_suffix (>= 2.0.2, < 7.0) | 83 | public_suffix (>= 2.0.2, < 7.0) |
| 84 | airbrussh (1.5.3) | ||
| 85 | sshkit (>= 1.6.1, != 1.7.0) | ||
| 84 | base64 (0.2.0) | 86 | base64 (0.2.0) |
| 85 | benchmark (0.4.0) | 87 | benchmark (0.4.0) |
| 86 | bigdecimal (3.1.8) | 88 | bigdecimal (3.1.8) |
| @@ -88,6 +90,21 @@ GEM | |||
| 88 | bootsnap (1.18.4) | 90 | bootsnap (1.18.4) |
| 89 | msgpack (~> 1.2) | 91 | msgpack (~> 1.2) |
| 90 | builder (3.3.0) | 92 | builder (3.3.0) |
| 93 | capistrano (3.19.2) | ||
| 94 | airbrussh (>= 1.0.0) | ||
| 95 | i18n | ||
| 96 | rake (>= 10.0.0) | ||
| 97 | sshkit (>= 1.9.0) | ||
| 98 | capistrano-bundler (2.1.1) | ||
| 99 | capistrano (~> 3.1) | ||
| 100 | capistrano-passenger (0.2.1) | ||
| 101 | capistrano (~> 3.0) | ||
| 102 | capistrano-rails (1.6.3) | ||
| 103 | capistrano (~> 3.1) | ||
| 104 | capistrano-bundler (>= 1.1, < 3) | ||
| 105 | capistrano-rvm (0.1.2) | ||
| 106 | capistrano (~> 3.0) | ||
| 107 | sshkit (~> 1.2) | ||
| 91 | capybara (3.40.0) | 108 | capybara (3.40.0) |
| 92 | addressable | 109 | addressable |
| 93 | matrix | 110 | matrix |
| @@ -128,6 +145,8 @@ GEM | |||
| 128 | temple (>= 0.8.2) | 145 | temple (>= 0.8.2) |
| 129 | thor | 146 | thor |
| 130 | tilt | 147 | tilt |
| 148 | highline (3.1.1) | ||
| 149 | reline | ||
| 131 | i18n (1.14.6) | 150 | i18n (1.14.6) |
| 132 | concurrent-ruby (~> 1.0) | 151 | concurrent-ruby (~> 1.0) |
| 133 | io-console (0.8.0) | 152 | io-console (0.8.0) |
| @@ -171,8 +190,13 @@ GEM | |||
| 171 | net-protocol | 190 | net-protocol |
| 172 | net-protocol (0.2.2) | 191 | net-protocol (0.2.2) |
| 173 | timeout | 192 | timeout |
| 193 | net-scp (4.0.0) | ||
| 194 | net-ssh (>= 2.6.5, < 8.0.0) | ||
| 195 | net-sftp (4.0.0) | ||
| 196 | net-ssh (>= 5.0.0, < 8.0.0) | ||
| 174 | net-smtp (0.5.0) | 197 | net-smtp (0.5.0) |
| 175 | net-protocol | 198 | net-protocol |
| 199 | net-ssh (7.3.0) | ||
| 176 | nio4r (2.7.4) | 200 | nio4r (2.7.4) |
| 177 | nokogiri (1.16.8-aarch64-linux) | 201 | nokogiri (1.16.8-aarch64-linux) |
| 178 | racc (~> 1.4) | 202 | racc (~> 1.4) |
| @@ -187,6 +211,7 @@ GEM | |||
| 187 | nokogiri (1.16.8-x86_64-linux) | 211 | nokogiri (1.16.8-x86_64-linux) |
| 188 | racc (~> 1.4) | 212 | racc (~> 1.4) |
| 189 | normalize-rails (8.0.1) | 213 | normalize-rails (8.0.1) |
| 214 | ostruct (0.6.1) | ||
| 190 | psych (5.2.1) | 215 | psych (5.2.1) |
| 191 | date | 216 | date |
| 192 | stringio | 217 | stringio |
| @@ -270,6 +295,12 @@ GEM | |||
| 270 | sqlite3 (1.7.3-x86-linux) | 295 | sqlite3 (1.7.3-x86-linux) |
| 271 | sqlite3 (1.7.3-x86_64-darwin) | 296 | sqlite3 (1.7.3-x86_64-darwin) |
| 272 | sqlite3 (1.7.3-x86_64-linux) | 297 | sqlite3 (1.7.3-x86_64-linux) |
| 298 | sshkit (1.23.2) | ||
| 299 | base64 | ||
| 300 | net-scp (>= 1.1.2) | ||
| 301 | net-sftp (>= 2.1.2) | ||
| 302 | net-ssh (>= 2.8.0) | ||
| 303 | ostruct | ||
| 273 | stringio (3.1.2) | 304 | stringio (3.1.2) |
| 274 | temple (0.10.3) | 305 | temple (0.10.3) |
| 275 | terser (1.1.20) | 306 | terser (1.1.20) |
| @@ -305,11 +336,17 @@ PLATFORMS | |||
| 305 | DEPENDENCIES | 336 | DEPENDENCIES |
| 306 | activerecord-diff | 337 | activerecord-diff |
| 307 | bootsnap | 338 | bootsnap |
| 339 | capistrano (~> 3.0) | ||
| 340 | capistrano-bundler | ||
| 341 | capistrano-passenger | ||
| 342 | capistrano-rails | ||
| 343 | capistrano-rvm | ||
| 308 | capybara | 344 | capybara |
| 309 | coffee-rails (~> 4.2) | 345 | coffee-rails (~> 4.2) |
| 310 | debug | 346 | debug |
| 311 | enumerize | 347 | enumerize |
| 312 | haml | 348 | haml |
| 349 | highline | ||
| 313 | jbuilder | 350 | jbuilder |
| 314 | jquery-rails | 351 | jquery-rails |
| 315 | mini_racer | 352 | mini_racer |
| diff --git a/config/deploy.rb b/config/deploy.rb new file mode 100644 index 0000000..27168a9 --- /dev/null +++ b/config/deploy.rb | |||
| @@ -0,0 +1,60 @@ | |||
| 1 | # config valid for current version and patch releases of Capistrano | ||
| 2 | lock "~> 3.19.2" | ||
| 3 | |||
| 4 | set :application, "pokeviewer" | ||
| 5 | set :repo_url, "/srv/git/pokeviewer" | ||
| 6 | |||
| 7 | # Default branch is :master | ||
| 8 | # ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp | ||
| 9 | |||
| 10 | # Default deploy_to directory is /var/www/my_app_name | ||
| 11 | set :deploy_to, "/srv/www/pokeviewer" | ||
| 12 | |||
| 13 | # Default value for :format is :airbrussh. | ||
| 14 | # set :format, :airbrussh | ||
| 15 | |||
| 16 | # You can configure the Airbrussh format using :format_options. | ||
| 17 | # These are the defaults. | ||
| 18 | # set :format_options, command_output: true, log_file: "log/capistrano.log", color: :auto, truncate: :auto | ||
| 19 | |||
| 20 | # Default value for :pty is false | ||
| 21 | # set :pty, true | ||
| 22 | |||
| 23 | # Default value for :linked_files is [] | ||
| 24 | append :linked_files, 'config/master.key', 'config/credentials/production.key' | ||
| 25 | |||
| 26 | # Default value for linked_dirs is [] | ||
| 27 | append :linked_dirs, "log", "tmp/pids", "tmp/cache", "tmp/sockets" #, "public/system", "vendor", "storage" | ||
| 28 | |||
| 29 | # Default value for default_env is {} | ||
| 30 | # set :default_env, { path: "/opt/ruby/bin:$PATH" } | ||
| 31 | set :default_env, { 'RAILS_RELATIVE_URL_ROOT' => '/poke3' } | ||
| 32 | |||
| 33 | # Default value for local_user is ENV['USER'] | ||
| 34 | # set :local_user, -> { `git config user.name`.chomp } | ||
| 35 | |||
| 36 | # Default value for keep_releases is 5 | ||
| 37 | # set :keep_releases, 5 | ||
| 38 | |||
| 39 | # Uncomment the following to require manually verifying the host key before first deploy. | ||
| 40 | # set :ssh_options, verify_host_key: :secure | ||
| 41 | |||
| 42 | # rvm | ||
| 43 | set :rvm_type, :system | ||
| 44 | set :rvm_custom_path, '/usr/local/rvm' | ||
| 45 | |||
| 46 | # rails | ||
| 47 | set :rails_env, 'production' | ||
| 48 | set :conditionally_migrate, true | ||
| 49 | set :migration_role, :app | ||
| 50 | set :assets_roles, [:app] | ||
| 51 | |||
| 52 | namespace :deploy do | ||
| 53 | after :updated, :compile do | ||
| 54 | on primary(:app) do | ||
| 55 | within release_path do | ||
| 56 | rake "compile" | ||
| 57 | end | ||
| 58 | end | ||
| 59 | end | ||
| 60 | end | ||
| diff --git a/config/deploy/production.rb b/config/deploy/production.rb new file mode 100644 index 0000000..3313458 --- /dev/null +++ b/config/deploy/production.rb | |||
| @@ -0,0 +1,62 @@ | |||
| 1 | # server-based syntax | ||
| 2 | # ====================== | ||
| 3 | # Defines a single server with a list of roles and multiple properties. | ||
| 4 | # You can define all roles on a single server, or split them: | ||
| 5 | |||
| 6 | # server "example.com", user: "deploy", roles: %w{app db web}, my_property: :my_value | ||
| 7 | # server "example.com", user: "deploy", roles: %w{app web}, other_property: :other_value | ||
| 8 | # server "db.example.com", user: "deploy", roles: %w{db} | ||
| 9 | server "fourisland.com", user: "thoughts", roles: %w{app db web} | ||
| 10 | |||
| 11 | |||
| 12 | |||
| 13 | # role-based syntax | ||
| 14 | # ================== | ||
| 15 | |||
| 16 | # Defines a role with one or multiple servers. The primary server in each | ||
| 17 | # group is considered to be the first unless any hosts have the primary | ||
| 18 | # property set. Specify the username and a domain or IP for the server. | ||
| 19 | # Don't use `:all`, it's a meta role. | ||
| 20 | |||
| 21 | # role :app, %w{deploy@example.com}, my_property: :my_value | ||
| 22 | # role :web, %w{user1@primary.com user2@additional.com}, other_property: :other_value | ||
| 23 | # role :db, %w{deploy@example.com} | ||
| 24 | |||
| 25 | |||
| 26 | |||
| 27 | # Configuration | ||
| 28 | # ============= | ||
| 29 | # You can set any configuration variable like in config/deploy.rb | ||
| 30 | # These variables are then only loaded and set in this stage. | ||
| 31 | # For available Capistrano configuration variables see the documentation page. | ||
| 32 | # http://capistranorb.com/documentation/getting-started/configuration/ | ||
| 33 | # Feel free to add new variables to customise your setup. | ||
| 34 | |||
| 35 | |||
| 36 | |||
| 37 | # Custom SSH Options | ||
| 38 | # ================== | ||
| 39 | # You may pass any option but keep in mind that net/ssh understands a | ||
| 40 | # limited set of options, consult the Net::SSH documentation. | ||
| 41 | # http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start | ||
| 42 | # | ||
| 43 | # Global options | ||
| 44 | # -------------- | ||
| 45 | # set :ssh_options, { | ||
| 46 | # keys: %w(/home/user_name/.ssh/id_rsa), | ||
| 47 | # forward_agent: false, | ||
| 48 | # auth_methods: %w(password) | ||
| 49 | # } | ||
| 50 | # | ||
| 51 | # The server-based syntax can be used to override options: | ||
| 52 | # ------------------------------------ | ||
| 53 | # server "example.com", | ||
| 54 | # user: "user_name", | ||
| 55 | # roles: %w{web app}, | ||
| 56 | # ssh_options: { | ||
| 57 | # user: "user_name", # overrides user setting above | ||
| 58 | # keys: %w(/home/user_name/.ssh/id_rsa), | ||
| 59 | # forward_agent: false, | ||
| 60 | # auth_methods: %w(publickey password) | ||
| 61 | # # password: "please use keys" | ||
| 62 | # } | ||
| diff --git a/config/deploy/staging.rb b/config/deploy/staging.rb new file mode 100644 index 0000000..0a3f086 --- /dev/null +++ b/config/deploy/staging.rb | |||
| @@ -0,0 +1,61 @@ | |||
| 1 | # server-based syntax | ||
| 2 | # ====================== | ||
| 3 | # Defines a single server with a list of roles and multiple properties. | ||
| 4 | # You can define all roles on a single server, or split them: | ||
| 5 | |||
| 6 | # server "example.com", user: "deploy", roles: %w{app db web}, my_property: :my_value | ||
| 7 | # server "example.com", user: "deploy", roles: %w{app web}, other_property: :other_value | ||
| 8 | # server "db.example.com", user: "deploy", roles: %w{db} | ||
| 9 | |||
| 10 | |||
| 11 | |||
| 12 | # role-based syntax | ||
| 13 | # ================== | ||
| 14 | |||
| 15 | # Defines a role with one or multiple servers. The primary server in each | ||
| 16 | # group is considered to be the first unless any hosts have the primary | ||
| 17 | # property set. Specify the username and a domain or IP for the server. | ||
| 18 | # Don't use `:all`, it's a meta role. | ||
| 19 | |||
| 20 | # role :app, %w{deploy@example.com}, my_property: :my_value | ||
| 21 | # role :web, %w{user1@primary.com user2@additional.com}, other_property: :other_value | ||
| 22 | # role :db, %w{deploy@example.com} | ||
| 23 | |||
| 24 | |||
| 25 | |||
| 26 | # Configuration | ||
| 27 | # ============= | ||
| 28 | # You can set any configuration variable like in config/deploy.rb | ||
| 29 | # These variables are then only loaded and set in this stage. | ||
| 30 | # For available Capistrano configuration variables see the documentation page. | ||
| 31 | # http://capistranorb.com/documentation/getting-started/configuration/ | ||
| 32 | # Feel free to add new variables to customise your setup. | ||
| 33 | |||
| 34 | |||
| 35 | |||
| 36 | # Custom SSH Options | ||
| 37 | # ================== | ||
| 38 | # You may pass any option but keep in mind that net/ssh understands a | ||
| 39 | # limited set of options, consult the Net::SSH documentation. | ||
| 40 | # http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start | ||
| 41 | # | ||
| 42 | # Global options | ||
| 43 | # -------------- | ||
| 44 | # set :ssh_options, { | ||
| 45 | # keys: %w(/home/user_name/.ssh/id_rsa), | ||
| 46 | # forward_agent: false, | ||
| 47 | # auth_methods: %w(password) | ||
| 48 | # } | ||
| 49 | # | ||
| 50 | # The server-based syntax can be used to override options: | ||
| 51 | # ------------------------------------ | ||
| 52 | # server "example.com", | ||
| 53 | # user: "user_name", | ||
| 54 | # roles: %w{web app}, | ||
| 55 | # ssh_options: { | ||
| 56 | # user: "user_name", # overrides user setting above | ||
| 57 | # keys: %w(/home/user_name/.ssh/id_rsa), | ||
| 58 | # forward_agent: false, | ||
| 59 | # auth_methods: %w(publickey password) | ||
| 60 | # # password: "please use keys" | ||
| 61 | # } | ||
