vagrant, ACF and commandbox/cfconfig

Hey all,
so i have a vagrant file that is setting up a vm, installing ACF 11 provisioning stuff…etc. (yes brad I can just use commandbox to spin up a server i know, i know, i know).
what i was wondering was this:
could i get my vagrant file to run the box.exe file to install commandbox, then run install cfconfig into commandbox, then run the cfconfig import command so i could import in my cf admin settings?
right now we do use a .car file or i manually run my box.exe then start up commandBox then manually type in the cfconfig import command…
I thought using commandBox with my vagrant file could help me manually configure my ACF server instead of doing anything by hand.

yes I know DOCKER, we’ll get there, but for now we are using vagarant.
yes I know run stand alone commandBox to do all this and I am for some stuff, but we are still using vagrant vm’s, so thought i could automate our ACF install and setup process beyond just provisioning the setup of ACF…

any thoughts, comments that will help me…LOL
thanks
Dan

Yes, of course you can do all that. Honestly, the only reason I haven’t bothered doing it because we left Vagrant and just use straight CommandBox for all our local dev now, and for the really specific scenarios, we moved to Docker.

Swapping your CF 11 install in your VM over to CommandBox might be very little work, especially considering it’s LESS work to tie CFConfig into a CommandBox site. Nonetheless, if you’re wanting to keep a standard CF install and just add CFConfig into the mix, then that should be very easy to do. Just add a provisioner that’s a shell script that installs CommandBox and installs CFConfig. Then run the import. That’s really it! Just do that step after CF11 is installed so it doesn’t overwrite stuff. CommandBox servers are “smart” enough to not overwrite existing configuration :slight_smile:

Thanks!

~Brad

ColdBox/CommandBox Developer Advocate
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Hey, thought it was pretty simple
so run a provisioner line in the vagrant file something like this:
config.vm.provision :shell, path: “C:/inetpub/wwwroot/provisioners/ColdFusion/install_cf.cmd”
but change the install_cf.cmd to whatever bat file I have.
in that bat file i have lines that run box.exe
then i have a line that runs the install commandbox-cfconfig
then i need to just run my cfconfig import line where i have full path names:

cfconfig import from=.CFCConfig.json to=C:/ColdFusion11/cfusion/ toFormat=adobe@11

put all of these lines into the bat file and have the provisioner line call the bat file?
since I just installed CF, do i need to restart CF? seemed like I had to restart CF after i ran the cfconfig manually?

Do I seem to be going down the right track?

thanks Brad…yeah we are eventually going to docker, but still on vagrant…right now I am doing a lot of just spinning up commandbox on my local machine to make my quick fixes, but want to work on the vagrant image for everyone else on the team.
dan

Ugh, these are Windows VMs? :slight_smile: I do not wish to go back to the days of a 26Gig VM file. I have a funny story where we needed to send a VM to a remote client (this was before Vagrant even) we ended up literally overnight mailing a USB drive to them because it was faster than them downloading 26Gigs from us, lol

But yes, everything you said below sounds great. In fact, if you had just tried it, you might have had it working by now :slight_smile:
You will want CF to be stopped before you apply the config. I’ve been told that newer versions of CF actually overwrite the config on disk to prevent it from being “messed with”. So if your CF installation step actually starts the server, then you’ll want to stop it before applying the config, and then start it again after. Keep in mind a NET STOP is async so you might want to wait a few seconds to make sure it’s good and stopped.

Scripting anything on Windows is more of a pain, but so long as you can get command line tools to download the box binary and unzip it, then you should be golden. To test it, spin up your vagrant machine and then just play around while remoted in and running your script directly until it works. Then do a vagrant destroy and try it from scratch. Back when I did Vagrant, I always
piped all output from each command in my provisioners into a log file so it was much easier to review after the fact when things went wrong.

> yeah we are eventually going to docker

To be clear, I think Docker is overkill for many local dev situations. I love love it for stage/prod deploys, but I still prefer a super simple and lightweight CommandBox setup for local dev unless you have very strict environment setups or need to bundle a bunch of additional services like a DB, elasticache server, etc. Since the Ortus docker image still use CommandBox, it’s still a seamless transition and you can use all the same server.json and .cfconfig.json files between your local dev and you production docker images! The main benifit Docker gives you for local dev is full control over your OS runtime environment and the ability to bundle other services via Docker compose.

Thanks!

~Brad

ColdBox/CommandBox Developer Advocate
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

lol, love people’s reactions when I saw windows vm’s…LOL
had to run off and now gotta get my kids, but i’ll check into this stuff…thought it might be pretty simple, and yes have 3.9 downloaded so should be easy to get it running…and i’ll look into the command line to now start cf until this bat file has been run.

as for commandbox, i am running it a lot more on my local and it is faster after it unpacks itself the first time…

Hey CommandBox people…
I have been playing with this for a few hours, and not sure the best way to run this stuff…
vagrant file (on windows machine and windows vm)…i need to call a file with commandbox commands in them.
need commandbox to run a install cfconfig command
then i need to run a cfconfig import to my stand alone cf11 server…the command is easy to write…

currently when my vm spins up and my cf11 server is loaded, I then manually go into into cmd window and run box.exe, then install cfconfig then run my import command.

how can I run these commands via bat file, cmd file, boxr file, etc???
below is one example i have tried but this does not work, so i know i am not doing something right…this in a .cmd file being called from my vagrant file.

echo Creating commandbox…
C:\provisioners\commandBox3.9\commandbox-jre-win64-3.9.0\box.exe
echo Creating cfconfig…
#install commandbox-cfconfig

cd /website
#cfconfig import from=.CFCConfig.json to=C:/ColdFusion11/cfusion/ toFormat=adobe@11

Hey, is there a reason you’re not just using CommandBox to start the server as well? That would probably really simplify your setup plus it would make the CFConfig integration even easier. For instance, when a CommandBox server starts up, it looks for a .cfconfig.json file in the webroot and just load it right up without any need for you to configure anything.

That said, your script above is a little confusing to me since I think you’re mixing CommandBox comands directly into a batch script. I think you need to prepend your stuff with box so it’s

box install commandbox-cfconfig
box cfconfig import etc

Also, I assume when you just run box.exe by itself that’s going to just sit and hang waiting for user input since it will load the interactive shell. I would recommend you testing your script by just running it manually to see what errors are happening.

yeah after i was playing with this, my coworker was talking about us just going to commandbox full time since we figured out our buildURL issue…so i figure all this is not not really needed…i need to get a shirt so i remember:
USE COMMANDBOX!!!

thanks
Dan