stack_car 0.7.1 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +64 -1
  3. data/lib/stack_car.rb +1 -0
  4. data/lib/stack_car/cli.rb +131 -38
  5. data/lib/stack_car/dot_rc.rb +25 -0
  6. data/lib/stack_car/version.rb +1 -1
  7. data/stack_car.gemspec +1 -0
  8. data/templates/.dockerignore.erb +2 -2
  9. data/templates/.env.development.erb +2 -0
  10. data/templates/.env.erb +15 -16
  11. data/templates/.gitlab-ci.yml.erb +95 -62
  12. data/templates/Dockerfile.erb +26 -7
  13. data/templates/chart-fcrepo/fcrepo-deploy.yaml +63 -0
  14. data/templates/chart-fcrepo/fcrepo-env-cm.yaml +8 -0
  15. data/templates/chart-fcrepo/fcrepo-env-secret.yaml.tt +10 -0
  16. data/templates/chart-fcrepo/fcrepo-pvc.yaml +20 -0
  17. data/templates/chart-fcrepo/fcrepo-svc.yaml +19 -0
  18. data/templates/chart-sidekiq/sidekiq-deploy.yaml +80 -0
  19. data/templates/chart/.gitignore +3 -0
  20. data/templates/chart/.helmignore +23 -0
  21. data/templates/chart/Chart.yaml.tt +29 -0
  22. data/templates/chart/README.md +223 -0
  23. data/templates/chart/bin/check_sidekiq.rb +0 -0
  24. data/templates/chart/bin/decrypt +17 -0
  25. data/templates/chart/bin/deploy +14 -0
  26. data/templates/chart/bin/encrypt +15 -0
  27. data/templates/chart/bin/remove +15 -0
  28. data/templates/chart/sample-values.yaml.tt +138 -0
  29. data/templates/chart/templates/_helpers.tpl.tt +85 -0
  30. data/templates/chart/templates/rails-env-cm.yaml.tt +47 -0
  31. data/templates/chart/templates/rails-env-secret.yaml +10 -0
  32. data/templates/chart/templates/rails-pvc-shared.yml +20 -0
  33. data/templates/chart/templates/setup-job.yaml +73 -0
  34. data/templates/chart/templates/web-deploy.yaml +67 -0
  35. data/templates/chart/templates/web-ing-wildcard.yaml +20 -0
  36. data/templates/chart/templates/web-ing.yaml +20 -0
  37. data/templates/chart/templates/web-svc.yaml +20 -0
  38. data/templates/database.yml.erb +10 -10
  39. data/templates/docker-compose.yml.erb +49 -17
  40. data/templates/env.conf.erb +11 -9
  41. data/templates/nginx.sh.erb +17 -0
  42. metadata +47 -11
  43. data/templates/Dockerfile.base.erb +0 -48
  44. data/templates/docker-compose.ci.yml.erb +0 -87
  45. data/templates/docker-compose.production.yml.erb +0 -26
@@ -1,16 +1,18 @@
1
1
  <% if options[:postgres] -%>
2
- env POSTGRES_DB;
3
- env POSTGRES_USER;
4
- env POSTGRES_PASSWORD;
5
- env POSTGRES_HOST;
2
+ env DATABASE_ADAPTER;
3
+ env DATABASE_NAME;
4
+ env DATABASE_USER;
5
+ env DATABASE_PASSWORD;
6
+ env DATABASE_HOST;
6
7
  env TEST_DB;
7
8
  <% end -%>
8
9
  <% if options[:mysql] -%>
9
- env MYSQL_DATABASE;
10
- env MYSQL_USER;
11
- env MYSQL_PASSWORD;
12
- env MYSQL_ROOT_PASSWORD;
13
- env MYSQL_HOST;
10
+ env DATABASE_ADAPTER;
11
+ env DATABASE_NAME;
12
+ env DATABASE_USER;
13
+ env DATABASE_PASSWORD;
14
+ env DATABASE_ROOT_PASSWORD;
15
+ env DATABASE_HOST;
14
16
  env TEST_DB;
15
17
  <% end -%>
16
18
  <% if options[:deploy] || options[:rancher] -%>
@@ -12,9 +12,26 @@ then
12
12
  export PASSENGER_APP_ENV=development
13
13
  fi
14
14
 
15
+ rm -rf /home/app/webapp/.ruby*
16
+
17
+ declare -p | grep -Ev 'BASHOPTS|PWD|BASH_VERSINFO|EUID|PPID|SHELLOPTS|UID' > /container.env
18
+
19
+ if [[ $PASSENGER_APP_ENV == "development" ]] || [[ $PASSENGER_APP_ENV == "test" ]]
20
+ then
21
+ /sbin/setuser app /bin/bash -l -c 'cd /home/app/webapp && bundle exec rails db:create db:migrate db:test:prepare'
22
+ fi
23
+
15
24
  if [[ $PASSENGER_APP_ENV == "production" ]] || [[ $PASSENGER_APP_ENV == "staging" ]]
16
25
  then
