Ask A Question


You’re not receiving notifications from this thread.

Deploy Ubuntu 20.04 Focal Fossa Discussion

Chris Oliver asked in General

Thanks for the guide. There is an error installing NGINX on Ubuntu20.04: "The following packages have unmet dependencies:
libnginx-mod-http-passenger : Depends: passenger (= 1:6.0.4-1~bionic1) but it is not going to be installed
Depends: nginx-common (< 1.14.1) but 1.17.10-0ubuntu1 is to be installed."
Maybe you can correct the installation commands.
Thank You.


You are attempting to install the version of Passenger for bionic beaver, 18.04. In there "Installing NGINX & Passenger" you need to use a different repository. Use: sudo sh -c 'echo deb focal main > /etc/apt/sources.list.d/passenger.list' instead of sudo sh -c 'echo deb bionic main > /etc/apt/sources.list.d/passenger.list'. Also note this is still beta / testing for passenger, while it should work, the final version is expect to release in a couple more weeks.

Switch out this repository as mentioned above and rerun the commands form the installing passenger section -- this should allow you to install successfully.


Thank you very much.Nginx with your help successful installed.


I'm having an issue at the end of deployment. I get this error:

00:07 deploy:assets:precompile
01 $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile
01 rake aborted!
01 URI::InvalidURIError: bad URI(is not URI?): postgresql://deploy:nicetry@

Is there an issue with me using rails as API only mode? If so, I tried this according to a github issue I found:

In Capfile you add these lines (but it fails on migration after getting thru precompile) -

removed "require 'capistrano/rails'"

require 'capistrano/bundler'
require 'capistrano/rails/migrations'

I'm wondering if there's some general knowledge I'm missing that's preventing me from having a successful deployment. Any tips would be greatly appreciated!

SOLVED: ok, just in case anyone else runs into this issue it's because i had special characters in my postgresql password. you can escape them or remove them.

additionally, since i was running an api i definitely had to make those changes to my capfile i listed above.


I faced same issue but with mysql. So I removed the configuration from .rbenv-vars and created shared/config/database.yml.


Thanks for the tutorial. Deploys to the server fine but am getting an internal server error.

The application encountered the following error: uninitialized constant ApplicationCable::ActionCable
Did you mean? ActionMailer (NameError)

Any idea why this might be happening? I haven't touched anything with ActionCable in my app and it works great on dev.


Found the answer. I'm running Rails 6 webpacker only, so I removed sprockets. My config/application.rb had 'require action_cable' commented out. Added that and came across another issue.

cap's deploy:assets:backup_manifest was failing because it couldn't find the assets manifest file. Since I removed sprockets it doesn't exist.

I added Rake::Task["deploy:assets:backup_manifest"].clear_actions to my config/deploy.rb and now everything works. Going to do some research to make sure I didn't stop doing something I need by calling that. Its working for now


Thanks for the tutorial. I've been trying for a while to fiture out how to setup a server to deploy rails apps. I followed the video and everything went well but when I try to deploy I get the following error: I have search all over and posted on but can't get any answer. Any help would be greatly appreciated. I will say that I did use ubuntu 20, so if that is the issue I am willing to scrp the whole thig and do it again using 18.4 instead.

terminated with exception (report_on_exception is true):

