-
Notifications
You must be signed in to change notification settings - Fork 1
Server Setup
~~ Work in Progress ~~
-
Spin up a server at DigitalOcean
-
Modify /etc/postgres.../pga_hba.conf file to allow MD5 authentication
-
Set up a database and database user
-
Install libpq-dev (needed for gem 'pg')
$ sudo apt-get install libpq-dev
-
Install NodeJS as JS runtime
$ sudo apt-get install nodejs
-
Install CMake (needed for Rugged2: Git repository management)
$ sudo add-apt-repository ppa:george-edison55/cmake-3.x $ sudo apt-get update $ sudo apt-get install cmake
-
Set up Nginx, rvm, and Rails up to step 6
-
Deploy environment variables
$ cap production figaro_yml:setup
-
Install cerbot and get SSL certificates (may need temporary Nginx configuration for acme-challenge)
$ sudo add-apt-repository ppa:certbot/certbot $ sudo apt-get update $ sudo apt-get install certbot $ sudo certbot certonly -a webroot --webroot-path /var/apps/openly/shared/public -d <domain-name>
-
Update Diffie-Hellman Parameters
$ sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048
-
Now continue Set up Nginx, rvm, and Rails up with step 7
-
Confirm that your site is live!
Are you getting the following error when running your Capistrano deployment?
PG::InsufficientPrivilege: ERROR: permission denied to create extension "citext"
HINT: Must be superuser to create this extension.
: CREATE EXTENSION IF NOT EXISTS "citext"
You will need to temporarily make your database user a superuser.
-
Connect to the server:
$ ssh user@server
-
Connect to PostgreSQL as the superuser (not your database user):
$ sudo su postgres $ \psql
-
Make your database user a superuser:
$ alter role your_user superuser;
-
Run
cap production deploy
from your local machine. This time it should succeed -
Remove superuser from your database user:
$ alter role your_user nosuperuser;
-
Leave PostgreSQL shell:
$ \q
If you're using systemctl / systemd (e.g. Ubuntu 16.04):
-
Add a puma service to the
/etc/systemd/system
directory:$ cd /etc/systemd/system $ sudo nano puma.service
-
Copy the contents from this gist into the puma.service file. See gist comments for modification instructions.
-
Verify the new service. There should be no output.
$ sudo systemd-analyze verify puma.service
-
Enable the service (so that it will be run on reboot)
$ sudo systemctl enable puma.service
-
Verify that the status is enabled
$ sudo systemctl is-enabled puma.service
-
Reboot and verify that puma auto restarts! (Be patient, it might take half a minute)
If you are using Upstart:
Take a look at this article: http://codepany.com/blog/rails-5-puma-capistrano-nginx-jungle-upstart/