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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +64 -61
- data/README.md +11 -16
- data/lib/generators/rails_template18f/active_storage/active_storage_generator.rb +7 -6
- data/lib/generators/rails_template18f/circleci/circleci_generator.rb +28 -27
- data/lib/generators/rails_template18f/circleci/templates/Dockerfile.ci.tt +0 -1
- data/lib/generators/rails_template18f/circleci/templates/circleci/config.yml.tt +152 -163
- data/lib/generators/rails_template18f/github_actions/github_actions_generator.rb +31 -30
- data/lib/generators/rails_template18f/github_actions/templates/github/actions/compile-assets/action.yml +50 -0
- data/lib/generators/rails_template18f/github_actions/templates/github/actions/setup-project/action.yml.tt +4 -8
- data/lib/generators/rails_template18f/github_actions/templates/github/dependabot.yml.tt +2 -4
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/deploy-production.yml +72 -0
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/deploy-staging.yml +72 -0
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/owasp-daily-scan.yml.tt +10 -1
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/owasp-scan.yml.tt +1 -1
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/pa11y.yml.tt +2 -2
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/terraform-production.yml +46 -3
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/terraform-staging.yml +46 -3
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/validate-ssp.yml +2 -2
- data/lib/generators/rails_template18f/i18n_js/i18n_js_generator.rb +2 -2
- data/lib/generators/rails_template18f/i18n_js/templates/app/javascript/{i18n.js → i18n/index.js} +1 -1
- data/lib/generators/rails_template18f/i18n_js/templates/config/i18n-js.yml +1 -1
- data/lib/generators/rails_template18f/newrelic/newrelic_generator.rb +4 -2
- data/lib/generators/rails_template18f/public_egress/public_egress_generator.rb +86 -54
- data/lib/generators/rails_template18f/sidekiq/sidekiq_generator.rb +8 -17
- data/lib/generators/rails_template18f/terraform/templates/full_bootstrap/imports.tf.tftpl +25 -0
- data/lib/generators/rails_template18f/terraform/templates/full_bootstrap/main.tf.tt +159 -0
- data/lib/generators/rails_template18f/terraform/templates/sandbox_bootstrap/imports.tf.tftpl +10 -0
- data/lib/generators/rails_template18f/terraform/templates/sandbox_bootstrap/main.tf.tt +117 -0
- data/lib/generators/rails_template18f/terraform/templates/terraform/README.md.tt +77 -93
- data/lib/generators/rails_template18f/terraform/templates/terraform/app.tf.tt +63 -0
- data/lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/apply.sh +15 -0
- data/lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/templates/backend_config.tftpl +8 -0
- data/lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/templates/bot_secrets.tftpl +5 -0
- data/lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/users.auto.tfvars +5 -0
- data/lib/generators/rails_template18f/terraform/templates/terraform/main.tf.tt +106 -0
- data/lib/generators/rails_template18f/terraform/templates/terraform/production.tfvars.tt +10 -0
- data/lib/generators/rails_template18f/terraform/templates/terraform/providers.tf.tt +32 -0
- data/lib/generators/rails_template18f/terraform/templates/terraform/sandbox_bot/main.tf +74 -0
- data/lib/generators/rails_template18f/terraform/templates/terraform/sandbox_bot/run.sh +17 -0
- data/lib/generators/rails_template18f/terraform/templates/terraform/staging.tfvars.tt +8 -0
- data/lib/generators/rails_template18f/terraform/templates/terraform/terraform.sh.tt +135 -0
- data/lib/generators/rails_template18f/terraform/templates/terraform/variables.tf.tt +99 -0
- data/lib/generators/rails_template18f/terraform/terraform_generator.rb +13 -4
- data/lib/rails_template18f/generators/cloud_gov_options.rb +9 -6
- data/lib/rails_template18f/generators/cloud_gov_parsing.rb +7 -7
- data/lib/rails_template18f/generators.rb +0 -1
- data/lib/rails_template18f/version.rb +1 -1
- data/rails-template-18f.gemspec +4 -4
- data/railsrc +4 -2
- data/railsrc-hotwire +4 -2
- data/template.rb +61 -71
- data/templates/README.md.tt +21 -8
- data/templates/app/assets/stylesheets/uswds-settings.scss +3 -2
- data/templates/app/views/application/_header.html.erb +1 -1
- data/templates/app/views/application/_usa_banner.html.erb +3 -3
- data/templates/bin/ops/create_service_account.sh.tt +20 -11
- data/templates/bin/ops/destroy_service_account.sh.tt +3 -3
- data/templates/browserslistrc +1 -2
- data/templates/doc/compliance/TODO.md +1 -4
- metadata +30 -29
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/deploy-production.yml.tt +0 -50
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/deploy-staging.yml.tt +0 -50
- data/lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/import.sh +0 -13
- data/lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/main.tf.tt +0 -22
- data/lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/providers.tf +0 -16
- data/lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/run.sh.tt +0 -40
- data/lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/teardown_creds.sh.tt +0 -5
- data/lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/variables.tf +0 -2
- data/lib/generators/rails_template18f/terraform/templates/terraform/production/main.tf.tt +0 -90
- data/lib/generators/rails_template18f/terraform/templates/terraform/production/providers.tf +0 -23
- data/lib/generators/rails_template18f/terraform/templates/terraform/production/variables.tf +0 -2
- data/lib/generators/rails_template18f/terraform/templates/terraform/staging/main.tf.tt +0 -70
- data/lib/generators/rails_template18f/terraform/templates/terraform/staging/providers.tf +0 -23
- data/lib/generators/rails_template18f/terraform/templates/terraform/staging/variables.tf +0 -2
- data/lib/rails_template18f/generators/pipeline_options.rb +0 -18
- data/templates/app/assets/images/uswds.js +0 -6
- data/templates/config/deployment/production.yml +0 -3
- data/templates/config/deployment/staging.yml +0 -3
- data/templates/manifest.yml.tt +0 -17
data/template.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "colorize"
|
2
|
+
require "bundler/version"
|
2
3
|
|
3
4
|
## Supporting methods
|
4
5
|
# tell our template to grab all files from the templates directory
|
@@ -14,8 +15,8 @@ def skip_active_job?
|
|
14
15
|
!!options[:skip_active_job]
|
15
16
|
end
|
16
17
|
|
17
|
-
def
|
18
|
-
options[:javascript] == "
|
18
|
+
def esbuild?
|
19
|
+
options[:javascript] == "esbuild"
|
19
20
|
end
|
20
21
|
|
21
22
|
def hotwire?
|
@@ -26,9 +27,17 @@ def cloud_gov_org_tktk?
|
|
26
27
|
@cloud_gov_organization =~ /TKTK/
|
27
28
|
end
|
28
29
|
|
30
|
+
def gem_ruby_entry
|
31
|
+
if Gem::Version.new(Bundler::VERSION) >= Gem::Version.new("2.4.20") # add file: option to #ruby
|
32
|
+
'ruby file: ".ruby-version"'
|
33
|
+
else
|
34
|
+
"ruby \"#{@ruby_version}\""
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
29
38
|
@announcements = Hash.new { |h, k| h[k] = [] }
|
30
39
|
def register_announcement(section_name, instructions)
|
31
|
-
@announcements[section_name.to_sym] << instructions
|
40
|
+
@announcements[section_name.to_sym] << instructions.strip
|
32
41
|
end
|
33
42
|
|
34
43
|
def print_announcements
|
@@ -39,16 +48,18 @@ def print_announcements
|
|
39
48
|
end
|
40
49
|
end
|
41
50
|
|
42
|
-
unless Gem::Dependency.new("rails", "~>
|
43
|
-
warn "This template requires Rails
|
51
|
+
unless Gem::Dependency.new("rails", "~> 8.0.1").match?("rails", Rails.gem_version)
|
52
|
+
warn "This template requires Rails 8.0.x"
|
44
53
|
if Gem::Dependency.new("rails", "~> 6.1.0").match?("rails", Rails.gem_version)
|
45
54
|
warn "See the rails-6 branch https://github.com/gsa-tts/rails-template/tree/rails-6"
|
46
55
|
elsif Gem::Dependency.new("rails", "~> 7.0.0").match?("rails", Rails.gem_version)
|
47
56
|
warn "See the rails-7.0 branch https://github.com/gsa-tts/rails-template/tree/rails-7.0"
|
48
57
|
elsif Gem::Dependency.new("rails", "~> 7.1.0").match?("rails", Rails.gem_version)
|
49
58
|
warn "See the rails-7.1 branch https://github.com/gsa-tts/rails-template/tree/rails-7.1"
|
50
|
-
elsif Gem::Dependency.new("rails", "
|
51
|
-
warn "
|
59
|
+
elsif Gem::Dependency.new("rails", "~> 7.2.0").match?("rails", Rails.gem_version)
|
60
|
+
warn "See the rails-7.2 branch https://github.com/gsa-tts/rails-template/tree/rails-7.2"
|
61
|
+
elsif Gem::Dependency.new("rails", ">= 8.1.0").match?("rails", Rails.gem_version)
|
62
|
+
warn "We haven't updated the template for Rails >= 8.1 yet! Please file an issue so we can get the template updated"
|
52
63
|
else
|
53
64
|
warn "We didn't recognize the version of Rails you are using: #{Rails.version}"
|
54
65
|
end
|
@@ -77,12 +88,13 @@ if auditree
|
|
77
88
|
auditree_evidence_repo = ask("What is the https address of your auditree evidence repo? (Leave blank to fill in later)")
|
78
89
|
end
|
79
90
|
|
80
|
-
terraform = yes?("Create terraform files for cloud.gov services? (y/n)")
|
81
91
|
@cloud_gov_organization = ask("What is your cloud.gov organization name? (Leave blank to fill in later)")
|
82
92
|
default_staging_space = "staging"
|
83
93
|
cloud_gov_staging_space = ask("What is your cloud.gov staging space name? (Default: #{default_staging_space})")
|
84
|
-
default_prod_space = "
|
85
|
-
|
94
|
+
default_prod_space = "production"
|
95
|
+
if @cloud_gov_organization != "sandbox-gsa"
|
96
|
+
cloud_gov_production_space = ask("What is your cloud.gov production space name? (Default: #{default_prod_space})")
|
97
|
+
end
|
86
98
|
@cloud_gov_organization = "TKTK-cloud.gov-org-name" if @cloud_gov_organization.blank?
|
87
99
|
cloud_gov_staging_space = default_staging_space if cloud_gov_staging_space.blank?
|
88
100
|
cloud_gov_production_space = default_prod_space if cloud_gov_production_space.blank?
|
@@ -106,6 +118,8 @@ running_node_version = `node --version`.gsub(/^v/, "").strip
|
|
106
118
|
run_db_setup = yes?("Run db setup steps? (y/n)")
|
107
119
|
|
108
120
|
## Start of app customizations
|
121
|
+
insert_into_file "Gemfile", "\n#{gem_ruby_entry}\n", after: /^source "https.*\n/
|
122
|
+
|
109
123
|
template "README.md", force: true
|
110
124
|
register_announcement("Documentation", <<~EOM)
|
111
125
|
* Complete the project README by adding a quick summary of the project in the top section.
|
@@ -187,7 +201,7 @@ after_bundle do
|
|
187
201
|
end
|
188
202
|
|
189
203
|
# updates for OWASP scan to pass
|
190
|
-
gem "secure_headers", "~>
|
204
|
+
gem "secure_headers", "~> 7.1"
|
191
205
|
initializer "secure_headers.rb", <<~EOM
|
192
206
|
SecureHeaders::Configuration.default do |config|
|
193
207
|
# CSP settings are handled by Rails
|
@@ -226,22 +240,16 @@ uncomment_lines csp_initializer, "content_security_policy_nonce"
|
|
226
240
|
|
227
241
|
# install development & testing gems
|
228
242
|
gem_group :development, :test do
|
229
|
-
gem "rspec-rails", "~>
|
243
|
+
gem "rspec-rails", "~> 7.1"
|
230
244
|
gem "dotenv-rails", "~> 3.1"
|
231
245
|
gem "bundler-audit", "~> 0.9"
|
232
|
-
gem "standard", "~> 1.
|
246
|
+
gem "standard", "~> 1.43"
|
233
247
|
end
|
234
248
|
if ENV["RT_DEV"] == "true"
|
235
249
|
gem "rails_template_18f", group: :development, path: ENV["PWD"]
|
236
250
|
else
|
237
251
|
gem "rails_template_18f", group: :development
|
238
252
|
end
|
239
|
-
after_bundle do
|
240
|
-
gsub_file "bin/dev", /foreman start -f (.*)$/, <<~'EOM'
|
241
|
-
# pass /dev/null for the environment file to prevent weird interactions between foreman and dotenv
|
242
|
-
foreman start -e /dev/null -f \1
|
243
|
-
EOM
|
244
|
-
end
|
245
253
|
|
246
254
|
copy_file "lib/tasks/scanning.rake"
|
247
255
|
copy_file "env", ".env"
|
@@ -269,27 +277,19 @@ unless skip_git?
|
|
269
277
|
end
|
270
278
|
|
271
279
|
# setup USWDS and asset pipeline
|
272
|
-
copy_file "browserslistrc", ".browserslistrc"
|
280
|
+
copy_file "browserslistrc", ".browserslistrc"
|
273
281
|
after_bundle do
|
274
|
-
run 'npm pkg set scripts.build:css="postcss ./app/assets/stylesheets/application.postcss.scss -o ./app/assets/builds/application.css"'
|
275
|
-
# include verbose flag for dev postcss output
|
276
|
-
gsub_file "Procfile.dev", "yarn build:css --watch", "yarn build:css --verbose --watch"
|
277
|
-
# Replace postcss-nesting with sass since USWDS uses sass
|
278
|
-
run "yarn remove postcss-nesting"
|
279
|
-
run "yarn add @csstools/postcss-sass postcss-scss postcss-minify"
|
280
|
-
insert_into_file "postcss.config.js", " syntax: 'postcss-scss',\n", before: /^\s+plugins/
|
281
|
-
insert_into_file "package.json", <<-EOJSON, before: /^\s+\}$/
|
282
|
-
},
|
283
|
-
"resolutions": {
|
284
|
-
"@csstools/postcss-sass/@csstools/sass-import-resolve": "https://github.com/rahearn/sass-import-resolve"
|
285
|
-
EOJSON
|
286
|
-
gsub_file "postcss.config.js", "postcss-nesting'),", <<~EOJS.strip
|
287
|
-
@csstools/postcss-sass')({
|
288
|
-
includePaths: ['./node_modules/@uswds/uswds/packages'],
|
289
|
-
}),
|
290
|
-
EOJS
|
291
|
-
insert_into_file "postcss.config.js", " process.env.NODE_ENV === 'production' ? require('postcss-minify') : null,\n", before: /^\s+\],/
|
292
282
|
run "yarn add @uswds/uswds"
|
283
|
+
if esbuild?
|
284
|
+
run "yarn add --dev browserslist browserslist-to-esbuild"
|
285
|
+
run 'npm pkg set scripts.build:js="esbuild app/javascript/*.* --bundle --sourcemap --format=esm --outdir=app/assets/builds --public-path=/assets --target=\$(cat config/esbuild-targets.txt) --pure:console.log"'
|
286
|
+
run 'npm pkg set scripts.build="yarn build:js --minify"'
|
287
|
+
run 'npm pkg set scripts.update-browserslist="update-browserslist-db && browserslist-to-esbuild | sed \'s/ /,/g\' > config/esbuild-targets.txt"'
|
288
|
+
run "yarn update-browserslist"
|
289
|
+
gsub_file "Procfile.dev", "js: yarn build --watch", "js: yarn build:js --watch"
|
290
|
+
end
|
291
|
+
gsub_file "package.json", "--load-path=node_modules", "--load-path=node_modules/@uswds/uswds/packages --style=compressed"
|
292
|
+
gsub_file "Procfile.dev", "css: yarn build:css --watch", "css: yarn build:css --style=expanded --watch"
|
293
293
|
appjs_file = "app/javascript/application.js"
|
294
294
|
append_to_file appjs_file, "\nimport \"@uswds/uswds\"\n"
|
295
295
|
if hotwire?
|
@@ -313,15 +313,12 @@ after_bundle do
|
|
313
313
|
EOJS
|
314
314
|
end
|
315
315
|
directory "app/assets"
|
316
|
-
append_to_file "app/assets/stylesheets/application.
|
316
|
+
append_to_file "app/assets/stylesheets/application.sass.scss", <<~EOCSS
|
317
317
|
@forward "uswds-settings";
|
318
318
|
@forward "uswds-components";
|
319
319
|
|
320
320
|
@forward "uswds-overrides";
|
321
321
|
EOCSS
|
322
|
-
inside "app/assets/stylesheets" do
|
323
|
-
File.rename("application.postcss.css", "application.postcss.scss")
|
324
|
-
end
|
325
322
|
gsub_file "app/views/layouts/application.html.erb", "<html>", '<html lang="<%= I18n.locale %>">'
|
326
323
|
gsub_file "app/views/layouts/application.html.erb", /^\s+<%= yield %>/, <<-EOHTML
|
327
324
|
<%= render "application/usa_banner" %>
|
@@ -332,7 +329,13 @@ after_bundle do
|
|
332
329
|
</div>
|
333
330
|
</main>
|
334
331
|
EOHTML
|
335
|
-
append_to_file "config/initializers/assets.rb",
|
332
|
+
append_to_file "config/initializers/assets.rb", <<~EOC
|
333
|
+
Rails.application.configure do
|
334
|
+
config.assets.paths << Rails.root.join("node_modules/@uswds/uswds/dist/img")
|
335
|
+
config.assets.paths << Rails.root.join("node_modules/@uswds/uswds/dist/fonts")
|
336
|
+
config.assets.excluded_paths << Rails.root.join("app/assets/stylesheets")
|
337
|
+
end
|
338
|
+
EOC
|
336
339
|
end
|
337
340
|
directory "app/views/application"
|
338
341
|
|
@@ -387,29 +390,24 @@ if dap
|
|
387
390
|
end
|
388
391
|
|
389
392
|
# infrastructure & deploy
|
390
|
-
template "manifest.yml"
|
391
393
|
copy_file "lib/tasks/cf.rake"
|
392
|
-
directory "config/deployment"
|
393
394
|
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
* terraform/production/main.tf
|
409
|
-
EOM
|
410
|
-
end
|
411
|
-
register_announcement("Terraform", "Run the bootstrap script and update the appropriate CI/CD environment variables defined in the Deployment section of the README")
|
395
|
+
after_bundle do
|
396
|
+
generator_arguments = [
|
397
|
+
"--cg-org=#{@cloud_gov_organization}",
|
398
|
+
"--cg-staging=#{cloud_gov_staging_space}",
|
399
|
+
"--cg-prod=#{cloud_gov_production_space}"
|
400
|
+
]
|
401
|
+
generate "rails_template18f:terraform", *generator_arguments
|
402
|
+
end
|
403
|
+
if cloud_gov_org_tktk?
|
404
|
+
register_announcement("Terraform", <<~EOM)
|
405
|
+
Fill in the cloud.gov organization information in:
|
406
|
+
* terraform/bootstrap/main.tf
|
407
|
+
* terraform/main.tf
|
408
|
+
EOM
|
412
409
|
end
|
410
|
+
register_announcement("Terraform", "Run the bootstrap script and update the appropriate CI/CD environment variables defined in the Deployment section of the README")
|
413
411
|
|
414
412
|
if !skip_active_job?
|
415
413
|
after_bundle do
|
@@ -426,7 +424,6 @@ end
|
|
426
424
|
if @github_actions
|
427
425
|
after_bundle do
|
428
426
|
generator_arguments = [
|
429
|
-
(terraform ? "--terraform" : "--no-terraform"),
|
430
427
|
"--cg-org=#{@cloud_gov_organization}",
|
431
428
|
"--cg-staging=#{cloud_gov_staging_space}",
|
432
429
|
"--cg-prod=#{cloud_gov_production_space}"
|
@@ -446,7 +443,6 @@ end
|
|
446
443
|
if @circleci_pipeline
|
447
444
|
after_bundle do
|
448
445
|
generator_arguments = [
|
449
|
-
(terraform ? "--terraform" : "--no-terraform"),
|
450
446
|
"--cg-org=#{@cloud_gov_organization}",
|
451
447
|
"--cg-staging=#{cloud_gov_staging_space}",
|
452
448
|
"--cg-prod=#{cloud_gov_production_space}"
|
@@ -513,12 +509,6 @@ after_bundle do
|
|
513
509
|
run "bundle exec standardrb --fix"
|
514
510
|
|
515
511
|
unless skip_git?
|
516
|
-
run "cp .gitignore .cfignore"
|
517
|
-
append_to_file ".cfignore", <<~EOM
|
518
|
-
|
519
|
-
# compliance documentation
|
520
|
-
/doc/compliance/
|
521
|
-
EOM
|
522
512
|
if compliance_trestle_submodule
|
523
513
|
inside "doc/compliance/oscal" do
|
524
514
|
run "git add -A"
|
data/templates/README.md.tt
CHANGED
@@ -110,34 +110,47 @@ To enable automatic ruby linting on every `git commit` follow the instructions a
|
|
110
110
|
Each environment has dependencies on a PostgreSQL RDS instance managed by cloud.gov.
|
111
111
|
See [cloud.gov docs](https://cloud.gov/docs/services/relational-database/) for information on RDS.
|
112
112
|
|
113
|
+
Terraform is used to deploy the application and supporting services. See [terraform/README.md](./terraform/README.md)
|
114
|
+
for more information on how to set up your terraform backend and deploy the app.
|
115
|
+
|
113
116
|
#### Staging
|
114
117
|
<% if !@github_actions && !@circleci_pipeline %>
|
115
|
-
|
118
|
+
First, follow the `terraform/README.md` instructions to set up your backend, then:
|
116
119
|
|
117
|
-
|
120
|
+
```bash
|
121
|
+
$ cd terraform
|
122
|
+
$ ./terraform.sh -e staging -c apply
|
123
|
+
```
|
118
124
|
<% end %>
|
119
125
|
|
120
126
|
#### Production
|
121
127
|
<% if !@github_actions && !@circleci_pipeline %>
|
122
|
-
|
128
|
+
First, follow the `terraform/README.md` instructions to set up your backend, then:
|
123
129
|
|
124
|
-
|
130
|
+
```bash
|
131
|
+
$ cd terraform
|
132
|
+
$ ./terraform.sh -e production -k $(cat ../config/credentials/production.key) -c apply
|
133
|
+
```
|
125
134
|
<% end %>
|
126
135
|
|
127
136
|
### Configuring ENV variables in cloud.gov
|
128
137
|
|
129
138
|
All configuration that needs to be added to the deployed application's ENV should be added to
|
130
|
-
the `
|
139
|
+
the `environment = {}` block in `terraform/app.tf`
|
140
|
+
|
141
|
+
Items that are both **public** and **consistent** across environments can be set directly there.
|
131
142
|
|
132
|
-
|
143
|
+
Otherwise:
|
133
144
|
|
134
|
-
|
145
|
+
1. add a new `variable "variable_name" {}` block to `terraform/variables.tf`
|
146
|
+
2. add a new entry in the `environment = {}` block to reference that variable
|
147
|
+
3. set that variable depending on sensitivity:
|
135
148
|
|
136
149
|
#### Credentials and other Secrets
|
137
150
|
|
138
151
|
#### Non-secrets
|
139
152
|
|
140
|
-
Configuration that changes
|
153
|
+
Configuration that changes by environment, but is public, should be added to the `tfvars` files, such as `terraform/production.tfvars` and `terraform/staging.tfvars`
|
141
154
|
|
142
155
|
## Documentation
|
143
156
|
|
@@ -1,7 +1,8 @@
|
|
1
1
|
@use "uswds-core" with (
|
2
2
|
// Point the asset pipline to the correct locations
|
3
|
-
|
4
|
-
$theme-
|
3
|
+
// empty strings are on purpose to override the defaults
|
4
|
+
$theme-font-path: "",
|
5
|
+
$theme-image-path: "",
|
5
6
|
|
6
7
|
$theme-show-notifications: false,
|
7
8
|
|
@@ -14,7 +14,7 @@
|
|
14
14
|
</div>
|
15
15
|
<nav aria-label="<%= t('shared.header.primary') %>" class="usa-nav">
|
16
16
|
<button class="usa-nav__close">
|
17
|
-
<%= image_tag "
|
17
|
+
<%= image_tag "usa-icons/close.svg", role: "img", alt: t('shared.header.close') %>
|
18
18
|
</button>
|
19
19
|
<ul class="usa-nav__primary usa-accordion">
|
20
20
|
<li class="usa-nav__primary-item">
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<div class="usa-banner__inner">
|
7
7
|
<div class="banner__text-container grid-row">
|
8
8
|
<div class="grid-col-auto">
|
9
|
-
<%= image_tag "
|
9
|
+
<%= image_tag "us_flag_small.png", alt: t('shared.banner.us_flag'), class: "usa-banner__header-flag" %>
|
10
10
|
</div>
|
11
11
|
<div class="grid-col-fill tablet:grid-col-auto">
|
12
12
|
<p class="usa-banner__header-text">
|
@@ -35,14 +35,14 @@
|
|
35
35
|
<% end %>
|
36
36
|
<div class="grid-row grid-gap-lg">
|
37
37
|
<div class="usa-banner__guidance tablet:grid-col-6">
|
38
|
-
<%= image_tag "
|
38
|
+
<%= image_tag "icon-dot-gov.svg", role: "img", "aria-hidden": true, class: "usa-banner__icon usa-media-block__img" %>
|
39
39
|
<div class="usa-media-block__body">
|
40
40
|
<strong><%= t('shared.banner.gov_heading') %></strong>
|
41
41
|
<br> <%= t('shared.banner.gov_description_html') %>
|
42
42
|
</div>
|
43
43
|
</div>
|
44
44
|
<div class="usa-banner__guidance tablet:grid-col-6">
|
45
|
-
<%= image_tag "
|
45
|
+
<%= image_tag "icon-https.svg", role: "img", "aria-hidden": true, class: "usa-banner__icon usa-media-block__img" %>
|
46
46
|
<div class="usa-media-block__body">
|
47
47
|
<p>
|
48
48
|
<strong><%= t('shared.banner.secure_heading') %></strong>
|
@@ -7,7 +7,7 @@ $0: Create a Service User Account for a given space
|
|
7
7
|
|
8
8
|
Usage:
|
9
9
|
$0 -h
|
10
|
-
$0 -s <SPACE NAME> -u <USER NAME> [-r <ROLE NAME>] [-o <ORG NAME>] [-m]
|
10
|
+
$0 -s <SPACE NAME> -u <USER NAME> [-r <ROLE NAME>] [-o <ORG NAME>] [-m] [-n]
|
11
11
|
|
12
12
|
Options:
|
13
13
|
-h: show help and exit
|
@@ -15,10 +15,12 @@ Options:
|
|
15
15
|
-u <USER NAME>: set the service user name. Required
|
16
16
|
-r <ROLE NAME>: set the service user's role to either space-deployer or space-auditor. Default: space-deployer
|
17
17
|
-m: If provided, make the service user an OrgManager
|
18
|
+
-n: If provided, make the service user a SpaceManager
|
18
19
|
-o <ORG NAME>: configure the organization to act on. Default: $org
|
19
20
|
|
20
21
|
Notes:
|
21
|
-
* OrgManager is required for terraform to create
|
22
|
+
* OrgManager is required for terraform to create spaces
|
23
|
+
* OrgManager or SpaceManager is required for terraform to set egress rules
|
22
24
|
"
|
23
25
|
|
24
26
|
set -e
|
@@ -28,8 +30,9 @@ space=""
|
|
28
30
|
service=""
|
29
31
|
role="space-deployer"
|
30
32
|
org_manager="false"
|
33
|
+
space_manager="false"
|
31
34
|
|
32
|
-
while getopts ":
|
35
|
+
while getopts ":hmns:u:r:o:" opt; do
|
33
36
|
case "$opt" in
|
34
37
|
s)
|
35
38
|
space=${OPTARG}
|
@@ -46,6 +49,9 @@ while getopts ":hms:u:r:o:" opt; do
|
|
46
49
|
m)
|
47
50
|
org_manager="true"
|
48
51
|
;;
|
52
|
+
n)
|
53
|
+
space_manager="true"
|
54
|
+
;;
|
49
55
|
h)
|
50
56
|
echo "$usage"
|
51
57
|
exit 0
|
@@ -59,26 +65,29 @@ then
|
|
59
65
|
exit 1
|
60
66
|
fi
|
61
67
|
|
62
|
-
if [[ $space
|
68
|
+
if [[ -z "$space" || -z "$service" ]]; then
|
63
69
|
echo "$usage"
|
64
70
|
exit 1
|
65
71
|
fi
|
66
72
|
|
67
|
-
cf target -o $org -s $space 1>&2
|
73
|
+
cf target -o "$org" -s "$space" 1>&2
|
68
74
|
|
69
75
|
# create user account service
|
70
|
-
cf create-service cloud-gov-service-account $role $service 1>&2
|
76
|
+
cf create-service cloud-gov-service-account "$role" "$service" 1>&2
|
71
77
|
|
72
78
|
# create service key
|
73
|
-
cf create-service-key $service service-account-key 1>&2
|
79
|
+
cf create-service-key "$service" service-account-key 1>&2
|
74
80
|
|
75
81
|
# output service key to stdout in secrets.auto.tfvars format
|
76
|
-
creds=`cf service-key $service service-account-key | tail -n +2 | jq '.credentials'`
|
77
|
-
username=`echo $creds | jq -r '.username'`
|
78
|
-
password=`echo $creds | jq -r '.password'`
|
82
|
+
creds=`cf service-key "$service" service-account-key | tail -n +2 | jq '.credentials'`
|
83
|
+
username=`echo "$creds" | jq -r '.username'`
|
84
|
+
password=`echo "$creds" | jq -r '.password'`
|
79
85
|
|
80
86
|
if [[ "$org_manager" = "true" ]]; then
|
81
|
-
cf set-org-role $username $org OrgManager 1>&2
|
87
|
+
cf set-org-role "$username" "$org" OrgManager 1>&2
|
88
|
+
fi
|
89
|
+
if [[ "$space_manager" = "true" ]]; then
|
90
|
+
cf set-space-role "$username" "$org" "$space" SpaceManager 1>&2
|
82
91
|
fi
|
83
92
|
|
84
93
|
cat << EOF
|
@@ -39,12 +39,12 @@ while getopts ":hs:u:o:" opt; do
|
|
39
39
|
esac
|
40
40
|
done
|
41
41
|
|
42
|
-
if [[ $space
|
42
|
+
if [[ -z "$space" || -z "$service" ]]; then
|
43
43
|
echo "$usage"
|
44
44
|
exit 1
|
45
45
|
fi
|
46
46
|
|
47
|
-
cf target -o $org -s $space
|
47
|
+
cf target -o "$org" -s "$space"
|
48
48
|
|
49
49
|
# destroy service
|
50
|
-
cf delete-service $service
|
50
|
+
cf delete-service -f "$service"
|
data/templates/browserslistrc
CHANGED
@@ -10,10 +10,7 @@ Egress Spaces
|
|
10
10
|
|
11
11
|
If your application requires outbound communication to services outside of cloud.gov:
|
12
12
|
|
13
|
-
1.
|
14
|
-
1. Set that space to public egress with `bin/ops/set_space_egress.sh -s <env>-egress -p`
|
15
|
-
1. Run [cg-egress-proxy](https://github.com/GSA/cg-egress-proxy#deploying-proxies-for-a-bunch-of-apps-automatically) in that space
|
16
|
-
1. Send all outbound traffic from your app through the proxy
|
13
|
+
1. `bin/rails g rails_template18f:public_egress`
|
17
14
|
1. Document this use under the SC-7 security control
|
18
15
|
|
19
16
|
Log Drains
|