rails_template_18f 1.3.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -0
  3. data/Gemfile +1 -1
  4. data/Gemfile.lock +64 -61
  5. data/README.md +11 -16
  6. data/lib/generators/rails_template18f/active_storage/active_storage_generator.rb +7 -6
  7. data/lib/generators/rails_template18f/circleci/circleci_generator.rb +28 -27
  8. data/lib/generators/rails_template18f/circleci/templates/Dockerfile.ci.tt +0 -1
  9. data/lib/generators/rails_template18f/circleci/templates/circleci/config.yml.tt +152 -163
  10. data/lib/generators/rails_template18f/github_actions/github_actions_generator.rb +31 -30
  11. data/lib/generators/rails_template18f/github_actions/templates/github/actions/compile-assets/action.yml +50 -0
  12. data/lib/generators/rails_template18f/github_actions/templates/github/actions/setup-project/action.yml.tt +4 -8
  13. data/lib/generators/rails_template18f/github_actions/templates/github/dependabot.yml.tt +2 -4
  14. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/deploy-production.yml +72 -0
  15. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/deploy-staging.yml +72 -0
  16. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/owasp-daily-scan.yml.tt +10 -1
  17. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/owasp-scan.yml.tt +1 -1
  18. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/pa11y.yml.tt +2 -2
  19. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/terraform-production.yml +46 -3
  20. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/terraform-staging.yml +46 -3
  21. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/validate-ssp.yml +2 -2
  22. data/lib/generators/rails_template18f/i18n_js/i18n_js_generator.rb +2 -2
  23. data/lib/generators/rails_template18f/i18n_js/templates/app/javascript/{i18n.js → i18n/index.js} +1 -1
  24. data/lib/generators/rails_template18f/i18n_js/templates/config/i18n-js.yml +1 -1
  25. data/lib/generators/rails_template18f/newrelic/newrelic_generator.rb +4 -2
  26. data/lib/generators/rails_template18f/public_egress/public_egress_generator.rb +86 -54
  27. data/lib/generators/rails_template18f/sidekiq/sidekiq_generator.rb +8 -17
  28. data/lib/generators/rails_template18f/terraform/templates/full_bootstrap/imports.tf.tftpl +25 -0
  29. data/lib/generators/rails_template18f/terraform/templates/full_bootstrap/main.tf.tt +159 -0
  30. data/lib/generators/rails_template18f/terraform/templates/sandbox_bootstrap/imports.tf.tftpl +10 -0
  31. data/lib/generators/rails_template18f/terraform/templates/sandbox_bootstrap/main.tf.tt +117 -0
  32. data/lib/generators/rails_template18f/terraform/templates/terraform/README.md.tt +77 -93
  33. data/lib/generators/rails_template18f/terraform/templates/terraform/app.tf.tt +63 -0
  34. data/lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/apply.sh +15 -0
  35. data/lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/templates/backend_config.tftpl +8 -0
  36. data/lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/templates/bot_secrets.tftpl +5 -0
  37. data/lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/users.auto.tfvars +5 -0
  38. data/lib/generators/rails_template18f/terraform/templates/terraform/main.tf.tt +106 -0
  39. data/lib/generators/rails_template18f/terraform/templates/terraform/production.tfvars.tt +10 -0
  40. data/lib/generators/rails_template18f/terraform/templates/terraform/providers.tf.tt +32 -0
  41. data/lib/generators/rails_template18f/terraform/templates/terraform/sandbox_bot/main.tf +74 -0
  42. data/lib/generators/rails_template18f/terraform/templates/terraform/sandbox_bot/run.sh +17 -0
  43. data/lib/generators/rails_template18f/terraform/templates/terraform/staging.tfvars.tt +8 -0
  44. data/lib/generators/rails_template18f/terraform/templates/terraform/terraform.sh.tt +135 -0
  45. data/lib/generators/rails_template18f/terraform/templates/terraform/variables.tf.tt +99 -0
  46. data/lib/generators/rails_template18f/terraform/terraform_generator.rb +13 -4
  47. data/lib/rails_template18f/generators/cloud_gov_options.rb +9 -6
  48. data/lib/rails_template18f/generators/cloud_gov_parsing.rb +7 -7
  49. data/lib/rails_template18f/generators.rb +0 -1
  50. data/lib/rails_template18f/version.rb +1 -1
  51. data/rails-template-18f.gemspec +4 -4
  52. data/railsrc +4 -2
  53. data/railsrc-hotwire +4 -2
  54. data/template.rb +61 -71
  55. data/templates/README.md.tt +21 -8
  56. data/templates/app/assets/stylesheets/uswds-settings.scss +3 -2
  57. data/templates/app/views/application/_header.html.erb +1 -1
  58. data/templates/app/views/application/_usa_banner.html.erb +3 -3
  59. data/templates/bin/ops/create_service_account.sh.tt +20 -11
  60. data/templates/bin/ops/destroy_service_account.sh.tt +3 -3
  61. data/templates/browserslistrc +1 -2
  62. data/templates/doc/compliance/TODO.md +1 -4
  63. metadata +30 -29
  64. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/deploy-production.yml.tt +0 -50
  65. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/deploy-staging.yml.tt +0 -50
  66. data/lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/import.sh +0 -13
  67. data/lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/main.tf.tt +0 -22
  68. data/lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/providers.tf +0 -16
  69. data/lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/run.sh.tt +0 -40
  70. data/lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/teardown_creds.sh.tt +0 -5
  71. data/lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/variables.tf +0 -2
  72. data/lib/generators/rails_template18f/terraform/templates/terraform/production/main.tf.tt +0 -90
  73. data/lib/generators/rails_template18f/terraform/templates/terraform/production/providers.tf +0 -23
  74. data/lib/generators/rails_template18f/terraform/templates/terraform/production/variables.tf +0 -2
  75. data/lib/generators/rails_template18f/terraform/templates/terraform/staging/main.tf.tt +0 -70
  76. data/lib/generators/rails_template18f/terraform/templates/terraform/staging/providers.tf +0 -23
  77. data/lib/generators/rails_template18f/terraform/templates/terraform/staging/variables.tf +0 -2
  78. data/lib/rails_template18f/generators/pipeline_options.rb +0 -18
  79. data/templates/app/assets/images/uswds.js +0 -6
  80. data/templates/config/deployment/production.yml +0 -3
  81. data/templates/config/deployment/staging.yml +0 -3
  82. data/templates/manifest.yml.tt +0 -17
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_template_18f
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Ahearn
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-12-18 00:00:00.000000000 Z
11
+ date: 2025-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 7.2.0
19
+ version: 8.0.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 7.2.0
26
+ version: 8.0.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 7.2.0
33
+ version: 8.0.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 7.2.0
40
+ version: 8.0.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: thor
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '1.40'
103
+ version: '1.43'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '1.40'
110
+ version: '1.43'
111
111
  description:
