Ask A Question

Notifications

You’re not receiving notifications from this thread.

Deploy Ubuntu 22.04 Jammy Jellyfish Discussion

Chris Oliver asked in General

Thanks a lot for this step by step guide!
Anyway, I'm facing a problem with Passenger. After deploying the app, I see this in the nginx logs:

Error opening '/home/deploy/my_app/current/Passengerfile.json' for reading: Permission denied (errno=13); This error means that the Nginx worker process (PID 48756, running as UID 33) does not have permission to access this file. Please read this page to learn how to fix this problem: https://www.phusionpassenger.com/library/admin/nginx/troubleshooting/?a=upon-accessing-the-web-app-nginx-reports-a-permission-denied-error;

But I don't have any file called Passengerfile.json in my app's directory. Any clue?

Reply

My fault. This fixed it:
chmod o+x $HOME

Reply

second this observation. This change - although I have never seen an Passengerfile.json file in the application directory before - is necessary to get the application running.

To prove the point I created multiple users on a VPS deployed & had to restate the cammand for each user.

Reply

Thank u so much

Reply

i am still facing this issue . kindly let me know

Reply

Thanks for the article, nice and clear.

I was following this for 22.04 and ruby 2.7.5 and ran into an openssl when installing.

Reply

First thanks - very helpful.
I followed the instructions step by step - the command: 'sudo apt-get install -y nginx-extras libnginx-mod-http-passenger' ended in an error: Unfullfilled dependencies: passenger : Depends: ruby2.7 but is not installable.
Thanks in advance.

Reply

I get the same error

Reply

Passenger do not yet support 22.04: https://www.phusionpassenger.com/docs/advanced_guides/install_and_upgrade/standalone/install/
I ended up switching to 20.04

Reply

Passenger is now up to date. Change sudo sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger focal main > /etc/apt/sources.list.d/passenger.list'
to
sudo sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger jammy main > /etc/apt/sources.list.d/passenger.list'
Nginx-Installing is then successfull.

Reply

deploy failed with yarn install, however this stack-overflow solved my problem
https://stackoverflow.com/questions/46013544/yarn-install-command-error-no-such-file-or-directory-install/47680012#47680012

ssh into the production server and ran
sudo apt remove cmdtest
sudo apt remove yarn
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update
sudo apt-get install yarn -y
then
yarn install

then proceeded with cap production deploy , now have production up and running

Reply

Also running into trouble with Passenger on 22.04. Going to try this all over again with 20.04.

Reply

I have created 4 droplets. 4 times the same behaviours popped up.
There are deprecated methods:

Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).

Then there are services that need to be restarted - the list is quite long & I would not know where to start with each one of them as they are more foreign to me than spoken-martian.

FInally, although mosh installs on the droplet:

