Skip to content

Spring Profile Management

Jeremy Zitomer edited this page Feb 26, 2021 · 25 revisions

We need to outline our best (or at least, shared) practices. This page will do that. It doesn't yet.

Our current practice is to have two (mostly) sets of bean profiles: profiles that activate or deactivate beans directly within the application context, and profiles that are linked to a deployment environment and include profiles from the first set within them.

Profiles within the code

See the BeanProfiles class for profiles that can be used within the code. At the time of this writing they are no-security, single-tenant, and auth-dev. In addition, there is a test profile for integration tests, though this should probably be removed (or at least moved out of src/main). These profiles are mainly incorporated into deployment profiles by way of the spring.profiles.include property.

Profiles for deployment

Profiles that are intended to define a deployment environment include:

  • dev (local development, though also used for some tests)
  • local is a special case profile that is ignored by git so that local property overrides can be made without editing a version-controlled file. It is automatically included in the dev profile, but otherwise ignored.
  • prod (original production deployment)
  • cloud (any deployment to cloud.gov or other PCF instance)
  • azure-dev, azure-demo, azure-staging and azure-prod, which are the eventual profiles for deploying through managed infrastructure.

In addition, we have one set of "facet" profiles to link API deployments to Okta environments: okta-dev, okta-stg and okta-prod. These should be included in deployment-specific profiles using spring.profiles.include, as if they were bean-activating profiles.

Profile Applicable Environments Authentication Contains Profiles Comments
okta-prod prod Okta
no-security unit tests,dev,demo,training None
no-okta-mgmt demo,training(?) N/A
single-tenant
create-sample-data
Generated by Table Generator
Environment All included Spring profiles azure- okta- no-security single-tenant no-okta-mgmt **create-sample- okta- auth-dev local
prod azure-prod,okta-prod
demo azure-demo,no-security,single-tenant,no-okta-mgmt,create-sample-data
training azure-training,no-security,single-tenant,no-okta-mgmt,create-sample-data
pentest azure-pentest,okta-pentest
stg azure-stg,okta-stg
dev azure-dev,okta-dev,auth-dev
test azure-test,okta-test,auth-dev
local dev,no-security,auth-dev,single-tenant,create-sample-data,local
unit tests no-security,no-okta-mgmt,local(?)

Did we miss any?

See src/main/resources or grep for @Profile in src/ to find out!

Local development

Setup

How to

Development process and standards

Oncall

Technical resources

How-to guides

Environments/Azure

Misc

?

Clone this wiki locally