![](https://secure.gravatar.com/avatar/988eeb339d1c306630f239bb4e7c7cb2.png?default=mp&rating=pg&size=250)
Saunved
Joined
10 Experience
0 Lessons Completed
0 Questions Solved
Activity
Here are some links and tips I found helpful while setting up the production server. Feel free to add to this by commenting below or suggest any edits:
- Refer to this link to understand how to set up a Rails server on 18.04: https://gorails.com/deploy/ubuntu/18.04
- Refer to this link if you get a
packet_write wait
orbroken_pipe
error: https://www.digitalocean.com/community/questions/why-am-i-getting-packet_write_wait-connection-to-xxx-xx-xx-xxx-port-22-broken-pipe?answer=41458 This error usually comes up when you are installing Ruby on the production server and the client thinks the server is inactive. - Make sure
database.yml
,secrets.yml
,application.yml
files are created manually on the server (in theshared
folder) - Edit
nginx /etc/nginx/sites-enabled/app-name
file and make sure it points to the correct directory. Refer to this link: https://www.digitalocean.com/community/tutorials/how-to-move-an-nginx-web-root-to-a-new-location-on-ubuntu-18-04 - Make sure MySQL privileges are provided to the deploy user
If you are using GitLab, you'll need to generate SSH public and secret keys on the server and then add the public key to the GitLab user settings.
The steps to do that are as follows:su deploy
ssh-keygen -t rsa -b 2048
- Press
ENTER
thrice cat /home/<user-name>/.ssh/id_rsa.pub
to obtain the SSH key- Navigate to: https://gitlab.com/profile/keys and paste your key there
- You should be able to use Capistrano with GitLab now (as long as you have followed all the other instructions in the main article and setup deploy.rb correctly)
Make sure production secret key is set (this can be generated locally using
rails secret
) and then added to thesecrets.yml
file in the production server