"The locale requested by LC_CTYPE=UTF-8 isn't available here.
Running `locale-gen UTF-8' may be necessary.
[...]
/usr/local/bin/mosh: Did not find mosh server startup message. (Have you installed mosh on your server?)

But running that comand yields no change in behaviour. All this does not occur on 20.04.
Could we be dealing with a still flaky release?

Reply

example of 'Daemons using outdated libraries': systemd-logind.service

Reply

other deprecation.
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).

Reply

Hi !
I have a 403 forbidden error after deploying the rails app
I added some gems in order to deploy it :
gem 'ed25519', '>= 1.2', '< 2.0'
gem 'bcrypt_pbkdf', '>= 1.0', '< 2.0'
gem 'net-smtp'

I added a line on deploy.rb :
set :passenger_restart_with_touch, true

without it the deploy failed

Now deploying seems ok but I have a 403 forbidden error when I need to acces website, here is the log :
2022/05/30 12:03:53 [error] 10803#10803: *177 directory index of "/home/deploy/azureenne/current/public/" is forbidden, client: 78.113.48.84, server: _, request: "GET / HTTP/1.1", host: "212.227.197.131"

I don't have any index file, root page is home.html.erb

Reply

same error, need help

Reply

Hi did you solve this problem?

Reply

I feel this guide needs a bit of an update for Ubuntu 22.04.

Reply

PassengerAgent: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No such file or directory

Getting this error for Ubuntu 22.04

Reply
Reply

Thanks for this guide. It is really thorough but wasn't thorough enough for me. I wasted a day and a half trying to get my rails app on Ubuntu 22.04. Still haven't managed to do it and am considering pulling the plug at this point.

Several steps appear to be missing such as:

  • needing to add SSH key to the virtual machine and to your github for 'cap production deploy' to connect to github
  • Node needs a higher version of >=14 in order to work with @hotwired/turbo in Rails 7 (copy/pasting from your guide installed 12.22.9 for me)

It would also be amazing if you could add recommended rails versions for these systems or even some kind of guide to save people these headaches.

Reply

Chris, I know this isn't technically your fault - but when people are building out linux servers, this type of thing ends up costing hours and hours of devops time - time that most developers loath! ESPECIALLY beginner programmers. I can't imagine how many people have tried this on 22.04 and gave up, blaming themselves.

You should really take a moment to make a note about the issue until it is resolved.

Reply

So it doesnt work with 22.04?

Reply

Please help mee. Why its says 403 Forbidden

Reply

Hi I have problem with step passenger:restart . I got this message:

*** ERROR: Phusion Passenger(R) doesn't seem to be running. If you are sure that it
01 is running, then the causes of this problem could be one of:
01
01 1. You customized the instance registry directory using Apache's
01 PassengerInstanceRegistryDir option, Nginx's
01 passenger_instance_registry_dir option, or Phusion Passenger(R) Standalone's
01 --instance-registry-dir command line argument. If so, please set the
01 environment variable PASSENGER_INSTANCE_REGISTRY_DIR to that directory
01 and run this command again.
01 2. The instance directory has been removed by an operating system background
01 service. Please set a different instance registry directory using Apache's
01 PassengerInstanceRegistryDir option, Nginx's passenger_instance_registry_dir
01 option, or Phusion Passenger(R) Standalone's --instance-registry-dir command
01 line argument.

Reply

I think it is not OK to have a guide with lastest versions that is autogenerated to rank well in SEO keywords but that actually isn't updated as it is and can't be used without problems. Repos, passenger, node there are a lot of problematic parts.

Reply

/home/deploy/myapp/.rbenv-vars, works, but just wondering if it is possible to get the same result with credentials.yml.enc .

Reply

Running into problems Rails 7.0.4 with deploy

00:16 bundler:install
The Gemfile's dependencies are satisfied, skipping installation
00:16 deploy:assets:precompile
01 $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile
01 rake aborted!
01 ActiveSupport::MessageEncryptor::InvalidMessage: ActiveSupport::MessageEncryptor::InvalidMessage

scratching at straws

Yarn init and Yarn install OK

package.json
.yarnrc.yml
yarn.lock
yarn --version
3.3.1

all look ok

package.json there
.yarnrc.yml
yarn.lock

ssh into server and ran
$HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile
as per
Viktor Smári 1,790 XP · on Apr 26, 2022 suggestion.

Could not locate Gemfile or .bundle/ directory

echo $PATH
/home/deploy/.rbenv/plugins/ruby-build/bin:/home/deploy/.rbenv/shims:/home/deploy/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

/home/deploy/.rbenv/versions/3.2.0/bin/ruby
ruby 3.2.0 (2022-12-25 revision a528908271) [x86_64-linux]
Bundler version 2.4.3
which bundler
/home/deploy/.rbenv/shims/bundler

rbenv local
3.2.0

as you can see from above the capistrano reports that the gems are installed also
gem env
RubyGems Environment:

  • RUBYGEMS VERSION: 3.4.1
  • RUBY VERSION: 3.2.0 (2022-12-25 patchlevel 0) [x86_64-linux]
  • INSTALLATION DIRECTORY: /home/deploy/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0
  • USER INSTALLATION DIRECTORY: /home/deploy/.local/share/gem/ruby/3.2.0
  • RUBY EXECUTABLE: /home/deploy/.rbenv/versions/3.2.0/bin/ruby
  • GIT EXECUTABLE: /usr/bin/git
  • EXECUTABLE DIRECTORY: /home/deploy/.rbenv/versions/3.2.0/bin
  • SPEC CACHE DIRECTORY: /home/deploy/.local/share/gem/specs
  • SYSTEM CONFIGURATION DIRECTORY: /home/deploy/.rbenv/versions/3.2.0/etc
  • RUBYGEMS PLATFORMS:
    • ruby
    • x86_64-linux
  • GEM PATHS:
    • /home/deploy/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0
    • /home/deploy/.local/share/gem/ruby/3.2.0
  • GEM CONFIGURATION:
    • :update_sources => true
    • :verbose => true
    • :backtrace => true
    • :bulk_threshold => 1000
  • REMOTE SOURCES:
  • SHELL PATH:
    • /home/deploy/.rbenv/versions/3.2.0/bin
    • /home/deploy/.rbenv/libexec
    • /home/deploy/.rbenv/plugins/ruby-build/bin
    • /home/deploy/.rbenv/plugins/rbenv-vars/bin
    • /home/deploy/.rbenv/plugins/ruby-build/bin
    • /home/deploy/.rbenv/shims
    • /home/deploy/.rbenv/bin
    • /usr/local/sbin
    • /usr/local/bin
    • /usr/sbin
    • /usr/bin
    • /sbin
    • /bin
    • /usr/games
    • /usr/local/games
    • /snap/bin
Reply

if you are getting this error in rails api only then check you CAP file you should change require file
require "capistrano/rails"this with require "capistrano/rails/migrations" and please also go down and chechk there will be another require file require "capistrano/rails/assets comment it
i hope it will remove this error but only for api mode

Reply

I'm getting this error on

passenger-status
*** Cleaning stale instance directory /var/run/passenger-instreg/passenger.KDGdRez
Warning: Permission denied @ dir_s_rmdir - /var/run/passenger-instreg/passenger.KDGdRez
Version : 6.0.17
Date : 2023-03-04 23:52:38 +0000
Instance: eRjphKXk (nginx/1.18.0 Phusion_Passenger/6.0.17)

Phusion Passenger(R) is currently not serving any applications.

Reply

I had the same issue using DO when I turned on the ufw firewall

I just had to turn of the firewall, restart the server and the error is gone

Reply

did you find any solution to this error?

Reply

In my case error is happening even tho my ufw status is inactive?

Reply

When running cap production deploy, I get this error message.

00:13 deploy:assets:precompile
01 $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile
01 rake aborted!
01 ArgumentError: Missing secret_key_base for 'production' environment, set this string with bin/rails credentials:edit

Reply

The solution for me was to create a master.key file

You can create the master.key file by running this command:
EDITOR=nano rails credentials:edit

Once that is created, it will also create a credentials.yml.enc file

Ccopy the database.yml / master.key / credentials.yml.enc from your dev server and put it on the production server and then cap production deploy should work

Reply

Thanks for the guide, which almost works, with:

Ubuntu 22.04.2 LTS Jammy (client and server)
Ruby 3.2.0 / Rails 7.0.4.2
capistrano (3.17.2)
capistrano-bundler (2.1.0)
capistrano-passenger (0.2.1)
capistrano-rails (1.6.2)
capistrano-rbenv (2.2.0)
net-ssh (7.1.0)
openssl (default: 3.1.0)

When running cap production deploy (withHostKey /etc/ssh/ssh_host_ed25519_key in the ssh server config file - I am using ed25519 keys) I get this error:

verify_host_key: :secure is deprecated, use :always
Thread:0x00007f169f27a710 /home/user/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/sshkit-1.21.4/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
/home/user/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/sshkit-1.21.4/lib/sshkit/runners/parallel.rb:15:in rescue in block (2 levels) in execute': Exception while executing as deploy@xx.xx.xx.xx: could not settle on host_key algorithm (SSHKit::Runner::ExecuteError)
Server host_key preferences: ssh-ed25519
Client host_key preferences: ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256,ssh-rsa-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512
from /home/user/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/sshkit-1.21.4/lib/sshkit/runners/parallel.rb:11:in
block (2 levels) in execute'
/home/user/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/net-ssh-7.1.0/lib/net/ssh/transport/algorithms.rb:410:in `negotiate': could not settle on host_key algorithm (Net::SSH::Exception)
Server host_key preferences: ssh-ed25519
Client host_key preferences: ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256,ssh-rsa-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512
...
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy@xx.xx.xx.xx: could not settle on host_key algorithm
Server host_key preferences: ssh-ed25519
Client host_key preferences: ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256,ssh-rsa-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512