26
+ /bin/bash -l -c 'chown -R app:app /home/app/webapp/tmp' # mounted volume may have wrong permissions
27
+ /bin/bash -l -c 'chown -R app:app /home/app/webapp/public' # mounted volume may have wrong permissions
17
28
  /sbin/setuser app /bin/bash -l -c 'cd /home/app/webapp && bundle exec rake db:migrate'
29
+ if [ -d /home/app/webapp/public/assets-new ]; then
30
+ /sbin/setuser app /bin/bash -l -c 'cd /home/app/webapp && rsync -a public/assets-new/ public/assets/'
31
+ fi
32
+ if [ -d /home/app/webapp/public/packs-new ]; then
33
+ /sbin/setuser app /bin/bash -l -c 'cd /home/app/webapp && rsync -a public/packs-new/ public/packs/'
34
+ fi
18
35
  fi
19
36
 
20
37
  exec /usr/sbin/nginx
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stack_car
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Kaufman
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-06-21 00:00:00.000000000 Z
11
+ date: 2021-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '2.2'
111
+ - !ruby/object:Gem::Dependency
112
+ name: json
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '2.3'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '2.3'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: thor
113
127
  requirement: !ruby/object:Gem::Requirement
@@ -122,7 +136,7 @@ dependencies:
122
136
  - - "~>"
123
137
  - !ruby/object:Gem::Version
124
138
  version: '0.19'
125
- description:
139
+ description:
126
140
  email:
127
141
  - rob@notch8.com
128
142
  executables:
@@ -144,6 +158,7 @@ files:
144
158
  - exe/stack_car
145
159
  - lib/stack_car.rb
146
160
  - lib/stack_car/cli.rb
161
+ - lib/stack_car/dot_rc.rb
147
162
  - lib/stack_car/version.rb
148
163
  - logo.jpg
149
164
  - public/.gitkeep
@@ -154,14 +169,36 @@ files:
154
169
  - templates/.env.development.erb
155
170
  - templates/.env.erb
156
171
  - templates/.gitlab-ci.yml.erb
157
- - templates/Dockerfile.base.erb
158
172
  - templates/Dockerfile.builder.erb
159
173
  - templates/Dockerfile.erb
160
174
  - templates/README.md
175
+ - templates/chart-fcrepo/fcrepo-deploy.yaml
176
+ - templates/chart-fcrepo/fcrepo-env-cm.yaml
177
+ - templates/chart-fcrepo/fcrepo-env-secret.yaml.tt
178
+ - templates/chart-fcrepo/fcrepo-pvc.yaml
179
+ - templates/chart-fcrepo/fcrepo-svc.yaml
180
+ - templates/chart-sidekiq/sidekiq-deploy.yaml
181
+ - templates/chart/.gitignore
182
+ - templates/chart/.helmignore
183
+ - templates/chart/Chart.yaml.tt
184
+ - templates/chart/README.md
185
+ - templates/chart/bin/check_sidekiq.rb
186
+ - templates/chart/bin/decrypt
187
+ - templates/chart/bin/deploy
188
+ - templates/chart/bin/encrypt
189
+ - templates/chart/bin/remove
190
+ - templates/chart/sample-values.yaml.tt
191
+ - templates/chart/templates/_helpers.tpl.tt
192
+ - templates/chart/templates/rails-env-cm.yaml.tt
193
+ - templates/chart/templates/rails-env-secret.yaml
194
+ - templates/chart/templates/rails-pvc-shared.yml
195
+ - templates/chart/templates/setup-job.yaml
196
+ - templates/chart/templates/web-deploy.yaml
197
+ - templates/chart/templates/web-ing-wildcard.yaml
198
+ - templates/chart/templates/web-ing.yaml
199
+ - templates/chart/templates/web-svc.yaml
161
200
  - templates/database.yml.erb
162
201
  - templates/deploy.yml.erb
163
- - templates/docker-compose.ci.yml.erb
164
- - templates/docker-compose.production.yml.erb
165
202
  - templates/docker-compose.yml.erb
166
203
  - templates/env.conf.erb
167
204
  - templates/hosts.erb
@@ -188,7 +225,7 @@ files:
188
225
  homepage: https://gitlab.com/notch8/stack_car
189
226
  licenses: []
190
227
  metadata: {}
191
- post_install_message:
228
+ post_install_message:
192
229
  rdoc_options: []
193
230
  require_paths:
194
231
  - lib
@@ -203,9 +240,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
203
240
  - !ruby/object:Gem::Version
204
241
  version: '0'
205
242
  requirements: []
206
- rubyforge_project:
207
- rubygems_version: 2.6.12
208
- signing_key:
243
+ rubygems_version: 3.0.8
244
+ signing_key:
209
245
  specification_version: 4
210
246
  summary: A tool to make rails + docker easy
211
247
  test_files: []
