錯誤的問題:(仍未解決)


 部署出現❌:

 

 

 

terminal輸入:

ssh root@xx.xx.xx.xx進入root目錄

root@iZ8vb9z1vsb31g6zoqqt0bZ:~# pwd
/root

但這“/”才是真正的根目錄。 

/var/log/nginx/error.log這是告訴我var目錄是在“/”目錄下的.

所以:

root@iZ8vb9z1vsb31g6zoqqt0bZ:~# cd /
root@iZ8vb9z1vsb31g6zoqqt0bZ:/# ls
bin   etc         initrd.img.old  lost+found  opt   run   sys  var
boot  home        lib             media       proc  sbin  tmp  vmlinuz
dev   initrd.img  lib64           mnt         root  srv   usr  vmlinuz.old

 


 

忘記配置:

 

執行 cap install,這會新增一些配置檔案。

編輯 Capfile

Capfile

   require "capistrano/scm/git"
   install_plugin Capistrano::SCM::Git

+  require 'capistrano/rails'
+ require 'capistrano/passenger'

 

 

再試出現新的❌!

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

。。。略。。

An error occurred while installing sassc (1.12.1), and Bundler cannot continue.
Make sure that `gem install sassc -v '1.12.1' --source
'https://gems.ruby-china.com/'` succeeds before bundling.

In Gemfile:
  font-awesome-sass was resolved to 5.2.0, which depends on
    sassc
bundle stderr: Nothing written


** DEPLOY FAILED
** Refer to log/capistrano.log for details. Here are the last 20 lines:


`block (2 levels) in <top (required)>'

/home/deploy/Trello/shared/bundle/ruby/2.5.0/gems/rake-12.3.1/exe/rake:27:in

`<main>'

Tasks: TOP => lib/libsass.so

(See full trace by running task with --trace)



rake failed, exit code 1



Gem files will remain installed in

/home/deploy/Trello/shared/bundle/ruby/2.5.0/gems/sassc-1.12.1 for inspection.

Results logged to

/home/deploy/Trello/shared/bundle/ruby/2.5.0/extensions/x86_64-linux/2.5.0/sassc-1.12.1/gem_make.out



An error occurred while installing sassc (1.12.1), and Bundler cannot continue.

Make sure that `gem install sassc -v '1.12.1' --source

'https://gems.ruby-china.com/'` succeeds before bundling.



In Gemfile:

  font-awesome-sass was resolved to 5.2.0, which depends on

    sassc

 

 

無法確認問題的出處,准備重裝。

 


 

 

避開程序,

  • 換一個簡單的程序。

拖拉的網頁:先使用Heroku試一下。是否正常上線

 


 

 

新問題:

輸入:cap production deploy

