ruby-on-rails - Capistrano 部署的 Sprockets 语法错误
问题描述
我正在使用 Rails 5.2.2 和 ruby 2.3.1p112。我正在使用 capistrano 将我的 rails 应用程序部署到服务器。我有这些宝石。
gem "capistrano", "~> 3.10", require: false
gem "capistrano-rails", "~> 1.4", require: false
gem 'capistrano-rvm'
gem 'capistrano3-puma', github: "seuros/capistrano-puma"
gem 'capistrano-bundler', require: false
在部署期间,当 capistrano 执行时:
deploy:assets:backup_manifest
我收到以下错误:
Capistrano Log:
02:04 deploy:assets:backup_manifest
01 mkdir -p /home/developer/clapp/releases/20181207075748/assets_manifest_backup
01 /etc/profile.d/lang.sh: line 19: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
✔ 01 developer@142.93.105.197 1.537s
02 cp /etc/profile.d/lang.sh: line 19: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory /home/developer/clapp/releases/20181207075748…
02 /etc/profile.d/lang.sh: line 19: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
02 bash: -c: line 0: syntax error near unexpected token `('
02 bash: -c: line 0: `cd /home/developer/clapp/releases/20181207075748 && /usr/bin/env cp /etc/profile.d/lang.sh: line 19: warning: setlocale: LC_CTYPE: cannot change loca…
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as developer@142.93.105.197: cp exit status: 1
cp stdout: /etc/profile.d/lang.sh: line 19: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
bash: -c: line 0: syntax error near unexpected token `('
bash: -c: line 0: `cd /home/developer/clapp/releases/20181207075748 && /usr/bin/env cp /etc/profile.d/lang.sh: line 19: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory /home/developer/clapp/releases/20181207075748/public/assets/.sprockets-manifest-4b7cb236de58906a848ecfd6888fa29f.json /home/developer/clapp/releases/20181207075748/assets_manifest_backup'
cp stderr: Nothing written
Caused by:
SSHKit::Command::Failed: cp exit status: 1
cp stdout: /etc/profile.d/lang.sh: line 19: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
bash: -c: line 0: syntax error near unexpected token `('
bash: -c: line 0: `cd /home/developer/clapp/releases/20181207075748 && /usr/bin/env cp /etc/profile.d/lang.sh: line 19: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory /home/developer/clapp/releases/20181207075748/public/assets/.sprockets-manifest-4b7cb236de58906a848ecfd6888fa29f.json /home/developer/clapp/releases/20181207075748/assets_manifest_backup'
cp stderr: Nothing written
Tasks: TOP => deploy:assets:backup_manifest
(See full trace by running task with --trace)
The deploy has failed with an error: Exception while executing as developer@142.93.105.197: cp exit status: 1
cp stdout: /etc/profile.d/lang.sh: line 19: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
bash: -c: line 0: syntax error near unexpected token `('
bash: -c: line 0: `cd /home/developer/clapp/releases/20181207075748 && /usr/bin/env cp /etc/profile.d/lang.sh: line 19: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory /home/developer/clapp/releases/20181207075748/public/assets/.sprockets-manifest-4b7cb236de58906a848ecfd6888fa29f.json /home/developer/clapp/releases/20181207075748/assets_manifest_backup'
cp stderr: Nothing written
** DEPLOY FAILED
** Refer to log/capistrano.log for details. Here are the last 20 lines:
有人可以建议我需要进行哪些更改才能成功部署?
更新:
部署.rb
lock "~> 3.11.0"
set :application, "myapp"
set :repo_url, "git@bitbucket.org:selise07/myapp.git"
set :branch, 'feature/push'
set :deploy_to, '/home/developer/myapp'
set :pty, true
set :default_shell, '/bin/bash -l'
set :linked_files, %w[config/secrets.yml config/database.yml .env]
set :linked_dirs, %w[bin log tmp/pids tmp/cache tmp/sockets vendor/bundle
public/default public/files]
set :keep_releases, 5
set :rvm_type, :user # Defaults to: :auto
set :rvm_ruby_version, 'ruby-2.3.1' # Defaults to: 'default'
append :rbenv_map_bins, 'puma', 'pumactl'
set :puma_rackup, -> { File.join(current_path, 'config.ru') }
set :puma_state, "#{shared_path}/tmp/pids/puma.state"
set :puma_pid, "#{shared_path}/tmp/pids/puma.pid"
set :puma_bind, "unix://#{shared_path}/tmp/sockets/puma.sock" #accept array
for multi-bind
set :puma_conf, "#{shared_path}/puma.rb"
set :puma_access_log, "#{shared_path}/log/puma_error.log"
set :puma_error_log, "#{shared_path}/log/puma_access.log"
set :puma_role, :app
set :puma_env, fetch(:rack_env, fetch(:rails_env, 'production'))
set :puma_threads, [0, 8]
set :puma_workers, 0
set :puma_worker_timeout, nil
set :puma_init_active_record, true
set :puma_preload_app, false
namespace :deploy do
after :restart, :clear_cache do
on roles(:web), in: :groups, limit: 3, wait: 10 do
# Here we can do anything such as:
# within release_path do
# execute :rake, 'cache:clear'
# end
end
end
end
解决方案
推荐阅读
- android - 互联网关闭时如何获得警报对话框
- python - Pandas read_csv() 可以很好地解析日期,但不能按日期索引
- php - 雄辩的 Laravel 查询
- xamarin - Xamarin Forms Shell:动态删除 FlyoutFooter
- flutter - 如何修复通知程序包中的 inheritFromWidgetOfExactType 错误
- python - 将 csv 导入 pandas 数据框时可以使用哪种文件路径?
- sql-server - 在 SQL Server 2019 中没有事务的 sp_GetAppLock
- csv - 从 csv 文件读取 Hyperledger Fabric 智能合约以将数据加载到区块链中
- android - RecyclerView.Adapter getRef(position).getKey() 不工作
- asp.net-core - 我们可以像使用 asp.net app.config 一样使用 ASPNET_REGIIS 命令来加密 appsettings.json 的部分吗