[英]Facing this Error after running this command RAILS_ENV=production bin/rails assets:precompile
[英]Running RAILS_ENV=production with the system command
我在服務器上運行的腳本有一個非常奇怪的問題,詳細信息如下。 但是本質上,我使用腳本來設置Rails應用程序,並且從現有的Rails應用程序中調用該腳本。
在我現有的應用程序(正在服務器上調用腳本的應用程序)中,我具有:-
Spawnling.new do
system "cd ~/ && ~/*/create_site.sh param1 param2 >> /tmp/logger"
end
create_site.sh腳本使用以下命令創建全新的rails安裝:
rails new $DIR --database postgresql
然后,它做了很多事情來設置應用程序。 問題在於,在進入以下命令之前,腳本似乎可以正常運行:
cd $DIR && RAILS_ENV=production rails g roroacms:install -v && RAILS_ENV=production rake assets:clean && RAILS_ENV=production rake assets:precompile
這真的很奇怪,因為當我以root用戶身份手動運行top命令時,它似乎完全可以正常運行而沒有任何問題。 當我在top命令末尾查看記錄器文件時,它看起來如下所示:
Your bundle is updated!
Bundle is installed and up to date
RoroaCMS installation
Installation complete with assets
Server started
當我手動運行此命令時,它將在運行命令的每行之間輸出許多消息。 有什么想法嗎? 我認為這可能與RAILS_ENV有關,因為rails new命令在腳本中的早期運行良好。
嗨,我在服務器上做了很多腳本編寫的腳本,並且我總是使用格式bundle exec rails g rspec:install production
所以您的命令將是cd $DIR && bundle exec rails g roroacms:install -v production && bundle exec rake assets:clean production && bundle exec rake assets:precompile production
。 我背后沒有很多理由,但是這種格式似乎在不同服務器環境中最可靠。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.