tpt-rails 1.4.1 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/generators/{tpt_rails → tpt/rails}/configuration/configuration_generator.rb +0 -0
- data/lib/generators/tpt/rails/configuration/templates/config/initializers/tpt_rails.rb +14 -0
- data/lib/generators/tpt/rails/continuous_integration/continuous_integration_generator.rb +7 -0
- data/lib/generators/tpt/rails/continuous_integration/templates/ci/Dockerfile.tt +42 -0
- data/lib/generators/{tpt_rails → tpt/rails}/continuous_integration/templates/ci/docker-compose.yaml.tt +1 -3
- data/lib/generators/tpt/rails/continuous_integration/templates/ci/tasks/project.test.unit.tt +22 -0
- data/lib/generators/{tpt_rails → tpt/rails}/kubernetes/kubernetes_generator.rb +17 -52
- data/lib/generators/tpt/rails/kubernetes/templates/Dockerfile.tt +56 -0
- data/lib/generators/tpt/rails/kubernetes/templates/entrypoint.sh +9 -0
- data/lib/generators/{tpt_rails → tpt/rails}/kubernetes/templates/kubernetes/helm/Chart.yaml.tt +1 -1
- data/lib/generators/{tpt_rails → tpt/rails}/kubernetes/templates/kubernetes/helm/README.md +6 -2
- data/lib/generators/tpt/rails/kubernetes/templates/kubernetes/helm/requirements.yaml.tt +9 -0
- data/lib/generators/{tpt_rails → tpt/rails}/kubernetes/templates/kubernetes/helm/templates/NOTES.txt.tt +0 -0
- data/lib/generators/{tpt_rails → tpt/rails}/kubernetes/templates/kubernetes/helm/templates/_env.yaml +0 -0
- data/lib/generators/{tpt_rails → tpt/rails}/kubernetes/templates/kubernetes/helm/templates/_helpers.tpl.tt +4 -0
- data/lib/generators/{tpt_rails → tpt/rails}/kubernetes/templates/kubernetes/helm/templates/autoscaler.yaml.tt +0 -0
- data/lib/generators/{tpt_rails → tpt/rails}/kubernetes/templates/kubernetes/helm/templates/deployment.yaml.tt +2 -1
- data/lib/generators/{tpt_rails/kubernetes/templates/kubernetes/helm/templates/hooks/db-migrate.yaml.tt → tpt/rails/kubernetes/templates/kubernetes/helm/templates/hooks/db-prepare.yaml.tt} +6 -3
- data/lib/generators/{tpt_rails → tpt/rails}/kubernetes/templates/kubernetes/helm/templates/service.yaml.tt +2 -0
- data/lib/generators/tpt/rails/kubernetes/templates/kubernetes/helm/values.prod.yaml.tt +82 -0
- data/lib/generators/tpt/rails/kubernetes/templates/kubernetes/helm/values.staging.yaml.tt +125 -0
- data/lib/generators/{tpt_rails → tpt/rails}/kubernetes/templates/kubernetes/helm/values.yaml.tt +85 -14
- data/lib/generators/{tpt_rails → tpt/rails}/postman/postman.yaml.tt +0 -0
- data/lib/tpt/rails/version.rb +1 -1
- metadata +30 -35
- data/lib/generators/tpt_rails/configuration/templates/config/initializers/tpt_rails.rb +0 -10
- data/lib/generators/tpt_rails/continuous_integration/continuous_integration_generator.rb +0 -17
- data/lib/generators/tpt_rails/continuous_integration/templates/ci/Dockerfile.tt +0 -31
- data/lib/generators/tpt_rails/continuous_integration/templates/ci/tasks/project.test.unit +0 -12
- data/lib/generators/tpt_rails/continuous_integration/templates/ci/test.Jenkinsfile.tt +0 -40
- data/lib/generators/tpt_rails/continuous_integration/templates/ci/test.config.xml.tt +0 -76
- data/lib/generators/tpt_rails/continuous_integration/templates/ci/tptcd.Jenkinsfile.tt +0 -7
- data/lib/generators/tpt_rails/continuous_integration/templates/ci/tptci.Jenkinsfile.tt +0 -7
- data/lib/generators/tpt_rails/kubernetes/templates/Dockerfile.tt +0 -41
- data/lib/generators/tpt_rails/kubernetes/templates/entrypoint.sh +0 -13
- data/lib/generators/tpt_rails/kubernetes/templates/kubernetes/helm/requirements.yaml.tt +0 -8
- data/lib/generators/tpt_rails/kubernetes/templates/kubernetes/helm/values.prod.yaml.tt +0 -52
- data/lib/generators/tpt_rails/kubernetes/templates/kubernetes/helm/values.staging.yaml.tt +0 -52
- data/lib/tasks/tpt/rails_tasks.rake +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 02dd625bd9a9d1bc33d43038b1d08ce10453d423586938b6ca428475567ae4ea
|
4
|
+
data.tar.gz: 8b78f4fb111e9db3170f21abfaf0c4c54a34b7d3715fffee64a7851b1bb9dade
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25e4a00434bd5c945df5f3f20f6b70c15e91851db4207b75a38ebcd63f4d59b167d3d4a8747280cd4a0bf1bf280721687e29681eb6489be6129841edacf735ab
|
7
|
+
data.tar.gz: 07f17c97f36929405680bf951ce43eed9220dd25ac878bd9e77e1596fee5ccb4a468a7029584d8ff604ba87e213ae567feda1ae050ac1474ee5f8548fafd256f
|
data/README.md
CHANGED
@@ -11,7 +11,7 @@ automatically do the following for you.**
|
|
11
11
|
|
12
12
|
```sh
|
13
13
|
bundle add tpt-rails --git 'git@github.com:TeachersPayTeachers/tpt-rails'
|
14
|
-
rails generate
|
14
|
+
rails generate tpt:rails:configuration
|
15
15
|
```
|
16
16
|
|
17
17
|
### Configuration
|
@@ -23,12 +23,12 @@ See the documentation in [lib/tpt/rails.rb](lib/tpt/rails.rb).
|
|
23
23
|
|
24
24
|
For Kubernetes configuration:
|
25
25
|
```sh
|
26
|
-
rails generate
|
26
|
+
rails generate tpt:rails:kubernetes
|
27
27
|
```
|
28
28
|
|
29
29
|
For CI/CD configuration:
|
30
30
|
```sh
|
31
|
-
rails generate
|
31
|
+
rails generate tpt:rails:continuous_integration
|
32
32
|
```
|
33
33
|
|
34
34
|
### Overview
|
File without changes
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Tpt::Rails.configure do |config|
|
2
|
+
config.app_name = ENV.fetch('APP_NAME')
|
3
|
+
config.app_env = if ENV['APP_ENV_NAME'].present? && ENV['APP_ENV_NAME'] != 'default'
|
4
|
+
"#{ENV.fetch('APP_ENV')}-#{ENV.fetch('APP_ENV_NAME')}"
|
5
|
+
else
|
6
|
+
ENV.fetch('APP_ENV')
|
7
|
+
end
|
8
|
+
|
9
|
+
config.rollbar_access_token = ''
|
10
|
+
config.rollbar_enabled = ENV["ROLLBAR_ENABLED"] == '1'
|
11
|
+
|
12
|
+
config.datadog_statsd_url = ENV["DOGSTATSD_URL"].presence
|
13
|
+
config.datadog_trace_url = ENV["DATADOG_TRACE_URL"].presence
|
14
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
FROM teacherspayteachers/tptci as tptci
|
2
|
+
FROM ruby:<%= RUBY_VERSION %>-alpine
|
3
|
+
|
4
|
+
ENV LANG C.UTF-8
|
5
|
+
|
6
|
+
RUN \
|
7
|
+
apk add --no-cache \
|
8
|
+
# temporarily adding git to allow using gems from git sources
|
9
|
+
git \
|
10
|
+
# bash is nice to have when we need a shell into a container
|
11
|
+
bash \
|
12
|
+
# tzdata is required by rails to avoid "tzinfo-data is not present. Please add gem 'tzinfo-data' to your Gemfile"
|
13
|
+
tzdata \
|
14
|
+
# busybox is useful utilities when we need a shell into a container
|
15
|
+
busybox \
|
16
|
+
# curl is useful when we need a shell into a container
|
17
|
+
curl \
|
18
|
+
# screen helps with long-running tasks in one-off pods
|
19
|
+
screen \
|
20
|
+
# netcat is for detecting when the DB is ready during CI testing
|
21
|
+
netcat-openbsd \
|
22
|
+
# build-base is required for mysql2 and pg gems
|
23
|
+
build-base \
|
24
|
+
# mariadb-dev is required for mysql2
|
25
|
+
mariadb-dev
|
26
|
+
|
27
|
+
RUN gem install bundler -v '~> 2.2'
|
28
|
+
|
29
|
+
RUN bundle config --global ignore_messages true
|
30
|
+
|
31
|
+
RUN mkdir /app
|
32
|
+
WORKDIR /app
|
33
|
+
|
34
|
+
ENV RAILS_ENV=test APP_ENV=test APP_NAME=<%= Tpt::Rails.app_name %>
|
35
|
+
|
36
|
+
COPY Gemfile Gemfile.lock .ruby-version /app/
|
37
|
+
|
38
|
+
RUN bundle install --jobs=4 --retry=3
|
39
|
+
|
40
|
+
COPY . .
|
41
|
+
|
42
|
+
COPY --from=tptci /usr/bin/tptci /usr/bin/tptci
|
@@ -3,7 +3,7 @@ services:
|
|
3
3
|
db:
|
4
4
|
image: mysql:5.7
|
5
5
|
ports:
|
6
|
-
- '3306
|
6
|
+
- '3306'
|
7
7
|
environment:
|
8
8
|
MYSQL_ROOT_PASSWORD: ''
|
9
9
|
MYSQL_ALLOW_EMPTY_PASSWORD: '1'
|
@@ -12,8 +12,6 @@ services:
|
|
12
12
|
build:
|
13
13
|
context: ../
|
14
14
|
dockerfile: ci/Dockerfile
|
15
|
-
args:
|
16
|
-
GITHUB_TOKEN: ${GITHUB_TOKEN}
|
17
15
|
links:
|
18
16
|
- db
|
19
17
|
depends_on:
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
if [ "$CI_PLATFORM" = "brigade" ]; then
|
4
|
+
export RAILS_LOG_TO_STDOUT='1'
|
5
|
+
export RAILS_ENV='test'
|
6
|
+
export DISABLE_SPRING='1'
|
7
|
+
|
8
|
+
MYSQL_HOSTNAME="$(tptci -q print-app-name <%= Tpt::Rails.app_name %> -b mysql)"
|
9
|
+
MYSQL_PORT=3306
|
10
|
+
export DATABASE_URL="mysql2://root:123456@${MYSQL_HOSTNAME}:${MYSQL_PORT}/<%= Tpt::Rails.app_name %>_test"
|
11
|
+
fi
|
12
|
+
|
13
|
+
until nc -z -v ${MYSQL_HOSTNAME} ${MYSQL_PORT}
|
14
|
+
do
|
15
|
+
echo "Waiting for database connection..."
|
16
|
+
sleep 5
|
17
|
+
done
|
18
|
+
|
19
|
+
exec bin/rails db:prepare test
|
20
|
+
|
21
|
+
# Uncomment to run system tests
|
22
|
+
# exec bin/rails test:system
|
@@ -15,18 +15,15 @@ class Tpt::Rails::KubernetesGenerator < ::Rails::Generators::Base
|
|
15
15
|
check_dependencies
|
16
16
|
|
17
17
|
secrets_name = "#{Tpt::Rails.app_name}-secrets"
|
18
|
+
secrets_key = "secret-key-base"
|
19
|
+
secrets_value = SecureRandom.alphanumeric(32).downcase
|
18
20
|
|
19
|
-
|
20
|
-
|
21
|
-
app_type = tpt_yaml.fetch('target')
|
21
|
+
team_name = ask("What's your GitHub team name? Something like `core-services`").strip
|
22
|
+
app_type = "internal"
|
22
23
|
|
23
24
|
tpt_config = get_tpt_config
|
24
25
|
tpt_user_alias = tpt_config.fetch('user.alias')
|
25
26
|
|
26
|
-
default_email = get_default_email_address
|
27
|
-
email = ask("What's the maintainer email address? (#{default_email})").strip
|
28
|
-
email = email.presence || default_email || 'FIXME'
|
29
|
-
|
30
27
|
template 'Dockerfile'
|
31
28
|
template 'entrypoint.sh'
|
32
29
|
template '.dockerignore'
|
@@ -35,7 +32,7 @@ class Tpt::Rails::KubernetesGenerator < ::Rails::Generators::Base
|
|
35
32
|
'kubernetes',
|
36
33
|
team_name: team_name,
|
37
34
|
secrets_name: secrets_name,
|
38
|
-
|
35
|
+
secrets_key: secrets_key,
|
39
36
|
app_type: app_type,
|
40
37
|
)
|
41
38
|
|
@@ -43,8 +40,9 @@ class Tpt::Rails::KubernetesGenerator < ::Rails::Generators::Base
|
|
43
40
|
run('helm dependency update', abort_on_failure: true)
|
44
41
|
end
|
45
42
|
|
46
|
-
add_kube_secret(secrets_name)
|
43
|
+
add_kube_secret(secrets_name, secrets_key, secrets_value)
|
47
44
|
|
45
|
+
# TODO: move the below instruction to a wiki page
|
48
46
|
say(<<~MESSAGE)
|
49
47
|
|
50
48
|
********************************************************************************
|
@@ -56,16 +54,12 @@ class Tpt::Rails::KubernetesGenerator < ::Rails::Generators::Base
|
|
56
54
|
!
|
57
55
|
! 1. Review and commit these changes
|
58
56
|
! 2. Push your changes up to a Github repository
|
59
|
-
! 3.
|
57
|
+
! 3. Follow the docker instructions on
|
58
|
+
! https://teacherspayteachers.atlassian.net/wiki/spaces/SER/pages/1521090593/Getting+started+Create+a+new+serverless+service#Build-and-push-your-project-to-DockerHub
|
60
59
|
! 4. Deploy to an ODE with `tpt project push`
|
61
|
-
! 5.
|
62
|
-
! - Go to https://hub.docker.com/repository/docker/teacherspayteachers/#{Tpt::Rails.app_name}/permissions
|
63
|
-
! - Choose "readonly" in the "Team" dropdown box
|
64
|
-
! - Choose "Read-only" in the "Permission" box
|
65
|
-
! - Click the "+" button on the right-hand side
|
66
|
-
! 6. Monitor the status of your ODE deploy with:
|
60
|
+
! 5. Monitor the status of your ODE deploy with:
|
67
61
|
! kubectl get pods --namespace #{tpt_user_alias} | grep #{Tpt::Rails.app_name}
|
68
|
-
!
|
62
|
+
! 6. When your ODE is ready you can visit it here:
|
69
63
|
! http://#{Tpt::Rails.app_name}--#{tpt_user_alias}.ode.tptpm.info/#{Tpt::Rails::Engine.instance.routes.url_helpers.health_check_path}
|
70
64
|
!
|
71
65
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
@@ -104,50 +98,21 @@ class Tpt::Rails::KubernetesGenerator < ::Rails::Generators::Base
|
|
104
98
|
Tpt::Rails.app_name =~ VALID_APP_NAME
|
105
99
|
end
|
106
100
|
|
107
|
-
def generate_tpt_yaml
|
108
|
-
# TODO: Add an options to `tpt project init` that allows passing in these values
|
109
|
-
say(<<~TEXT)
|
110
|
-
|
111
|
-
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
112
|
-
! IMPORTANT !
|
113
|
-
! In the prompt below, please enter "#{Tpt::Rails.app_name}" for the "project name"
|
114
|
-
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
115
|
-
|
116
|
-
TEXT
|
117
|
-
|
118
|
-
run('tpt project init --force', abort_on_failure: true)
|
119
|
-
|
120
|
-
YAML.load(run('cat tpt.yaml', capture: true, abort_on_failure: true))
|
121
|
-
end
|
122
|
-
|
123
101
|
def get_tpt_config
|
124
102
|
conf = run('tpt config get', capture: true, abort_on_failure: true)
|
125
103
|
YAML.load(conf)
|
104
|
+
rescue
|
105
|
+
say("Failed to get tpt config")
|
106
|
+
raise
|
126
107
|
end
|
127
108
|
|
128
|
-
def
|
129
|
-
run('git config user.email', capture: true, abort_on_failure: false)&.strip.presence
|
130
|
-
end
|
131
|
-
|
132
|
-
def add_kube_secret(secrets_name)
|
133
|
-
secret = run('cat config/master.key', capture: true, abort_on_failure: true).strip
|
109
|
+
def add_kube_secret(secrets_name, secrets_key, secrets_value)
|
134
110
|
key_exists = run("kubectl get secret #{secrets_name} --context='#{ODE_KUBE_CONTEXT}' >/dev/null 2>&1", abort_on_failure: false)
|
135
111
|
|
136
|
-
if key_exists
|
137
|
-
say "Kube secret #{secrets_name} already exists. Updating it…"
|
138
|
-
ENV['KUBE_GENERATOR_RAILS_MASTER_KEY'] = Base64.strict_encode64(secret)
|
139
|
-
run(
|
140
|
-
<<~CMD,
|
141
|
-
kubectl get secret #{secrets_name} --context=#{ODE_KUBE_CONTEXT} --output=json \
|
142
|
-
| jq --arg key $KUBE_GENERATOR_RAILS_MASTER_KEY '.data["rails-master-key"]=$key' \
|
143
|
-
| kubectl apply --context=#{ODE_KUBE_CONTEXT} -f -
|
144
|
-
CMD
|
145
|
-
abort_on_failure: true,
|
146
|
-
)
|
147
|
-
else
|
112
|
+
if !key_exists
|
148
113
|
say "Kube secret #{secrets_name} not found. Creating it…"
|
149
114
|
run(
|
150
|
-
"kubectl create secret generic #{secrets_name} --from-literal='
|
115
|
+
"kubectl create secret generic #{secrets_name} --from-literal='#{secrets_key}=#{secrets_value}' --context='#{ODE_KUBE_CONTEXT}'",
|
151
116
|
abort_on_failure: true,
|
152
117
|
)
|
153
118
|
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
FROM ruby:<%= RUBY_VERSION %>-alpine
|
2
|
+
|
3
|
+
ENV LANG C.UTF-8
|
4
|
+
|
5
|
+
RUN \
|
6
|
+
apk add --no-cache \
|
7
|
+
# temporarily adding git to allow using gems from git sources
|
8
|
+
git \
|
9
|
+
# bash is nice to have when we need a shell into a container
|
10
|
+
bash \
|
11
|
+
# tzdata is required by rails to avoid "tzinfo-data is not present. Please add gem 'tzinfo-data' to your Gemfile"
|
12
|
+
tzdata \
|
13
|
+
# busybox is useful utilities when we need a shell into a container
|
14
|
+
busybox \
|
15
|
+
# curl is useful when we need a shell into a container
|
16
|
+
curl \
|
17
|
+
# screen helps with long-running tasks in one-off pods
|
18
|
+
screen \
|
19
|
+
# netcat is for detecting when the DB is ready during Jenkins testing
|
20
|
+
netcat-openbsd \
|
21
|
+
# build-base is required for mysql2 and pg gems
|
22
|
+
build-base \
|
23
|
+
# mariadb-dev is required for mysql2
|
24
|
+
mariadb-dev \
|
25
|
+
# mariadb-client allows us to perform manual mysql queries via console when needed
|
26
|
+
mariadb-client
|
27
|
+
|
28
|
+
RUN gem install bundler -v '~> 2.2'
|
29
|
+
|
30
|
+
RUN bundle config --global ignore_messages true
|
31
|
+
|
32
|
+
RUN mkdir /app
|
33
|
+
WORKDIR /app
|
34
|
+
|
35
|
+
# Set production env for asset compilation
|
36
|
+
ARG RAILS_ENV=production
|
37
|
+
ARG APP_ENV=production
|
38
|
+
ARG APP_NAME=<%= Tpt::Rails.app_name %>
|
39
|
+
|
40
|
+
# Add a script to be executed every time the container starts.
|
41
|
+
COPY entrypoint.sh /usr/bin/
|
42
|
+
|
43
|
+
COPY Gemfile Gemfile.lock .ruby-version ./
|
44
|
+
RUN \
|
45
|
+
bundle config without 'development test' && \
|
46
|
+
bundle install --jobs=4 --retry=3
|
47
|
+
|
48
|
+
COPY . .
|
49
|
+
|
50
|
+
# TODO: Delete this?
|
51
|
+
ENTRYPOINT ["entrypoint.sh"]
|
52
|
+
CMD ["rails", "server", "-b", "0.0.0.0"]
|
53
|
+
EXPOSE 3000
|
54
|
+
|
55
|
+
ARG TPT_RELEASE_VERSION
|
56
|
+
ENV TPT_RELEASE_VERSION=$TPT_RELEASE_VERSION
|
data/lib/generators/{tpt_rails → tpt/rails}/kubernetes/templates/kubernetes/helm/Chart.yaml.tt
RENAMED
@@ -12,5 +12,5 @@ keywords: [odev2, rails, service-template, '<%= Tpt::Rails.app_name %>', '<%= co
|
|
12
12
|
home: https://www.teacherspayteachers.com
|
13
13
|
icon: https://static1.teacherspayteachers.com/tpt-frontend/releases/production/current/a24f03b12028dbc93cf182318e6993e5.svg
|
14
14
|
sources: ['https://github.com/TeachersPayTeachers/<%= Tpt::Rails.app_name %>']
|
15
|
-
maintainers: [{name: '<%= config.fetch(:team_name) %>', email: '<%= config.fetch(:
|
15
|
+
maintainers: [{name: '<%= config.fetch(:team_name) %>', email: '<%= config.fetch(:team_name) %>@teacherspayteachers.com'}]
|
16
16
|
engine: gotpl # yaml parsing engine, just leave this alone
|
@@ -16,8 +16,12 @@ There are a couple files that constitute a Chart. Here is an overview:
|
|
16
16
|
└── kubernetes
|
17
17
|
└── helm
|
18
18
|
├── charts
|
19
|
-
│ ├──
|
19
|
+
│ ├── db-migrate-0.2.2.tgz
|
20
|
+
│ ├── mysql-1.6.9.tgz
|
20
21
|
├── templates
|
22
|
+
│ ├── hooks
|
23
|
+
│ │ ├── db-prepare.yaml
|
24
|
+
│ ├── _env.yaml
|
21
25
|
│ ├── _helpers.tpl
|
22
26
|
│ ├── autoscaler.yaml
|
23
27
|
│ ├── deployment.yaml
|
@@ -28,7 +32,7 @@ There are a couple files that constitute a Chart. Here is an overview:
|
|
28
32
|
├── README.md
|
29
33
|
├── requirements.lock
|
30
34
|
├── requirements.yaml
|
31
|
-
├── values.
|
35
|
+
├── values.prod.yaml
|
32
36
|
├── values.staging.yaml
|
33
37
|
└── values.yaml
|
34
38
|
```
|
File without changes
|
data/lib/generators/{tpt_rails → tpt/rails}/kubernetes/templates/kubernetes/helm/templates/_env.yaml
RENAMED
File without changes
|
@@ -44,7 +44,11 @@ Get service.
|
|
44
44
|
{{- if eq .service.useIngress true -}}
|
45
45
|
{{- printf "%s://%s-%s:%v/%s" .service.protocol .service.hostName .domain .service.port $trimPath -}}
|
46
46
|
{{- else -}}
|
47
|
+
{{- if or (eq .env "staging") (eq .env "production") -}}
|
47
48
|
{{- printf "%s://%s:%v/%s" .service.protocol .service.hostName .service.port $trimPath -}}
|
49
|
+
{{- else -}}
|
50
|
+
{{- printf "%s://%s--%s:%v/%s" .service.protocol .service.hostName .namespace .service.port $trimPath -}}
|
51
|
+
{{- end -}}
|
48
52
|
{{- end -}}
|
49
53
|
{{- end -}}
|
50
54
|
|
File without changes
|
@@ -15,6 +15,8 @@ metadata:
|
|
15
15
|
tpt/owner: {{ .Values.annotations.owner }}
|
16
16
|
tpt/creator: {{ .Values.annotations.creator | default "UNKNOWN" | quote }}
|
17
17
|
tpt/release: "{{ .Release.Name }}"
|
18
|
+
tpt/costEnv: {{ .Values.annotations.costEnv | quote }}
|
19
|
+
tpt/costCategory: {{ .Values.annotations.costCategory | quote }}
|
18
20
|
spec:
|
19
21
|
strategy:
|
20
22
|
type: RollingUpdate
|
@@ -23,7 +25,6 @@ spec:
|
|
23
25
|
selector:
|
24
26
|
matchLabels:
|
25
27
|
app: {{ template "<%= Tpt::Rails.app_name %>.fullname" . }}
|
26
|
-
replicas: {{ .Values.replicas }}
|
27
28
|
# Max number of replicat sets to retain.
|
28
29
|
# Sets exceeding this limit will get deleted
|
29
30
|
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
|
@@ -1,8 +1,8 @@
|
|
1
|
-
{{- if .Values.
|
1
|
+
{{- if .Values.dbPrepare.enabled }}
|
2
2
|
apiVersion: batch/v1
|
3
3
|
kind: Job # runs once and then stops
|
4
4
|
metadata:
|
5
|
-
name: {{ template "<%= Tpt::Rails.app_name %>.fullname" . }}-db-
|
5
|
+
name: {{ template "<%= Tpt::Rails.app_name %>.fullname" . }}-db-prepare
|
6
6
|
labels:
|
7
7
|
app: {{ template "<%= Tpt::Rails.app_name %>.name" . }}
|
8
8
|
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
@@ -12,6 +12,8 @@ metadata:
|
|
12
12
|
tpt/owner: {{ .Values.annotations.owner }}
|
13
13
|
tpt/creator: {{ .Values.annotations.creator | default "UNKNOWN" | quote }}
|
14
14
|
tpt/release: "{{ .Release.Name }}"
|
15
|
+
tpt/costEnv: {{ .Values.annotations.costEnv | quote }}
|
16
|
+
tpt/costCategory: {{ .Values.annotations.costCategory | quote }}
|
15
17
|
annotations:
|
16
18
|
# post-install: after initial creation of stack, pre-upgrade: before deploying new code
|
17
19
|
"helm.sh/hook": "post-install,pre-upgrade"
|
@@ -42,7 +44,7 @@ spec:
|
|
42
44
|
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
|
43
45
|
command: ["/bin/sh"]
|
44
46
|
# This is what causes a different command to be run for this job
|
45
|
-
args: ["-c", "{{ .Values.
|
47
|
+
args: ["-c", "{{ .Values.dbPrepare.command }}"]
|
46
48
|
# Specifies provisioning requests & limits (memory and CPU)
|
47
49
|
resources:
|
48
50
|
limits:
|
@@ -53,6 +55,7 @@ spec:
|
|
53
55
|
cpu: {{ .Values.resources.requests.cpu }}
|
54
56
|
env:
|
55
57
|
{{- include "env" . | indent 10 }}
|
58
|
+
{{- include "<%= Tpt::Rails.app_name %>.services" . | nindent 10 }}
|
56
59
|
{{- if .Values.secrets }}
|
57
60
|
{{ toYaml .Values.secrets | trim | nindent 10 }}
|
58
61
|
{{- end }}
|