112
112
  email:
113
113
  - ryan.ahearn@gsa.gov
@@ -151,6 +151,7 @@ files:
151
151
  - lib/generators/rails_template18f/cloud_gov_config/templates/spec/models/cloud_gov_config_spec.rb
152
152
  - lib/generators/rails_template18f/dap/dap_generator.rb
153
153
  - lib/generators/rails_template18f/github_actions/github_actions_generator.rb
154
+ - lib/generators/rails_template18f/github_actions/templates/github/actions/compile-assets/action.yml
154
155
  - lib/generators/rails_template18f/github_actions/templates/github/actions/run-server/action.yml
155
156
  - lib/generators/rails_template18f/github_actions/templates/github/actions/setup-languages/action.yml.tt
156
157
  - lib/generators/rails_template18f/github_actions/templates/github/actions/setup-project/action.yml.tt
@@ -158,8 +159,8 @@ files:
158
159
  - lib/generators/rails_template18f/github_actions/templates/github/workflows/assemble-ssp.yml.tt
159
160
  - lib/generators/rails_template18f/github_actions/templates/github/workflows/brakeman-analysis.yml
160
161
  - lib/generators/rails_template18f/github_actions/templates/github/workflows/dependency-scans.yml
161
- - lib/generators/rails_template18f/github_actions/templates/github/workflows/deploy-production.yml.tt
162
- - lib/generators/rails_template18f/github_actions/templates/github/workflows/deploy-staging.yml.tt
162
+ - lib/generators/rails_template18f/github_actions/templates/github/workflows/deploy-production.yml
163
+ - lib/generators/rails_template18f/github_actions/templates/github/workflows/deploy-staging.yml
163
164
  - lib/generators/rails_template18f/github_actions/templates/github/workflows/owasp-daily-scan.yml.tt
