• This repository has been archived on 23/Dec/2020
  • Stars
    star
    665
  • Rank 67,794 (Top 2 %)
  • Language
    Ruby
  • License
    MIT License
  • Created over 10 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Opinionated rails application templates.

This project has been deprecated in favor of docker-rails-example

Orats was a fun project that started as an elaborate Rails application template that eventually shifted into being a pre-configured app where Orats itself was a CLI tool to help personalize things like your app's name.

The initial release came out all the way back in February 2014.

It feels like it's time for a fresh start because moving forward I like the idea of having a pre-configured application that has a few opinions baked in, such as using Docker and more. That kind of means that orats as a name doesn't make sense since it's technically no longer a Rails application template.

With that said, I've started a new repo at docker-rails-example that picks up where orats left off while keeping everything current. As Rails continues to get updated this new repo will get updated too.

Thank you for using orats (and now this new repo)! Also, huge shout out to anyone who contributed to orats. Your efforts will not be forgotten. This repo is now archived which means it will remain available in read-only mode but not deleted.


Gem Version

What is orats?

It stands for opinionated rails application templates.

The goal is to provide you an excellent base application that you can use on your next Rails project.

You're meant to generate a project using orats and then build your custom application on top of it.

It also happens to use Docker so that your app can be ran on any major platform -- even without needing Ruby installed.

If you want to learn about Docker specifically then I recommend checking out Dive Into Docker: The Complete Docker Course for Developers.

What versions are you targeting?

Ruby 2.5+

Rails 5.2+

Docker 1.11+ / Docker Compose API v2+

Contents

Installation

gem install orats

Or if you already have orats then run gem update orats to upgrade to the latest version.

If you don't have Ruby installed, then you can generate an app easily with bash.

Commands

To get the details of each command then please run orats help from the terminal. Here's a high level overview:

New

The new command generates a new orats app, which is just a Rails app in the end.

Currently there is only 1 template, which is the "base" template but others may be added in the future.

Try the new command

orats new myproject

Templates

Return a list of available templates to choose from.

Try the templates command

orats templates

Available templates

Base

This is the starter template that every other template will be based upon. I feel like when I make a new project, 95% of the time it includes these features and when I do not want a specific thing it is much quicker to remove it than add it.

Main changes vs a fresh Rails project

  • Core changes:
    • Use postgres as the primary SQL database
    • Use redis as the cache backend
    • Use sidekiq as a background worker through Active Job
    • Use a standalone Action Cable server
    • jQuery is installed with jquery-rails
    • Capybara is commented out in the Gemfile
    • Bootsnap and Credentials are disabled
  • Features:
    • Add a pages controller with home action
  • Config:
    • Extract a bunch of configuration settings to environment variables
    • Rewrite the database.yml and secrets.yml files
    • Add a staging environment
    • Development mode only:
      • Use rack mini profiler for profiling / analysis
    • Production mode only:
      • Add popular file types to the assets pre-compile list
    • Log to STDOUT so that Docker can consume and deal with log entries
    • Change validation errors to output in-line on each element instead of a big list
  • Helpers:
    • title, meta_description, heading to easily set those values per view
    • humanize_boolean to convert true / false into Yes / No
    • css_for_boolean to convert true / false into a css class success / danger
  • Views:
    • Use scss and javascript
    • Use bootstrap 3.x and font-awesome 4.x
    • Add a minimal and modern layout file
    • Conditionally load html5shiv, json3 and respondjs for IE < 9 support
    • Partials:
      • Add navigation
      • Add flash message
      • Add footer
      • Add Google Analytics

FAQ

How can I learn about the Docker specific aspects of the project?

Check out the blog post Dockerize a Rails 5, Postgres, Redis, Sidekiq and Action Cable Application.

Another option is to take my Dive Into Docker course.

What do I do after I generate the application?

Start by reading the above blog post, because the Docker blog post explains how you can run the project. It also goes over a few Docker related caveats that may hang you up if you're not already familiar with Docker.

After that, just dive into the project's source code and write your awesome app!

What's the bare minimum to get things running?

If you don't feel like reading the blog post, this is the bare minimum to get everything up and running -- assuming you have Docker and Docker Compose installed.

