• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Cold Fusion Docker container write connection string values at container run time

Community Beginner ,
Jul 26, 2022 Jul 26, 2022

Copy link to clipboard

Copied

Hi,

I'm deploying apps in Cold Fusion Docker containers via DevOps pipelines into Azure

The Cold Fusion apps in this container need to connect to an SQL database in Azure

I need to add the connection string values for the database as a Cold Fusion data source within the container

I have found the connections strings are stored in the neo-datasource.xml file, but my attempts to add connection string values into this file fail, probably due to passwords in this file being encrypted by Cold Fusion

 

Is there any way of adding datasource values into the Cold Fusion Docker container during container run time?

 

Thanks,

Matt

Views

377

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jul 27, 2022 Jul 27, 2022

Matt, are you doing this to ADD the datasource during container startup? If so, then as Scott Stroz of the CFhour Podcast would have said several years ago, "you're doing it wrong". 🙂

 

I'd said (and the docs show) that there's an environment variable where you name the json file in which you have EXPORTED the settings (from some cf implementation) using cfsetup.

 

As for the cfsetup and alias issue, perhaps that's because WHEN and WHERE you're running it, that folder may not yet exist (like if

...

Votes

Translate

Translate
Community Expert ,
Jul 26, 2022 Jul 26, 2022

Copy link to clipboard

Copied

Matt, do you really mean "during container run time"? Or do you mean instead "at container start"? And are you using Adobe's CF images? 

 

To be clear, there are multiple ways to automate admin settings in containers created from the Adobe CF images. See the docs for using them, which indicate the options, from CAR files or a script using the admin api (which can be put in a specific folder the container looks at and imports on startup), to the new json-based config file you can create with the new cf2021 cfsetup tool (and name with available a new environment variable).

 

You definitely don't need to mess with the xml files. 


/Charlie (troubleshooter, carehart.org)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 26, 2022 Jul 26, 2022

Copy link to clipboard

Copied

Also, Matt, it could help you to know that ColdFusion is spelled without a space (since cf5 in 2001). Using the correct spelling could help when searching for content, for instance. 


/Charlie (troubleshooter, carehart.org)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 27, 2022 Jul 27, 2022

Copy link to clipboard

Copied

Thanks Charlie, yes have been using the CF docs on containers

I have been using the .car method of importing the connection string successfully using a DevOps secure file, however, this method involves manual generation of the .car, then adding it as a DevOps secure pipeline file which diverges from our project methodology

 

I'm working on adding the connection string with a cfsetup which seems the best approach, but having an issue appending the alias cfusion in the add datasource command, which works fine when run from cfsetup, but fails when run within the .bat:

./cfsetup.sh add datasource name=mysql1 driver=MySQL5 host=dbhostname port=3306 database=Test_dbo username=user1 password=1234 cfusion

 

Where cfusion is the alias, registered: cfusion /opt/coldfusion/cfusion

 

I've tried selecting the alias: ./cfsetup.sh select cfusion

 

But this fails with the same error, though the error lists cfusion as a valid alias:

 

./addDataSource.bat
ERR: Provide a valid ColdFusion home.
ExitStatus: FAIL
) found. Register the alias first.
Valid alias list: cfusion
ExitStatus: FAIL
ERR: Provide a valid alias that is registered with CFSetup or ColdFusion home.
ExitStatus: FAIL
: not found

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 27, 2022 Jul 27, 2022

Copy link to clipboard

Copied

Matt, are you doing this to ADD the datasource during container startup? If so, then as Scott Stroz of the CFhour Podcast would have said several years ago, "you're doing it wrong". 🙂

 

I'd said (and the docs show) that there's an environment variable where you name the json file in which you have EXPORTED the settings (from some cf implementation) using cfsetup.

 

As for the cfsetup and alias issue, perhaps that's because WHEN and WHERE you're running it, that folder may not yet exist (like if doing it as commands in a dockerfile, or naming this bat as the startup script for the container).

 

Can you please try using cfsetup on some working cf2021 instance, and export the setting/s you want from that, and then name THAT file for the container's importcfsettings environment variable? 


/Charlie (troubleshooter, carehart.org)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 03, 2022 Aug 03, 2022

Copy link to clipboard

Copied

Thanks Charlie, I was trying to avoid using any settings files and configuring the data source on the fly with a KeyVault secret - I've compromised and used the importCFSettings as you've suggested - the DB password is encrypted within that so not plain text at least, then use a KeyVault secret as the passphrase for CF to access this file

I'll mark your answer above as correct as the method works

Interesting, the installModules=sqlserver broke after this - had to locate and copy the package for this and its dependencies and use importModules with a settings file - we have Internet locked down on this, reckon that is the issue though weird it was working before

thanks for your help, might hit you up again if can't figure out non-root user context for the container, my next challenge

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 04, 2022 Aug 04, 2022

Copy link to clipboard

Copied

Glad it worked out, and yep on how the json file created by cfsetup will have the any passwords encrypted (something the popular cfconfig alternative does not). And yep on the ability to use a secret for specifying the passphrase for that file.

 

As for your installmodules not working, are you confirming for sure that that happens on using these other two env vars? It should not, of course. What specific image and tag are you using? Have you tried the latest?

 

As for the import working over the web, that's true. But as you see it's possible to pull the modules down and have cf use that. Again, I don't see that being affected by the use of a settings file, either way.

 

If you may hit what you think is a bug, you can file it at tracker.adobe.com just like for cf itself. 

 

Or you can ask here (this thread or another, as may be appropriate), or sure I can help folks directly via carehart.org/consulting, often in as little as 15 mins.

 

Good to see more people stretching their wings with the cf docker images, something I've been helping folks do since their release. They've also evolved in useful ways like the above, and I'll be covering that in a cf summit talk in October (as well as in a related talk at the into the box pre-con in a few weeks). 


/Charlie (troubleshooter, carehart.org)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 04, 2022 Aug 04, 2022

Copy link to clipboard

Copied

LATEST

Thanks Charlie. Another issue I have just encountered with our restricted internet connectivity for ColdFusion Docker containers - applying the Enterprise license fails as it appears this needs to talk out to the Internet. 

I've confirmed this by disconnecting all network connections, then building and running the container locally. For this local container, the license reverts to a trial one whenever internet cannot be reached; or in the case of our target Azure App Service environment, the container fails to run. What would be the best avenue of support for this? Should I log this on tracker.adobe.com as a feature request/bug? We'll need a license that doesn't require Internet connectivity.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation