Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

Server Setup

Finn Woelm edited this page Aug 7, 2017 · 5 revisions

~~ Work in Progress ~~

  1. Spin up a server at DigitalOcean

  2. Set up your firewall

  3. Set up non-root user

  4. Set up PostgreSQL database

  5. Modify /etc/postgres.../pga_hba.conf file to allow MD5 authentication

  6. Set up a database and database user

  7. Install libpq-dev (needed for gem 'pg')

     $ sudo apt-get install libpq-dev
    
  8. Install NodeJS as JS runtime

     $ sudo apt-get install nodejs
    
  9. Set up Nginx, rvm, and Rails up to step 6

  10. Deploy environment variables

     $ cap production figaro_yml:setup
    
  11. 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/upshift/shared/public -d <domain-name>
    
  12. Update Diffie-Hellman Parameters

     $ sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048
    
  13. Set up certbot auto renewal

  14. Now continue Set up Nginx, rvm, and Rails up with step 7

  15. Confirm that your site is live!

  16. Confirm that your SSL Rating is A+

FAQ

Error during cap production deploy: Cannot create extension "citext"

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.

  1. Connect to the server: $ ssh user@server

  2. Connect to PostgreSQL as the superuser (not your database user):

    $ sudo su postgres
    $ \psql
    
  3. Make your database user a superuser: $ alter role your_user superuser;

  4. Run cap production deploy from your local machine. This time it should succeed

  5. Remove superuser from your database user: $ alter role your_user nosuperuser;

  6. Leave PostgreSQL shell: $ \q

Clone this wiki locally