Ruby on rails 不要使用Capistrano在DigitalOcean上传递部署
我是按照计划做的,但还是不行。Ruby on rails 不要使用Capistrano在DigitalOcean上传递部署,ruby-on-rails,ruby,capistrano,digital-ocean,Ruby On Rails,Ruby,Capistrano,Digital Ocean,我是按照计划做的,但还是不行。 服务器写到我没有指向文件database.yml的符号链接 00:03 deploy:check:linked_files ERROR linked file /home/demo/myproject/shared/config/database.yml does not exist on 188.226.140.17 需要手动创建文件database.yml的内容 我创建database.yml touch /home/demo/myproject/shar
服务器写到我没有指向文件database.yml的符号链接
00:03 deploy:check:linked_files
ERROR linked file /home/demo/myproject/shared/config/database.yml does not exist on 188.226.140.17
需要手动创建文件database.yml的内容
我创建database.yml
touch /home/demo/myproject/shared/config/database.yml
此外,他还写道,没有指向secrets.yml文件的符号链接:
00:03 deploy:check:linked_files
ERROR linked file /home/demo/myproject/shared/config/secrets.yml does not exist on 188.226.140.17
在服务器上创建了secrets.yml
touch /home/demo/myproject/shared/config/secrets.yml
# Be sure to restart your server when you modify this file.
# Your secret key is used for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
# You can use `rake secret` to generate a secure secret key.
# Make sure the secrets in this file are kept private
# if you're sharing your code publicly.
development:
secret_key_base: 1bbe19e548182eb986995dfef00bb0bb0ed410e25c8cdbf4e9f2e92290ce69f91b84c0fa76fdd50a18d49fea3906f57a0cba9398562fa39492a3472b680d8112
test:
secret_key_base: ed1b6e6ca1dfd6c1b939414ffd69fa92dadfeb61fe7e819ac7d08c515a169f8648ec29b21e89a34d8649585916b6485dfc74f9eded1ecf83a87e315500e1b64a
# Do not keep production secrets in the repository,
# instead read values from the environment.
production:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
关于nginx.conf文件
有人写道,有必要在其他地方创建一点符号链接,而不是在错误中指定给我的地方,以及在秘密的情况下。yml它被告知。
我的服务器中的路径:
/home/demo/myproject/shared/config/nginx.conf
路径以以下格式写入:
我用我的用户名代替命令,而不是deploy,也不是appname我的应用程序的名称。结果是:
sudo ln -nfs "/home/demo/apps/myproject/current/config/nginx.conf" "/etc/nginx/sites-enabled/myproject"
仍在写入错误:
00:03 deploy:check:linked_files
ERROR linked file /home/demo/myproject/shared/config/nginx.conf does not exist on 188.226.140.17
然后我创建的不是一个符号链接,而是一个文件**nginx.conf**
touch /home/demo/mypoject/shared/config/nginx.conf
最有趣的事情就从这里开始了当我尝试使用Gemfile提取gem时-部署挂起。起初我以为这是应该的,但经过长时间的等待,我意识到有些事情不对劲
00:21 bundler:install
01 ~/.rvm/bin/rvm default do bundle install --gemfile /home/demo/myproject/releases/20170525093300/Gemfile --path /home/demo/myproject/shared/bundle --without development test --deployment --quiet
然后我尝试直接在服务器上执行这个命令
~/.rvm/bin/rvm default do bundle install --gemfile /home/demo/myproject/releases/20170525093300/Gemfile --path /home/demo/myproject/shared/bundle --without development test --deployment --quiet
它似乎走得更远,但又开始出现错误:
00:31 deploy:assets:precompile
01 ~/.rvm/bin/rvm default do bundle exec rake assets:precompile
01 rake aborted!
01 ActiveRecord::AdapterNotSpecified: 'production' database is not configured. Available: []
01 /home/demo/myproject/shared/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/connection_specification.rb:248:in `resolve_symbol_connection'
01 /home/demo/myproject/shared/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/connection_specification.rb:211:in `resolve_connection'
我在服务器上执行此命令:
demo@test8CPU:~$ ~/.rvm/bin/rvm default do bundle exec rake assets:precompile
Could not locate Gemfile or .bundle/ directory
但我在Github的存储库和我的项目中都有Gemfile!
我在谷歌上搜索相关问题
但是他们没有帮助。还是一样的错误。
请帮帮我。我是新手
demo@test8CPU:~$ ~/.rvm/bin/rvm default do bundle exec rake assets:precompile
Could not locate Gemfile or .bundle/ directory
这很简单。你不在应用程序文件夹中。以前的命令之所以有效,是因为它们具有类似于--gemfile
和--path
的参数。
bundle exec
没有此类参数
解决办法是
cd /home/demo/myproject/current
~/.rvm/bin/rvm default do bundle exec rake assets:precompile
请注意,切勿在任何地方发布密钥库和密码。如果可能,尝试用占位符替换。您可以编辑answer@AkashPinnaka这个数据是伪造的,那就好了
00:31 deploy:assets:precompile
01 ~/.rvm/bin/rvm default do bundle exec rake assets:precompile
01 rake aborted!
01 ActiveRecord::AdapterNotSpecified: 'production' database is not configured. Available: []
01 /home/demo/myproject/shared/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/connection_specification.rb:248:in `resolve_symbol_connection'
01 /home/demo/myproject/shared/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/connection_specification.rb:211:in `resolve_connection'
demo@test8CPU:~$ ~/.rvm/bin/rvm default do bundle exec rake assets:precompile
Could not locate Gemfile or .bundle/ directory
demo@test8CPU:~$ ~/.rvm/bin/rvm default do bundle exec rake assets:precompile
Could not locate Gemfile or .bundle/ directory
cd /home/demo/myproject/current
~/.rvm/bin/rvm default do bundle exec rake assets:precompile