Song uses Spring Profiles as a feature to manage the running of a Song server in different environments. Spring profiles allow different settings to be applied to different environments, for example keeping security strict in production but less strict in test deployments.
During configuration, you will need to enable the active profiles in the song-server-[version]/conf/application.yml
file. The active profiles to use for a particular application can be specified using the profiles
argument which should be added at the start of the spring
block, for example:
spring:profiles:active: "prod,jwt,secure,kafka,score-client-credentials"
Descriptions of the profiles available to Song are provided below. Depending on the type of configuration, some profiles are required to run and some are optional.
The secure
profile:
song.WRITE
is configured for access with Ego. spring:profiles: secureauth:server:url: "http://<host>:<port>/check_token/"clientId: <client id from Ego>clientSecret: <client secret from ego>tokenName: "token"enableStrictSSL: falseenableHttpLogging: falsescope:study:prefix: "song."suffix: ".WRITE"system: "song.WRITE"
You can optionally include the jwt
profile. When enabled, this profile allows usage of both JWT and API-key during authentication requests. The JWT public key url is by default configured to talk with Ego and will need to be replaced if another authentication service is used.
spring.profiles: jwtspring:profiles:include: [secure]auth:jwt:public-key-url: http://localhost:8084/oauth/token/public_key
The prod
profile is designed to be enabled for production deployments. Specify your Postgres details for the production environment in this profile:
spring:profiles: proddatasource:initialization-mode: never# Datasourcespring.datasource:driver-class-name: org.postgresql.Driver## update the url, username, and password belowurl: jdbc:tc:postgresql:9.6.12://<host>:5432/<database_name>?stringtype=unspecifiedusername: <username-here>password: <password-here>max-active: 10max-idle: 1min-idle: 1
The score
profile contains the connection details to the score-server. If this profile is enabled, the default configurations will be overwritten.
spring.profiles: score-client-credscore:url: "http://localhost:8087"clientCredentials:id: <client id from Ego>secret: <client secret from Ego>tokenUrl: http://ego-api:8080/oauth/tokensystemScope: "score.WRITE" # Storage scope needs to include both READ and WRITE
The kafka
profile contains the connection details to a deployed Kafka instance. This profile is optional unless Kafka is configured.
spring:profiles: kafkakafka:bootstrap-servers: localhost:9092template:default-topic: song-analysis