0

I'm doing according to the instruction, but still doesn't work.
Server writes that I don't have a symbolic link to the file 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

I read what need to create file database.yml manually I create database.yml

touch /home/demo/myproject/shared/config/database.yml


production:
  adapter: postgresql
  encoding: utf8
  database: myproject_db
  username: postgres
  password: 1234567890postgres
  host: localhost
  pool: 5
  min_messages: WARNING

Further, he writes that there is no symbolic link to the file 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

Created secrets.yml on the server

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"] %>

Further he writes that there is no symbolic link to the file ** nginx.conf **:

00:03 deploy:check:linked_files
      ERROR linked file /home/demo/myproject/shared/config/nginx.conf does not exist on 188.226.140.17

About the nginx.conf file Tutorials DigitalOcean it is written that it is necessary to create the symbolic link a little in other place, not in that in which it is specified at me in an error, and in occasion of secrets.yml it is told at all. The path in my server:

/home/demo/myproject/shared/config/nginx.conf

The path is written in tutorial:

sudo ln -nfs "/home/deploy/apps/appname/current/config/nginx.conf" "/etc/nginx/sites-enabled/appname"

I substitute the name of my user for the command instead of deploy and instead of appname the name of my application. It turns out:

sudo ln -nfs "/home/demo/apps/myproject/current/config/nginx.conf" "/etc/nginx/sites-enabled/myproject"

still writing an error:

00:03 deploy:check:linked_files
      ERROR linked file /home/demo/myproject/shared/config/nginx.conf does not exist on 188.226.140.17

Then I create not a symbolic link, but a file ** nginx.conf **

touch /home/demo/mypoject/shared/config/nginx.conf


upstream puma {
  server unix:///home/demo/apps/myproject/shared/tmp/sockets/myproject-puma.sock;
}

server {
  listen 80 default_server deferred;
  # server_name example.com;

  root /home/demo/apps/myproject/current/public;
  access_log /home/demo/apps/myproject/current/log/nginx.access.log;
  error_log /home/demo/apps/myproject/current/log/nginx.error.log info;

  location ^~ /assets/ {
    gzip_static on;
    expires max;
    add_header Cache-Control public;
  }

  try_files $uri/index.html $uri @puma;
  location @puma {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;

    proxy_pass http://puma;
  }

  error_page 500 502 503 504 /500.html;
  client_max_body_size 10M;
  keepalive_timeout 10;
}

And here begins the most interesting! When i try to pull gems with Gemfile - deploy hangs. I thought at first that this was the way it should be, but after a long wait I realized that something wasn't right.

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

I then tried to execute this command on the server directly.

~/.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

It seems to go further, but again began to give errors:

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'

I execute this command on the server:

demo@test8CPU:~$ ~/.rvm/bin/rvm default do bundle exec rake assets:precompile
Could not locate Gemfile or .bundle/ directory

But I have Gemfile in repository on Github and in my project! I'm googling and find related questions first second third but they didn't help. Still the same error.

Help me please. I'm newbie.

Ivan
  • 103
  • 1
Andy
  • 583
  • 1
  • 5
  • 19

1 Answers1

0
demo@test8CPU:~$ ~/.rvm/bin/rvm default do bundle exec rake assets:precompile
Could not locate Gemfile or .bundle/ directory

It's very simple. You're not in app folder. Previous commands worked because they had arguments like --gemfile and --path. bundle exec doesn't have such arguments.

The solution is

cd /home/demo/myproject/current

~/.rvm/bin/rvm default do bundle exec rake assets:precompile
snake
  • 326
  • 1
  • 9