164
165
  - lib/generators/rails_template18f/github_actions/templates/github/workflows/owasp-scan.yml.tt
165
166
  - lib/generators/rails_template18f/github_actions/templates/github/workflows/pa11y.yml.tt
@@ -174,7 +175,7 @@ files:
174
175
  - lib/generators/rails_template18f/i18n/templates/config/locales/fr.yml
175
176
  - lib/generators/rails_template18f/i18n/templates/config/locales/zh.yml
176
177
  - lib/generators/rails_template18f/i18n_js/i18n_js_generator.rb
177
- - lib/generators/rails_template18f/i18n_js/templates/app/javascript/i18n.js
178
+ - lib/generators/rails_template18f/i18n_js/templates/app/javascript/i18n/index.js
178
179
  - lib/generators/rails_template18f/i18n_js/templates/config/i18n-js.yml
179
180
  - lib/generators/rails_template18f/i18n_js/templates/config/initializers/i18n_js.rb
180
181
  - lib/generators/rails_template18f/i18n_js/templates/lib/tasks/i18n.rake
@@ -190,25 +191,29 @@ files:
190
191
  - lib/generators/rails_template18f/rails_erd/templates/erdconfig
191
192
  - lib/generators/rails_template18f/sidekiq/sidekiq_generator.rb
192
193
  - lib/generators/rails_template18f/sidekiq/templates/config/initializers/redis.rb
194
+ - lib/generators/rails_template18f/terraform/templates/full_bootstrap/imports.tf.tftpl
195
+ - lib/generators/rails_template18f/terraform/templates/full_bootstrap/main.tf.tt
196
+ - lib/generators/rails_template18f/terraform/templates/sandbox_bootstrap/imports.tf.tftpl
197
+ - lib/generators/rails_template18f/terraform/templates/sandbox_bootstrap/main.tf.tt
193
198
  - lib/generators/rails_template18f/terraform/templates/terraform/README.md.tt
194
- - lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/import.sh
195
- - lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/main.tf.tt
196
- - lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/providers.tf
197
- - lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/run.sh.tt
198
- - lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/teardown_creds.sh.tt
199
- - lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/variables.tf
200
- - lib/generators/rails_template18f/terraform/templates/terraform/production/main.tf.tt
201
- - lib/generators/rails_template18f/terraform/templates/terraform/production/providers.tf
202
- - lib/generators/rails_template18f/terraform/templates/terraform/production/variables.tf
203
- - lib/generators/rails_template18f/terraform/templates/terraform/staging/main.tf.tt
204
- - lib/generators/rails_template18f/terraform/templates/terraform/staging/providers.tf
205
- - lib/generators/rails_template18f/terraform/templates/terraform/staging/variables.tf
199
+ - lib/generators/rails_template18f/terraform/templates/terraform/app.tf.tt
200
+ - lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/apply.sh
201
+ - lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/templates/backend_config.tftpl
202
+ - lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/templates/bot_secrets.tftpl
203
+ - lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/users.auto.tfvars
204
+ - lib/generators/rails_template18f/terraform/templates/terraform/main.tf.tt
205
+ - lib/generators/rails_template18f/terraform/templates/terraform/production.tfvars.tt
206
+ - lib/generators/rails_template18f/terraform/templates/terraform/providers.tf.tt
207
+ - lib/generators/rails_template18f/terraform/templates/terraform/sandbox_bot/main.tf
208
+ - lib/generators/rails_template18f/terraform/templates/terraform/sandbox_bot/run.sh
209
+ - lib/generators/rails_template18f/terraform/templates/terraform/staging.tfvars.tt
210
+ - lib/generators/rails_template18f/terraform/templates/terraform/terraform.sh.tt
211
+ - lib/generators/rails_template18f/terraform/templates/terraform/variables.tf.tt
206
212
  - lib/generators/rails_template18f/terraform/terraform_generator.rb
207
213
  - lib/rails_template18f/generators.rb
208
214
  - lib/rails_template18f/generators/base.rb
209
215
  - lib/rails_template18f/generators/cloud_gov_options.rb
210
216
  - lib/rails_template18f/generators/cloud_gov_parsing.rb
