tpt-rails 1.4.0.rc1 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/internal/error_reporter.rb +1 -1
- data/lib/tpt/rails/version.rb +2 -1
- metadata +37 -42
- 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
@@ -1,10 +0,0 @@
|
|
1
|
-
Tpt::Rails.configure do |config|
|
2
|
-
config.app_name = ENV.fetch('APP_NAME')
|
3
|
-
config.app_env = ENV.fetch('APP_ENV')
|
4
|
-
if ENV['DOGSTATSD_URL'].present?
|
5
|
-
config.datadog_statsd_url = ENV.fetch('DOGSTATSD_URL')
|
6
|
-
end
|
7
|
-
if ENV['DATADOG_TRACE_URL'].present?
|
8
|
-
config.datadog_trace_url = ENV.fetch('DATADOG_TRACE_URL')
|
9
|
-
end
|
10
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
class Tpt::Rails::ContinuousIntegrationGenerator < ::Rails::Generators::Base
|
2
|
-
source_root File.expand_path('templates', __dir__)
|
3
|
-
|
4
|
-
def setup_continuous_integration
|
5
|
-
# TODO: should we run tpt cli to generate `test.config.xml`?
|
6
|
-
# TODO: ask nathan about the test/tptcd/tptci files
|
7
|
-
directory('ci')
|
8
|
-
|
9
|
-
say(<<~MESSAGE)
|
10
|
-
…note about running `tpt ci run protect.test.unit` to run tests
|
11
|
-
|
12
|
-
You need to ask dev tools to create a credential in jenkins. Example ticket:
|
13
|
-
https://teacherspayteachers.atlassian.net/browse/DEVT-710
|
14
|
-
|
15
|
-
MESSAGE
|
16
|
-
end
|
17
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
FROM teacherspayteachers/tptci as tptci
|
2
|
-
FROM ruby:<%= RUBY_VERSION %>
|
3
|
-
|
4
|
-
RUN mkdir -p /app
|
5
|
-
WORKDIR /app
|
6
|
-
|
7
|
-
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash \
|
8
|
-
&& apt-get update && apt-get install -y nodejs && rm -rf /var/lib/apt/lists/* \
|
9
|
-
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
|
10
|
-
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
|
11
|
-
&& apt-get update && apt-get install -y yarn && apt-get install -y netcat && rm -rf /var/lib/apt/lists/*
|
12
|
-
|
13
|
-
COPY package.json yarn.lock /app/
|
14
|
-
RUN yarn install --check-files
|
15
|
-
|
16
|
-
ENV RAILS_ENV test
|
17
|
-
ENV APP_ENV test
|
18
|
-
ENV APP_NAME <%= Tpt::Rails.app_name %>
|
19
|
-
|
20
|
-
# GITHUB_TOKEN allows accessing our private tpt-rails gem on Github
|
21
|
-
ARG GITHUB_TOKEN
|
22
|
-
|
23
|
-
COPY Gemfile /app/Gemfile
|
24
|
-
COPY Gemfile.lock /app/Gemfile.lock
|
25
|
-
# TODO: Do we need this? Can we move it into a base image?
|
26
|
-
RUN gem update bundler
|
27
|
-
RUN BUNDLE_GITHUB__COM="${GITHUB_TOKEN}:x-oauth-basic" bundle install
|
28
|
-
|
29
|
-
COPY . .
|
30
|
-
|
31
|
-
COPY --from=tptci /usr/bin/tptci /usr/bin/tptci
|
@@ -1,40 +0,0 @@
|
|
1
|
-
@Library('tpt-pipeline-library') _
|
2
|
-
|
3
|
-
def ci = new tpt.CI(this)
|
4
|
-
ci.project = '<%= Tpt::Rails.app_name %>'
|
5
|
-
|
6
|
-
pipeline {
|
7
|
-
agent {
|
8
|
-
label 'docker-node'
|
9
|
-
}
|
10
|
-
|
11
|
-
environment {
|
12
|
-
GITHUB_TOKEN = credentials('24caddab-590e-467f-a1d2-1c0c1864d628')
|
13
|
-
}
|
14
|
-
|
15
|
-
stages {
|
16
|
-
stage('Start') {
|
17
|
-
steps {
|
18
|
-
startBuild(ci)
|
19
|
-
}
|
20
|
-
}
|
21
|
-
|
22
|
-
stage('Build') {
|
23
|
-
steps {
|
24
|
-
dockerComposeBuild(ci)
|
25
|
-
}
|
26
|
-
}
|
27
|
-
|
28
|
-
stage('Unit Test') {
|
29
|
-
steps {
|
30
|
-
dockerComposeRun(ci, "tests", './ci/tasks/project.test.unit')
|
31
|
-
}
|
32
|
-
}
|
33
|
-
}
|
34
|
-
|
35
|
-
post {
|
36
|
-
always {
|
37
|
-
finishBuild(ci, currentBuild.currentResult)
|
38
|
-
}
|
39
|
-
}
|
40
|
-
}
|
@@ -1,76 +0,0 @@
|
|
1
|
-
<?xml version='1.1' encoding='UTF-8'?><org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject plugin="workflow-multibranch@2.21">
|
2
|
-
<actions/>
|
3
|
-
<description></description>
|
4
|
-
<displayName><%= Tpt::Rails.app_name %>-test</displayName>
|
5
|
-
<properties>
|
6
|
-
<org.jenkinsci.plugins.workflow.libs.FolderLibraries plugin="workflow-cps-global-lib@2.13">
|
7
|
-
<libraries>
|
8
|
-
<org.jenkinsci.plugins.workflow.libs.LibraryConfiguration>
|
9
|
-
<name>jenkins-pipeline-library</name>
|
10
|
-
<retriever class="org.jenkinsci.plugins.workflow.libs.SCMSourceRetriever">
|
11
|
-
<scm class="jenkins.plugins.git.GitSCMSource" plugin="git@3.9.3">
|
12
|
-
<id>31643265-3634-6665-6262-343134326436</id>
|
13
|
-
<remote>git@github.com:TeachersPayTeachers/jenkins-pipeline-library.git</remote>
|
14
|
-
<credentialsId>jenkins-master-rsa-key</credentialsId>
|
15
|
-
<traits>
|
16
|
-
<jenkins.plugins.git.traits.BranchDiscoveryTrait/>
|
17
|
-
</traits>
|
18
|
-
</scm>
|
19
|
-
</retriever>
|
20
|
-
<implicit>false</implicit>
|
21
|
-
<allowVersionOverride>true</allowVersionOverride>
|
22
|
-
<includeInChangesets>true</includeInChangesets>
|
23
|
-
</org.jenkinsci.plugins.workflow.libs.LibraryConfiguration>
|
24
|
-
</libraries>
|
25
|
-
</org.jenkinsci.plugins.workflow.libs.FolderLibraries>
|
26
|
-
<org.jenkinsci.plugins.pipeline.modeldefinition.config.FolderConfig plugin="pipeline-model-definition@1.3.7">
|
27
|
-
<dockerLabel/>
|
28
|
-
<registry plugin="docker-commons@1.14"/>
|
29
|
-
</org.jenkinsci.plugins.pipeline.modeldefinition.config.FolderConfig>
|
30
|
-
</properties>
|
31
|
-
<folderViews class="jenkins.branch.MultiBranchProjectViewHolder" plugin="branch-api@2.4.0">
|
32
|
-
<owner class="org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject" reference="../.."/>
|
33
|
-
</folderViews>
|
34
|
-
<healthMetrics>
|
35
|
-
<com.cloudbees.hudson.plugins.folder.health.WorstChildHealthMetric plugin="cloudbees-folder@6.8">
|
36
|
-
<nonRecursive>false</nonRecursive>
|
37
|
-
</com.cloudbees.hudson.plugins.folder.health.WorstChildHealthMetric>
|
38
|
-
<jenkins.branch.PrimaryBranchHealthMetric plugin="branch-api@2.4.0"/>
|
39
|
-
</healthMetrics>
|
40
|
-
<icon class="jenkins.branch.MetadataActionFolderIcon" plugin="branch-api@2.4.0">
|
41
|
-
<owner class="org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject" reference="../.."/>
|
42
|
-
</icon>
|
43
|
-
<orphanedItemStrategy class="com.cloudbees.hudson.plugins.folder.computed.DefaultOrphanedItemStrategy" plugin="cloudbees-folder@6.8">
|
44
|
-
<pruneDeadBranches>true</pruneDeadBranches>
|
45
|
-
<daysToKeep>-1</daysToKeep>
|
46
|
-
<numToKeep>5</numToKeep>
|
47
|
-
</orphanedItemStrategy>
|
48
|
-
<triggers/>
|
49
|
-
<disabled>false</disabled>
|
50
|
-
<sources class="jenkins.branch.MultiBranchProject$BranchSourceList" plugin="branch-api@2.4.0">
|
51
|
-
<data>
|
52
|
-
<jenkins.branch.BranchSource>
|
53
|
-
<source class="org.jenkinsci.plugins.github_branch_source.GitHubSCMSource" plugin="github-branch-source@2.4.5">
|
54
|
-
<id>65633436-6138-6163-6638-323663356636</id>
|
55
|
-
<credentialsId>tpt-github-source-credential</credentialsId>
|
56
|
-
<repoOwner>TeachersPayTeachers</repoOwner>
|
57
|
-
<repository><%= Tpt::Rails.app_name %></repository>
|
58
|
-
<traits>
|
59
|
-
<org.jenkinsci.plugins.github__branch__source.BranchDiscoveryTrait>
|
60
|
-
<strategyId>3</strategyId>
|
61
|
-
</org.jenkinsci.plugins.github__branch__source.BranchDiscoveryTrait>
|
62
|
-
<org.jenkinsci.plugins.github__branch__source.TagDiscoveryTrait/>
|
63
|
-
</traits>
|
64
|
-
</source>
|
65
|
-
<strategy class="jenkins.branch.DefaultBranchPropertyStrategy">
|
66
|
-
<properties class="empty-list"/>
|
67
|
-
</strategy>
|
68
|
-
</jenkins.branch.BranchSource>
|
69
|
-
</data>
|
70
|
-
<owner class="org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject" reference="../.."/>
|
71
|
-
</sources>
|
72
|
-
<factory class="org.jenkinsci.plugins.workflow.multibranch.WorkflowBranchProjectFactory">
|
73
|
-
<owner class="org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject" reference="../.."/>
|
74
|
-
<scriptPath>ci/test.Jenkinsfile</scriptPath>
|
75
|
-
</factory>
|
76
|
-
</org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject>
|
@@ -1,7 +0,0 @@
|
|
1
|
-
@Library('tpt-pipeline-library') _
|
2
|
-
|
3
|
-
def ci = new tpt.CI(this)
|
4
|
-
ci.project = '<%= Tpt::Rails.app_name %>'
|
5
|
-
ci.buildCredentials = [[ id: '<%= Tpt::Rails.app_name %>-rails-master-key', var: '<%= Tpt::Rails.app_name.underscore.upcase %>_RAILS_MASTER_KEY' ]]
|
6
|
-
|
7
|
-
tptcdPipeline(ci: ci)
|
@@ -1,7 +0,0 @@
|
|
1
|
-
@Library('tpt-pipeline-library') _
|
2
|
-
|
3
|
-
def ci = new tpt.CI(this)
|
4
|
-
ci.project = '<%= Tpt::Rails.app_name %>'
|
5
|
-
ci.buildCredentials = [[ id: '<%= Tpt::Rails.app_name %>-rails-master-key', var: '<%= Tpt::Rails.app_name.underscore.upcase %>_RAILS_MASTER_KEY' ]]
|
6
|
-
|
7
|
-
tptciPipeline(ci: ci, ode: '') // we don't need an ode, just test this service
|
@@ -1,41 +0,0 @@
|
|
1
|
-
FROM ruby:<%= RUBY_VERSION %>
|
2
|
-
|
3
|
-
RUN mkdir /app
|
4
|
-
WORKDIR /app
|
5
|
-
|
6
|
-
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash \
|
7
|
-
&& apt-get update && apt-get install -y nodejs && rm -rf /var/lib/apt/lists/* \
|
8
|
-
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
|
9
|
-
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
|
10
|
-
&& apt-get update && apt-get install -y yarn && rm -rf /var/lib/apt/lists/*
|
11
|
-
|
12
|
-
COPY package.json yarn.lock /app/
|
13
|
-
RUN yarn install --check-files
|
14
|
-
|
15
|
-
# Set production env for asset compilation
|
16
|
-
ARG RAILS_ENV=production
|
17
|
-
ARG APP_ENV=production
|
18
|
-
ARG APP_NAME=<%= Tpt::Rails.app_name %>
|
19
|
-
|
20
|
-
ARG <%= Tpt::Rails.app_name.underscore.upcase %>_RAILS_MASTER_KEY
|
21
|
-
# GITHUB_TOKEN allows accessing our private tpt-rails gem on Github
|
22
|
-
ARG GITHUB_TOKEN
|
23
|
-
|
24
|
-
COPY Gemfile /app/Gemfile
|
25
|
-
COPY Gemfile.lock /app/Gemfile.lock
|
26
|
-
RUN gem update bundler
|
27
|
-
RUN BUNDLE_GITHUB__COM="${GITHUB_TOKEN}:x-oauth-basic" bundle install --without development test
|
28
|
-
|
29
|
-
# Add a script to be executed every time the container starts.
|
30
|
-
COPY entrypoint.sh /usr/bin/
|
31
|
-
RUN chmod +x /usr/bin/entrypoint.sh
|
32
|
-
|
33
|
-
ADD . /app
|
34
|
-
|
35
|
-
RUN RAILS_MASTER_KEY=${<%= Tpt::Rails.app_name.underscore.upcase %>_RAILS_MASTER_KEY} bin/rails assets:precompile
|
36
|
-
|
37
|
-
EXPOSE 3000
|
38
|
-
|
39
|
-
# TODO: Delete this?
|
40
|
-
ENTRYPOINT ["entrypoint.sh"]
|
41
|
-
CMD ["rails", "server", "-b", "0.0.0.0"]
|
@@ -1,13 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
set -e
|
3
|
-
|
4
|
-
if [ -f /app/tmp/pids/server.pid ]; then
|
5
|
-
rm /app/tmp/pids/server.pid
|
6
|
-
fi
|
7
|
-
|
8
|
-
echo "Preparing database"
|
9
|
-
# In Kubernetes this should always be a no-op because our migration hook will already have run.
|
10
|
-
rails db:prepare
|
11
|
-
|
12
|
-
echo "Starting server"
|
13
|
-
exec "$@"
|
@@ -1,52 +0,0 @@
|
|
1
|
-
name: <%= Tpt::Rails.app_name %>
|
2
|
-
deploy_env: production
|
3
|
-
|
4
|
-
image:
|
5
|
-
name: <%= Tpt::Rails.app_name %>
|
6
|
-
repository: <%= Tpt::Rails.app_name %>
|
7
|
-
tag: latest
|
8
|
-
pullPolicy: Always
|
9
|
-
|
10
|
-
environment:
|
11
|
-
ENVIRONMENT: production
|
12
|
-
APP_ENV: production
|
13
|
-
RAILS_ENV: production
|
14
|
-
|
15
|
-
postgresql:
|
16
|
-
enabled: false
|
17
|
-
|
18
|
-
copy-secrets:
|
19
|
-
enabled: false
|
20
|
-
|
21
|
-
redis:
|
22
|
-
enabled: false
|
23
|
-
|
24
|
-
secrets:
|
25
|
-
- name: RAILS_MASTER_KEY
|
26
|
-
valueFrom:
|
27
|
-
secretKeyRef:
|
28
|
-
name: <%= Tpt::Rails.app_name %>-secrets
|
29
|
-
key: rails-master-key
|
30
|
-
- name: DATABASE_URL
|
31
|
-
valueFrom:
|
32
|
-
secretKeyRef:
|
33
|
-
name: <%= Tpt::Rails.app_name %>-secrets
|
34
|
-
# To set up a staging/prod DB:
|
35
|
-
# - Create the DB in the TpT terraform repo
|
36
|
-
# - Use the root DB account to create an application DB user
|
37
|
-
# - Create a kube secret (e.g. prod-resource-catalog-db-url) with the DATABASE_URL
|
38
|
-
# (including the application user credentials)
|
39
|
-
# - Update the key below to reference your secret
|
40
|
-
key: 'FIXME'
|
41
|
-
|
42
|
-
autoscaler:
|
43
|
-
minimumPods: 3
|
44
|
-
maximumPods: 6
|
45
|
-
targetCPUUtilizationPercentage: 70
|
46
|
-
|
47
|
-
rollingUpdate:
|
48
|
-
maxSurge: 25%
|
49
|
-
|
50
|
-
# Create ELB
|
51
|
-
# service:
|
52
|
-
# type: LoadBalancer
|
@@ -1,52 +0,0 @@
|
|
1
|
-
name: <%= Tpt::Rails.app_name %>
|
2
|
-
deploy_env: staging
|
3
|
-
|
4
|
-
image:
|
5
|
-
name: <%= Tpt::Rails.app_name %>
|
6
|
-
repository: <%= Tpt::Rails.app_name %>
|
7
|
-
tag: latest
|
8
|
-
pullPolicy: Always
|
9
|
-
|
10
|
-
environment:
|
11
|
-
ENVIRONMENT: staging
|
12
|
-
APP_ENV: staging
|
13
|
-
RAILS_ENV: production
|
14
|
-
|
15
|
-
postgresql:
|
16
|
-
enabled: false
|
17
|
-
|
18
|
-
copy-secrets:
|
19
|
-
enabled: false
|
20
|
-
|
21
|
-
redis:
|
22
|
-
enabled: false
|
23
|
-
|
24
|
-
secrets:
|
25
|
-
- name: RAILS_MASTER_KEY
|
26
|
-
valueFrom:
|
27
|
-
secretKeyRef:
|
28
|
-
name: <%= Tpt::Rails.app_name %>-secrets
|
29
|
-
key: rails-master-key
|
30
|
-
- name: DATABASE_URL
|
31
|
-
valueFrom:
|
32
|
-
secretKeyRef:
|
33
|
-
name: <%= Tpt::Rails.app_name %>-secrets
|
34
|
-
# To set up a staging/prod DB:
|
35
|
-
# - Create the DB in the TpT terraform repo
|
36
|
-
# - Use the root DB account to create an application DB user
|
37
|
-
# - Create a kube secret (e.g. prod-resource-catalog-db-url) with the DATABASE_URL
|
38
|
-
# (including the application user credentials)
|
39
|
-
# - Update the key below to reference your secret
|
40
|
-
key: 'FIXME'
|
41
|
-
|
42
|
-
autoscaler:
|
43
|
-
minimumPods: 2
|
44
|
-
maximumPods: 3
|
45
|
-
targetCPUUtilizationPercentage: 70
|
46
|
-
|
47
|
-
rollingUpdate:
|
48
|
-
maxSurge: 25%
|
49
|
-
|
50
|
-
# Create ELB
|
51
|
-
# service:
|
52
|
-
# type: LoadBalancer
|
@@ -1,23 +0,0 @@
|
|
1
|
-
namespace :tpt_rails do
|
2
|
-
|
3
|
-
desc "Gets the credentials key from Kubernetes and puts it in config/master.key"
|
4
|
-
task get_master_key: :environment do
|
5
|
-
command = <<~CMD
|
6
|
-
kubectl get secret #{Tpt::Rails.app_name}-secrets --output=json --context=kubernetes-eks-poc \
|
7
|
-
| jq --raw-output '.data."rails-master-key" | @base64d'
|
8
|
-
CMD
|
9
|
-
|
10
|
-
puts "Running command:\n#{command}"
|
11
|
-
result = `#{command}`
|
12
|
-
|
13
|
-
if $CHILD_STATUS.success?
|
14
|
-
puts 'Success'
|
15
|
-
File.open(::Rails.root.join('config/master.key'), 'w') do |file|
|
16
|
-
file.print(result.strip)
|
17
|
-
end
|
18
|
-
else
|
19
|
-
raise "Error: #{result}"
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|