• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javaandroidc++objective-ccocoa誰得c#gamebathyscaphelinuxphpqt翻訳rubypythoncwindowsomegattwitterguiframeworkbtronvb.netdirectxtestdomarduino計画中(planning stage)previewerpukiwiki

Voice data server for navigation voice changer app.


コミットメタ情報

リビジョン11129217b3fd7e15f99e9b9a6534a0447e297175 (tree)
日時2016-09-29 23:06:36
作者HMML <hmml3939@gmai...>
コミッターHMML

ログメッセージ

Update capistrano and add docker deploy setting.

変更サマリ

差分

--- a/Capfile
+++ b/Capfile
@@ -1,4 +1,28 @@
1-load 'deploy'
2-# Uncomment if you are using Rails' asset pipeline
3-load 'deploy/assets'
4-load 'config/deploy' # remove this line to skip loading any of the default tasks
1+# Load DSL and set up stages
2+require "capistrano/setup"
3+
4+# Include default deployment tasks
5+require "capistrano/deploy"
6+
7+# Include tasks from other gems included in your Gemfile
8+#
9+# For documentation on these, see for example:
10+#
11+# https://github.com/capistrano/rvm
12+# https://github.com/capistrano/rbenv
13+# https://github.com/capistrano/chruby
14+# https://github.com/capistrano/bundler
15+# https://github.com/capistrano/rails
16+# https://github.com/capistrano/passenger
17+#
18+# require 'capistrano/rvm'
19+# require 'capistrano/rbenv'
20+# require 'capistrano/chruby'
21+require 'capistrano/bundler'
22+require 'capistrano/rails/assets'
23+require 'capistrano/rails/migrations'
24+require 'capistrano/passenger'
25+require 'capistrano/deploy_into_docker'
26+
27+# Load custom tasks from `lib/capistrano/tasks` if you have any defined
28+Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,12 @@
1+FROM ruby:latest
2+ENV DEBIAN_FRONTEND noninteractive
3+RUN apt update
4+RUN apt -y full-upgrade
5+RUN apt -y install file sox libsox-fmt-mp3 libsox-fmt-base
6+RUN apt -y install libsqlite3-dev
7+RUN apt-get clean
8+RUN adduser --system --disabled-password --uid 3000 --group --home /var/local/app rails
9+RUN gem install bundler --no-rdoc --no-ri
10+USER rails
11+ENV BUNDLE_APP_CONFIG /var/local/app/.bundle
12+CMD cd /var/local/app/current && exec bin/rails server
--- a/Gemfile
+++ b/Gemfile
@@ -64,7 +64,9 @@ gem 'rubyzip', '< 1.0.0', require: 'zip/zip'
6464 gem 'rails_admin'
6565 group :develpment do
6666 gem 'capistrano'
67- gem 'capistrano-ext'
68- gem 'capistrano_colors'
67+ gem 'capistrano-bundler'
68+ gem 'capistrano-rails'
69+ gem 'capistrano-passenger'
70+ gem 'capistrano-deploy_into_docker'
6971 end
7072 gem 'exception_notification', group: :production
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -51,10 +51,17 @@ GEM
5151 i18n
5252 rake (>= 10.0.0)
5353 sshkit (>= 1.9.0)
54- capistrano-ext (1.2.1)
55- capistrano (>= 1.0.0)
54+ capistrano-bundler (1.1.4)
55+ capistrano (~> 3.1)
56+ sshkit (~> 1.2)
57+ capistrano-deploy_into_docker (0.2.0)
58+ sshkit-backend-docker
5659 capistrano-harrow (0.5.3)
57- capistrano_colors (0.5.5)
60+ capistrano-passenger (0.2.0)
61+ capistrano (~> 3.0)
62+ capistrano-rails (1.1.7)
63+ capistrano (~> 3.1)
64+ capistrano-bundler (~> 1.1)
5865 client_side_validations (4.2.6)
5966 jquery-rails (>= 3.1.2, < 5.0.0)
6067 js_regex (~> 1.0, >= 1.0.9)
@@ -242,6 +249,8 @@ GEM
242249 sshkit (1.11.3)
243250 net-scp (>= 1.1.2)
244251 net-ssh (>= 2.8.0)
252+ sshkit-backend-docker (0.1.0)
253+ sshkit (>= 1.9.0)
245254 therubyracer (0.12.2)
246255 libv8 (~> 3.16.14.0)
247256 ref
@@ -262,8 +271,10 @@ PLATFORMS
262271 DEPENDENCIES
263272 bootstrap-sass
264273 capistrano
265- capistrano-ext
266- capistrano_colors
274+ capistrano-bundler
275+ capistrano-deploy_into_docker
276+ capistrano-passenger
277+ capistrano-rails
267278 client_side_validations
268279 client_side_validations-simple_form
269280 coffee-rails (~> 4.0.0)
--- a/config/deploy.rb
+++ b/config/deploy.rb
@@ -1,37 +1,18 @@
1-require 'bundler/capistrano'
2-
3-set :stages, %w(production homedev)
4-set :default_stage, "homedev"
5-require 'capistrano/ext/multistage'
6-
7-set :application, "NVC Serv"
8-set :repository, "git://git.pf.sourceforge.jp/gitroot/h/hm/hmml/nvc_serv.git"
1+set :application, "NVC_Serv"
2+set :repo_url, "git://git.pf.sourceforge.jp/gitroot/h/hm/hmml/nvc_serv.git"
93 set :scm, :git
104 set :branch, 'master'
11-set :rails_env, :production
12-
13-# set :scm, :git # You can set :scm explicitly or Capistrano will make an intelligent guess based on known version control directory names
14-# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
15-
16-#role :web, "localhost" # Your HTTP server, Apache/etc
17-#role :app, "localhost" # This may be the same as your `Web` server
18-#role :db, "localhost", :primary => true # This is where Rails migrations will run
5+fetch(:default_env).merge!(rails_env: :production)
196
20-# if you want to clean up old releases on each deploy uncomment this:
21-# after "deploy:restart", "deploy:cleanup"
7+set :linked_files, fetch(:linked_files, []).push('config/database.yml', 'config/secrets.yml', 'config/initializers/z90_local.rb')
8+set :linked_dirs, %w{log tmp/sockets public/system}
229
23-after 'deploy:update_code', 'deploy:migrate'
24-before "deploy", "deploy:setup"
25-
26-
27-# if you're still using the script/reaper helper you will need
28-# these http://github.com/rails/irs_process_scripts
29-
30-# If you are using Passenger mod_rails uncomment this:
3110 namespace :deploy do
32- task :start do ; end
33- task :stop do ; end
34- task :restart, :roles => :app, :except => { :no_release => true } do
35- run "touch #{File.join(current_path,'tmp','restart.txt')}"
11+ task :fix_asset_perms do
12+ on roles(:web), in: :sequence do
13+ execute "chmod o+r -R #{release_path}/public/assets"
14+ end
3615 end
16+ after "deploy:assets:precompile", "deploy:fix_asset_perms"
3717 end
18+
--- /dev/null
+++ b/config/deploy/docker-test.rb
@@ -0,0 +1,18 @@
1+set :sshkit_backend, SSHKit::Backend::Docker
2+set :stage, :development
3+set :branch, 'master'
4+set :deploy_to, '/var/local/app'
5+set :repo_url, '/src'
6+fetch(:default_env).merge!(rails_env: :development, SECRET_KEY_BASE: 'dummy', DEVISE_SECRET_KEY: 'dummy')
7+set :bundle_without, 'test'
8+
9+fetch(:linked_dirs, []).clear
10+fetch(:linked_files, []).clear
11+
12+server docker: {
13+ image: 'nvc-base',
14+ commit: 'nvc-test',
15+ volume: "#{Dir.pwd}:/src",
16+}, user: 'rails:rails', roles: %w{web app}
17+
18+Rake::Task["passenger:restart"].clear
--- /dev/null
+++ b/config/deploy/docker.rb
@@ -0,0 +1,15 @@
1+set :sshkit_backend, SSHKit::Backend::Docker
2+set :stage, :development
3+set :branch, 'master'
4+set :deploy_to, '/var/local/app'
5+fetch(:default_env).merge!(rails_env: :production, SECRET_KEY_BASE: 'dummy', DEVISE_SECRET_KEY: 'dummy')
6+
7+fetch(:linked_dirs, []).clear
8+fetch(:linked_files, []).clear
9+
10+server docker: {
11+ image: 'nvc-base',
12+ commit: 'nvc',
13+}, user: 'rails:rails', roles: %w{web app}
14+
15+Rake::Task["passenger:restart"].clear
--- a/config/deploy/production.rb
+++ b/config/deploy/production.rb
@@ -3,9 +3,7 @@ role :app, 'nvc.nekoteki.jp'
33 role :db, 'nvc.nekoteki.jp', primary: true
44 set :user, 'nvc'
55 set :deploy_to, '/var/local/nvc/app'
6-set :use_sudo, false
76 set :branch, 'release'
8-set :git_shallow_clone, 1
97 after "deploy:finalize_update", :override_local_settings
108 task :override_local_settings do
119 run "cp -av #{release_path}/../../config/* #{release_path}/config/"