-
Clone this repositoty
$ git clone git@github.com:sshkarupa/rails-startup-kit.git
-
Rename the
rails-startup-kit
in your project's name (for example, incool_project
)$ mv rails-startup-kit cool_project
-
Change the default project's name in these files:
- devops/base/dockerfile - devops/dev/dockerfile - devops/dev/docker-compose.yml - devops/prod/dockerfile - Makefile
You need to change the project's name from
my_app
tocool_project
and the namespace for docker images (DOCKER_NAMESPACE
inMakefile
) fromsshkarupa
towhat-ever-you-want
. -
Go to your project's folder and remove the old
.git
folder$ cd cool_project && rm -rf .git
-
Rename
devops/dev/.sample.env
todevops/dev/.env
cool_project$ mv devops/dev/{.sample.env,.env}
-
Build the base docker image:
cool_project$ make build:base
-
Build the development docker image:
coool_project$ make build:dev
-
Run a docker container and generate a new rails application
cool_project$ make run /usr/src/cool_project# rails new . --skip-coffee --skip-turbolinks --skip-sprockets --webpack --database=postgresql -T -f /usr/src/cool_project# exit
-
Change owners for all folders and file which were generated inside the container (you will need to type your sudo password):
cool_project$ make owner
-
Change your
config/database.yml
(default block) something like this:
default: &default
adapter: postgresql
encoding: unicode
host: <%= ENV.fetch('DATABASE_HOST', 'db')%>
username: <%= ENV.fetch('DATABASE_USERNAME', 'postgres')%>
password: <%= ENV.fetch('DATABASE_PASSWORD', '')%>
-
Create databases:
cool_project$ make rake db:create
-
Run rails server:
cool_project$ make start
You're all set!