Traceback (most recent call last):
25: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sshkit-1.21.1/lib/sshkit/runners/parallel.rb:12:in block (2 levels) in execute'
24: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sshkit-1.21.1/lib/sshkit/backends/abstract.rb:31:in
23: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sshkit-1.21.1/lib/sshkit/backends/abstract.rb:31:in instance_exec'
22: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/capistrano-rbenv-2.2.0/lib/capistrano/tasks/rbenv.rake:10:in
block (3 levels) in '
21: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sshkit-1.21.1/lib/sshkit/backends/abstract.rb:61:in test'
20: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sshkit-1.21.1/lib/sshkit/backends/abstract.rb:148:in
19: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sshkit-1.21.1/lib/sshkit/backends/abstract.rb:148:in tap'
18: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sshkit-1.21.1/lib/sshkit/backends/abstract.rb:148:in
block in create_command_and_execute'
17: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sshkit-1.21.1/lib/sshkit/backends/netssh.rb:130:in execute_command'
16: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sshkit-1.21.1/lib/sshkit/backends/netssh.rb:177:in
15: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sshkit-1.21.1/lib/sshkit/backends/connection_pool.rb:63:in with'
14: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sshkit-1.21.1/lib/sshkit/backends/connection_pool.rb:63:in
13: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/net-ssh-6.1.0/lib/net/ssh.rb:255:in start'
12: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/net-ssh-6.1.0/lib/net/ssh/authentication/session.rb:72:in
11: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/net-ssh-6.1.0/lib/net/ssh/authentication/session.rb:72:in each'
10: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/net-ssh-6.1.0/lib/net/ssh/authentication/session.rb:86:in
block in authenticate'
9: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/net-ssh-6.1.0/lib/net/ssh/authentication/methods/publickey.rb:19:in authenticate'
8: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/net-ssh-6.1.0/lib/net/ssh/authentication/key_manager.rb:111:in
7: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/net-ssh-6.1.0/lib/net/ssh/authentication/key_manager.rb:250:in load_identities'
6: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/net-ssh-6.1.0/lib/net/ssh/authentication/key_manager.rb:250:in
5: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/net-ssh-6.1.0/lib/net/ssh/authentication/key_manager.rb:254:in block in load_identities'
4: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/net-ssh-6.1.0/lib/net/ssh/key_factory.rb:84:in
3: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/net-ssh-6.1.0/lib/net/ssh/key_factory.rb:103:in load_data_public_key'
2: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/net-ssh-6.1.0/lib/net/ssh/buffer.rb:248:in
1: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/net-ssh-6.1.0/lib/net/ssh/buffer.rb:322:in
raiseUnlessLoaded': unsupported key type `ssh-ed25519' (NotImplementedError)
net-ssh requires the following gems for ed25519 support:

  • ed25519 (>= 1.2, < 2.0)
  • bcrypt_pbkdf (>= 1.0, < 2.0) See for more information LoadError : "cannot load such file -- bcrypt_pbkdf_ext" (Backtrace restricted to imported tasks) cap aborted! NotImplementedError: unsupported key type `ssh-ed25519' net-ssh requires the following gems for ed25519 support:
  • ed25519 (>= 1.2, < 2.0)
  • bcrypt_pbkdf (>= 1.0, < 2.0) See for more information LoadError : "cannot load such file -- bcrypt_pbkdf_ext"

Tasks: TOP => rbenv:validate




Check this StackOverflow >
On MacOS, you'll need to add your SSH Key after every system restart (ssh-add)


Beautiful. Thanks for the guide. Got my production environment setup and running in no time!


Other than not being able to use the Capistrano commands as listed, needed to use bundle exec, this was all straight forward. How long is it supposed to sit on bundler:install when using Capistrano to deploy? It isn't crashing, I'm not getting any error messages, but it's been over 45 minutes. If I ssh into the server from a different terminal window, I can see processes working, but I can't differentiate which process is running the bundler:install.


Solved my own issue. Secret_Key_Base was not set appropriately, and the failure to execute bundler did not cause Capistrano to stop, it just hangs.


Notes on this guide
1 : the section for deployment, where you mention the block to edit, it ought to be stated that it should follow the line install_plugin Capistrano::SCM::Git otherwise bad ordering will make the cap commands fail.
2: I would suggest on the capfile configuration comment to include all files that you need to avoid being committed via gitignore (assuming not using environment variables), [often initializer] files with keys to things like s3, e-commerce, devise ...


*deployment hangs RAILS_ENV=development on assets precompile Rails *

INFO [7e60e5e4] Running $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile as deploy@...243
 DEBUG [7e60e5e4] Command: cd /home/deploy/zappa/releases/20210110095959 && ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.6.1" RAILS_ENV="development" RAILS_GROUPS="" ; $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile )
 DEBUG [7e60e5e4]   error Couldn't find an integrity file
 DEBUG [7e60e5e4]   error Found 1 errors.
 DEBUG [7e60e5e4]   

  Your Yarn packages are out of date!
  Please run `yarn install --check-files` to update.

To disable this check, please change `check_yarn_integrity`
to `false` in your webpacker config file (config/webpacker.yml).

running yarn install --check-files either locally or in the file server does not change behaviour one iota (on the server it is pointless as the next deployment creates a new directory). Setting 'check_yarn_integrity' to false does not change the behaviour.

Now I have read that should be in the shared directory (append :linked_dirs, public/packs, node_modules) which make sense given the two directories can be a 200 MB bloat. Tried that... no happiness.
The github repositry states: ensure that the installed packages match the yarn.lock file. ; the VPS yarn.lock file is empty. Another assumption I have been working on is the environment; it could be that development mode

yarn install --check-files did finally populate the shared directory ([ahem] after I had polluted all sorts of other directories. That moved the process further... to another error.

LoadError: Could not load the 'listen' gem. Addgem 'listen'to the development group of your Gemfile
buuut... that was already loaded.

Error identical to running Running RAILS_ENV=development bundle install; but this returns a clue:

Gems in the groups development and test were not installed.

SO and rails repo ( comments of moving the gem from the development block to the global block .
RAILS_ENV=development bundle install can now run (you'll see the various modules taking their time to compile (hundreds of MBs worth). Deployment can proceed.

1 - ensure append :linked_dirs, 'node_modules', 'public/packs'
2 - if in dev mode, move listento general block.
3 - Run RAILS_ENV=development bundle install on server to feel safe.

Then question if you need the other dev block gems on the server and move those to the global block.
OK. I am not aware of how to install those deve/test gems remotely. Any suggestion is welcome.


This guide is excellent. But I still do not understand why I got into 503 error when I removed /etc/nginx/site-enabled/default file (chapter 3). I restored it and nginx works fine.


Thanks a lot for this excellent guide :-) Everything works fine except i would like to use rails console on the deploy machine, and i constantly get this error message : "Your Ruby version is 2.7.0, but your Gemfile specified 3.0.0".
When i "ruby -v" with the deploy user, i get "3.0.0" but when i "ruby -v" with root, i get "2.7.0"...

Does anyone have an idea where it could come from ?


I had to cd into myapp/current then run RAILS_ENV=production bundle exec rails c


Thanks for that man, i just did the same!

I wonder why that comes up though, when running ruby -v or rbenv version it comes up as 3.0.0 correctly


Great tutorial. I got everything working but can you tell me how I can access the rails console from the server?


I figured it out. I had to cd into myapp/current then run RAILS_ENV=production bundle exec rails c


Is is possible to host multiple sites on a droplet with this setup?


Yes. You need separate nginx server configs for each website. Make one server the default.


server {
listen 80 default_server;
listen [::]:80 default server;
# more config


server {
listen 80;
listen [::]:80;
# more config


Hi guys! are we missing a step? What about the firewall and stuff?


Hello Chris,
Thank you for this amazing guide. I followed all the steps and I can deploy fine. But when access the address with my public IP. I keep getting the error screen with this message

We're sorry, but something went wrong.
The issue has been logged for investigation. Please try again later.

After checking the nginx error log. I found this

App 82883 output: /bin/sh: 1: exec: /home/deploy/.rbenv/versions/2.7.2/ruby: Permission denied
[ E 2021-06-01 19:08:57.8708 82618/Tz age/Cor/App/Implementation.cpp:221 ]: Could not spawn process for application /var/www/harefx-dev/current: The application process exited prematurely.
  Error ID: 8eae67af
  Error details saved to: /tmp/passenger-error-JR3VAo.html

[ E 2021-06-01 19:08:57.8755 82618/T8 age/Cor/Con/CheckoutSession.cpp:274 ]: [Client 1-3] Cannot checkout session because a spawning error occurred. The identifier of the error is 8eae67af. Please see earlier logs for details about the error.

I double-checked the permission of /home/deploy/.rbenv/shims/ruby, it's already owned by deploy user and the permission is set to chmod 777 already. Did I miss something? :(


Oh I just forgot to put user deploy instead of root in deploy.rb file. Now it's running fine. Thank you


I'm wondering if there's some general knowledge I'm missing that's preventing me from having a successful deployment. Any tips would be greatly appreciated!


what problem are you facing?


I am getting the below error on the Nginx log.
Error opening '/home/deploy/online_therapy_platform/current/Passengerfile.json' for reading: Permission denied (errno=13).

Please guide me to resolve this error. on the website, its give me 500 internal server error.


when try to enter ip address in browser i am getting this error

App 8063 output: /usr/share/passenger/helper-scripts/rack-preloader.rb:189:in block in <module:App>'
App 8063 output: /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:390:in
App 8063 output: /usr/share/passenger/helper-scripts/rack-preloader.rb:188:in <module:App>'
App 8063 output: /usr/share/passenger/helper-scripts/rack-preloader.rb:30:in
App 8063 output: /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in <main>'
[ E 2021-06-19 12:16:33.6418 8041/Tc age/Cor/App/Implementation.cpp:221 ]: Could not spawn process for application /home/deploy/projects/smiiley: The application encountered the following error: undefined method
[]' for nil:NilClass (NoMethodError)
Error ID: f6ffa075
Error details saved to: /tmp/passenger-error-tXle5c.html

[ E 2021-06-19 12:16:33.6493 8041/T6 age/Cor/Con/CheckoutSession.cpp:274 ]: [Client 1-1] Cannot checkout session because a spawning error occurred. The identifier of the error is f6ffa075. Please see earlier logs for details about the error.



I have an issue when I run cap production deploy

My serveur runs on ubuntu 20.04. On my local I'm with a Mac.
During the execution of the script, it stop with this error :

Could not find rails-6.1.4, activerecord_where_assoc-1.1.2, [...], in any of the sources

I try to run bundle install directly on the server but I got the same issue.
which ruby, gem and bundler are in /home/deploy/.rbenv/shims/

ruby -v 2.7.3, same in gem file.

Did I miss something ? Someone got the same issue ?


Excellent tutorial.
Quick question.
How do I force nginx to rewrite/redirect to

Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 82,969+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.