# 1) Read the .env file carefully and change any user specific settings, such
#    as e-mail credentials and platform specific settings (check the comments).
#
# 2) Build and run the project with Docker Compose
docker-compose up --build
#
# 3) Reset and Migrate the database (run this in a 2nd Docker-enabled terminal)
# OSX / Windows users can skip adding the --user "$(id -u):$(id -g)" flag
docker-compose exec --user "$(id -u):$(id -g)" website rails db:reset
docker-compose exec --user "$(id -u):$(id -g)" website rails db:migrate
#
# 4a) Running Docker natively? Visit http://localhost:3000
# 4b) Running Docker with the Toolbox? Visit http://192.168.99.100:3000
#     (you may need to replace 192.168.99.100 with your Docker machine IP)

Do I need to install orats to use the base app?

Not really. The base application is already generated and you can view it directly in this repo.

The main benefit of the orats gem is that it will do a recursive find / replace on a few strings to personalize the project for your project's name. It will also make it easy to pick different templates when they are available.

You could easily do this yourself if you don't have Ruby installed on your work station. The 3 strings you'll want to replace are:

  • OratsBase (used as class names and in the generated home page)
  • orats_base (used for a number of Rails specific prefixes and more)
  • VERSION (used to set the current orats version in the generated home page)

You could whip up a simple bash script to do this, such as:

# Clone this repo to a directory of your choosing.
git clone https://github.com/nickjj/orats /tmp/orats

# Copy the base project to a directory of your choosing.
cp -r /tmp/orats/lib/orats/templates/base /tmp/foo_bar

# Swap a few custom values into the base project.
find /tmp/foo_bar -type f -exec sed -i -e 's/OratsBase/FooBar/g' {} \;
find /tmp/foo_bar -type f -exec sed -i -e 's/orats_base/foo_bar/g' {} \;
find /tmp/foo_bar -type f -exec sed -i -e 's/VERSION/5.2.0/g' {} \;

# Rename the example .env file since `.env` is git ignored.
mv /tmp/foo_bar/.env.example /tmp/foo_bar/.env

# Clean up the cloned directory.
rm -rf /tmp/orats

More Repositories

1

docker-django-example

A production ready example Django app that's using Docker and Docker Compose.
Python
1,148
star
2

build-a-saas-app-with-flask

Learn how to build a production ready web app with Flask and Docker.
HTML
950
star
3

docker-rails-example

A production ready example Rails app that's using Docker and Docker Compose.
Ruby
945
star
4

dotfiles

Settings for various tools I use.
Shell
938
star
5

ansible-docker

Install / Configure Docker and Docker Compose using Ansible.
Python
744
star
6

docker-flask-example

A production ready example Flask app that's using Docker and Docker Compose.
Python
583
star
7

ansigenome

A tool to help you gather information and manage your Ansible roles.
Python
447
star
8

flask-webpack

A Flask extension to manage assets with Webpack.
Python
338
star
9

rolespec

A test library for testing Ansible roles
Shell
232
star
10

docker-web-framework-examples

Example apps that demonstate how to use Docker with your favorite web frameworks.
Elixir
217
star
11

docker-phoenix-example

A production ready example Phoenix app that's using Docker and Docker Compose.
Elixir
207
star
12

docker-node-example

An example Node / Express app that's using Docker and Docker Compose.
Shell
200
star
13

flask-static-digest

Flask extension to help make your static files production ready by md5 tagging and gzipping them.
Python
154
star
14

notes

A zero dependency shell script that makes it really simple to manage your text notes.
Shell
129
star
15

manifest-revision-webpack-plugin

Write out a manifest file containing your versioned webpack chunks and assets.
JavaScript
124
star
16

flask-db

A Flask CLI extension to help migrate and manage your SQL database.
Python
75
star
17

ansible-nginx

Install and configure nginx (SSL A+ by default) with Ansible.
Jinja
73
star
18

ansible-acme-sh

Install and auto-renew SSL certificates with Let's Encrypt using acme.sh.
71
star
19

wait-until

A zero dependency Bash script that waits until a command of your choosing has run successfully.
Shell
57
star
20

