stack_car 0.12.0 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/.gitlab-ci.yml +17 -12
  3. data/README.md +84 -10
  4. data/lib/stack_car/cli.rb +166 -33
  5. data/lib/stack_car/version.rb +3 -1
  6. data/stack_car.gemspec +1 -0
  7. data/templates/.env.erb +23 -0
  8. data/templates/.gitlab/issue_templates/Bug.md +46 -0
  9. data/templates/.gitlab/issue_templates/Feature.md +41 -0
  10. data/templates/.gitlab/issue_templates/Question.md +18 -0
  11. data/templates/.gitlab/issue_templates/enable_pipeline_check_before_merge.md +8 -0
  12. data/templates/.gitlab/merge_request_templates/Bug.md +36 -0
  13. data/templates/.gitlab/merge_request_templates/Feature.md +36 -0
  14. data/templates/.gitlab-ci.yml.erb +4 -3
  15. data/templates/.sops.yaml.erb +3 -0
  16. data/templates/Dockerfile.erb +6 -6
  17. data/templates/README.md +84 -7
  18. data/templates/chart/Chart.yaml.tt +15 -14
  19. data/templates/chart/bin/deploy +1 -1
  20. data/templates/chart/bin/remove +1 -1
  21. data/templates/chart/sample-values.yaml.tt +16 -1
  22. data/templates/chart/templates/_helpers.tpl.tt +1 -1
  23. data/templates/chart/templates/web-ing-wildcard.yaml +1 -1
  24. data/templates/chart/templates/web-ing.yaml +1 -1
  25. data/templates/database.yml.erb +0 -1
  26. data/templates/decrypt-secrets +22 -0
  27. data/templates/deploy.yml.erb +2 -2
  28. data/templates/development.rb.erb +90 -0
  29. data/templates/docker-compose.yml.erb +14 -21
  30. data/templates/encrypt-secrets +19 -0
  31. data/templates/production.rb.erb +117 -0
  32. data/templates/solrcloud-assign-configset.sh +35 -0
  33. data/templates/solrcloud-upload-configset.sh +42 -0
  34. metadata +34 -9
  35. data/templates/Dockerfile.base.erb +0 -57
  36. data/templates/Dockerfile.builder.erb +0 -13