@@ -1,48 +0,0 @@
1
- FROM phusion/passenger-ruby23:0.9.28
2
-
3
- RUN <%= pre_apt_string %> && \
4
- curl -sL https://deb.nodesource.com/setup_8.x | bash - && \
5
- apt-get update -qq && \
6
- apt-get install -y build-essential nodejs pv tzdata libsasl2-dev <%= apt_packages_string %> && \
7
- apt-get clean && \
8
- rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
9
- <%= post_apt_string %>
10
-
11
- <% if options[:fcrepo] %>
12
- RUN mkdir -p /opt/fits && \
13
- curl -fSL -o /opt/fits-0.8.5.zip http://projects.iq.harvard.edu/files/fits/files/fits-0.8.5.zip && \
14
- cd /opt && \
15
- unzip fits-0.8.5.zip && \
16
- chmod +x fits-0.8.5/fits.sh
17
-
18
- <% end -%>
19
-
20
- RUN rm /etc/nginx/sites-enabled/default
21
-
22
- ENV APP_HOME /home/app/webapp
23
- RUN mkdir $APP_HOME
24
- WORKDIR $APP_HOME
25
-
26
- ENV BUNDLE_GEMFILE=$APP_HOME/Gemfile \
27
- BUNDLE_JOBS=4
28
-
29
- ADD Gemfile* $APP_HOME/
30
- RUN bundle check || bundle install
31
-
32
- <% if options[:delayed_job] || options[:sidekiq] %>
33
- RUN touch /var/log/worker.log && chmod 666 /var/log/worker.log
34
- RUN mkdir /etc/service/worker
35
- ADD ops/worker.sh /etc/service/worker/run
36
- RUN chmod +x /etc/service/worker/run
37
- <% end %>
38
-
39
- ADD . $APP_HOME
40
- RUN chown -R app $APP_HOME
41
-
42
- # this is so that these items are cached and only have to be updated
43
- RUN /sbin/setuser app /bin/bash -l -c 'cd /home/app/webapp && DB_ADAPTER=nulldb bundle exec rake assets:precompile'
44
- # Asset complie and migrate if prod, otherwise just start nginx
45
- ADD ops/nginx.sh /etc/service/nginx/run
46
- RUN chmod +x /etc/service/nginx/run
47
- RUN rm -f /etc/service/nginx/down
48
-
@@ -1,87 +0,0 @@
1
- version: '2.1'
2
- services:
3
- <% if options[:postgres] -%>
4
- postgres:
5
- image: postgres
6
- env_file:
7
- - .env
8
- ports:
9
- - "5432"
10
- <% end -%>
11
- <% if options[:mysql] -%>
12
- mysql:
13
- image: mysql
14
- env_file:
15
- - .env
16
- ports:
17
- - '3306'
18
- <% end -%>
19
- <% if options[:elasticsearch] -%>
20
- elasticsearch:
21
- image: elasticsearch:1.7.1
22
- env_file:
23
- - .env
24
- ports:
25
- - "9200"
26
- - "9300"
27
- <% end -%>
28
- <% if options[:solr] %>
29
- solr:
30
- image: solr:latest
31
- env_file:
32
- - .env
33
- ports:
34
- - "8983"
35
- entrypoint:
36
- - docker-entrypoint.sh
37
- - solr-precreate
38
- - mycore
39
- # docker-compose exec --user=solr solr bin/solr create_core -c CORENAME
40
- <% end -%>
41
- <% if options[:redis] -%>
42
- redis:
43
- image: 'redis:3.2-alpine'
44
- env_file:
45
- - .env
46
- command: redis-server
47
- ports:
48
- - '6379'
49
- <% end -%>
50
- <% if options[:mongodb] -%>
51
- mongodb:
52
- image: mongo:2.6.12
53
- env_file:
54
- - .env
55
- ports:
56
- - "27017"
57
- <% end -%>
58
- <% if options[:memcached] -%>
59
- memcached:
60
- image: memcached
61
- env_file:
62
- - .env
63
- ports:
64
- - "11211"
65
- <% end -%>
66
- <% if options[:fcrepo] -%>
67
- fcrepo:
68
- image: botimer/fcrepo:4.5.1
69
- env_file:
70
- - .env
71
- volumes:
72
- - 'fcrepo:/opt/data'
73
- ports:
74
- - "8080"
75
- <% end -%>
76
- web:
77
- image: "${REGISTRY_HOST}${REGISTRY_URI}:${TAG:-master}"
78
- env_file:
79
- - .env
80
- rap.host: ${SITE_URI}
81
- rap.le_host: ${SITE_URI}
82
- rap.le_test: true
83
- io.rancher.container.pull_image: always
84
- ports:
85
- - "80"
86
- depends_on:
87
- <%= compose_depends %>
@@ -1,26 +0,0 @@
1
- version: '2.1'
2
- services:
3
- web:
4
- image: "${REGISTRY_HOST}${REGISTRY_URI}:${TAG:-master}"
5
- environment:
6
- - RAILS_ENV=production
7
- - RACK_ENV=production
8
- - PASSENGER_APP_ENV=production
9
- restart: unless-stopped
10
- ports:
11
- - "80"
12
- labels:
13
- rap.host: ${SITE_URI}
14
- rap.le_host: ${SITE_URI}
15
- rap.le_test: true
16
- io.rancher.container.pull_image: always
17
- env_file:
18
- - .env
19
- - .env.production
20
-
21
- <% if options[:rancher] -%>
22
- volumes:
23
- uploads:
24
- driver: rancher-nfs
25
- external: true
26
- <% end -%>