- curl
- gnupg
- build-essential
- git
- nodejs
$ sudo apt install -y <packages>
See how to install via RVM (Ruby Version Manager).
$ gem install bundler
$ sudo add-apt-repository "deb https://oss-binaries.phusionpassenger.com/apt/passenger <distribution_name> main"
Or...
$ sudo <file_editor> /etc/apt/sources.list.d/passenger.list
Paste the content deb https://oss-binaries.phusionpassenger.com/apt/passenger <distribution_name> main
, save and get out.
Run
$ sudo apt update
And
$ sudo apt upgrade
$ sudo apt install -y nginx-extras passenger
$ passenger-config validate-install
Choose correctly the installation that you want to check and press ENTER.
$ sudo <file_editor> /etc/nginx/nginx.conf
Insert the follow lines
passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
include /etc/nginx/sites-enabled/**/*;
To find out when Passenger was installed, run
$ passenger-config --root
Then copy and paste beside passenger_root
key.
$ sudo <file_editor> /etc/nginx/sites-available/<environment>/<app_name>
Insert the follow lines
server {
listen 80;
server_name = <domain>;
root <absolute public folder of your project>;
passenger_ruby <paste ruby interpreter here>;
passenger_enabled on;
passenger_app_env <environment>;
passenger_friendly_error_pages on;
passenger_start_timeout <seconds>;
}
To set the Ruby version, run
$ rvm use <version>
to find out when the Ruby interpreter is installed, run
$ passenger-config about ruby-command
Create a symbolic link to make the virtual server available
$ sudo ln -s /etc/nginx/sites-available/<environment>/<project_name> /etc/nginx/sites-enabled/<environment>
$ sudo service nginx restart
$ git clone <https or git address>
$ git checkout <environment>
Inside the root folder of project, run
$ rvm use <ruby_version>
If the server it’s restarts run this line again, or run
$ rvm --ruby-version use <version>
Like this the Ruby version will definitely be set.
$ chmod 700 config db
$ chmod 600 config/database.yml
Create, inside root folder of your project, the .bundle/config
file with the follow content
---
BUNDLE_WITHOUT: "development:test"
To don’t install gems to use in development and tests environment.
So, inside the root folder of project, run
$ rvmsudo bundle install
Note: rvmsudo
needs to use only if you isn’t own of the project. Don’t use sudo
otherwise the Ruby interpreter will be used from system wide scope, don’t from RVM
scope. So create ~/.rvmrc
file and put export rvmsudo_secure_path=1
inside this file.
$ bundle exec rake assets:precompile
$ bundle exec rake db:migrate RAILS_ENV=<environment>
$ curl http(s)://<server_name>