@@ -0,0 +1,8 @@
1
+ # Gitlab Original Documentation:
2
+ - https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html#only-allow-merge-requests-to-be-merged-if-the-pipeline-succeeds
3
+
4
+ # Notch8 Playbook Artcile with image:
5
+ - http://playbook-staging.notch8.com/en/gitlab-only-merge-if-pipeline-succeeds
6
+
7
+ # How to Video:
8
+ - https://share.getcloudapp.com/yAuykArv
@@ -0,0 +1,36 @@
1
+ # Summary
2
+ A short description of the bug
3
+
4
+ # Related Issue
5
+ Use # to add a quick link to the parent issue(s), or ! for parent merge requests. Also, go to the issue and edit it to mention this MR.
6
+
7
+ # Expected Behavior
8
+
9
+ Demo how this merge request is working in the app. Consult the steps for reproducing the bug in the issue.
10
+
11
+ # Screenshots / Video
12
+ Include screenshots or video demonstrating how this bug fix works
13
+
14
+ # Dependencies
15
+
16
+ Are there any other outstanding issues which need to be resolved before this can be merged?
17
+
18
+ # Special Attention / Side Effects
19
+
20
+ Is there anything you would like to have special scrutiny given to during code review? Will the changes in this merge request potentially impact any thing else that isn't explicitly part of this bug fix?
21
+
22
+ # Testing / Reproduction instructions
23
+
24
+ Step by step instructions on how to test this bug fix. Include links and username/passswords if necessary. Videos are especially helpful. Also, name any spec files that should be run for this bug fix, or to test any side effects from this bug fix.
25
+
26
+ 1. Go here
27
+ 2. Do this
28
+ 3. Observe this behavior
29
+
30
+ # Deployment
31
+
32
+ Where is this deployed? Are there any additional steps to get this working on staging/production? (e.g. setting up enviromental variables)
33
+
34
+ # Other Information
35
+
36
+ Any other logs, related issues, merge requests, wireframes, documentation, slack conversations or anything else that would help the developer try to find and fix this issue, or provide context.
@@ -0,0 +1,36 @@
1
+ # Summary
2
+ A short description of the feature
3
+
4
+ # Related Issue
5
+ Use # to add a quick link to the parent issue(s), or ! for parent merge requests. Also, go to that issue and edit the description to mention this MR.
6
+
7
+ # Expected Behavior
8
+
9
+ Demo how this merge request is working in the app. Consult the acceptance criteria in the issue.
10
+
11
+ # Screenshots / Video
12
+ Include screenshots or video demonstrating how this feature works
13
+
14
+ # Dependencies
15
+
16
+ Are there any other outstanding issues which need to be resolved before this can be merged?
17
+
18
+ # Special Attention / Side Effects
19
+
20
+ Is there anything you would like to have special scrutiny given to during code review? Will the changes in this merge request potentially impact any thing else that isn't explicitly part of this feature?
21
+
22
+ # Testing / Reproduction instructions
23
+
24
+ Step by step instructions on how to test this feature. Include links and username/passswords if necessary. Videos are especially helpful. Also, name any spec files that should be run for this feature, or to test any side effects from this feature.
25
+
26
+ 1. Go here
27
+ 2. Do this
28
+ 3. Observe this behavior
29
+
30
+ # Deployment
31
+
32
+ Where is this deployed? Are there any additional steps to get this working on staging/production? (e.g. setting up enviromental variables)
33
+
34
+ # Other Information
35
+
36
+ Any other logs, related issues, merge requests, wireframes, documentation, slack conversations or anything else that would help the developer try to find and fix this issue, or provide context.
@@ -1,5 +1,6 @@
1
1
  stages:
2
2
  - build
3
+ - lint
3
4
  - test
4
5
  - deploy
5
6
 
@@ -108,7 +109,7 @@ review:
108
109
  only:
109
110
  - branches
110
111
  except:
111
- - master
112
+ - main
112
113
  script:
113
114
  <% if options[:rancher] -%>
114
115
  - export RANCHER_ENVIRONMENT=staging
@@ -148,7 +149,7 @@ staging:
148
149
  - dpl --provider=heroku --app=<%= @project_name %>-staging --api-key=$HEROKU_STAGING_API_KEY --run="bundle exec rake db:migrate"
149
150
  <% end -%>
150
151
  only:
151
- - master
152
+ - main
152
153
  tags:
153
154
  - local
154
155
 
@@ -166,6 +167,6 @@ production:
166
167
  <% end -%>
167
168
  when: manual
168
169
  only:
169
- - master
170
+ - main
170
171
  tags:
171
172
  - local
@@ -0,0 +1,3 @@
1
+ ---
2
+ creation_rules:
3
+ - pgp: "CHANGEME"
@@ -1,14 +1,13 @@
1
1
  FROM CHANGEME/base:latest
2
- <% if options[:git] %>
2
+ <% if options[:git] -%>
3
3
  ARG BRANCH=master
4
4
  ARG REPO_URL
5
- <% end %>
5
+ <% end -%>
6
6
 
7
- ADD http://timejson.herokuapp.com build-time
8
7
  ADD ops/webapp.conf /etc/nginx/sites-enabled/webapp.conf
9
8
  ADD ops/env.conf /etc/nginx/main.d/env.conf
10
9
 
11
- <% if options[:git] %>
10
+ <% if options[:git] -%>
12
11
  RUN /sbin/setuser app bash -l -c "set -x && \
13
12
  git fetch -ap && \
14
13
  git reset --hard && \
@@ -18,14 +17,15 @@ RUN /sbin/setuser app bash -l -c "set -x && \
18
17
  bundle exec rake assets:clobber assets:precompile DATABASE_ADAPTER=nulldb && \
19
18
  mv /home/app/webapp/public/assets /home/app/webapp/public/assets-new && \
