# Terminal: Productionsudo-u postgres createuser --interactive--> Create new user, it will ask for enter username
sudo-u postgres createdb <dbname>
--> Create new database
sudo-u postgres psql
--> use psql to set password and add user to database
postgres=# alter user <username> with encrypted password '<password>';postgres=# grant all privileges on database <dbname> to <username>;postgres=# \q
Edit pg_hba.conf file to allow login with password
1
2
3
4
5
# Terminal: Productionsudo nano /etc/postgresql/12/main/pg_hba.conf
local all postgres peer
--> change peer to md5
sudo service postgresql restart
Install Nginx
1
2
# Terminal: Productionsudo apt install nginx
Create github repo and config deploy key
1
2
3
# Terminal: Production
ssh-keygen -t rsa
cat ~/.ssh/id_rsa.pub
Follow these instructions to add the newly created key to your GitHub project.
Adding Capistrano to your project
1
2
3
4
5
6
7
8
9
10
11
12
# Gemfile# The Puma gem may already exist in your Gemfile. If not, add it
gem 'puma'# If you already have a development group, you can add this into it
group :development do
gem 'capistrano', require: false
gem 'capistrano-rvm', require: false
gem 'capistrano-rails', require: false
gem 'capistrano-bundler', require: false
gem 'capistrano3-puma', require: false
end
1
2
3
# Terminal: Development
bundle
cap install
This creates:
Capfile, used to load some pre-defined scripts (selecting the right version of Ruby, pre-compiling assets, installing new gems, and more).
config/deploy.rb, which holds configuration and environment variables