How to automate the creation of scheduled tasks after deployment?

I am working on an app modernization/migration project which involves moving a set of cold fusion applications to the cloud (azure) and moving to open source technologies. Our current design involves creating pre baked packer images with application code bundled on it that can be deployed to multiple environments. The deployment of updated application code would involve the creation of a new image which then gets deployed.

Using an init script, I am pulling those lucee server creds and datasource credentials from secrets on Azure Key Vault and configuring those connections and other configurations with CFConfig prior to Lucee startup.

The CFConfig documentation states that the management of scheduled tasks is only supported for Adobe ColdFusion. How can I automate the creation of scheduled tasks for lucee?

OS: RHEL-7
Java Version: 11.0.7 (AdoptOpenJDK) 64bit
Tomcat Version: Apache Tomcat/9.0.35
Lucee Version: Lucee 5.3.6.61

Do you need something to programatically edit, add, update your schedules? Don’t know I’m understanding your question right. You could use the classic <cfschedule> tag, or not?

See cfschedule in Lucee docs

For all my apps I try to configure everything in the application.cfc. This includes pulling in environment variables secrets for connection strings etc. I deploy on azure so I tend to mock up azure Environment variabes in my Dev Varmint

With regards to tasks. I’ve created a CFC object the abstracts the CFschedule function. The key concept here is that it will create the task or ensure it is created when the application starts or other key life cycle events. I’m happy to share this code / concept.

1 Like

I was just wanting a way to be able to configure tasks that would automatically show up on the lucee web administrator pages on a fresh deployment of the server and apps and startup without any additional actions by users. I do not have much cold fusion experience but am involved as part of an app modernization/migration effort. I’m currently trying to create the configs from scratch using CFConfig.

I’d appreciate seeing your example, thank you.

What we ended up doing was using blobfuse to mount our scheduled task directories to blob storage containers. We used cfconfig exclusively to script changes to the lucee server itself. The scheduled tasks on the web context administrator however can be modified from the dashboard on the browser and changes persist across VM deployments.

@ShrinivasKR Someone has sponsored the feature to allow CFConfig support scheduled tasks for Lucee if you still want to try it out.

2 Likes

Here is the Gist: Schedule Wrapper for Lucee · GitHub

Then in my application.cfc :: onApplicationStart() I use the function:

	//Set up Scheduled Tasks
	if(  ! Schedule().TaskExists('<Task>')  ){
		Schedule().NewTask('<Task>',Serverlink('?appTask=<Task>'),60*5);
	}
1 Like