Adding cas.properties file to source control

61 views
Skip to first unread message

Dustin J Luck

unread,
Jan 15, 2020, 2:39:32 PM1/15/20
to CAS Community
I would like to add my cas.properties file for a standalone deployment to source control. I'd like to know if there is a way to put certain settings that would necessarily be different between our dev & prod environments someplace external to the main properties file so I don't need to maintain the common properties in multiple places. An example of one of the properties I'd like to manage this way is cas.ticket.registry.hazelcast.cluster.members.

Andy Ng

unread,
Jan 15, 2020, 8:44:36 PM1/15/20
to CAS Community
Hi Dustin,

What version of CAS are you using?

So for source control which source control are you trying to use? I assume you are talking about git since this is the most common source control nowadays.

There are document here stating how to do:


Basically you need to do the following:
- Setup a spring-cloud-config-server
- Config the spring cloud config server to point to your git
- Config CAS to point to the spring cloud config server, and use git


I have built an CAS server that can connect to git previously, but it is a sub-module of a bigger project so the code is a bit all over the place.

Nonetheless I am posting the folder including the critical files here so you might be able to reference it:


See if the above helps...

Cheers!
- Andy



Ray Bon

unread,
Jan 16, 2020, 12:46:34 PM1/16/20
to cas-...@apereo.org
Dustin,

Look into Spring cloud config server, https://apereo.github.io/cas/6.1.x/configuration/Configuration-Server-Management.html, and store config in git with a branch for each environment. Spring cloud allows you to encrypt sensitive values.
In tomcat's setenv.sh, or however you use to start your container, set the config server url and branch.

CATALINA_OPTS="$CATALINA_OPTS -Dspring.cloud.config.uri=https://casuser:pass...@cloudconfig.com/casconfigserver"
CATALINA_OPTS="$CATALINA_OPTS -Dspring.cloud.config.enabled=true -Dspring.cloud.config.label=prod"

Ray

On Wed, 2020-01-15 at 11:39 -0800, Dustin J Luck wrote:
I would like to add my cas.properties file for a standalone deployment to source control. I'd like to know if there is a way to put certain settings that would necessarily be different between our dev & prod environments someplace external to the main properties file so I don't need to maintain the common properties in multiple places. An example of one of the properties I'd like to manage this way is cas.ticket.registry.hazelcast.cluster.members.
-- 
Ray Bon
Programmer Analyst
Development Services, University Systems

I respectfully acknowledge that my place of work is located within the ancestral, traditional and unceded territory of the Songhees, Esquimalt and WSÁNEĆ Nations.

Misagh Moayyed

unread,
Jan 29, 2020, 5:26:37 AM1/29/20
to CAS Community
I would like to add my cas.properties file for a standalone deployment to source control. I'd like to know if there is a way to put certain settings that would necessarily be different between our dev & prod environments someplace external to the main properties file so I don't need to maintain the common properties in multiple places. An example of one of the properties I'd like to manage this way is cas.ticket.registry.hazelcast.cluster.members.

You need to use deployment profiles.  Keep your cas.properties file, then create a dev.properties file and a prod.properties file. Put the relevant settings for each tier in those, and keep the common stuff in the cas.properties file. Then activate the profile at runtime with "-Dspring.profiles.include=dev|prod"

Then manage the configuration files as you like with source control. 

Blog post that conceptually outlines the same strategy: https://apereo.github.io/2018/11/02/cas6-groovy-config-slurper/

Dustin J Luck

unread,
Jan 29, 2020, 11:57:41 AM1/29/20
to CAS Community
Thanks, Misagh.

That's exactly what I was looking for. The thing that confused me at first was how to set the profile. I'll leave what I did here for others that may need to do the same.

My environment uses Tomcat running as a service on a Windows server. In order to set the profile, I had to add the -Dspring.profiles.include=[profile] to the Java Options found in the Tomcat properties utility.
Reply all
Reply to author
Forward
0 new messages