Spring Profile Management - CDCgov/prime-simplereport GitHub Wiki

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, no-okta-mgmt, create-sample-data and server-debug. 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)
  • azure-${ENV}, where the current list of options includes dev (confusingly), test, demo, training, stg, prod and pentest. These are the base profiles for deploying through managed infrastructure in Azure: other bean profiles activated for each environment are listed in spring.profiles.include in these property files.

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

Profile Comments
no-security Disables Okta authentication and gets user identity from demo user configuration, not JWT
no-okta-mgmt Creates and manages Okta resources (users, groups) in-memory vs thru Okta management API. Highly correlated with no-security.
create-sample-data Initializes sample organization, facilities, users
server-debug enables some simple echo-back features to show what the server sees for a request, to be compared with what the developer expected it to see
Environment azure-* okta-* no-security no-okta-mgmt create-sample-data server-debug local
prod Y Y
demo Y Y Y Y
training Y Y Y Y
pentest Y Y
stg Y Y
dev Y Y Y
test Y Y Y
local dev Y Y Y Y Y
unit tests Y Y

Did we miss any?

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