webserver

A zero dependency Python 3 web server to echo back an HTTP request's headers and data.
Python
50
star
21

ansible-user

Create and configure a user for SSH key based logins and passwordless sudo.
48
star
22

dockercon21-docker-best-practices

Reference links for my live demo talk from DockerCon 21.
47
star
23

ansible-fail2ban

Install and configure fail2ban using ansible.
46
star
24

runninginproduction.com

The website for the Running in Production podcast.
HTML
41
star
25

esbuild-copy-static-files

An esbuild plugin to copy static files that changed from a source directory to a destination directory.
Shell
37
star
26

flask-pg-extras

A Flask extension to obtain useful information from your PostgreSQL database.
Python
33
star
27

ansible-swapfile

Create and configure a swap file with Ansible.
32
star
28

ansible-letsencrypt

Install and auto-renew SSL certificates with Let's Encrypt and Ansible.
Python
29
star
29

invoice

Calculate a billable amount, hours and days logged for 1 or more projects.
Shell
18
star
30

nyhackr-cli-dev-env

Reference notes for the Creating a Command Line Driven Development Environment talk.
18
star
31

ansible-playbooks

A collection of ansible playbooks with end to end examples.
Shell
18
star
32

ansible-rails

Deploy a rails application using git with ansible.
Ruby
18
star
33

gowatcher

Reload a specified go program automatically by monitoring a directory.
Shell
16
star
34

docker-community-all-hands

Reference links to every talk I've given for the Docker Community All-Hands events.
15
star
35

deploy-web-apps-with-docker

Rescue yourself from the complexity of DevOps
Dockerfile
15
star
36

title-case-converter

A CLI tool to capitalize words based on industry standard style guides.
Python
14
star
37

sublime-text-3-packages

A list of my Sublime Text 3 packages along with their settings.
Python
14
star
38

flask-secrets

A Flask CLI extension to generate random secret tokens.
Python
14
star
39

verdiff

A CLI tool to diff 2 versions of a Phoenix, Rails, Django or Laravel generated project.
Python
12
star
40

ansible-security

Configure ssh and ufw as well as install fail2ban with ansible.
12
star
41

gemshine

Recursively compare a ruby project's gem versions to their latest versions.
Ruby
12
star
42

ansible-iptables

Configure iptables using Ansible.
12
star
43

lcurl

Visit a site every X seconds in a loop to help detect downtime while testing deployment strategies.
Shell
12
star
44

ansible-sshd

Install and configure openssh-server using Ansible.
12
star
45

demo-for-chattanooga-python-user-group

A demo app for a talk I gave at the Chattanooga python user group.
JavaScript
10
star
46

latest-releases

A command line tool that lets you keep tabs on the latest releases of your favorite tools and libraries.
Shell
10
star
47

ansible-monit

Install monit and configure as many processes as you want with ansible.
8
star
48

passify

A small utility to create a password and wrap bcrypt.
JavaScript
8
star
49

pick-random-youtube-comments

Get a list of top level comments from a YouTube video and then pick N amount of unique comment authors by choosing them randomly.
Python
8
star
50

ansible-bootstrap

Configure a server to run Ansible and install essential packages.
6
star
51

ansible-ferm

Manage iptables with ferm using ansible.
5
star
52

ansible-postgres

Install a bare bones version of postgres with ansible.
5
star
53

ansible-pumacorn

Manage a puma or unicorn rails process with init.d using ansible.
Ruby
5
star
54

docker-faye

A docker image for running a secure Faye (websocket) server.
JavaScript
5
star
55

ansible-nodejs

Install the latest stable version of nodejs with ansible.
4
star
56

ansible-mariadb

Install and configure MariaDB using Ansible.
4
star
57

ansible-sendy

Copy and configure Sendy with Ansible.
C
3
star
58

ansible-locale

Install and configure your system's locale using ansible
3
star
59

ansible-phpfpm

Install and configure php-fpm using Ansible.
2
star
60

ansible-dnsmasq

Install and configure dnsmasq to map a TLD to localhost using ansible.
2
star
61

docker-play-example

A production ready example Play app that's using Docker and Docker Compose.
1
star