Monday, September 26, 2016

Setting up NGINX as server for Ionic and reverse proxy for Rails on AWS

For Assignment 3, we implemented a RESTful application, Wishes (www.wishful.tk), with Ionic as front-end framework and Rails as back-end server. Regrading the deployment, there is very limited resource on how to setup Ionic and Rails with NGINX on Ubuntu and make them work together. After days of searching and a few trials, I come up with the following steps.

  1. Install NGINX on Ubuntu 14-04
    1. https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-14-04-lts
  2. Install letsencrypt to get CA certificate
    1. https://certbot.eff.org/#ubuntutrusty-nginx
  3. Update NGINX config to enable HTTPS connection
    1. https://certbot.eff.org/#ubuntutrusty-nginx
    2. http://nginx.org/en/docs/http/configuring_https_servers.html
  4. Setup Ionic
    1. http://ionicframework.com/docs/guide/installation.html
  5. Install git
    1. sudo apt-get install git
    2. sudo npm install gulp -g
  6. Clone frontend repo onto server
    1. git clone https://github.com/Wishes-CS3216/Wishes-Frontend.git
  7. Update NGINX configuration (located at /etc/nginx/sites-avaiable/default)
    1. http://nginx.org/en/docs/beginners_guide.html
    2. restar NGINX
  8. Setup Rails
    1. https://gorails.com/setup/ubuntu/14.10
  9. Clone backend repo
    1. git clone https://github.com/Wishes-CS3216/Wishes-Backend.git
  10. Update NGINX configuration
    1. https://www.digitalocean.com/community/tutorials/how-to-deploy-a-rails-app-with-puma-and-nginx-on-ubuntu-14-04 (We are using Puma here. Other alternatives are Passenger and Unicorn)
    2. git clone https://github.com/Wishes-CS3216/Wishes-Backend.git
    3. update Rails configurations if necessary (under repo/config/ folder)
    4. start Puma
    5. restart NGINX
Links to relevant resource are attached here. Hope it can be useful. If you are still confused about the detailed configurations please feel free to comment below. Cheers =)

No comments:

Post a Comment