211
- - lib/rails_template18f/generators/pipeline_options.rb
212
217
  - lib/rails_template18f/version.rb
213
218
  - lib/rails_template_18f.rb
214
219
  - rails-template-18f.gemspec
@@ -217,7 +222,6 @@ files:
217
222
  - template.rb
218
223
  - templates/Brewfile
219
224
  - templates/README.md.tt
220
- - templates/app/assets/images/uswds.js
221
225
  - templates/app/assets/stylesheets/uswds-components.scss
222
226
  - templates/app/assets/stylesheets/uswds-overrides/_index.scss
223
227
  - templates/app/assets/stylesheets/uswds-overrides/_override-usa-banner.scss
@@ -235,8 +239,6 @@ files:
235
239
  - templates/bin/pa11y-scan
236
240
  - templates/bin/with-server
237
241
  - templates/browserslistrc
238
- - templates/config/deployment/production.yml
239
- - templates/config/deployment/staging.yml
240
242
  - templates/config/environments/ci.rb
241
243
  - templates/config/environments/staging.rb
242
244
  - templates/doc/adr/0001-record-architecture-decisions.md.tt
@@ -252,7 +254,6 @@ files:
252
254
  - templates/githooks/pre-commit
253
255
  - templates/lib/tasks/cf.rake
254
256
  - templates/lib/tasks/scanning.rake
255
- - templates/manifest.yml.tt
256
257
  - templates/pa11y.js
257
258
  - templates/pa11yci.js
258
259
  - templates/zap.conf
@@ -271,7 +272,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
271
272
  requirements:
272
273
  - - ">="
273
274
  - !ruby/object:Gem::Version
274
- version: 2.7.5
275
+ version: 3.2.0
275
276
  required_rubygems_version: !ruby/object:Gem::Requirement
276
277
  requirements:
277
278
  - - ">="
