Before you continue
Please make sure you have done the following :
- A Github account
- A Digital Ocean account & cash-in the voucher given earlier
- Have Ruby installed locally
- Have Redis Server installed locally
- Have PostgreSQL installed locally
- Prepare SSH key for your machine
Outline
In this tutorial we are building 2 simple apps - Shopping Cart & Customer Relationship Management (CRM) portal.
The Shopping Cart will have a catalogue of products, then customers can buy and sales will be captured. And in the end the customer’s information is sent to the CRM.
In addition to that, we want to queue up the API requests so that the purchase process is not blocked / slowed down.
And finally, we need to write an automated deployment script to deploy both apps to their respective servers.
Step 1: Creating the Shopping Cart
Estimate time: 20 mins
Create Rails App with PostgreSQL database [how ah?]
Admin login using Devise [how ah?]
Setup Upmin Admin on /admin [how ah?]
Scaffold “Products” Model
Add some styles
[how ah?]
Scaffold “Sales”
Product Checkout & Sales
Step 2: Creating the CRM
Estimate time: 30 mins
User login using Devise [how ah?]
Scaffold Customers Model [how ah?]
Setup Upmin Admin [how ah?]
“API Applications” Model
Setup API with Grape
Setup API Documentation with Grape-Swagger-Rails
Step 3: Integrating with API
Estimate time: 20 mins
Generate API token for Shopping Cart app
Use API token to send customer data to CRM
Setup Rails Config
Step 4: Queue Up Jobs
Estimate time: 15 mins
Setup Sidekiq
Use Sidekiq to queue up jobs
Step 5: Setup Digital Ocean
Estimate time: 15 mins
Generate / Get public SSH Key for machine
Add SSH Key
Create two (2) 14.04 x64 Ubuntu droplets with private networking
Step 6: Prep the Servers
Estimate time: 20 mins
Install rbenv with ruby-build
Install PostgreSQL
Install Redis Server
Security tweaks: change SSH port and disable root access
Step 7: Deployment
Estimate time: 15 mins
Setup Capistrano with Capistrano Rbenv + Capistrano Sidekiq + Capistrano Unicorn Nginx
Create & upload production settings
Finally … Deploy Live !!