20
19
  mv /home/app/webapp/public/packs /home/app/webapp/public/packs-new"
21
- <% else %>
20
+ <% else -%>
21
+ RUN gem install bundler -v CHANGEME # Add the BUNDLED WITH version listed at the bottom of the Gemfile.lock
22
22
  COPY --chown=app . $APP_HOME
23
23
  RUN /sbin/setuser app bash -l -c "set -x && \
24
24
  (bundle check || bundle install) && \
25
25
  bundle exec rake assets:clobber assets:precompile DATABASE_ADAPTER=nulldb && \
26
26
  mv /home/app/webapp/public/assets /home/app/webapp/public/assets-new && \
27
27
  mv /home/app/webapp/public/packs /home/app/webapp/public/packs-new"
28
- <% end %>
28
+ <% end -%>
29
29
 
30
30
  RUN bash -l -c "set -x && \
31
31
  rm -f /etc/service/nginx/down"
data/templates/README.md CHANGED
@@ -1,19 +1,96 @@
1
+ [Docker development setup](#docker-development-setup)
2
+
3
+ [Bash into the container](#bash-into-the-container)
4
+
5
+ [Handling Secrets with SOPS](#handling-secrets-with-sops)
6
+
7
+ [Deploy a new release](#deploy-a-new-release)
8
+
9
+ [Run import from admin page](#run-import-from-admin-page)
10
+
1
11
  # Docker development setup
2
12
 
3
- 1) Install Docker.app
13
+ We recommend committing .env to your repo with good defaults. .env.development, .env.production etc can be used for local overrides and should not be in the repo. See [Handling Secrets with SOPS](#handling-secrets-with-sops) for how to manage secrets.
14
+
15
+ 1) Install Docker.app
16
+
17
+ 2) Install stack car
18
+ ``` bash
19
+ gem install stack_car
20
+ ```
4
21
 
5
- 2) gem install stack_car
22
+ 3) Sign in with dory
23
+ ``` bash
24
+ dory up
25
+ ```
6
26
 
7
- 3) We recommend committing .env to your repo with good defaults. .env.development, .env.production etc can be used for local overrides and should not be in the repo.
27
+ 4) Install dependencies
28
+ ``` bash
29
+ yarn install
30
+ ```
8
31
 
9
- 4) sc up
32
+ 5) Start the server
33
+ ``` bash
34
+ sc up
35
+ ```
10
36
 
