Skip to content

Instantly share code, notes, and snippets.

@jejacks0n
Last active May 10, 2018 16:49
Show Gist options
  • Save jejacks0n/bba5fe8bec67c85da41345b414e77dc1 to your computer and use it in GitHub Desktop.
Save jejacks0n/bba5fe8bec67c85da41345b414e77dc1 to your computer and use it in GitHub Desktop.
# rails new appname --skip-bundle --skip-test --webpack=vue --database=postgresql -m https://gist.githubusercontent.com/jejacks0n/bba5fe8bec67c85da41345b414e77dc1/raw/57faf214d548d2f8714756544e5fd6609ae2ee91/rails_template.rb
remove_file "README.md"
file "README.md", <<-MARKDOWN.strip_heredoc
#{app_name}
#{"=" * app_name.length}
One Paragraph/sentence of project description goes here.
### Key Notes
Notes that are helpful to the project, such as:
- Using JIRA for tickets
- JSON comes from client managed CMS (that we don't have access to)
## Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
## Built With
- [Rails](https://rubyonrails.org)
- Blendid
- Sass
### Prerequisites
What things you need to install the software and how to install them
```
Give examples
```
### Installing
A step by step series of examples that tell you have to get a development env running
```
Give the example
```
And repeat
```
until finished
```
## Deployment
Add additional notes about how to deploy this on a live system. Like gulp tasks, if we can even deploy, so on.
### Environments
- Staging: AWS
- Link to the staging site
- Is there a login for staging, if so, where is it?
- Production: Hosted by client on a server in their closet
- Link to production
- Is there a login for productions, if so, where is it?
## Point(s) of Contact
Legwork:
- Sally Gamflexer ( lead front-end on project )
- sally@legworkstudio.com
- Bob Armslacker ( lead back-end on project )
- bob@legworkstudio.com
Client Side:
- Steve McClient ( tech lead for [project] )
- steve@clientssite.com
---
![Legwork Studio](http://www.legworkstudio.com/images/logo@2x.gif "I know what you're thinkin'.")
Make Code Not War
MARKDOWN
# GEMS / MORE SETUP ---------------------------------------------------------------------------------------------------
# add_source "http://gems.github.com/"
# git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem_group :development, :test do
gem "rspec-rails"
end
# DOCKER --------------------------------------------------------------------------------------------------------------
# TODO: upgrade to version 3.6 or so
file "docker-compose.yml", <<-YAML
version: '2'
services:
postgres:
container_name: #{app_name}_postgres
image: postgres:latest
environment:
- POSTGRES_USER=dev
- POSTGRES_PASSWORD=53cr37
volumes:
- postgres-data:/var/lib/postgresql/data
ports:
- "5432:5432"
redis:
container_name: #{app_name}_redis
image: redis:latest
ports:
- "6379:6379"
app:
container_name: #{app_name}_app
build: .
command: bash -c "rm -f tmp/pids/server.pid && bundle install && bundle exec rails db:create db:migrate && bundle exec rails s"
environment:
- DB_CONNECTION_STRING=postgresql://dev:53cr37@postgres
volumes:
- .:/app
- /node_modules
depends_on:
- postgres
- redis
ports:
- "3000:3000"
- "3035:3035"
volumes:
postgres-data:
YAML
file "Dockerfile", <<-DOCKERFILE
FROM starefossen/ruby-node:latest
RUN mkdir /app
WORKDIR /app
COPY . /app
RUN bundle install
DOCKERFILE
remove_file "config/database.yml"
file "config/database.yml", <<-YAML
default: &default
adapter: postgresql
encoding: unicode
# For details on connection pooling, see rails configuration guide
# http://guides.rubyonrails.org/configuring.html#database-pooling
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
url: <%= ENV["DATABASE_URL"] || ENV["DB_CONNECTION_STRING"] %>
pool: 5
development:
<<: *default
database: #{app_name}_development
test:
<<: *default
database: #{app_name}_test
production:
<<: *default
YAML
# FINALIZE ------------------------------------------------------------------------------------------------------------
run "docker-compose build"
run "docker-compose run app rails webpacker:install"
run "docker-compose run app rails generate rspec:install"
git add: "."
git commit: %Q{ -m 'Initial commit' }
run "docker-compose up"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment