roro 0.3.17 → 0.3.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +11 -10
- data/.gitignore +3 -2
- data/Guardfile +8 -10
- data/README.md +2 -1
- data/lib/roro.rb +1 -0
- data/lib/roro/cli.rb +13 -7
- data/lib/roro/cli/generate/story.rb +18 -0
- data/lib/roro/cli/greenfield/rails.rb +2 -24
- data/lib/roro/cli/rollon.rb +135 -8
- data/lib/roro/cli/rollon/rails/base/base.rb +4 -0
- data/lib/roro/cli/{base → rollon/rails/base}/insert_gems.rb +2 -10
- data/lib/roro/cli/{base → rollon/rails/base}/insertions.rb +8 -0
- data/lib/roro/cli/rollon/rails/database.rb +4 -8
- data/lib/roro/cli/rollon/rails/database/with_mysql.rb +2 -2
- data/lib/roro/cli/rollon/rails/database/with_postgresql.rb +3 -4
- data/lib/roro/cli/rollon/ruby_gem/with_ci_cd.rb +7 -7
- data/lib/roro/configurator.rb +15 -0
- data/lib/roro/configurator/eligibility.rb +137 -0
- data/lib/roro/configurator/okonomi.rb +28 -0
- data/lib/roro/configurator/omakase.rb +170 -0
- data/lib/roro/stories/greenfield.yml +1 -0
- data/lib/roro/stories/greenfield/rails.yml +9 -0
- data/lib/roro/stories/rollon.yml +42 -0
- data/lib/roro/stories/rollon/rails.yml +76 -0
- data/lib/roro/stories/rollon/rails/ci_cd.yml +1 -0
- data/lib/roro/stories/rollon/rails/ci_cd/circleci.yml +2 -0
- data/lib/roro/stories/rollon/rails/database.yml +9 -0
- data/lib/roro/stories/rollon/rails/database/mysql.yml +17 -0
- data/lib/roro/stories/rollon/rails/database/postgresql.yml +15 -0
- data/lib/roro/stories/rollon/rails/kubernetes.yml +1 -0
- data/lib/roro/stories/rollon/rails/kubernetes/postgresql.yml +10 -0
- data/lib/roro/stories/rollon/rails/kubernetes/postgresql/default.yml +1 -0
- data/lib/roro/stories/rollon/rails/kubernetes/postgresql/edge.yml +1 -0
- data/lib/roro/stories/rollon/ruby_gem.yml +5 -0
- data/lib/roro/{cli/templates/rails → templates/base}/.circleci/_aliases.yml +0 -0
- data/lib/roro/templates/base/.circleci/_commands.yml +31 -0
- data/lib/roro/templates/base/.circleci/_defaults.yml +5 -0
- data/lib/roro/templates/base/.circleci/_executors.yml +11 -0
- data/lib/roro/templates/base/.circleci/_major_only.yml +4 -0
- data/lib/roro/templates/base/.circleci/_version.yml +1 -0
- data/lib/roro/{cli/templates → templates}/base/.circleci/_workflow.yml +0 -0
- data/lib/roro/{cli/templates → templates}/base/.circleci/config.job-example.yml +5 -5
- data/lib/roro/{cli/templates → templates}/base/.circleci/jobs/_build.yml +0 -0
- data/lib/roro/{cli/templates → templates}/base/.circleci/jobs/_release.yml +0 -0
- data/lib/roro/{cli/templates → templates}/base/.circleci/workflows/_build_release.yml +0 -0
- data/lib/roro/{cli/templates → templates}/base/.dockerignore +0 -0
- data/lib/roro/{cli/templates → templates}/base/dotenv +0 -0
- data/lib/roro/{cli/templates → templates}/base/jumpstart/.keep +0 -0
- data/lib/roro/{cli/templates → templates}/base/jumpstart/Dockerfile.tt +0 -0
- data/lib/roro/{cli/templates → templates}/base/jumpstart/docker-compose.yml +0 -0
- data/lib/roro/{cli/templates → templates}/base/jumpstart/docker-entrypoint.sh +0 -0
- data/lib/roro/{cli/templates → templates}/base/livereload/hosts.example +0 -0
- data/lib/roro/{cli/templates → templates}/base/roro/.keep +0 -0
- data/lib/roro/{cli/templates → templates}/base/roro/roro/.keep +0 -0
- data/lib/roro/{cli/templates → templates}/base/roro/roro/containers/.keep +0 -0
- data/lib/roro/{cli/templates → templates}/base/roro/roro/containers/app/.keep +0 -0
- data/lib/roro/{cli/templates → templates}/base/roro/roro/containers/frontend/.keep +0 -0
- data/lib/roro/{cli/templates → templates}/base/roro/roro/docker-entrypoint.sh.tt +0 -0
- data/lib/roro/{cli/templates → templates}/rails/.circleci/.keep +0 -0
- data/lib/roro/{cli/templates → templates}/rails/.circleci/config.yml.tt +4 -6
- data/lib/roro/{cli/templates → templates}/rails/.circleci/jobs/_build.yml +4 -6
- data/lib/roro/templates/rails/.circleci/jobs/_push.yml +11 -0
- data/lib/roro/templates/rails/.circleci/jobs/_test.yml +12 -0
- data/lib/roro/{cli/templates → templates}/rails/.circleci/setup-gem-credentials.sh +0 -0
- data/lib/roro/templates/rails/.circleci/workflows/_build_test_push.yml +12 -0
- data/lib/roro/{cli/templates → templates}/rails/.keep +0 -0
- data/lib/roro/templates/rails/Dockerfile.greenfield.tt +51 -0
- data/lib/roro/{cli/templates → templates}/rails/config/database.mysql.yml +0 -0
- data/lib/roro/{cli/templates → templates}/rails/config/database.pg.yml +2 -3
- data/lib/roro/{cli/templates/stories → templates/rails/database}/with_mysql/_service.yml +0 -0
- data/lib/roro/{cli/templates → templates}/rails/database/with_postgresql/.keep +0 -0
- data/lib/roro/{cli/templates/stories → templates/rails/database}/with_postgresql/_service.yml +0 -0
- data/lib/roro/{cli/templates → templates}/rails/docker-compose.yml.tt +3 -3
- data/lib/roro/{cli/templates → templates}/rails/dotenv/.keep +0 -0
- data/lib/roro/templates/rails/dotenv/database.mysql.env.tt +6 -0
- data/lib/roro/templates/rails/dotenv/database.pg.env.tt +4 -0
- data/lib/roro/{cli/templates → templates}/rails/dotenv/web.env.tt +0 -0
- data/lib/roro/templates/rails/kube.rake.tt +114 -0
- data/lib/roro/{cli/templates → templates}/rails/roro/.keep +0 -0
- data/lib/roro/{cli/templates → templates}/rails/roro/containers/.keep +0 -0
- data/lib/roro/{cli/templates → templates}/rails/roro/containers/app/.keep +0 -0
- data/lib/roro/templates/rails/roro/containers/app/Dockerfile.tt +34 -0
- data/lib/roro/{cli/templates → templates}/rails/roro/containers/frontend/.keep +0 -0
- data/lib/roro/{cli/templates/rails/roro/docker-entrypoint.sh.tt → templates/rails/roro/docker-entrypoint.sh} +0 -0
- data/lib/roro/{cli/templates/rails/roro/roro → templates/rails/roro/kube}/.keep +0 -0
- data/lib/roro/{cli/templates/rails/roro/roro/containers/.keep → templates/rails/roro/kube/certificate.yml.tt} +0 -0
- data/lib/roro/{cli/templates/rails/roro/roro/containers/app/.keep → templates/rails/roro/kube/cluster-issuer.yml.tt} +0 -0
- data/lib/roro/templates/rails/roro/kube/deployment.yml.tt +50 -0
- data/lib/roro/templates/rails/roro/kube/deployments/postgres_deploy.yaml +47 -0
- data/lib/roro/templates/rails/roro/kube/deployments/rails_deploy.yaml +62 -0
- data/lib/roro/templates/rails/roro/kube/deployments/redis_deploy.yaml +23 -0
- data/lib/roro/templates/rails/roro/kube/deployments/sidekiq_deploy.yaml +56 -0
- data/lib/roro/{cli/templates/rails/roro/roro/containers/frontend/.keep → templates/rails/roro/kube/ingress.yml.tt} +0 -0
- data/lib/roro/templates/rails/roro/kube/ingresses/ingress.yaml +13 -0
- data/lib/roro/{cli/templates/ruby_gem/.circleci/.keep → templates/rails/roro/kube/job-migrate.yml.tt} +0 -0
- data/lib/roro/templates/rails/roro/kube/jobs/setup.yaml +42 -0
- data/lib/roro/templates/rails/roro/kube/secret-digital-ocean.yml.tt +4 -0
- data/lib/roro/templates/rails/roro/kube/service.yml.tt +10 -0
- data/lib/roro/templates/rails/roro/kube/services/postgres_svc.yaml +13 -0
- data/lib/roro/templates/rails/roro/kube/services/rails_svc.yaml +13 -0
- data/lib/roro/templates/rails/roro/kube/services/redis_svc.yaml +13 -0
- data/lib/roro/templates/rails/roro/kube/volumes/postgres_volumes.yaml +25 -0
- data/lib/roro/{cli/templates/ruby_gem/roro/containers → templates/ruby_gem/.circleci}/.keep +0 -0
- data/lib/roro/{cli/templates → templates}/ruby_gem/.circleci/config.yml.tt +4 -4
- data/lib/roro/templates/ruby_gem/.circleci/jobs/_test.yml +4 -0
- data/lib/roro/{cli/templates → templates}/ruby_gem/.circleci/setup-gem-credentials.sh +0 -0
- data/lib/roro/{cli/templates → templates}/ruby_gem/docker-compose.yml +0 -0
- data/lib/roro/{cli/templates/ruby_gem/roro/keys → templates/ruby_gem/roro/containers}/.keep +0 -0
- data/lib/roro/{cli/templates → templates}/ruby_gem/roro/containers/ruby_image/Dockerfile.tt +1 -1
- data/lib/roro/templates/ruby_gem/roro/containers/ruby_image/ci.env.tt +1 -0
- data/lib/roro/{cli/templates/stories → templates/ruby_gem/roro/keys}/.keep +0 -0
- data/lib/roro/version.rb +1 -1
- metadata +101 -80
- data/lib/roro/cli/base/base.rb +0 -8
- data/lib/roro/cli/base/base_files.rb +0 -24
- data/lib/roro/cli/base/check_dependencies.rb +0 -97
- data/lib/roro/cli/base/continuous_integration.rb +0 -13
- data/lib/roro/cli/base/utilities.rb +0 -38
- data/lib/roro/cli/configuration.rb +0 -69
- data/lib/roro/cli/generate/config.rb +0 -11
- data/lib/roro/cli/generate/config/rails.rb +0 -17
- data/lib/roro/cli/rollon/rails.rb +0 -47
- data/lib/roro/cli/rollon/stories/stories.rb +0 -3
- data/lib/roro/cli/roro_configurator.yml +0 -157
- data/lib/roro/cli/templates/base/.circleci/_defaults.yml +0 -17
- data/lib/roro/cli/templates/base/.roro_config.yml +0 -15
- data/lib/roro/cli/templates/rails/.circleci/jobs/_push.yml +0 -23
- data/lib/roro/cli/templates/rails/.circleci/jobs/_test.yml +0 -13
- data/lib/roro/cli/templates/rails/.circleci/workflows/_build_test_push.yml +0 -9
- data/lib/roro/cli/templates/rails/Dockerfile.greenfield.tt +0 -47
- data/lib/roro/cli/templates/rails/database/with_mysql/_service.yml +0 -10
- data/lib/roro/cli/templates/rails/database/with_postgresql/_service.yml +0 -7
- data/lib/roro/cli/templates/rails/dotenv/database.mysql.env.tt +0 -3
- data/lib/roro/cli/templates/rails/dotenv/database.pg.env.tt +0 -4
- data/lib/roro/cli/templates/rails/roro/containers/app/Dockerfile.tt +0 -88
- data/lib/roro/cli/templates/rails/roro/roro/docker-entrypoint.sh.tt +0 -8
- data/lib/roro/cli/templates/ruby_gem/roro/containers/ruby_image/ci.env.tt +0 -1
- data/lib/roro/cli/templates/stories/ruby_gem/with_ci_cd/_build.yml +0 -11
- data/lib/roro/cli/templates/stories/with_postgresql/.keep +0 -0
- data/lib/tasks/deploy.rake +0 -126
@@ -1,88 +0,0 @@
|
|
1
|
-
## The FROM instruction below builds our first layer using an official image:
|
2
|
-
FROM ruby:<%= config['ruby_version'] %>
|
3
|
-
|
4
|
-
LABEL maintainer="<%= config['dockerhub_email'] %>"
|
5
|
-
|
6
|
-
## This is a rails app so, we will want to add node and yarn. In order for our
|
7
|
-
## container to trust yarn as a source, we first need to add yarn's public key.
|
8
|
-
## One good way to accomplish this is with apt-key, but apt-key is designed to
|
9
|
-
## send output to the terminal and not to stdout, and thus apt-key will send a
|
10
|
-
## warning message during the build context. One way to deal with the warning
|
11
|
-
## is to set an environment variable telling apt-get to be quiet. To do this,
|
12
|
-
## you'd first write an ENV instruction setting the environment variable, then
|
13
|
-
## write the RUN instruction adding the key to the container, and then you'd
|
14
|
-
## have to write another ENV instruction unsetting the variable. This would be
|
15
|
-
## ugly and inconvenient. Another way to deal with the warning is to just ignore
|
16
|
-
## it. There's no shame in that but ignoring it in the build context might
|
17
|
-
## condition us to ignore it in other contexts. But what if there was a way to
|
18
|
-
## deal with it that allowed you to set that variable just for the build
|
19
|
-
## context? Fortunately there is, using the ARG instruction. Variables set with
|
20
|
-
## ARG instructions stay in the build context while those set with ENV
|
21
|
-
## instructions follow into the container.
|
22
|
-
|
23
|
-
## Use an ARG instruction to set a variable disabling the apt-key warning:
|
24
|
-
ARG APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1
|
25
|
-
|
26
|
-
## Add yarn's public key using apt-key:
|
27
|
-
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
|
28
|
-
|
29
|
-
## Add yarn to our sources:
|
30
|
-
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
|
31
|
-
|
32
|
-
|
33
|
-
## Build a layer updating the image while adding node and yarn from the source
|
34
|
-
## above:
|
35
|
-
RUN apt-get update -qq && apt-get install -y build-essential git nodejs yarn
|
36
|
-
|
37
|
-
## We have two directories we'd like to follow from the build context into
|
38
|
-
## our containers. APP_HOME is where we'll do most of our work and BUNDLE_PATH
|
39
|
-
## is where we want bundler to store our gems.
|
40
|
-
|
41
|
-
## Set APP_HOME and BUNDLE_PATH as using ENV instructions:
|
42
|
-
ENV APP_HOME /usr/src/app/
|
43
|
-
ENV BUNDLE_PATH /gems
|
44
|
-
|
45
|
-
## Create both as directories to make sure they exist:
|
46
|
-
RUN mkdir ${APP_HOME}
|
47
|
-
RUN mkdir ${BUNDLE_PATH}
|
48
|
-
|
49
|
-
## Tell Docker to create volumes for our workspace and gems
|
50
|
-
## so other containers can access them.
|
51
|
-
VOLUME ${APP_HOME}
|
52
|
-
VOLUME ${BUNDLE_PATH}
|
53
|
-
|
54
|
-
## If we copy our entire app using a single COPY instruction, Docker will build
|
55
|
-
## it all as a single new layer. When Docker notices a change to a file, it then
|
56
|
-
## has to rebuild the entire layer. This can slow development. One way to speed
|
57
|
-
## it back up is to break a single big COPY layer into several smaller ones,
|
58
|
-
## with slow-building layers that don't change often underneath smaller,
|
59
|
-
## lighter, qucker oens that might change a lot.
|
60
|
-
|
61
|
-
## Set your work directory:
|
62
|
-
WORKDIR ${APP_HOME}
|
63
|
-
|
64
|
-
## You may need to adjust the bundler version based on your app Gemfile.lock's
|
65
|
-
## bundler version:
|
66
|
-
RUN gem install bundler:2.1.4
|
67
|
-
|
68
|
-
## Set your work directory. After this line you will be running commands in
|
69
|
-
## ${APP_HOME}. COPY instructions will move files from host to ${APP_HOME}:
|
70
|
-
WORKDIR ${APP_HOME}
|
71
|
-
|
72
|
-
## Build your big, slow gem layer by first copying your Gemfile && Gemfile.lock:
|
73
|
-
COPY package.json ./
|
74
|
-
COPY Gemfile* ./
|
75
|
-
|
76
|
-
## build the bundle layer, which now only runs if your Gemfile changes:
|
77
|
-
RUN bundle
|
78
|
-
|
79
|
-
## Now build a layer with everything in your app that's likely to change
|
80
|
-
## frequently. If you make a change to any of these files, only this layer has
|
81
|
-
## to rebuild:
|
82
|
-
COPY . ${APP_HOME}
|
83
|
-
|
84
|
-
## Now make your entrypoint executable.
|
85
|
-
RUN chmod +x roro/docker-entrypoint.sh
|
86
|
-
|
87
|
-
|
88
|
-
|
@@ -1 +0,0 @@
|
|
1
|
-
export RUBYGEMS_API_KEY=<%= config['rubygems_api_key'] %>
|
@@ -1,11 +0,0 @@
|
|
1
|
-
build:
|
2
|
-
machine: true
|
3
|
-
steps:
|
4
|
-
- checkout
|
5
|
-
|
6
|
-
<%= 'getsome' %>
|
7
|
-
- run: gem install roro
|
8
|
-
- run: roro generate::exposed ci
|
9
|
-
- run: echo 'source roro/containers/ruby_image/ci.env' >> $BASH_ENV
|
10
|
-
- run: gem install gem-release
|
11
|
-
# - run: gem release --key $RUBYGEMS_API_KEY
|
File without changes
|
data/lib/tasks/deploy.rake
DELETED
@@ -1,126 +0,0 @@
|
|
1
|
-
# use SSHKit directly instead of Capistrano
|
2
|
-
require 'sshkit'
|
3
|
-
require 'sshkit/dsl'
|
4
|
-
include SSHKit::DSL
|
5
|
-
|
6
|
-
deploy_tag = ENV['DEPLOY_TAG']
|
7
|
-
hostname = ENV['SERVER_HOST']
|
8
|
-
user = ENV['SERVER_USER']
|
9
|
-
dockerhub_user = ENV['DOCKERHUB_USER']
|
10
|
-
dockerhub_pass = ENV['DOCKERHUB_PASS']
|
11
|
-
dockerhub_org = ENV['DOCKERHUB_ORG']
|
12
|
-
port = ENV['SERVER_PORT']
|
13
|
-
deploy_env = ENV['DEPLOY_ENV'] || :production
|
14
|
-
deploy_path = ENV['APP_NAME']
|
15
|
-
|
16
|
-
server = SSHKit::Host.new(hostname: hostname, port: port, user: user)
|
17
|
-
|
18
|
-
namespace :deploy do
|
19
|
-
|
20
|
-
desc 'copy to server files needed to run and manage Docker containers'
|
21
|
-
task :configs do
|
22
|
-
|
23
|
-
on server do
|
24
|
-
within deploy_path do
|
25
|
-
upload! File.expand_path('../../docker/overrides/production.docker-compose.yml', __dir__), 'docker-compose.yml'
|
26
|
-
upload! File.expand_path('../../docker', __dir__), '.', recursive: true
|
27
|
-
execute 'apt', 'install', 'ruby'
|
28
|
-
execute 'gem', 'install', 'handsome_fencer-circle_c_i'
|
29
|
-
execute 'handsome_fencer-circle_c_i', 'expose', 'production'
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
desc 'copy production key to server'
|
35
|
-
task :production_key do
|
36
|
-
|
37
|
-
on server do
|
38
|
-
within deploy_path do
|
39
|
-
|
40
|
-
upload! '.circleci/keys/production.key', '.circleci/keys/production.key'
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
desc 'expose production environment'
|
46
|
-
task :expose_production_environment do
|
47
|
-
|
48
|
-
on server do
|
49
|
-
within deploy_path do
|
50
|
-
|
51
|
-
execute 'apt', 'install', 'ruby'
|
52
|
-
execute 'gem', 'install', 'handsome_fencer-circle_c_i'
|
53
|
-
execute 'handsome_fencer-circle_c_i', 'expose', 'production'
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
|
60
|
-
namespace :docker do
|
61
|
-
|
62
|
-
desc 'logs into Docker Hub for pushing and pulling'
|
63
|
-
|
64
|
-
task :login do
|
65
|
-
on server do
|
66
|
-
execute "mkdir -p #{deploy_path}"
|
67
|
-
within deploy_path do
|
68
|
-
execute 'docker', 'login', '-u', dockerhub_user, '-p', dockerhub_pass
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
desc 'stops all Docker containers via Docker Compose'
|
74
|
-
|
75
|
-
task stop: 'deploy:configs' do
|
76
|
-
on server do
|
77
|
-
within deploy_path do
|
78
|
-
with rails_env: deploy_env, deploy_tag: deploy_tag do
|
79
|
-
execute 'docker-compose', 'stop'
|
80
|
-
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
desc 'starts all Docker containers via Docker Compose'
|
87
|
-
|
88
|
-
task start: 'deploy:configs' do
|
89
|
-
on server do
|
90
|
-
within deploy_path do
|
91
|
-
with rails_env: deploy_env, deploy_tag: deploy_tag do
|
92
|
-
execute 'docker-compose', 'up', '-d'
|
93
|
-
execute 'echo', deploy_tag , '>', 'deploy.tag'
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
desc 'pulls images from Docker Hub'
|
100
|
-
|
101
|
-
task pull: 'docker:login' do
|
102
|
-
on server do
|
103
|
-
within deploy_path do
|
104
|
-
["#{deploy_path}_app", "#{deploy_path}_web"].each do |image_name|
|
105
|
-
execute 'docker', 'pull', "#{dockerhub_org}/#{image_name}:#{deploy_tag}"
|
106
|
-
end
|
107
|
-
execute 'docker', 'pull', 'postgres:9.4.5'
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
|
113
|
-
desc 'runs database migrations in application container via Docker Compose'
|
114
|
-
task migrate: 'deploy:configs' do
|
115
|
-
on server do
|
116
|
-
within deploy_path do
|
117
|
-
with rails_env: deploy_env, deploy_tag: deploy_tag do
|
118
|
-
execute 'docker-compose', 'run', 'app', "bin/rails", 'db:create', 'db:migrate'
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
desc 'pulls images, stops old containers, updates the database, and starts new containers'
|
125
|
-
task deploy: %w{docker:pull docker:stop docker:migrate docker:start }
|
126
|
-
end
|