00:16 deploy:assets:precompile
      01 bundle exec rake assets:precompile
      01 Yarn executable was not detected in the system.
      01 Download Yarn at https://yarnpkg.com/en/docs/install
      01 I, [2018-10-29T19:59:49.506978 #22896]  INFO -- : Writing /home/deploy/vue-todolist/release…
      01 I, [2018-10-29T19:59:49.507644 #22896]  INFO -- : Writing /home/deploy/vue-todolist/release…
      01 I, [2018-10-29T19:59:49.539748 #22896]  INFO -- : Writing /home/deploy/vue-todolist/release…
      01 I, [2018-10-29T19:59:49.540210 #22896]  INFO -- : Writing /home/deploy/vue-todolist/release…
      01 sh: 1:
      01 node: not found
      01
      01 Webpacker requires Node.js >= 6.0.0 and you are using 4.2.6
      01 Please upgrade Node.js https://nodejs.org/en/download/

 

我的app,安裝了yarn, 但是服務器沒有安裝yarn;

sudo apt-get update && sudo apt-get install yarn

 

參考:

https://github.com/yarnpkg/yarn/issues/2821

 

安裝nodejs

官網 ,選擇Ubuntu連接進入git

Node.js v10.x:

# Using Ubuntu
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install -y nodejs

 

參考:

https://blog.csdn.net/well2049/article/details/79138045

 


 

 

上一個問題通過:又遇到新的問題:

00:12 deploy:assets:precompile
      01 bundle exec rake assets:precompile
      01 yarn install v1.10.1
      01 [1/4] Resolving packages...
      01 [2/4] Fetching packages...
      01 info fsevents@1.2.4: The platform "linux" is incompatible with this module. 01 info "fsevents@1.2.4" is an optional dependency and failed compatibility check. Excluding i… 01 [3/4] Linking dependencies... 01 warning "@rails/webpacker > postcss-cssnext@3.1.0" has unmet peer dependency "caniuse-lite@…
      01 warning " > vue-loader@14.2.2" has unmet peer dependency "css-loader@*". 01 warning " > webpack-dev-server@2.11.2" has unmet peer dependency "webpack@^2.2.0 || ^3.0.0". 01 warning "webpack-dev-server > webpack-dev-middleware@1.12.2" has unmet peer dependency "web…
      01 [4/4] Building fresh packages...
      01 success Saved lockfile.
      01 Done in 161.28s.
      01 Webpacker is installed 🎉 🍰
      01 Using /home/deploy/vue-todolist/releases/20181029131732/config/webpacker.yml file for setti…
      01 Compiling…
      01 Compiled all packs in /home/deploy/vue-todolist/releases/20181029131732/public/packs
    ✔ 01 deploy@47.92.202.0 186.048s
03:18 deploy:assets:backup_manifest
      01 mkdir -p /home/deploy/vue-todolist/releases/20181029131732/assets_manifest_backup
    ✔ 01 deploy@47.92.202.0 0.093s
      02 cp /home/deploy/vue-todolist/releases/20181029131732/public/assets/.sprockets-manifest-dd3a…
    ✔ 02 deploy@47.92.202.0 0.097s
03:18 deploy:migrate
      [deploy:migrate] Run `rake db:migrate`
03:19 deploy:migrating
      01 bundle exec rake db:migrate 01 rake aborted!
      01 ActiveRecord::NoDatabaseError: FATAL:  database "rails_recipes" does not exist 01 /home/deploy/vue-todolist/shared/bundle/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_recor…
      01 /home/deploy/vue-todolist/shared/bundle/ruby/2

 

發現錯誤❌!!,沒改!!

production:
  adapter: postgresql
  pool: 25
  database: rails_recipes
  host: localhost
  username: postgres
  password: xxxxxxxxxx

數據庫操作。

https://itbilu.com/database/postgre/410auo8xZ.html 

 


 

新問題:

執行 sudo service nginx restart

Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xe" for details.

 

 

server {
  listen 80;
  server_name 47.92.82.116;   # 用你自己的服務器 IP 位置

  root /home/deploy/rails-recipes/current/public;  # 用你自己的項目名稱位置

  passenger_enabled on;

  passenger_min_instances 1;

  location ~ ^/assets/ {
    expires 1y;
    add_header Cache-Control public;
    add_header ETag "";
    break;
   }
:} #多輸入了一個冒號!

 


最后成功部署,不過又有新的問題!

顯示<body></body> 內是空的!!!

也就是說vue.js沒有部署到位!

 

這是因為vue.js的單頁面應用需要部署。

一上午瀏覽網上,能夠教vue.js部署的帖子。並沒有現成的解決方案!

第一,部署方面的了解。幾乎都不了解。所以網上的一些相關知識點,比較懵圈。

第二,關於vue-cli有部署的實例,但我沒有學習vue-cli。和我目前要解決的問題,也不相關。

 

想法:

   學習部署已經2天了,遇到不少坑,也掙扎爬出來。到vue方面的部署,我暫時不能解決。

所以,暫時停下來,先看一些其他相關知識點。

  • 了解一下webpack。
  • GoRails有教用Heroku的視頻看一下。
  • Linux基本運維知識,學習一下。
  • 目前最重要的事情是什么應該這2天趕緊了!

 


 

 

使用passwd命令修改密碼

參考man passwd

在root下輸入:passwd xxx, 就可以修改xxx的密碼了!


 

 

01:54 deploy:assets:precompile
      01 bundle exec rake assets:precompile
      01 yarn install v1.12.1
      01 [1/4] Resolving packages...
      01 [2/4] Fetching packages...
      01 info fsevents@1.2.4: The platform "linux" is incompatible with this module. 01 info "fsevents@1.2.4" is an optional dependency and failed compatibility check. Ex… 01 [3/4] Linking dependencies... 01 warning "@rails/webpacker > postcss-cssnext@3.1.0" has unmet peer dependency "cani…
      01 warning " > vue-loader@14.2.2" has unmet peer dependency "css-loader@*". 01 warning " > webpack-dev-server@2.11.2" has unmet peer dependency "webpack@^2.2.0 |…
      01 warning "webpack-dev-server > webpack-dev-middleware@1.12.2" has unmet peer depend… 01 [4/4] Building fresh packages...

 

網上的找的一個方法,沒有成功仍然會報告❌。

 

網上找到一篇 Nginx 教程 (中英)

https://www.oschina.net/translate/nginx-tutorial-basics-concepts?cmp

 

嘗試使用其他方式部署,嘗試一下。還是找不到解決辦法,暫時擱置!

 


 

嘗試action cable的部署:

輸入cap production deploy,走到 bundler:install時,❌:

在bunder之前先安裝gem install sassc -v '1.12.1 ?

An error occurred while installing sassc (1.12.1), and Bundler cannot continue.
Make sure that `gem install sassc -v '1.12.1' --source
'https://gems.ruby-china.com/'` succeeds before bundling.

 

gem 'font-awesome-sass' 有問題,移除它並去掉asset中的require ..后,運行cap production deploy即可成功。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM