Skip to main content
Participating Frequently
July 26, 2022
Answered

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

  • July 26, 2022
  • 1 reply
  • 1136 views

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

    This topic has been closed for replies.
    Correct answer Charlie Arehart

    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


    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? 

    1 reply

    Charlie Arehart
    Community Expert
    Community Expert
    July 27, 2022

    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)
    Charlie Arehart
    Community Expert
    Community Expert
    July 27, 2022

    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)
    Participating Frequently
    July 28, 2022

    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