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,69 +0,0 @@
|
|
1
|
-
require 'yaml'
|
2
|
-
module Roro
|
3
|
-
class Configuration < Thor
|
4
|
-
|
5
|
-
attr_reader :master, :app, :choices, :thor_actions
|
6
|
-
|
7
|
-
def initialize(options={})
|
8
|
-
@options = options || {}
|
9
|
-
@master = YAML.load_file(File.dirname(__FILE__) + '/roro_configurator.yml')
|
10
|
-
@master['services']['server_app']['vendors']['rails']['version'] = `ruby -v`.scan(/\d.\d/).first
|
11
|
-
@choices = @master['services']['server_app']['vendors']['rails']['choices']
|
12
|
-
@app = {}
|
13
|
-
@thor_actions = {}
|
14
|
-
configure
|
15
|
-
end
|
16
|
-
|
17
|
-
no_commands do
|
18
|
-
|
19
|
-
def configure
|
20
|
-
set_from_defaults
|
21
|
-
case
|
22
|
-
when @options['interactive'] && File.exist?('.roro_config.yml')
|
23
|
-
set_from_roro_config
|
24
|
-
set_from_interactive
|
25
|
-
when File.exist?('.roro_config.yml')
|
26
|
-
set_from_roro_config
|
27
|
-
when @options['interactive']
|
28
|
-
set_from_interactive
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def set_from_defaults
|
33
|
-
svcs = @master['services']
|
34
|
-
rails = svcs['server_app']['vendors']['rails']
|
35
|
-
@app = {
|
36
|
-
'main_app_name' => Dir.pwd.split('/').last,
|
37
|
-
'database_host' => rails['env_vars']['DATABASE_HOST'],
|
38
|
-
'ruby_version' => rails['version'],
|
39
|
-
'frontend_service' => svcs['frontend']['name'],
|
40
|
-
'webserver_service' => svcs['webserver']['default'],
|
41
|
-
'database_service' => svcs['database']['name'],
|
42
|
-
'database_vendor' => svcs['database']['vendor'],
|
43
|
-
}
|
44
|
-
@choices.each { |key, value| @thor_actions[key] = value["default"] }
|
45
|
-
end
|
46
|
-
|
47
|
-
def set_from_roro_config
|
48
|
-
yaml = YAML.load_file(Dir.pwd + '/.roro_config.yml')
|
49
|
-
yaml.each { |key, value| @app[key] = value }
|
50
|
-
if yaml['thor_actions']
|
51
|
-
yaml['thor_actions'].each do |key, value|
|
52
|
-
@thor_actions[key] = value
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
def set_from_interactive
|
58
|
-
@choices.each do |key, v|
|
59
|
-
prompt = ["\n\n" + v['question']]
|
60
|
-
v['choices'].each { |k,v| prompt << "(#{k}) #{v.to_s}" }
|
61
|
-
answer = ask((prompt.join("\n\n") + "\n\n"),
|
62
|
-
default: v['default'],
|
63
|
-
limited_to: v['choices'].keys)
|
64
|
-
@thor_actions[key] = answer
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# module Roro
|
2
|
-
# class CLI < Thor
|
3
|
-
# include Thor::Actions
|
4
|
-
|
5
|
-
# desc "generate::config::rails", "Generates a config file to use roro with
|
6
|
-
# a rails app at .roro.yml"
|
7
|
-
# map "generate::config::rails" => "generate_config_rails"
|
8
|
-
|
9
|
-
# def generate_config_rails
|
10
|
-
# master_config = YAML.load_file(ENV['PWD'] + "/lib/roro/cli/roro_configurator.yml")
|
11
|
-
# template 'base/.roro_config.yml', '.roro_config.yml'
|
12
|
-
# end
|
13
|
-
|
14
|
-
# no_commands do
|
15
|
-
# end
|
16
|
-
# end
|
17
|
-
# end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
require 'roro/cli/rollon/stories'
|
2
|
-
require 'roro/cli/rollon/rails/database'
|
3
|
-
|
4
|
-
module Roro
|
5
|
-
|
6
|
-
class CLI < Thor
|
7
|
-
|
8
|
-
desc "rollon::rails", "Generates files for and makes changes to your app
|
9
|
-
so it can run using Docker containers."
|
10
|
-
method_option :interactive, desc: "Set up your environment variables as
|
11
|
-
you go."
|
12
|
-
map "rollon::rails" => "rollon_rails"
|
13
|
-
|
14
|
-
def rollon_rails(*args)
|
15
|
-
confirm_directory_not_empty
|
16
|
-
confirm_dependencies
|
17
|
-
configure_for_rollon
|
18
|
-
copy_rails_files
|
19
|
-
generate_config
|
20
|
-
startup_commands
|
21
|
-
end
|
22
|
-
|
23
|
-
no_commands do
|
24
|
-
|
25
|
-
def copy_rails_files
|
26
|
-
template 'rails/.circleci/config.yml.tt', './.circleci/config.yml'
|
27
|
-
configure_database
|
28
|
-
template 'rails/docker-compose.yml.tt', './docker-compose.yml', @config.app
|
29
|
-
template 'base/dotenv', './.env', @config.app
|
30
|
-
directory 'rails/roro', './roro', @config.app
|
31
|
-
take_thor_actions
|
32
|
-
end
|
33
|
-
|
34
|
-
def startup_commands
|
35
|
-
success_msg = "'\n\n#{'*' * 5 }\n\nYour Rails app is available at http://localhost:3000/'\n\n#{'*' * 5 }"
|
36
|
-
system 'docker-compose build'
|
37
|
-
system 'docker-compose run web bundle'
|
38
|
-
system 'docker-compose run web bin/rails webpacker:install'
|
39
|
-
system 'docker-compose run web bin/rails yarn:install'
|
40
|
-
system 'docker-compose run web bin/rails db:create'
|
41
|
-
system 'docker-compose run web bin/rails db:migrate'
|
42
|
-
system 'docker-compose up -d'
|
43
|
-
system "docker-compose run web echo '\n\nYour Rails app is available at http://localhost:3000/'"
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
@@ -1,157 +0,0 @@
|
|
1
|
-
---
|
2
|
-
main_app_name: <%= Dir.pwd.split('/').last %>
|
3
|
-
developer:
|
4
|
-
name: your-name
|
5
|
-
email: your.email@example.com
|
6
|
-
|
7
|
-
services:
|
8
|
-
server_app:
|
9
|
-
name: app
|
10
|
-
vendors:
|
11
|
-
rails:
|
12
|
-
version:
|
13
|
-
image:
|
14
|
-
official_name: ruby
|
15
|
-
variants:
|
16
|
-
- alpine
|
17
|
-
- buster
|
18
|
-
- slim
|
19
|
-
- slim-buster
|
20
|
-
- stretch
|
21
|
-
|
22
|
-
choices:
|
23
|
-
|
24
|
-
config_std_out_true:
|
25
|
-
question: |
|
26
|
-
The team at Heroku, among others, recommend logging to STDOUT
|
27
|
-
and treating your logs as streams. We'll set this to
|
28
|
-
true as an environment variable but it may also be helpful
|
29
|
-
to configure './config/boot.rb' with '$stdout.sync = true'
|
30
|
-
just in case that doesn't work.
|
31
|
-
Would you like to configure this?
|
32
|
-
choices:
|
33
|
-
y: 'Yes'
|
34
|
-
n: 'No'
|
35
|
-
default: y
|
36
|
-
|
37
|
-
insert_roro_gem_into_gemfile:
|
38
|
-
question: |
|
39
|
-
Many developers believe it's good idea to secure sensitive
|
40
|
-
environment files and variables. You can use RoRo to
|
41
|
-
generate secret keys known only to you for use in any
|
42
|
-
environment, and then use them to encrypt and decrypt
|
43
|
-
these files. Would you like to add RoRo to your Gemfile?
|
44
|
-
choices:
|
45
|
-
y: 'Yes'
|
46
|
-
n: 'No'
|
47
|
-
default: y
|
48
|
-
|
49
|
-
gitignore_sensitive_files:
|
50
|
-
question: |
|
51
|
-
If you plan to use the environment files RoRo generates for
|
52
|
-
your own environment variables, it's a good idea to keep
|
53
|
-
these files out of source control. Would you like RoRo to
|
54
|
-
modify your .gitignore file to accomplish this for you ?
|
55
|
-
choices:
|
56
|
-
y: 'Yes'
|
57
|
-
n: 'No'
|
58
|
-
default: y
|
59
|
-
|
60
|
-
insert_hfci_gem_into_gemfile:
|
61
|
-
question: |
|
62
|
-
Jim Weirich passed too soon and remains missed. In addition
|
63
|
-
to Rake, Jim wrote a beautiful gem called 'Given' that makes
|
64
|
-
Rspec and Minitest less ugly and thus your tests more easy to
|
65
|
-
write. Would you like to install a gem called
|
66
|
-
handsome_fencer-test that allows you to try it out?
|
67
|
-
choices:
|
68
|
-
y: 'Yes'
|
69
|
-
n: 'No'
|
70
|
-
default: n
|
71
|
-
|
72
|
-
backup_existing_files:
|
73
|
-
question: |
|
74
|
-
RoRo will be generating a number of files, some of which will
|
75
|
-
replace existing ones. Would you like to back them up?
|
76
|
-
choices:
|
77
|
-
y: 'Yes'
|
78
|
-
n: 'No'
|
79
|
-
default: n
|
80
|
-
|
81
|
-
copy_dockerignore:
|
82
|
-
question: |
|
83
|
-
Would you like to create a .dockerignore file?
|
84
|
-
choices:
|
85
|
-
y: 'Yes'
|
86
|
-
n: 'No'
|
87
|
-
default: y
|
88
|
-
|
89
|
-
configure_database:
|
90
|
-
question: |
|
91
|
-
RoRo can reliably dockerize your Rails app with either
|
92
|
-
MySQL or PostgreSQL stories. Which story would you prefer
|
93
|
-
to roll on?
|
94
|
-
choices:
|
95
|
-
p: PostgreSQL
|
96
|
-
m: MySQL
|
97
|
-
default: p
|
98
|
-
|
99
|
-
env_vars:
|
100
|
-
DATABASE_HOST: database
|
101
|
-
|
102
|
-
database:
|
103
|
-
name: database
|
104
|
-
vendor: postgresql
|
105
|
-
vendors:
|
106
|
-
postgresql:
|
107
|
-
images:
|
108
|
-
official_name:
|
109
|
-
versions:
|
110
|
-
- latest
|
111
|
-
env_vars:
|
112
|
-
POSTGRES_USER: postgres
|
113
|
-
POSTGRES_PASSWORD: your-postgres-password
|
114
|
-
|
115
|
-
mysql:
|
116
|
-
env_vars:
|
117
|
-
MYSQL_ROOT_PASSWORD: root
|
118
|
-
MYSQL_PASSWORD: root
|
119
|
-
MYSQL_USERNAME: root
|
120
|
-
MYSQL_DATABASE_PORT: '3306'
|
121
|
-
|
122
|
-
frontend:
|
123
|
-
name: frontend
|
124
|
-
vendors:
|
125
|
-
|
126
|
-
- frontend
|
127
|
-
- vuejs
|
128
|
-
- react
|
129
|
-
- angular
|
130
|
-
webserver:
|
131
|
-
default: nginx
|
132
|
-
vendors:
|
133
|
-
- nginx
|
134
|
-
application_server:
|
135
|
-
name: appserver
|
136
|
-
vendors:
|
137
|
-
- unicorn:
|
138
|
-
- puma:
|
139
|
-
registries:
|
140
|
-
dockerhub:
|
141
|
-
env_vars:
|
142
|
-
DOCKERHUB_EMAIL: your-docker-hub-email
|
143
|
-
DOCKERHUB_ORG: your-docker-hub-org-name
|
144
|
-
DOCKERHUB_PASSWORD: your-docker-hub-password
|
145
|
-
DOCKERHUB_USER: your-docker-hub-user-name
|
146
|
-
|
147
|
-
ci_cd:
|
148
|
-
semaphore:
|
149
|
-
circleci:
|
150
|
-
env_vars:
|
151
|
-
DEPLOY_TAG: "${CIRCLE_SHA1:0:7}"
|
152
|
-
|
153
|
-
deployment:
|
154
|
-
env_vars:
|
155
|
-
SERVER_HOST: "ip-address-of-your-server"
|
156
|
-
SERVER_PORT: '22'
|
157
|
-
SERVER_USER: root
|
@@ -1,17 +0,0 @@
|
|
1
|
-
defaults: &defaults
|
2
|
-
executor: machine-layer-caching
|
3
|
-
working_directory: ~/project
|
4
|
-
|
5
|
-
version: 2.1
|
6
|
-
|
7
|
-
executors:
|
8
|
-
machine-layer-caching:
|
9
|
-
machine:
|
10
|
-
docker_layer_caching: true
|
11
|
-
machine-executor:
|
12
|
-
machine: true
|
13
|
-
ruby-executor:
|
14
|
-
docker:
|
15
|
-
- image: cimg/ruby:2.7
|
16
|
-
|
17
|
-
jobs:
|
@@ -1,15 +0,0 @@
|
|
1
|
-
---
|
2
|
-
main_app_name: greenfield
|
3
|
-
database_host: database
|
4
|
-
ruby_version: '2.7'
|
5
|
-
frontend_service: frontend
|
6
|
-
webserver_service: nginx
|
7
|
-
database_service: database
|
8
|
-
database_vendor: mysql
|
9
|
-
mysql_env_vars:
|
10
|
-
MYSQL_ROOT_PASSWORD: root
|
11
|
-
MYSQL_PASSWORD: root
|
12
|
-
MYSQL_USERNAME: root
|
13
|
-
MYSQL_DATABASE_PORT: '3306'
|
14
|
-
thor_actions:
|
15
|
-
insert_hfci_gem_into_gemfile: y
|
@@ -1,23 +0,0 @@
|
|
1
|
-
push:
|
2
|
-
machine: true
|
3
|
-
steps:
|
4
|
-
- checkout
|
5
|
-
- run: gem install handsome_fencer-circle_c_i
|
6
|
-
- run: handsome_fencer-circle_c_i expose circleci
|
7
|
-
- run: handsome_fencer-circle_c_i expose development
|
8
|
-
- run: echo 'source docker/env_files/circleci.env' >> $BASH_ENV
|
9
|
-
- run: cp docker/overrides/circleci.yml docker-compose.override.yml
|
10
|
-
- run: docker-compose build
|
11
|
-
- run: docker login -u $DOCKERHUB_USER -p $DOCKERHUB_PASS
|
12
|
-
- run:
|
13
|
-
name: Tag app image
|
14
|
-
command: docker tag $(docker images | grep project_app | awk '{ print $3 }') ${DOCKERHUB_ORG}/${APP_NAME}_app:$DEPLOY_TAG
|
15
|
-
# - run: docker tag $(docker images | grep project_app | awk '{ print $3 }') ${DOCKERHUB_ORG}/${APP_NAME}_app:latest
|
16
|
-
- run:
|
17
|
-
name: Tag app image
|
18
|
-
command: docker tag $(docker images | grep project_web | awk '{ print $3 }') ${DOCKERHUB_ORG}/${APP_NAME}_web:$DEPLOY_TAG
|
19
|
-
# - run: docker tag $(docker images | grep project_web | awk '{ print $3 }') ${DOCKERHUB_ORG}/${APP_NAME}_web:latest
|
20
|
-
- run: docker push ${DOCKERHUB_ORG}/${APP_NAME}_app:$DEPLOY_TAG
|
21
|
-
- run: docker push ${DOCKERHUB_ORG}/${APP_NAME}_app:latest
|
22
|
-
- run: docker push ${DOCKERHUB_ORG}/${APP_NAME}_web:$DEPLOY_TAG
|
23
|
-
- run: docker push ${DOCKERHUB_ORG}/${APP_NAME}_web:latest
|
@@ -1,13 +0,0 @@
|
|
1
|
-
test:
|
2
|
-
<<: *defaults
|
3
|
-
steps:
|
4
|
-
- checkout
|
5
|
-
- attach_workspace: *workspace-location
|
6
|
-
- run: *copy-ci-dotenv
|
7
|
-
- run: *source-ci-variables
|
8
|
-
- run: RORO_ENV=ci docker-compose build
|
9
|
-
- run: RORO_ENV=ci docker-compose run web bundle
|
10
|
-
- run: RORO_ENV=ci docker-compose run web yarn
|
11
|
-
- run: RORO_ENV=ci docker-compose run web bin/rails db:create
|
12
|
-
- run: RORO_ENV=ci docker-compose run web bin/rails db:migrate
|
13
|
-
- run: RORO_ENV=ci docker-compose run web bin/rails test
|
@@ -1,47 +0,0 @@
|
|
1
|
-
FROM ruby:<%= config['ruby_version'] %> AS builder
|
2
|
-
|
3
|
-
## Make sure we have yarn properly sourced:
|
4
|
-
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
|
5
|
-
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
|
6
|
-
|
7
|
-
## Update OS and download yarm from source specified above:
|
8
|
-
RUN apt-get update -qq && apt-get install -y build-essential git nodejs yarn
|
9
|
-
|
10
|
-
## Set up our workspace directories:
|
11
|
-
ENV APP_HOME /usr/src/app/
|
12
|
-
RUN mkdir ${APP_HOME}
|
13
|
-
|
14
|
-
## Tell bundler where to store downloaded gems:
|
15
|
-
ENV BUNDLE_PATH /gems
|
16
|
-
RUN mkdir ${BUNDLE_PATH}
|
17
|
-
|
18
|
-
## Tell Docker to create volumes for our workspace and gems
|
19
|
-
## so other containers can access them.
|
20
|
-
VOLUME ${APP_HOME}
|
21
|
-
VOLUME ${BUNDLE_PATH}
|
22
|
-
|
23
|
-
## Switch to the the work directory from container root:
|
24
|
-
WORKDIR ${APP_HOME}
|
25
|
-
|
26
|
-
## Create a Gemfile with just the Rails gem inside:
|
27
|
-
RUN echo "source 'https://rubygems.org'\ngem 'rails'" > Gemfile
|
28
|
-
|
29
|
-
## Bundle to install rails:
|
30
|
-
RUN bundle install
|
31
|
-
|
32
|
-
## Use Rails to generate a new app. We'll configure it later.
|
33
|
-
RUN bundle exec rails new .
|
34
|
-
|
35
|
-
## setup yarn for rails:
|
36
|
-
RUN bundle exec rails yarn:install
|
37
|
-
|
38
|
-
|
39
|
-
## Tell docker not to create a layer:
|
40
|
-
FROM scratch AS export-stage
|
41
|
-
|
42
|
-
## Copy the generated files onto the host. Note that because we are in a
|
43
|
-
## new container, we don't have access to the previous ${APP_HOME}
|
44
|
-
## variable and so we must hard code it as our source:
|
45
|
-
COPY --from=builder /usr/src/app/ .
|
46
|
-
|
47
|
-
|