- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 Capistrano 部署我的 Rails 应用程序,似乎 Assets 没有被编译,除非我 ssh 进入服务器并手动运行 RAILS_ENV=development bundle exec rake assets:precompile
。
我已尝试按照 the capistrano/rails github page 上的说明进行操作,但我不确定我是否遗漏了什么。
运行 cap production deploy
成功完成。但我不知道如何检查 assets:precompile
任务是否实际运行。运行 cap production deploy:assets:precompile
也成功完成,但服务器上没有明显变化。
版本
Server version: Apache/2.4.7 (Ubuntu)
Phusion Passenger 5.0.22
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux]
Rails 4.2.5
capistrano (3.1.0)
capistrano-bundler (1.1.4)
capistrano-rails (1.1.6)
capistrano-rbenv (2.0.4)
Capfile
require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/rbenv'
require 'capistrano/rails/assets'
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }
config/deploy.rb
set :application, "website"
set :repo_url, "git@bitbucket.org:company/website.git"
set :deploy_to, "/var/www/#{fetch(:application)}"
set :user, "webmaster"
set :rbenv_path, '/home/webmaster/.rbenv'
set :rbenv_ruby, '2.2.3'
set :assets_roles, [:web, :app]
set :keep_assets, 2
set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system', 'public/uploads')
set :linked_files, fetch(:linked_files, []).push('config/database.yml', 'config/secrets.yml')
config/deploy/production.rb
set :stage, :production
server 'company.com', user: 'webmaster', roles: %{web app db}
关于 Assets 未编译的任何想法?
[更新]
部署输出
/home/alistair/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/capistrano-3.1.0/lib/capistrano/i18n.rb:4: warning: duplicated key at line 6 ignored: :starting
DEBUG [1f337009] Running /usr/bin/env [ -d /home/webmaster/.rbenv/versions/2.2.3 ] as webmaster@company.com
DEBUG [1f337009] Command: [ -d /home/webmaster/.rbenv/versions/2.2.3 ]
DEBUG [1f337009] Finished in 1.359 seconds with exit status 0 (successful).
INFO [90810a3d] Running /usr/bin/env mkdir -p /tmp/website/ as webmaster@company.com
DEBUG [90810a3d] Command: ( export RBENV_ROOT="/home/webmaster/.rbenv" RBENV_VERSION="2.2.3" ; /usr/bin/env mkdir -p /tmp/website/ )
INFO [90810a3d] Finished in 0.098 seconds with exit status 0 (successful).
DEBUG Uploading /tmp/website/git-ssh.sh 0.0%
INFO Uploading /tmp/website/git-ssh.sh 100.0%
INFO [056c0cd0] Running /usr/bin/env chmod +x /tmp/website/git-ssh.sh as webmaster@company.com
DEBUG [056c0cd0] Command: ( export RBENV_ROOT="/home/webmaster/.rbenv" RBENV_VERSION="2.2.3" ; /usr/bin/env chmod +x /tmp/website/git-ssh.sh )
INFO [056c0cd0] Finished in 0.095 seconds with exit status 0 (successful).
DEBUG [bc777b81] Running /usr/bin/env git ls-remote git@bitbucket.org:company/website.git as webmaster@company.com
DEBUG [bc777b81] Command: ( export RBENV_ROOT="/home/webmaster/.rbenv" RBENV_VERSION="2.2.3" GIT_ASKPASS="/bin/echo" GIT_SSH="/tmp/website/git-ssh.sh" ; /usr/bin/env git ls-remote git@bitbucket.org:company/website.git )
DEBUG [bc777b81] 41758f51b425b0c7a57124dfeb623a1c16793f40 HEAD
41758f51b425b0c7a57124dfeb623a1c16793f40 refs/heads/master
DEBUG [bc777b81] Finished in 3.636 seconds with exit status 0 (successful).
INFO [b47c738d] Running /usr/bin/env mkdir -pv /var/www/website/shared /var/www/website/releases as webmaster@company.com
DEBUG [b47c738d] Command: ( export RBENV_ROOT="/home/webmaster/.rbenv" RBENV_VERSION="2.2.3" ; /usr/bin/env mkdir -pv /var/www/website/shared /var/www/website/releases )
INFO [b47c738d] Finished in 0.095 seconds with exit status 0 (successful).
INFO [5e356ddf] Running /usr/bin/env mkdir -pv /var/www/website/shared/log /var/www/website/shared/tmp/pids /var/www/website/shared/tmp/cache /var/www/website/shared/tmp/sockets /var/www/website/shared/vendor/bundle /var/www/website/shared/public/system /var/www/website/shared/public/uploads /var/www/website/shared/public/assets as webmaster@company.com
DEBUG [5e356ddf] Command: ( export RBENV_ROOT="/home/webmaster/.rbenv" RBENV_VERSION="2.2.3" ; /usr/bin/env mkdir -pv /var/www/website/shared/log /var/www/website/shared/tmp/pids /var/www/website/shared/tmp/cache /var/www/website/shared/tmp/sockets /var/www/website/shared/vendor/bundle /var/www/website/shared/public/system /var/www/website/shared/public/uploads /var/www/website/shared/public/assets )
INFO [5e356ddf] Finished in 0.099 seconds with exit status 0 (successful).
INFO [ea415b4a] Running /usr/bin/env mkdir -pv /var/www/website/shared/config /var/www/website/shared/config as webmaster@company.com
DEBUG [ea415b4a] Command: ( export RBENV_ROOT="/home/webmaster/.rbenv" RBENV_VERSION="2.2.3" ; /usr/bin/env mkdir -pv /var/www/website/shared/config /var/www/website/shared/config )
INFO [ea415b4a] Finished in 0.098 seconds with exit status 0 (successful).
DEBUG [6e429c96] Running /usr/bin/env [ -f /var/www/website/shared/config/database.yml ] as webmaster@company.com
DEBUG [6e429c96] Command: [ -f /var/www/website/shared/config/database.yml ]
DEBUG [6e429c96] Finished in 0.097 seconds with exit status 0 (successful).
DEBUG [12f009aa] Running /usr/bin/env [ -f /var/www/website/shared/config/secrets.yml ] as webmaster@company.com
DEBUG [12f009aa] Command: [ -f /var/www/website/shared/config/secrets.yml ]
DEBUG [12f009aa] Finished in 0.101 seconds with exit status 0 (successful).
DEBUG [037f2152] Running /usr/bin/env [ -f /var/www/website/repo/HEAD ] as webmaster@company.com
DEBUG [037f2152] Command: [ -f /var/www/website/repo/HEAD ]
DEBUG [037f2152] Finished in 0.098 seconds with exit status 0 (successful).
INFO The repository mirror is at /var/www/website/repo
DEBUG [8761724b] Running /usr/bin/env if test ! -d /var/www/website/repo; then echo "Directory does not exist '/var/www/website/repo'" 1>&2; false; fi as webmaster@company.com
DEBUG [8761724b] Command: if test ! -d /var/www/website/repo; then echo "Directory does not exist '/var/www/website/repo'" 1>&2; false; fi
DEBUG [8761724b] Finished in 0.097 seconds with exit status 0 (successful).
DEBUG [a9f39ba9] Running /usr/bin/env cd /var/www/website/repo && git rev-parse --short HEAD as webmaster@company.com
DEBUG [a9f39ba9] Command: cd /var/www/website/repo && git rev-parse --short HEAD
DEBUG [a9f39ba9] 41758f5
DEBUG [a9f39ba9] Finished in 0.100 seconds with exit status 0 (successful).
INFO [8a7bf4c0] Running /usr/bin/env git remote update as webmaster@company.com
DEBUG [8a7bf4c0] Command: cd /var/www/website/repo && ( export RBENV_ROOT="/home/webmaster/.rbenv" RBENV_VERSION="2.2.3" ; /usr/bin/env git remote update )
DEBUG [8a7bf4c0] Fetching origin
INFO [8a7bf4c0] Finished in 4.692 seconds with exit status 0 (successful).
DEBUG [894b0375] Running /usr/bin/env cd /var/www/website/repo && git rev-parse --short HEAD as webmaster@company.com
DEBUG [894b0375] Command: cd /var/www/website/repo && git rev-parse --short HEAD
DEBUG [894b0375] 41758f5
DEBUG [894b0375] Finished in 0.101 seconds with exit status 0 (successful).
DEBUG [78f3e509] Running /usr/bin/env if test ! -d /var/www/website/repo; then echo "Directory does not exist '/var/www/website/repo'" 1>&2; false; fi as webmaster@company.com
DEBUG [78f3e509] Command: if test ! -d /var/www/website/repo; then echo "Directory does not exist '/var/www/website/repo'" 1>&2; false; fi
DEBUG [78f3e509] Finished in 0.095 seconds with exit status 0 (successful).
INFO [8a07a0a1] Running /usr/bin/env mkdir -p /var/www/website/releases/20160301105814 as webmaster@company.com
DEBUG [8a07a0a1] Command: cd /var/www/website/repo && ( export RBENV_ROOT="/home/webmaster/.rbenv" RBENV_VERSION="2.2.3" GIT_ASKPASS="/bin/echo" GIT_SSH="/tmp/website/git-ssh.sh" ; /usr/bin/env mkdir -p /var/www/website/releases/20160301105814 )
INFO [8a07a0a1] Finished in 0.095 seconds with exit status 0 (successful).
INFO [344742a3] Running /usr/bin/env git archive master | tar -x -C /var/www/website/releases/20160301105814 as webmaster@company.com
DEBUG [344742a3] Command: cd /var/www/website/repo && ( export RBENV_ROOT="/home/webmaster/.rbenv" RBENV_VERSION="2.2.3" GIT_ASKPASS="/bin/echo" GIT_SSH="/tmp/website/git-ssh.sh" ; /usr/bin/env git archive master | tar -x -C /var/www/website/releases/20160301105814 )
INFO [344742a3] Finished in 0.102 seconds with exit status 0 (successful).
INFO [6018eedd] Running /usr/bin/env mkdir -pv /var/www/website/releases/20160301105814/config /var/www/website/releases/20160301105814/config as webmaster@company.com
DEBUG [6018eedd] Command: ( export RBENV_ROOT="/home/webmaster/.rbenv" RBENV_VERSION="2.2.3" ; /usr/bin/env mkdir -pv /var/www/website/releases/20160301105814/config /var/www/website/releases/20160301105814/config )
INFO [6018eedd] Finished in 0.090 seconds with exit status 0 (successful).
DEBUG [ae6b6fb8] Running /usr/bin/env [ -L /var/www/website/releases/20160301105814/config/database.yml ] as webmaster@company.com
DEBUG [ae6b6fb8] Command: [ -L /var/www/website/releases/20160301105814/config/database.yml ]
DEBUG [ae6b6fb8] Finished in 0.088 seconds with exit status 1 (failed).
DEBUG [f9d7b6d6] Running /usr/bin/env [ -f /var/www/website/releases/20160301105814/config/database.yml ] as webmaster@company.com
DEBUG [f9d7b6d6] Command: [ -f /var/www/website/releases/20160301105814/config/database.yml ]
DEBUG [f9d7b6d6] Finished in 0.088 seconds with exit status 1 (failed).
INFO [07890c6f] Running /usr/bin/env ln -s /var/www/website/shared/config/database.yml /var/www/website/releases/20160301105814/config/database.yml as webmaster@company.com
DEBUG [07890c6f] Command: ( export RBENV_ROOT="/home/webmaster/.rbenv" RBENV_VERSION="2.2.3" ; /usr/bin/env ln -s /var/www/website/shared/config/database.yml /var/www/website/releases/20160301105814/config/database.yml )
INFO [07890c6f] Finished in 0.095 seconds with exit status 0 (successful).
DEBUG [4740cfae] Running /usr/bin/env [ -L /var/www/website/releases/20160301105814/config/secrets.yml ] as webmaster@company.com
DEBUG [4740cfae] Command: [ -L /var/www/website/releases/20160301105814/config/secrets.yml ]
DEBUG [4740cfae] Finished in 0.100 seconds with exit status 1 (failed).
DEBUG [6de85d60] Running /usr/bin/env [ -f /var/www/website/releases/20160301105814/config/secrets.yml ] as webmaster@company.com
DEBUG [6de85d60] Command: [ -f /var/www/website/releases/20160301105814/config/secrets.yml ]
DEBUG [6de85d60] Finished in 0.092 seconds with exit status 1 (failed).
INFO [1fceb704] Running /usr/bin/env ln -s /var/www/website/shared/config/secrets.yml /var/www/website/releases/20160301105814/config/secrets.yml as webmaster@company.com
DEBUG [1fceb704] Command: ( export RBENV_ROOT="/home/webmaster/.rbenv" RBENV_VERSION="2.2.3" ; /usr/bin/env ln -s /var/www/website/shared/config/secrets.yml /var/www/website/releases/20160301105814/config/secrets.yml )
INFO [1fceb704] Finished in 0.092 seconds with exit status 0 (successful).
INFO [8184d994] Running /usr/bin/env mkdir -pv /var/www/website/releases/20160301105814 /var/www/website/releases/20160301105814/tmp /var/www/website/releases/20160301105814/tmp /var/www/website/releases/20160301105814/tmp /var/www/website/releases/20160301105814/vendor /var/www/website/releases/20160301105814/public /var/www/website/releases/20160301105814/public /var/www/website/releases/20160301105814/public as webmaster@company.com
DEBUG [8184d994] Command: ( export RBENV_ROOT="/home/webmaster/.rbenv" RBENV_VERSION="2.2.3" ; /usr/bin/env mkdir -pv /var/www/website/releases/20160301105814 /var/www/website/releases/20160301105814/tmp /var/www/website/releases/20160301105814/tmp /var/www/website/releases/20160301105814/tmp /var/www/website/releases/20160301105814/vendor /var/www/website/releases/20160301105814/public /var/www/website/releases/20160301105814/public /var/www/website/releases/20160301105814/public )
DEBUG [8184d994] mkdir: created directory ‘/var/www/website/releases/20160301105814/tmp’
INFO [8184d994] Finished in 0.090 seconds with exit status 0 (successful).
DEBUG [b723a723] Running /usr/bin/env [ -L /var/www/website/releases/20160301105814/log ] as webmaster@company.com
DEBUG [b723a723] Command: [ -L /var/www/website/releases/20160301105814/log ]
DEBUG [b723a723] Finished in 0.086 seconds with exit status 1 (failed).
DEBUG [3443bee9] Running /usr/bin/env [ -d /var/www/website/releases/20160301105814/log ] as webmaster@company.com
DEBUG [3443bee9] Command: [ -d /var/www/website/releases/20160301105814/log ]
DEBUG [3443bee9] Finished in 0.084 seconds with exit status 1 (failed).
INFO [864f0e99] Running /usr/bin/env ln -s /var/www/website/shared/log /var/www/website/releases/20160301105814/log as webmaster@company.com
DEBUG [864f0e99] Command: ( export RBENV_ROOT="/home/webmaster/.rbenv" RBENV_VERSION="2.2.3" ; /usr/bin/env ln -s /var/www/website/shared/log /var/www/website/releases/20160301105814/log )
INFO [864f0e99] Finished in 0.089 seconds with exit status 0 (successful).
DEBUG [790e1b77] Running /usr/bin/env [ -L /var/www/website/releases/20160301105814/tmp/pids ] as webmaster@company.com
DEBUG [790e1b77] Command: [ -L /var/www/website/releases/20160301105814/tmp/pids ]
DEBUG [790e1b77] Finished in 0.091 seconds with exit status 1 (failed).
DEBUG [7ff98979] Running /usr/bin/env [ -d /var/www/website/releases/20160301105814/tmp/pids ] as webmaster@company.com
DEBUG [7ff98979] Command: [ -d /var/www/website/releases/20160301105814/tmp/pids ]
DEBUG [7ff98979] Finished in 0.092 seconds with exit status 1 (failed).
INFO [bcacf055] Running /usr/bin/env ln -s /var/www/website/shared/tmp/pids /var/www/website/releases/20160301105814/tmp/pids as webmaster@company.com
DEBUG [bcacf055] Command: ( export RBENV_ROOT="/home/webmaster/.rbenv" RBENV_VERSION="2.2.3" ; /usr/bin/env ln -s /var/www/website/shared/tmp/pids /var/www/website/releases/20160301105814/tmp/pids )
INFO [bcacf055] Finished in 0.096 seconds with exit status 0 (successful).
DEBUG [84ce523e] Running /usr/bin/env [ -L /var/www/website/releases/20160301105814/tmp/cache ] as webmaster@company.com
DEBUG [84ce523e] Command: [ -L /var/www/website/releases/20160301105814/tmp/cache ]
DEBUG [84ce523e] Finished in 0.337 seconds with exit status 1 (failed).
DEBUG [e6cf3b8d] Running /usr/bin/env [ -d /var/www/website/releases/20160301105814/tmp/cache ] as webmaster@company.com
DEBUG [e6cf3b8d] Command: [ -d /var/www/website/releases/20160301105814/tmp/cache ]
DEBUG [e6cf3b8d] Finished in 0.092 seconds with exit status 1 (failed).
INFO [087875ef] Running /usr/bin/env ln -s /var/www/website/shared/tmp/cache /var/www/website/releases/20160301105814/tmp/cache as webmaster@company.com
DEBUG [087875ef] Command: ( export RBENV_ROOT="/home/webmaster/.rbenv" RBENV_VERSION="2.2.3" ; /usr/bin/env ln -s /var/www/website/shared/tmp/cache /var/www/website/releases/20160301105814/tmp/cache )
INFO [087875ef] Finished in 0.102 seconds with exit status 0 (successful).
DEBUG [a25556fa] Running /usr/bin/env [ -L /var/www/website/releases/20160301105814/tmp/sockets ] as webmaster@company.com
DEBUG [a25556fa] Command: [ -L /var/www/website/releases/20160301105814/tmp/sockets ]
DEBUG [a25556fa] Finished in 0.100 seconds with exit status 1 (failed).
DEBUG [b8f01ed0] Running /usr/bin/env [ -d /var/www/website/releases/20160301105814/tmp/sockets ] as webmaster@company.com
DEBUG [b8f01ed0] Command: [ -d /var/www/website/releases/20160301105814/tmp/sockets ]
DEBUG [b8f01ed0] Finished in 0.093 seconds with exit status 1 (failed).
INFO [19a28b67] Running /usr/bin/env ln -s /var/www/website/shared/tmp/sockets /var/www/website/releases/20160301105814/tmp/sockets as webmaster@company.com
DEBUG [19a28b67] Command: ( export RBENV_ROOT="/home/webmaster/.rbenv" RBENV_VERSION="2.2.3" ; /usr/bin/env ln -s /var/www/website/shared/tmp/sockets /var/www/website/releases/20160301105814/tmp/sockets )
INFO [19a28b67] Finished in 0.095 seconds with exit status 0 (successful).
DEBUG [06a1d8ca] Running /usr/bin/env [ -L /var/www/website/releases/20160301105814/vendor/bundle ] as webmaster@company.com
DEBUG [06a1d8ca] Command: [ -L /var/www/website/releases/20160301105814/vendor/bundle ]
DEBUG [06a1d8ca] Finished in 0.089 seconds with exit status 1 (failed).
DEBUG [dec00a8c] Running /usr/bin/env [ -d /var/www/website/releases/20160301105814/vendor/bundle ] as webmaster@company.com
DEBUG [dec00a8c] Command: [ -d /var/www/website/releases/20160301105814/vendor/bundle ]
DEBUG [dec00a8c] Finished in 0.083 seconds with exit status 1 (failed).
INFO [3627ac6b] Running /usr/bin/env ln -s /var/www/website/shared/vendor/bundle /var/www/website/releases/20160301105814/vendor/bundle as webmaster@company.com
DEBUG [3627ac6b] Command: ( export RBENV_ROOT="/home/webmaster/.rbenv" RBENV_VERSION="2.2.3" ; /usr/bin/env ln -s /var/www/website/shared/vendor/bundle /var/www/website/releases/20160301105814/vendor/bundle )
INFO [3627ac6b] Finished in 0.092 seconds with exit status 0 (successful).
DEBUG [146317e0] Running /usr/bin/env [ -L /var/www/website/releases/20160301105814/public/system ] as webmaster@company.com
DEBUG [146317e0] Command: [ -L /var/www/website/releases/20160301105814/public/system ]
DEBUG [146317e0] Finished in 0.087 seconds with exit status 1 (failed).
DEBUG [cb7118ee] Running /usr/bin/env [ -d /var/www/website/releases/20160301105814/public/system ] as webmaster@company.com
DEBUG [cb7118ee] Command: [ -d /var/www/website/releases/20160301105814/public/system ]
DEBUG [cb7118ee] Finished in 0.091 seconds with exit status 1 (failed).
INFO [aae2f5d3] Running /usr/bin/env ln -s /var/www/website/shared/public/system /var/www/website/releases/20160301105814/public/system as webmaster@company.com
DEBUG [aae2f5d3] Command: ( export RBENV_ROOT="/home/webmaster/.rbenv" RBENV_VERSION="2.2.3" ; /usr/bin/env ln -s /var/www/website/shared/public/system /var/www/website/releases/20160301105814/public/system )
INFO [aae2f5d3] Finished in 0.100 seconds with exit status 0 (successful).
DEBUG [08a0fb87] Running /usr/bin/env [ -L /var/www/website/releases/20160301105814/public/uploads ] as webmaster@company.com
DEBUG [08a0fb87] Command: [ -L /var/www/website/releases/20160301105814/public/uploads ]
DEBUG [08a0fb87] Finished in 0.095 seconds with exit status 1 (failed).
DEBUG [3e78a336] Running /usr/bin/env [ -d /var/www/website/releases/20160301105814/public/uploads ] as webmaster@company.com
DEBUG [3e78a336] Command: [ -d /var/www/website/releases/20160301105814/public/uploads ]
DEBUG [3e78a336] Finished in 0.094 seconds with exit status 1 (failed).
INFO [02f078fa] Running /usr/bin/env ln -s /var/www/website/shared/public/uploads /var/www/website/releases/20160301105814/public/uploads as webmaster@company.com
DEBUG [02f078fa] Command: ( export RBENV_ROOT="/home/webmaster/.rbenv" RBENV_VERSION="2.2.3" ; /usr/bin/env ln -s /var/www/website/shared/public/uploads /var/www/website/releases/20160301105814/public/uploads )
INFO [02f078fa] Finished in 0.093 seconds with exit status 0 (successful).
DEBUG [7c8f085e] Running /usr/bin/env [ -L /var/www/website/releases/20160301105814/public/assets ] as webmaster@company.com
DEBUG [7c8f085e] Command: [ -L /var/www/website/releases/20160301105814/public/assets ]
DEBUG [7c8f085e] Finished in 0.092 seconds with exit status 1 (failed).
DEBUG [dfe9ba24] Running /usr/bin/env [ -d /var/www/website/releases/20160301105814/public/assets ] as webmaster@company.com
DEBUG [dfe9ba24] Command: [ -d /var/www/website/releases/20160301105814/public/assets ]
DEBUG [dfe9ba24] Finished in 0.095 seconds with exit status 1 (failed).
INFO [6e122bb3] Running /usr/bin/env ln -s /var/www/website/shared/public/assets /var/www/website/releases/20160301105814/public/assets as webmaster@company.com
DEBUG [6e122bb3] Command: ( export RBENV_ROOT="/home/webmaster/.rbenv" RBENV_VERSION="2.2.3" ; /usr/bin/env ln -s /var/www/website/shared/public/assets /var/www/website/releases/20160301105814/public/assets )
INFO [6e122bb3] Finished in 0.100 seconds with exit status 0 (successful).
INFO [d6298e38] Running /usr/bin/env rm -rf /var/www/website/current as webmaster@company.com
DEBUG [d6298e38] Command: ( export RBENV_ROOT="/home/webmaster/.rbenv" RBENV_VERSION="2.2.3" ; /usr/bin/env rm -rf /var/www/website/current )
INFO [d6298e38] Finished in 0.098 seconds with exit status 0 (successful).
INFO [e02c789e] Running /usr/bin/env ln -s /var/www/website/releases/20160301105814 /var/www/website/current as webmaster@company.com
DEBUG [e02c789e] Command: ( export RBENV_ROOT="/home/webmaster/.rbenv" RBENV_VERSION="2.2.3" ; /usr/bin/env ln -s /var/www/website/releases/20160301105814 /var/www/website/current )
INFO [e02c789e] Finished in 0.098 seconds with exit status 0 (successful).
DEBUG [eaafdb77] Running /usr/bin/env ls -x /var/www/website/releases as webmaster@company.com
DEBUG [eaafdb77] Command: ( export RBENV_ROOT="/home/webmaster/.rbenv" RBENV_VERSION="2.2.3" ; /usr/bin/env ls -x /var/www/website/releases )
DEBUG [eaafdb77] 20160301072751 20160301075427 20160301075935 20160301080340 20160301082251
20160301105814
DEBUG [eaafdb77] Finished in 0.099 seconds with exit status 0 (successful).
INFO Keeping 5 of 6 deployed releases on company.com
INFO [d4b13204] Running /usr/bin/env rm -rf /var/www/website/releases/20160301072751 as webmaster@company.com
DEBUG [d4b13204] Command: ( export RBENV_ROOT="/home/webmaster/.rbenv" RBENV_VERSION="2.2.3" ; /usr/bin/env rm -rf /var/www/website/releases/20160301072751 )
INFO [d4b13204] Finished in 0.123 seconds with exit status 0 (successful).
DEBUG [08ec3d12] Running /usr/bin/env if test ! -d /var/www/website/releases; then echo "Directory does not exist '/var/www/website/releases'" 1>&2; false; fi as webmaster@company.com
DEBUG [08ec3d12] Command: if test ! -d /var/www/website/releases; then echo "Directory does not exist '/var/www/website/releases'" 1>&2; false; fi
DEBUG [08ec3d12] Finished in 0.095 seconds with exit status 0 (successful).
INFO [18eda59c] Running /usr/bin/env echo "Branch master (at 41758f5) deployed as release 20160301105814 by alistair; " >> /var/www/website/revisions.log as webmaster@company.com
DEBUG [18eda59c] Command: echo "Branch master (at 41758f5) deployed as release 20160301105814 by alistair; " >> /var/www/website/revisions.log
INFO [18eda59c] Finished in 0.096 seconds with exit status 0 (successful).
[工作解决方案]
gem 文件
group :development do
gem 'capistrano', '~> 3.1.0'
gem 'capistrano-bundler', '~> 1.1.2'
gem 'capistrano-rails', '~> 1.1.1'
gem 'capistrano-rbenv', '~> 2.0.4'
end
Capfile
require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/rbenv'
require 'capistrano/rails' # Same as requiring capistrano/bundler, capistrano/rails/assets and capistrano/rails/migrations
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }
config/deploy.rb
set :application, "website"
set :repo_url, "git@bitbucket.org:company/website.git"
set :deploy_to, "/var/www2/#{fetch(:application)}"
set :user, "webmaster"
set :rbenv_path, '/home/webmaster/.rbenv'
set :rbenv_ruby, '2.2.3'
set :assets_roles, [:web, :app]
set :keep_assets, 2
set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system', 'public/uploads')
set :linked_files, fetch(:linked_files, []).push('config/database.yml', 'config/secrets.yml')
namespace :deploy do
desc "Restart application"
task :restart do
on roles(:app), in: :sequence, wait: 5 do
execute :touch, release_path.join("tmp/restart.txt")
end
end
after "deploy:publishing", "deploy:restart"
end
config/deploy/production.rb
确保使用 %w{}
set :stage, :production
server 'company.com', user: 'webmaster', roles: %w{web app db}
部署输出
如果成功,您应该会在输出中看到与此类似的内容:
INFO [2412d16d] Running /home/webmaster/.rbenv/bin/rbenv exec bundle exec rake assets:precompile as webmaster@company.com
DEBUG [2412d16d] Command: cd /var/www/website/releases/20160302030846 && ( export RBENV_ROOT="/home/webmaster/.rbenv" RBENV_VERSION="2.2.3" RAILS_ENV="production" ; /home/webmaster/.rbenv/bin/rbenv exec bundle exec rake assets:precompile )
最佳答案
由于一个非常微妙的拼写错误,您没有正确地为您的服务器分配角色:
server 'company.com', user: 'webmaster', roles: %{web app db}
应该是:
server 'company.com', user: 'webmaster', roles: %w{web app db}
在 Ruby 中,%{}
与双引号字符串相同,而 %w{}
是字符串数组。您需要后者,以便您的服务器具有三个角色,web
、app
和 db
,而不是一个名为 web 的角色应用数据库
。
关于ruby-on-rails - Capistrano 部署后 Rails Assets 未编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35718268/
sanitize 是什么意思在 Rails 中是什么意思? 我正在阅读 CanCanCan 的文档.它说: When using strong_parameters or Rails 4+, you
在过去的几个月里,我感觉自己对 Ruby on Rails (RoR) 开发的了解达到了极限。我为大/小客户和 friend /爱好项目开发了大大小小的应用程序。我知道如何开发这些应用程序,但开始感觉
我昨天参加了一个关于扩展 Rails 的聚会,其中一个主题是 Hexagonal Rails。然而,我只做了一年的 Rails,对 MVC 结构非常满意(也许太舒服了),所以我不太了解适配器和消息队列
我使用多个 Rails 应用程序,一些在 Rails 3.2/Ruby 2.0 上,一些在 Rails 2.3/Ruby 1.8.7 上。 他们的共同点是,随着他们的成长和添加更多的依赖项/ gem
这个问题在这里已经有了答案: Using Rails-UJS in JS modules (Rails 6 with webpacker) (5 个答案) 关闭 3 年前。 我正在尝试使用 UJS
我正在开发一个当前使用 Rails 1.2 的 Rails 应用程序,所以我现在离最新的稳定版本(Rails 2.3)还有很长的路要走。 我应该如何进行迁移到更新版本的 Rails 的过程? 我应该一
尝试按照 Ryan Bates Backbone.js 教程构建抽奖应用程序,但我已经遇到了第一段代码的问题。在 application.js 的 init 函数中,他初始化了 Raffler 路由的
我正在使用 Rails 3.2 并且我有一个数据库表,我想在其中找到符合以下条件的所有行: a = true and b = true and ( 0 true, :b =>
我有一个用户类和一个联系人,其中联系人是用户的子类。这两个类都存储在用户表中。 我的联系人可能有也可能没有电子邮件地址,而我的用户需要一个电子邮件地址(我的用户模型定义中有 validates_pre
我正在编写一个教程,我在其中演示了一些 rails 命令。在我的机器上 rails和 script/rails两者都同样有效。有“首选”形式吗?两者中哪一个更普遍? 最佳答案 当您运行 rails 时
我正在寻找有关通过我的应用程序前进的最佳方式的建议,这是我首次开始集成Elasticsearch。我是一名初学者,但是热衷于深入研究,以便原谅任何明显的错误! 我遵循了http://www.sitep
我刚刚用 Rails new 启动了一个新的 Rails 应用程序,将默认数据库设置更改为 PostgresSQL。我用 bin/rails s 启动服务器,结果很奇怪 2016-04-21 05:0
我收到一个参数并希望它是这样的字符串: "abc,efg" 或者像这样的数组 ["abc","efg"] 在第一种情况下,我想将它转换成一个数组,什么是好的方法? 这是我的想法 if params[:
我刚刚用 Rails new 启动了一个新的 Rails 应用程序,将默认数据库设置更改为 PostgresSQL。我用 bin/rails s 启动服务器,结果很奇怪 2016-04-21 05:0
我收到一个参数并希望它是这样的字符串: "abc,efg" 或者像这样的数组 ["abc","efg"] 在第一种情况下,我想将它转换成一个数组,什么是好的方法? 这是我的想法 if params[:
我有 Rails 4,这是我的默认版本(我仍然希望它是)。但我不想在我的电脑上添加 rails 3.2。在以下命令中:gem install rails -v 3.2.16 我有这个警告: railt
您好,我想使用 Sheevaplug 构建一个“Rails Brick”来自 Marvell(操作系统是开箱即用的 Ubuntu,但您可以在其上安装其他发行版)。它将成为家庭服务器和静音、低成本(99
我需要能够从 Rails 控制台发送我的 Rails 应用程序的 Postgres 数据库中所有未接受的邀请。 (我有一个名为 Invitations 的表,其中包含一个名为 accepted 的 b
validate :cannot_modify_if_locked, on: :update def cannot_modify_if_locked if self.locked erro
我正在学习教程(学习 Rails 播客),需要更改以下路由语法,以便它与 Rails 3.0 兼容。谁能帮忙? map.view_page ':name', :controller => 'viewe
我是一名优秀的程序员,十分优秀!