@@ -1,50 +0,0 @@
1
- name: Deploy Production
2
-
3
- on:
4
- push:
5
- branches: [ production ]
6
- paths-ignore:
7
- - 'doc/**'
8
- - 'README.md'
9
-
10
- permissions:
11
- contents: read
12
- pull-requests: write
13
-
14
- jobs:
15
- deploy:
16
- name: Deploy to production
17
- runs-on: ubuntu-latest
18
- environment: production
19
- env:
20
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21
- steps:
22
- - uses: actions/checkout@v4
23
- <% if terraform? %>
24
- - name: Terraform apply
25
- uses: dflook/terraform-apply@v1
26
- env:
27
- TF_VAR_cf_user: ${{ secrets.CF_USERNAME }}
28
- TF_VAR_cf_password: ${{ secrets.CF_PASSWORD }}
29
- with:
30
- path: terraform/production
31
- backend_config: >
32
- access_key=${{ secrets.TERRAFORM_STATE_ACCESS_KEY }}
33
- secret_key=${{ secrets.TERRAFORM_STATE_SECRET_ACCESS_KEY }}
34
- <% end %>
35
- - name: Set restricted egress
36
- uses: cloud-gov/cg-cli-tools@main
37
- with:
38
- cf_username: ${{ secrets.CF_USERNAME }}
39
- cf_password: ${{ secrets.CF_PASSWORD }}
40
- cf_org: <%= cloud_gov_organization %>
41
- cf_space: <%= cloud_gov_production_space %>
42
- cf_command: bind-security-group trusted_local_networks_egress $INPUT_CF_ORG --space $INPUT_CF_SPACE
43
- - name: Deploy app
44
- uses: cloud-gov/cg-cli-tools@main
45
- with:
46
- cf_username: ${{ secrets.CF_USERNAME }}
47
- cf_password: ${{ secrets.CF_PASSWORD }}
48
- cf_org: <%= cloud_gov_organization %>
49
- cf_space: <%= cloud_gov_production_space %>
50
- cf_command: push --vars-file config/deployment/production.yml --var rails_master_key="${{ secrets.RAILS_MASTER_KEY }}" --strategy rolling
@@ -1,50 +0,0 @@
1
- name: Deploy Staging
2
-
3
- on:
4
- push:
5
- branches: [ main ]
6
- paths-ignore:
7
- - 'doc/**'
8
- - 'README.md'
9
-
10
- permissions:
11
- contents: read
12
- pull-requests: write
13
-
14
- jobs:
15
- deploy:
16
- name: Deploy to staging
17
- runs-on: ubuntu-latest
18
- environment: staging
19
- env:
20
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21
- steps:
22
- - uses: actions/checkout@v4
23
- <% if terraform? %>
24
- - name: Terraform apply
25
- uses: dflook/terraform-apply@v1
26
- env:
27
- TF_VAR_cf_user: ${{ secrets.CF_USERNAME }}
28
- TF_VAR_cf_password: ${{ secrets.CF_PASSWORD }}
29
- with:
30
- path: terraform/staging
31
- backend_config: >
32
- access_key=${{ secrets.TERRAFORM_STATE_ACCESS_KEY }}
33
- secret_key=${{ secrets.TERRAFORM_STATE_SECRET_ACCESS_KEY }}
34
- <% end %>
35
- - name: Set restricted egress
36
- uses: cloud-gov/cg-cli-tools@main
37
- with:
38
- cf_username: ${{ secrets.CF_USERNAME }}
39
- cf_password: ${{ secrets.CF_PASSWORD }}
40
- cf_org: <%= cloud_gov_organization %>
41
- cf_space: <%= cloud_gov_staging_space %>
42
- cf_command: bind-security-group trusted_local_networks_egress $INPUT_CF_ORG --space $INPUT_CF_SPACE
43
- - name: Deploy app
44
- uses: cloud-gov/cg-cli-tools@main
45
- with:
46
- cf_username: ${{ secrets.CF_USERNAME }}
47
- cf_password: ${{ secrets.CF_PASSWORD }}
48
- cf_org: <%= cloud_gov_organization %>
49
- cf_space: <%= cloud_gov_staging_space %>
50
- cf_command: push --vars-file config/deployment/staging.yml --var rails_master_key="${{ secrets.RAILS_MASTER_KEY }}" --strategy rolling
@@ -1,13 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- read -p "Are you sure you want to import terraform state (y/n)? " verify
4
-
5
- if [[ $verify == "y" ]]; then
6
- echo "Importing bootstrap state"
7
- ./run.sh init
8
- ./run.sh import module.s3.cloudfoundry_service_instance.bucket TKTK
9
- ./run.sh import cloudfoundry_service_key.bucket_creds TKTK
10
- ./run.sh plan
11
- else
12
- echo "Not importing bootstrap state"
13
- fi
@@ -1,22 +0,0 @@
1
- locals {
2
- s3_service_name = "<%= app_name %>-terraform-state"
3
- }
4
-
5
- module "s3" {
6
- source = "github.com/gsa-tts/terraform-cloudgov//s3?ref=v1.0.0"
7
-
8
- cf_org_name = "<%= cloud_gov_organization %>"
9
- cf_space_name = "<%= cloud_gov_production_space %>-mgmt"
10
- name = local.s3_service_name<% if cloud_gov_organization == "sandbox-gsa" %>
11
- s3_plan_name = "basic-sandbox"<% end %>
12
- }
13
-
14
- resource "cloudfoundry_service_key" "bucket_creds" {
15
- name = "${local.s3_service_name}-access"
16
- service_instance = module.s3.bucket_id
17
- }
18
-
19
- output "bucket_credentials" {
20
- value = cloudfoundry_service_key.bucket_creds.credentials
21
- sensitive = true
22
- }
@@ -1,16 +0,0 @@
1
- terraform {
2
- required_version = "~> 1.0"
3
- required_providers {
4
- cloudfoundry = {
5
- source = "cloudfoundry-community/cloudfoundry"
6
- version = "0.53.1"
7
- }
8
- }
9
- }
10
-
11
- provider "cloudfoundry" {
12
- api_url = "https://api.fr.cloud.gov"
13
- user = var.cf_user
14
- password = var.cf_password
15
- app_logs_max = 30
16
- }
@@ -1,40 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- if ! command -v jq &> /dev/null
4
- then
5
- echo "jq must be installed. Run 'brew bundle' to install everything in the Brewfile"
6
- exit 1
7
- fi
8
- if ! command -v terraform &> /dev/null
9
- then
10
- echo "terraform must be installed before running this script"
11
- exit 1
12
- fi
13
-
14
- dig_output () {
15
- dig_result=`cat terraform.tfstate | jq -r ".outputs.bucket_credentials.value.$1"`
16
- }
17
-
18
- if [[ ! -f "secrets.auto.tfvars" ]]; then
19
- cf target -s <%= cloud_gov_production_space %>-mgmt || cf create-space <%= cloud_gov_production_space %>-mgmt && cf disallow-space-ssh <%= cloud_gov_production_space %>-mgmt
20
- ../../bin/ops/create_service_account.sh -s <%= cloud_gov_production_space %>-mgmt -u config-bootstrap-deployer > secrets.auto.tfvars
21
- fi
22
-
23
- if [[ $# -gt 0 ]]; then
24
- echo "Running terraform $@"
25
- terraform $@
26
- if [[ -f terraform.tfstate ]]; then
27
- echo
28
- echo "Credentials for terraform state bucket:"
29
- dig_output "bucket"
30
- echo "BUCKET=$dig_result"
31
- dig_output "access_key_id"
32
- echo "AWS_ACCESS_KEY_ID=$dig_result"
33
- dig_output "secret_access_key"
34
- echo "AWS_SECRET_ACCESS_KEY=$dig_result"
35
- dig_output "region"
36
- echo "AWS_REGION=$dig_result"
37
- fi
38
- else
39
- echo "Not running terraform"
40
- fi
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- ../../bin/ops/destroy_service_account.sh -s <%= cloud_gov_production_space %>-mgmt -u config-bootstrap-deployer
4
-
5
- rm secrets.auto.tfvars
@@ -1,2 +0,0 @@
1
- variable "cf_password" {}
2
- variable "cf_user" {}
@@ -1,90 +0,0 @@
1
- locals {
2
- cf_org_name = "<%= cloud_gov_organization %>"
3
- cf_space_name = "<%= cloud_gov_production_space %>"
4
- env = "production"
5
- app_name = "<%= app_name %>"
6
- }
7
-
8
- module "app_space" {
9
- source = "github.com/gsa-tts/terraform-cloudgov//cg_space?ref=v1.1.0"
10
-
11
- cf_org_name = local.cf_org_name
12
- cf_space_name = local.cf_space_name
13
- deployers = [var.cf_user]
14
- # developers should include any users that will potentially need to run `cf ssh` on the app
15
- developers = []
16
- }
17
-
18
- module "database" {
19
- source = "github.com/gsa-tts/terraform-cloudgov//database?ref=v1.1.0"
20
-
21
- cf_org_name = local.cf_org_name
22
- cf_space_name = local.cf_space_name
23
- name = "${local.app_name}-rds-${local.env}"
24
- rds_plan_name = "TKTK-production-rds-plan"
25
- # depends_on line is needed only for initial creation and destruction. It should be commented out for updates to prevent unwanted cascading effects
26
- depends_on = [module.app_space]
27
- }
28
- <% if has_active_job? %>
29
- module "redis" {
30
- source = "github.com/gsa-tts/terraform-cloudgov//redis?ref=v1.1.0"
31
-
32
- cf_org_name = local.cf_org_name
33
- cf_space_name = local.cf_space_name
34
- name = "${local.app_name}-redis-${local.env}"
35
- redis_plan_name = "TKTK-production-redis-plan"
36
- # depends_on line is needed only for initial creation and destruction. It should be commented out for updates to prevent unwanted cascading effects
37
- depends_on = [module.app_space]
38
- }
39
- <% end %>
40
- <% if has_active_storage? %>
41
- module "s3" {
42
- source = "github.com/gsa-tts/terraform-cloudgov//s3?ref=v1.1.0"
43
-
44
- cf_org_name = local.cf_org_name
45
- cf_space_name = local.cf_space_name
46
- name = "${local.app_name}-s3-${local.env}"<% if cloud_gov_organization == "sandbox-gsa" %>
47
- s3_plan_name = "basic-sandbox"<% end %>
48
- # depends_on line is needed only for initial creation and destruction. It should be commented out for updates to prevent unwanted cascading effects
49
- depends_on = [module.app_space]
50
- }
51
-
52
- ###########################################################################
53
- # The following lines need to be commented out for the initial `terraform apply`
54
- # It can be re-enabled after:
55
- # 1) the app has first been deployed
56
- # 2) Your organization has sufficient memory. Each clamav app requires 3GB
57
- ###########################################################################
58
- # module "clamav" {
59
- # source = "github.com/gsa-tts/terraform-cloudgov//clamav?ref=v1.1.0"
60
- #
61
- # cf_org_name = local.cf_org_name
62
- # cf_space_name = local.cf_space_name
63
- # app_name_or_id = "${local.app_name}-${local.env}"
64
- # name = "${local.app_name}-clamapi-${local.env}"
65
- # clamav_image = "ghcr.io/gsa-tts/clamav-rest/clamav:20240602"
66
- # max_file_size = "30M"
67
- # # depends_on line is needed only for initial creation and destruction. It should be commented out for updates to prevent unwanted cascading effects
68
- # depends_on = [module.app_space]
69
- # }
70
- <% end %>
71
-
72
- ###########################################################################
73
- # The following lines need to be commented out for the initial `terraform apply`
74
- # It can be re-enabled after:
75
- # 1) the app has first been deployed
76
- # 2) the route has been manually created by an OrgManager:
77
- # `cf create-domain <%= cloud_gov_organization %> TKTK-production-domain-name`
78
- ###########################################################################
79
- # module "domain" {
80
- # source = "github.com/gsa-tts/terraform-cloudgov//domain?ref=v1.1.0"
81
- #
82
- # cf_org_name = local.cf_org_name
83
- # cf_space_name = local.cf_space_name
84
- # app_name_or_id = "${local.app_name}-${local.env}"
85
- # cdn_plan_name = "domain"
86
- # domain_name = "TKTK-production-domain-name"
87
- # host_name = "TKTK-production-hostname (optional)"
88
- # # depends_on line is needed only for initial creation and destruction. It should be commented out for updates to prevent unwanted cascading effects
89
- # depends_on = [module.app_space]
90
- # }
@@ -1,23 +0,0 @@
1
- terraform {
2
- required_version = "~> 1.0"
3
- required_providers {
4
- cloudfoundry = {
5
- source = "cloudfoundry-community/cloudfoundry"
6
- version = "0.53.1"
7
- }
8
- }
9
-
10
- backend "s3" {
11
- bucket = "TKTK-s3-bucket"
12
- key = "terraform.tfstate.prod"
13
- encrypt = "true"
14
- region = "us-gov-west-1"
15
- }
16
- }
17
-
18
- provider "cloudfoundry" {
19
- api_url = "https://api.fr.cloud.gov"
20
- user = var.cf_user
21
- password = var.cf_password
22
- app_logs_max = 30
23
- }
@@ -1,2 +0,0 @@
1
- variable "cf_password" {}
2
- variable "cf_user" {}
@@ -1,70 +0,0 @@
1
- locals {
2
- cf_org_name = "<%= cloud_gov_organization %>"
3
- cf_space_name = "<%= cloud_gov_staging_space %>"
4
- env = "staging"
5
- app_name = "<%= app_name %>"
6
- }
7
-
8
- module "app_space" {
9
- source = "github.com/gsa-tts/terraform-cloudgov//cg_space?ref=v1.1.0"
10
-
11
- cf_org_name = local.cf_org_name
12
- cf_space_name = local.cf_space_name
13
- deployers = [var.cf_user]
14
- # developers should include any users that will potentially need to run `cf ssh` on the app
15
- developers = []
16
- }
17
-
18
- module "database" {
19
- source = "github.com/gsa-tts/terraform-cloudgov//database?ref=v1.1.0"
20
-
21
- cf_org_name = local.cf_org_name
22
- cf_space_name = local.cf_space_name
23
- name = "${local.app_name}-rds-${local.env}"
24
- rds_plan_name = "micro-psql"
25
- # depends_on line is needed only for initial creation and destruction. It should be commented out for updates to prevent unwanted cascading effects
26
- depends_on = [module.app_space]
27
- }
28
- <% if has_active_job? %>
29
- module "redis" {
30
- source = "github.com/gsa-tts/terraform-cloudgov//redis?ref=v1.1.0"
31
-
32
- cf_org_name = local.cf_org_name
33
- cf_space_name = local.cf_space_name
34
- name = "${local.app_name}-redis-${local.env}"
35
- redis_plan_name = "redis-dev"
36
- # depends_on line is needed only for initial creation and destruction. It should be commented out for updates to prevent unwanted cascading effects
37
- depends_on = [module.app_space]
38
- }
39
- <% end %>
40
- <% if has_active_storage? %>
41
- module "s3" {
42
- source = "github.com/gsa-tts/terraform-cloudgov//s3?ref=v1.1.0"
43
-
44
- cf_org_name = local.cf_org_name
45
- cf_space_name = local.cf_space_name
46
- name = "${local.app_name}-s3-${local.env}"<% if cloud_gov_organization == "sandbox-gsa" %>
47
- s3_plan_name = "basic-sandbox"<% end %>
48
- # depends_on line is needed only for initial creation and destruction. It should be commented out for updates to prevent unwanted cascading effects
49
- depends_on = [module.app_space]
50
- }
51
-
52
- ###########################################################################
53
- # The following lines need to be commented out for the initial `terraform apply`
54
- # It can be re-enabled after:
55
- # 1) the app has first been deployed
56
- # 2) Your organization has sufficient memory. Each clamav app requires 3GB
57
- ###########################################################################
58
- # module "clamav" {
59
- # source = "github.com/gsa-tts/terraform-cloudgov//clamav?ref=v1.1.0"
60
- #
61
- # cf_org_name = local.cf_org_name
62
- # cf_space_name = local.cf_space_name
63
- # app_name_or_id = "${local.app_name}-${local.env}"
64
- # name = "${local.app_name}-clamapi-${local.env}"
65
- # clamav_image = "ghcr.io/gsa-tts/clamav-rest/clamav:20240602"
66
- # max_file_size = "30M"
67
- # # depends_on line is needed only for initial creation and destruction. It should be commented out for updates to prevent unwanted cascading effects
68
- # depends_on = [module.app_space]
69
- # }
70
- <% end %>
@@ -1,23 +0,0 @@
1
- terraform {
2
- required_version = "~> 1.0"
3
- required_providers {
4
- cloudfoundry = {
5
- source = "cloudfoundry-community/cloudfoundry"
6
- version = "0.53.1"
7
- }
8
- }
9
-
10
- backend "s3" {
11
- bucket = "TKTK-s3-bucket"
12
- key = "terraform.tfstate.stage"
13
- encrypt = "true"
14
- region = "us-gov-west-1"
15
- }
16
- }
17
-
18
- provider "cloudfoundry" {
19
- api_url = "https://api.fr.cloud.gov"
20
- user = var.cf_user
21
- password = var.cf_password
22
- app_logs_max = 30
23
- }
@@ -1,2 +0,0 @@
1
- variable "cf_password" {}
2
- variable "cf_user" {}
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RailsTemplate18f
4
- module Generators
5
- module PipelineOptions
6
- extend ActiveSupport::Concern
7
- include CloudGovOptions
8
-
9
- included do
10
- class_option :terraform, type: :boolean, desc: "Generate actions for planning and applying terraform"
11
- end
12
-
13
- def terraform?
14
- options[:terraform].nil? ? terraform_dir_exists? : options[:terraform]
15
- end
16
- end
17
- end
18
- end
@@ -1,6 +0,0 @@
1
- // Glue to find USWDS images with the `image_tag` helper
2
-
3
- //= link @uswds/uswds/dist/img/us_flag_small.png
4
- //= link @uswds/uswds/dist/img/icon-dot-gov.svg
5
- //= link @uswds/uswds/dist/img/icon-https.svg
6
- //= link @uswds/uswds/dist/img/usa-icons/close.svg
@@ -1,3 +0,0 @@
1
- env: production
2
- web_instances: 2
3
- web_memory: 512M
@@ -1,3 +0,0 @@
1
- env: staging
2
- web_instances: 1
3
- web_memory: 256M
@@ -1,17 +0,0 @@
1
- ---
2
- applications:
3
- - name: <%= app_name %>-((env))
4
- buildpacks:
5
- - ruby_buildpack
6
- env:
7
- RAILS_MASTER_KEY: ((rails_master_key))
8
- RAILS_ENV: ((env))
9
- RAILS_LOG_TO_STDOUT: true
10
- RAILS_SERVE_STATIC_FILES: true
11
- processes:
12
- - type: web
13
- instances: ((web_instances))
14
- memory: ((web_memory))
15
- command: bundle exec rake cf:on_first_instance db:migrate && exec bundle exec rails s -b 0.0.0.0 -p $PORT -e $RAILS_ENV
16
- services:
17
- - <%= app_name %>-rds-((env))