This repo contains a sample blog built with Ruby on Rails. There are instructions below to get the app working in both development and production environments.
- Articles
- Unauthenticated users can view articles
- Admins can create, edit, delete, and view articles
- Article resources has title, blurb (summary of main content), body, tags, and comments
- Tags
- Tags have many-to-many relationship with articles
- Can display list of tags
- Can display list of articles for a given tag
- Comments
- Unauthenticated users can create and view comments
- Admins can create, view, and delete comments
- Comments are limited to five per article to avoid spamming
- Data
- Article and tag data can be seeded using a database seeder
- Assets
- SASS is compiled into CSS and serverd to the user
- Coffee script is compiled into JS and served to the user
- Production
- The code can run in a production environment using Nginx, Unicorn, and Linux
- Code can be deployed via Capistrano
- All routes are sent via SSL
To get a development version of the app running follow the steps below:
- Clone the repository
- Run "rails server"
- Run "rake db:seed"
To get a development version of the app running follow the steps below:
- Log onto Digital ocean and spin up a server with Ubuntu 14.04 x 64
- Install Ruby and rbenv according to this tutorial
- Configure the server with Unicorn and Nginx according to this tutorial
- The only divergence from the tutorial is that you need to point the root in your Nginx configuration to "/public/current" instead of "/public" for Capistrano
- Follow this tutorial to get SSL working with LetsEncrypt
- Make sure that you have SECRET_KEY_BASE set and RAILS_ENV=production in your .rbenv-vars file in the root of the app
- Change the server settings in the "/config/deploy/production.rb" file to your server's IP and a user with sudo capability
- Run "bundle exec cap production deploy:inital"
- SSH into your server and run "rake db:seed"
- Navigate to your server's IP in the browser to use the blog app!