37
+ 6) Load and seed the database
38
+ ``` bash
39
+ sc be rake db:migrate db:seed
40
+ ```
41
+
42
+ 7) Visit the running instance in the browser at `project-name.test`
43
+
44
+ ### Troubleshooting Docker Development Setup
45
+ Confirm or configure settings. Sub your information for the examples.
11
46
  ``` bash
12
- gem install stack_car
13
- sc up
47
+ git config --global user.name example
48
+ git config --global user.email example@example.com
49
+ docker login registry.gitlab.com
50
+ ```
51
+
52
+ ### While in the container you can do the following
53
+ - Run rspec
54
+ ``` bash
55
+ bundle exec rspec
56
+ ```
57
+ - Access the rails console
58
+ ``` bash
59
+ bundle exec rails c
60
+ ```
61
+
62
+ ### Handling Secrets with SOPS
63
+
64
+ [**SOPS**](https://github.com/mozilla/sops) is used to handle this project's secrets.
14
65
 
66
+ The secrets in this repository include:
67
+ - `.env*` files
68
+ - `*-values.yaml` files
69
+
70
+ Scripts (`bin/decrypt-secrets` and `bin/encrypt-secrets`) are included in this project to help with managing secrets.
71
+
72
+ **To decrypt secrets**:
73
+
74
+ You will need to do this if you are new to the project or there have been changes to any secrets files that are required for development.
75
+
76
+ In terminal:
77
+ ```bash
78
+ bin/decrypt-secrets
79
+ ```
80
+
81
+ This will find and decrypt files with the `.enc` extension.
82
+
83
+ **To encrypt secrets**:
84
+
85
+ You will need to do this when you have edited secrets and are ready to commit them.
86
+
87
+ In terminal:
88
+ ```bash
89
+ bin/encrypt-secrets
15
90
  ```
16
91
 
92
+ This will find and output an encrypted version of secret files with an `.enc` extension.
93
+
17
94
  # Deploy a new release
18
95
 
19
96
  ``` bash
@@ -21,4 +98,4 @@ sc release {staging | production} # creates and pushes the correct tags
21
98
  sc deploy {staging | production} # deployes those tags to the server
22
99
  ```
23
100
 
24
- Releaese and Deployment are handled by the gitlab ci by default. See ops/deploy-app to deploy from locally, but note all Rancher install pull the currently tagged registry image
101
+ Release and Deployment are handled by the gitlab ci by default. See ops/deploy-app to deploy from locally, but note all Rancher install pull the currently tagged registry image
@@ -5,25 +5,26 @@ name: <%= @project_name %>
5
5
  version: 0.0.1
6
6
  dependencies:
7
7
  <%- if options[:solr] %>
8
- - name: solr
9
- version: 1.3.3
10
- repository: https://storage.googleapis.com/kubernetes-charts-incubator
8
+ - name: solr
9
+ version: 1.5.2
10
+ repository: https://charts.helm.sh/incubator
11
+ condition: solr.enabled
11
12
  <%- end %>
12
13
  <%- if options[:redis] %>
13
- - name: redis
14
- version: 10.3.1
15
- repository: https://kubernetes-charts.storage.googleapis.com/
16
- condition: redis.enabled
14
+ - name: redis
15
+ version: 11.0.4
16
+ repository: https://charts.bitnami.com/bitnami
17
+ condition: redis.enabled
17
18
  <%- end %>
18
19
  <%- if options[:postgres] %>
19
- - name: postgresql
20
- version: 8.1.2
21
- repository: https://kubernetes-charts.storage.googleapis.com/
22
- condition: postgresql.enabled
20
+ - name: postgresql
21
+ version: 10.3.18
22
+ repository: https://charts.bitnami.com/bitnami
23
+ condition: postgresql.enabled
23
24
  <%- end %>
24
25
  <%- if options[:mysql] %>
25
26
  - name: mariadb
26
- version: 5.x.x
27
- repository: https://kubernetes-charts.storage.googleapis.com/
27
+ version: 7.3.14
28
+ repository: https://charts.helm.sh/stable
28
29
  condition: mariadb.enabled
29
- <%- end %>
30
+ <%- end %>
@@ -11,4 +11,4 @@ then
11
11
  exit 1
12
12
  fi
13
13
 
14
- helm upgrade --install --namespace $1-$NAMESPACE $1 . -f $1-values.yaml --set rails.image.tag=$2
14
+ helm upgrade --install --namespace $NAMESPACE-$1 $1 . -f $1-values.yaml --set rails.image.tag=$2
@@ -12,4 +12,4 @@ then
12
12
  fi
13
13
 
14
14
  raise 'refusing to remove production' if $1 == 'production'
15
- helm uninstall --namespace $1-$NAMESPACE $1 . -f $1-values.yaml --set rails.image.tag=$2
15
+ helm uninstall --namespace $NAMESPACE-$1 $1 . -f $1-values.yaml --set rails.image.tag=$2
@@ -17,6 +17,7 @@ zookeeper:
17
17
  size: 1Gi
18
18
  <% end %>
19
19
 
20
+ <% if options[:postgres] %>
20
21
  postgresql:
21
22
  enabled: true
22
23
  <% if options[:fedora] %>
@@ -33,6 +34,8 @@ postgresql:
33
34
  persistence:
34
35
  enabled: true
35
36
  size: 1Gi
37
+ <% end %>
38
+
36
39
  <% if options[:mysql] %>
37
40
  externalDatabase:
38
41
  host: host_name
@@ -117,7 +120,6 @@ env:
117
120
  <% if options[:fcrepo] %>
118
121
  FC_DATABASE_NAME: fcrepo
119
122
  LD_LIBRARY_PATH: /opt/fits-latest/tools/mediainfo/linux
120
- SETTINGS__ACTIVE_JOB__QUEUE_ADAPTER: sidekiq
121
123
  SETTINGS__CONTACT_EMAIL: admin@example.org
122
124
  SETTINGS__DEVISE__INVITATION_FROM_EMAIL: admin@example.org
123
125
  SETTINGS__FITS_PATH: /opt/fits/fits.sh
@@ -126,13 +128,26 @@ env:
126
128
  SETTINGS__MULTITENANCY__DEFAULT_HOST: "%{tenant}.app.docker"
127
129
  SETTINGS__MULTITENANCY__ENABLED: "true"
128
130
  <% end %>
131
+ <% if options[:sidekiq] %>
132
+ SETTINGS__ACTIVE_JOB__QUEUE_ADAPTER: sidekiq
133
+ <% end %>
129
134
  DATABASE_NAME: <%= @project_name %>
130
135
  IN_DOCKER: "true"
131
136
  PASSENGER_APP_ENV: production
132
137
  RAILS_ENV: production
133
138
  RAILS_LOG_TO_STDOUT: "true"
134
139
  RAILS_SERVE_STATIC_FILES: "true"
140
+ # SMTP Mailer vars
141
+ # Uncomment vars and SMTP Mailer in config/environments/<environment>.rb to enable
142
+ # SMTP_USER_NAME: CHANGEME
143
+ # SMTP_ADDRESS: CHANGEME
144
+ # SMTP_DOMAIN: CHANGEME
145
+ # SMTP_PORT: CHANGEME
146
+ # SMTP_TYPE: CHANGEME
135
147
 
136
148
  secret:
137
149
  SECRET_KEY_BASE: secretabc
138
150
  DATABASE_PASSWORD: passwordabc
151
+ # SMTP Mailer secret
152
+ # Uncomment vars and SMTP Mailer in config/environments/<environment>.rb to enable
153
+ # SMTP_PASSWORD: CHANGEME
@@ -44,7 +44,7 @@ Shorthand for component names
44
44
  <%- end %>
45
45
  <%- if options[:redis] %>
46
46
  {{- define "app.redis.name" -}}
47
- {{- .Release.Name -}}-redis-master
47
+ {{- .Release.Name -}}-redis-primary
48
48
  {{- end -}}
49
49
  <%- end %>
50
50
  <%- if options[:sidekiq] %>
@@ -1,5 +1,5 @@
1
1
  ---
2
- apiVersion: extensions/v1beta1
2
+ apiVersion: apps/v1
3
3
  kind: Ingress
4
4
  metadata:
5
5
  name: {{ template "app.web.name" . }}-in-wildcard
@@ -1,5 +1,5 @@
1
1
  ---
2
- apiVersion: extensions/v1beta1
2
+ apiVersion: apps/v1
3
3
  kind: Ingress
4
4
  metadata:
5
5
  name: {{ template "app.web.name" . }}-in
@@ -2,7 +2,6 @@
2
2
 
3
3
  <% if options[:mysql] -%>
4
4
  login: &login
5
- adapter: mysql2
6
5
  adapter: <%%= ENV['DATABASE_ADAPTER'] %>
7
6
  host: <%%= ENV['DATABASE_HOST'] %>
8
7
  username: <%%= ENV['DATABASE_USER'] %>
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # require 'byebug'
4
+
5
+ parent_dir = File.dirname(__dir__)
6
+ Dir.chdir(File.join(parent_dir))
7
+ [
8
+ ".env.*",
9
+ "chart/*-values.yaml",
10
+ "ops/kube_config.yml",
11
+ "ops/.backend",
12
+ "ops/k8s/*-values.yaml"
13
+ ].each do |files|
14
+ Dir.glob(files).each do |file|
15
+ if file.match(/enc/)
16
+ next unless File.exists?(file)
17
+ cmd = "sops --decrypt #{file} > #{file.gsub(/.enc$/, '')}"
18
+ puts cmd
19
+ `#{cmd}`
20
+ end
21
+ end
22
+ end
@@ -29,7 +29,7 @@
29
29
  - debug: var=authout
30
30
 
31
31
  - name: Restart service
32
- command: "cd {{ compose_dir }} && docker-compose -f {{ project_name }}.yml pull web && docker-compose -f {{ project_name }}.yml up -d web"
32
+ command: "cd {{ compose_dir }} && docker compose -f {{ project_name }}.yml pull web && docker compose -f {{ project_name }}.yml up -d web"
33
33
  environment:
34
34
  TAG: "{{ tag }}"
35
35
  register: output
@@ -62,4 +62,4 @@
62
62
  body_format: json
63
63
  status_code: 200
64
64
 
65
- <% end %>
65
+ <% end %>
@@ -0,0 +1,90 @@
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ <% if options[:sidekiq] %>
5
+ # In the development environment your application's code is reloaded on
6
+ # every request. This slows down response time but is perfect for development
7
+ # since you don't have to restart the web server when you make code changes.
8
+ config.cache_classes = !!Sidekiq.server?
9
+ <% end -%>
10
+
11
+ # Do not eager load code on boot.
12
+ config.eager_load = false
13
+
14
+ # Show full error reports.
15
+ config.consider_all_requests_local = true
16
+
17
+ # Enable/disable caching. By default caching is disabled.
18
+ if Rails.root.join('tmp/caching-dev.txt').exist?
19
+ config.action_controller.perform_caching = true
20
+
21
+ config.cache_store = :memory_store
22
+ config.public_file_server.headers = {
23
+ 'Cache-Control' => 'public, max-age=172800'
24
+ }
25
+ else
26
+ config.action_controller.perform_caching = false
27
+
28
+ config.cache_store = :null_store
29
+ end
30
+
31
+ # SMTP Mailer configuration
32
+ # Add SMTP settings to your environment and uncomment the following section to enable mailer
33
+ # if ENV['SMTP_ENABLED'].present? && ENV['SMTP_ENABLED'].to_s == 'true'
34
+ # config.action_mailer.smtp_settings = {
35
+ # user_name: ENV['SMTP_USER_NAME'],
36
+ # password: ENV['SMTP_PASSWORD'],
37
+ # address: ENV['SMTP_ADDRESS'],
38
+ # domain: ENV['SMTP_DOMAIN'],
39
+ # port: ENV['SMTP_PORT'],
40
+ # enable_starttls_auto: true,
41
+ # authentication: ENV['SMTP_TYPE']
42
+ # }
43
+ # # ActionMailer Config
44
+ # config.action_mailer.delivery_method = :smtp
45
+ # config.action_mailer.perform_deliveries = true
46
+ # config.action_mailer.raise_delivery_errors = false
47
+ <% if options[:hyku] %>
48
+ # config.action_mailer.asset_host = ENV['SETTINGS__MULTITENANCY__ADMIN_HOST']
49
+ <% end %>
50
+ # else
51
+ # config.action_mailer.delivery_method = :test
52
+ # end
53
+
54
+ # Don't care if the mailer can't send.
55
+ config.action_mailer.raise_delivery_errors = false
56
+
57
+ config.action_mailer.perform_caching = false
58
+
59
+ # Print deprecation notices to the Rails logger.
60
+ config.active_support.deprecation = :log
61
+
62
+ # Raise an error on page load if there are pending migrations.
63
+ config.active_record.migration_error = :page_load
64
+
65
+ # Debug mode disables concatenation and preprocessing of assets.
66
+ # This option may cause significant delays in view rendering with a large
67
+ # number of complex assets.
68
+ config.assets.debug = true
69
+
70
+ # Suppress logger output for asset requests.
71
+ config.assets.quiet = true
72
+
73
+ # Raises error for missing translations
74
+ # config.action_view.raise_on_missing_translations = true
75
+
76
+ config.action_mailer.default_url_options = { host: "localhost:3001" }
77
+
78
+ config.web_console.whitelisted_ips = ['172.18.0.0/16', '172.27.0.0/16', '0.0.0.0/0']
79
+
80
+ if ENV["RAILS_LOG_TO_STDOUT"].present?
81
+ logger = ActiveSupport::Logger.new(STDOUT)
82
+ logger.formatter = config.log_formatter
83
+ config.logger = ActiveSupport::TaggedLogging.new(logger)
84
+ end
85
+
86
+ config.active_job.queue_adapter = Settings.active_job.queue_adapter
87
+ # Use an evented file watcher to asynchronously detect changes in source code,
88
+ # routes, locales, etc. This feature depends on the listen gem.
89
+ # config.file_watcher = ActiveSupport::EventedFileUpdateChecker
90
+ end
@@ -51,7 +51,7 @@ services:
51
51
  - docker-entrypoint.sh
52
52
  - solr-precreate
53
53
  - mycore
54
- # docker-compose exec --user=solr solr bin/solr create_core -c CORENAME
54
+ # docker compose exec --user=solr solr bin/solr create_core -c CORENAME
55
55
  <% end -%>
56
56
  <% if options[:redis] -%>
57
57
  redis:
@@ -97,28 +97,20 @@ services:
97
97
  - "8080"
98
98
  <% end -%>
99
99
 
100
- base:
101
- image: "${REGISTRY_HOST}${REGISTRY_URI}/base:latest"
102
- build:
103
- context: .
104
- dockerfile: Dockerfile.base
105
- args:
106
- DEPLOY_KEY: "${DEPLOY_KEY}"
107
- APP_NAME: "${APP_NAME}"
108
- REPO_URL: "${REPO_URL}"
109
- env_file:
110
- - .env
111
- - .env.development
112
-
113
100
  app:
114
101
  build:
115
- context: ..
102
+ <% if @sc_dir -%>
103
+ context: ..
116
104
  dockerfile: stack_car/Dockerfile
117
- args:
105
+ <% else -%>
106
+ context: .
107
+ dockerfile: Dockerfile
108
+ <% end -%>
109
+ args:
118
110
  DEPLOY_KEY: "${DEPLOY_KEY}"
119
111
  REPO_URL: "${REPO_URL}"
120
112
  BRANCH: "${BRANCH}"
121
- image: "${REGISTRY_HOST}${REGISTRY_URI}:${TAG:-master}"
113
+ image: "${REGISTRY_HOST}${REGISTRY_URI}:${TAG:-main}"
122
114
  env_file:
123
115
  - .env
124
116
  - .env.development
@@ -133,13 +125,12 @@ services:
133
125
  tty: true
134
126
 
135
127
  web:
136
- extends:
137
- app:
128
+ extends: app
138
129
  ports:
139
130
  - "${WEB_PORT}"
140
131
  environment:
141
- - VIRTUAL_HOST=<%= @project_name %>.docker
142
- - VIRTUAL_PORT=80
132
+ - VIRTUAL_HOST=.<%= @project_name %>.test
133
+ - VIRTUAL_PORT=3000
143
134
  depends_on:
144
135
  <%= compose_depends %>
145
136
 
@@ -147,6 +138,7 @@ services:
147
138
  worker:
148
139
  extends: app
149
140
  command: ./bin/delayed_job run
141
+ depends_on:
150
142
  <%= compose_depends %>
151
143
  <% end %>
152
144
 
@@ -154,6 +146,7 @@ services:
154
146
  worker:
155
147
  extends: app
156
148
  command: bundle exec sidekiq
149
+ depends_on:
157
150
  <%= compose_depends %>
158
151
  <% end %>
159
152
 
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # require 'byebug'
4
+
5
+ parent_dir = File.dirname(__dir__)
6
+ [
7
+ ".env.*",
8
+ "chart/*-values.yaml",
9
+ "ops/kube_config.yml",
10
+ "ops/.backend",
11
+ "ops/k8s/*-values.yaml"
12
+ ].each do |files|
13
+ Dir.glob(files).each do |file|
14
+ next if /enc/.match?(file)
15
+ cmd = "sops --encrypt #{file} > #{file}.enc"
16
+ puts cmd
17
+ `#{cmd}`
18
+ end
19
+ end