And when no HostKey is set on the server I get this error:

verify_host_key: :secure is deprecated, use :always
Thread:0x00007f0d3c68a6c8 /home/user/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/sshkit-1.21.4/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
/home/user/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/sshkit-1.21.4/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as deploy@xx.xx.xx.xx: fingerprint SHA256:6EF6B30F9E557F948C402C89002C7C8A is unknown for "xx.xx.xx.xx" (SSHKit::Runner::ExecuteError)
...
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy@xx.xx.xx.xx: fingerprint SHA256:6EF6B30F9E557F948C402C89002C7C8A is unknown for "xx.xx.xx.xx"

Caused by:
Net::SSH::HostKeyUnknown: fingerprint SHA256:6EF6B30F9E557F948C402C89002C7C8A is unknown for "xx.xx.xx.xx"

Tasks: TOP => rbenv:validate
(See full trace by running task with --trace)


I can do a password-less ssh into the server, no problem, so PubKey authentication appears to work just fine.

Please! If anyone else has had, and overcome this problem, I would really appreciate your help - I've been trying to fix this for days now!

Thanks in advance.

Reply

Okay, I have managed to deploy now. Someone on stack overflow suggested installing gems ed25519 and bcrypt_pbkdf (only now do I notice Loris on May 30, 2022 did this here :rollseyes:). I did this, but was still getting an exception. The thread is here:

https://stackoverflow.com/questions/75900868/rails-7-deployment-fails-using-capistrano-with-sshkitrunnerexecuteerror/75924541#75924541

It appears I needed to edit ~/.ssh/config to include:

Host *
IdentityFile /home/user/.ssh/id_ed255190

The other issues I ran into were needing (in config/deploy.rb) to set:

ask :branch,git rev-parse --abbrev-ref HEAD.chomp

Otherwise Capistrano fails with this error:

DEBUG [47bb050c] fatal: not a valid object name: master
DEBUG [47bb050c] tar:
DEBUG [47bb050c] This does not look like a tar archive
DEBUG [47bb050c] tar:
DEBUG [47bb050c] Exiting with failure status due to previous errors

Finally, I encountered this error:

2023/04/06 16:36:46 [alert] 138879#138879: *1 Error opening '/home/deploy/flix/Passengerfile.json' for reading: Permission denied (errno=13); This error means that the Nginx worker process (PID 138879, running as UID 33) does not have permission to access this file. Please read this page to learn how to fix this problem: https://www.phusionpassenger.com/library/admin/nginx/troubleshooting/?a=upon-accessing-the-web-app-nginx-reports-a-permission-denied-error; Extra info, client: xxx.xx.xxx.xxx, server: _, request: "GET / HTTP/1.1", host: "xx.xx.xxx.xx"

This was fixed by sudo chmod o+x $HOME -- thanks to Gustavo Garcia (here on 17 Jan 2022) for documenting that!

At long, long last I have my first Rails website deployed via the help in these pages and pure voodoo with Capistrano - which I still do not understand! I hope these comments help others who encounter similar issues.

Reply
Join the discussion
Create an account Log in

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

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

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