The reference to the lex in the XML is for Lucee t...
# lucee
g
The reference to the lex in the XML is for Lucee to "use" it. You need to ensure that any extensions you need are "available". So make sure you have installed the extension and you shouldn't have an issue. Since you're using CommandBox - you can programmatically use any of the methods that CommandBox supports to install the extension Or manually copy the LEX files you want / need into the "deploy" folder within the lucee-server context.
d
Thank you. The Error occurred in the context of an
rm -rf lucee-sever/*
The extension is I think bundled with the lucee-jar . So maybe a race condition as far as "available" goes ?
g
I am not sure what you're trying to do - but if you're attempting to delete the folder of a running server - then that most likely won't work - where the filesystem has open handles to files you're trying to delete. if it is something else - you might need to give us a some more information about what you're trying to achieve, how you're doing it and what is failing... Perhaps even if we can't solve the issue you're having - there might be another way to get the same results.
d
Thank you for the pulling the discussion back to the goal: (1) I want to be able to set some (prod) lucee servers's configuration from files created on another (dev) server in version control using the command line. (2) When update time comes, I'd like to be able to stop tomcat, remove luce-server/* and webapps/myapp/WEB-INF/* , drop a new jar into $CATALINA_BASE/lib , restore the configuration and restart tomcat #2 is , I admit a little voodoo-ish, but I've read a bunch of posts that suggest this voodoo in special circumstances. I'm open to a better way, but if voodoo is ever needed, I'd just as soon practice using it on all occasions.
g
OK. I think I have it.... IN all the following - I have really made it as plain and simple as I can. Not because I am trying to treat you like an idiot - or be patronising, either. I have been a CFML developer since 2000 and it has only been the last year that I have started to realise the freedom of getting this all worked out correctly brings about for me. Previously I always treated the CFML Server / it's parts (Tomcat / IIS / etc) and it's configuration and my application(s) as being one monolith. I would install ACF or Lucee. Then I would configure the CFML Server and make sure all the settings were right and all the needed datasources and mapping etc were all set up, correctly, too. Then I would make sure that I had my code in the webroot / approot - and test the application. A few hours - is what I normally allowed myself to setup and test a new server. Whether it was a NEW (physical) server or a new CFML upgrade / re-install. This is a waste of those few hours. I now have this down to "literal" minutes. 1. Completely ignore the difference between Upgrading an existing server AND installing a new server. a. The difference is not needed (in code - or in your mind). 2. Realize that the Lucee server / web settings are ALL stored in a file. a. You do NOT need to configure Lucee via the web admin tool. 3. Realize that your application's files AND the Lucee config file are "separate" a. Yes you need to configure Lucee for the requirements of your Application... b. BUT they ARE separate : they can be treated separately. c. Think along the lines of - I am a Lucee Hosting company.... i. I have a Lucee server to configure - that OTHERS can use. ii. I have an application to run (as if I was some OTHER - on the Lucee Server of my hosting company) So let's start with the Lucee Server. I use CommandBox. CommandBox lets you run CFML servers, easily, quickly. CommandBox is just for the Hosting company - (in my example above) It has NOTHING to do with the "configuration" of Lucee - from the perspective of your application (datasources / mappings) CommandBox IS the actual CFML server and the Web Server and the configuration needed between the two. CommandBox = Lucee AND IIS CommandBox = Lucee AND Apache HTTPD CommandBox = Lucee AND Tomcat CommandBox = Lucee AND Tomcat and NGINX (All the "pre" stuff you install / configure - just so you can open up the Lucee Web admin - to configure the datasources / mappings.) CommandBox IS all of this AND does this part for you really easily. The configuration for CommandBox (Min / Max Java Heap : SSL : which port to use : etc) is in "server.json" server.json - can reside anywhere if you only have one application / one host - place it in the approot. You CAN get ALL the guff on CommandBox / server.json at https://commandbox.ortusbooks.com/ "I" have all my settings in the server.json file. I do NOT use any environment variables - I have no secrets in the server.json file. I DO commit the server.json file into version control. QUICK ASIDE The documentation for CommandBox and CFConfig is awesome. It is really well written and detailed. If anything it is is too good. If you read it from the start to the end - you're likely to feel dumber than when you started. This is because CommandBox and CFConfig are "general" tools. And by that I mean - they do NOT prescribe a set way to do any of the functions. And the documentation is written with a prescription in mind either. When you're reading from start to end - this makes the documentation a little hard to follow. Initially they talk about a settings file... Then they're talking about environment variables Then there is also "conventions" that they use, too. But if you think of the documentation as a "CookBook" - then it makes reading them a whole lot easier. Want to set the Lucee Admin Password (or a datasource password) by environment variables (so you don't have passwords in code version control? - then go to the part of the documentation that talks about setting The Lucee Admin password via an environment variable. Don't bother reading about how to do it in the 17 other ways - that you don't need. Want to know how to setup HTTPS/SSL - "JUST" look up https / ssl only. This is the only way that "I" have managed to not lose my mind in the (genuine) majesty of their documentation.
Configuring Lucee server : CFCONFIG Now that you no longer have to deal with Tomcat / NGINX.... You can treat the Lucee server as if you were using a hosting company. And by that I mean you can set all your normal server settings (UTF / timezone / etc) and then "separately" use your Application.cfc for all your "Application" specific settings. (datasources / directory mappings / etc) You don't have to do it like this - I am just demonstrating that if you prefer - you can have separation between "generic" Lucee config items and the settings for your CFML application. Or you can treat the Lucee Server's configuration - as if you were hand-configuring everything within the Lucee Web admin - where the server "generics" and your CFML app's settings are a "joint" effort. In the CommandBox world - there is a SEPARATE tool that you use with CommandBox to do your Lucee Configuration. CFConfig All the guff is here at https://cfconfig.ortusbooks.com/ It used to confuse the heck out of me - because I saw them as the same "thing" (CommandBox and CFConfig) Afterall you MUST have CommandBox to use CFConfig. But you do NOT have to be using CommandBox for your server infrastructure - to use CFConfig. That is you can install Lucee or ACF by a native installer. AND You still CAN use CFConfig to configure your server. But in order to use CFConfig - you MUST install CommandBox. It was again another one of those things that added to my confusion / frustration. But if you think of CFConfig as a stand alone tool that needs dependency "XXX" - then that might help. It is just a coincidence that CommandBox is the dependency you need. It is just a coincidence that you CAN use CommandBox to setup / run your CFML server. For me : Once I truly understood - that they are different tools - for different tasks - it really started to "click" for me. Just like CommandBox - CFConfig has a few ways to do the same task. You CAN store all your Lucee Admin settings in a JSON file. You CAN set all your Lucee Admin settings via environment variables. You can mix and match - which is what I do. I set everything I need (from a Lucee Admin perspective) in the ".cfconfig.json" file. (note the leading "." in the filename) The filename is a convention. If you are using CommandBox for your Lucee Server (not a native installer) Then CommandBox - by convention will look for and use a ".cfconfig.json" file. The file CAN be named anything you like - but if you name it something else - you will need to tell CommandBox what the name of the file is - that you are using for Lucee configuration. The ".cfconfig.json" file CAN be anywhere By convention it is in the APPROOT. If it is somewhere else you need to tell CommandBox where it is. (don't forget though - you CAN use CFConfig - without using CommandBox to also run your CFML / web server.) CFConfig itself has IMPORT and EXPORT abilities. So you certainly can configure everything via the web admin - and then export the "lucee-server.xml" file to a ".config.json" file. You don't have to hand-edit it from scratch. Which leads to... What is the correlation between .cfconfig.json and lucee-server.xml. "I" don't actually know - if the .cfconfig.json overwrites the contents of the lucee-server.xml - or if the JSON file is just "used" in addition to the XML. But the chain of of authority for setting Lucee configuration details, works like this.... Use settings in the lucee-server.xml Use settings in the .cfconfig.json and overwrite any "same" "key" - with the value in JSON file. Use environment variables to overwrite and "same" "key"- with the value in the environment variable. So to finalise all this... (I do NOT use the Lucee Admin at all - I do not know or care what is in lucee-server.xml) I have some VERY general setup in the server.json file (ports / SSL and I have a hard-coded value for the version of Lucee I want to use.) This file is committed to version control. I then have ALL my settings (including datasources and mappings) in a .config.json In that file - I use a "placeholder" for an environment variable - for all sensitive info (passwords / keys / etc) I also use a placeholder for database host / port / userrname too. This file is committed to version control. And while there are multiple ways to do it, In the script that I use to launch CommandBox (which I automate to run on startup) I copy the Lex files I use to the "deploy" folder of the running Lucee instance. This file is committed to version control The Lucee Extensions I use are committed to source control. I use the CommandBox docker image. That way - CommandBox and CFConfig are already loaded and ready to use. My dockerfile (or docker-compose) in my case MAPS the application source code to the "/app" folder in the container from a static resource • for dev ◦ it is my local hard drive ▪︎ I can now edit my source code on my "C" drive and see the results directly in my running app - which is a docker container. ▪︎ I can wholly delete the docker container and have a brand new one up and running in less than a minute. • for production it is a little more complicated... ◦ We use GIT to pull in a release to a local drive on an EC2 instance. ◦ On the EC2 instance we run docker: which in turn loads ▪︎ a container for the database ▪︎ a container for the SMTP server ▪︎ a container for the Lucee App server. Because I have environment variables for the DB Host Server / Port / User / Password I don't need to edit the JSON files so they work on DEV and TEST and PROD. Because the JSON files are named and located as expected by the conventions used by CommandBox, I don't need to worry about copying / moving files to suit my different environments either. The only thing I need to do - and it is a one-off (unless you change passwords, as an example) Is set the database Server / port etc in an environment variable - that matches the environment. EG - I use a DB on my local machine for my dev work But use a DB in a cluster in the cloud for Prod. As long as a DB_HOST environment variable exists and is set correctly - my "code", my startup scripts, etc - do NOT change. What has really helped me - is thinking of my Lucee server / my DB server / etc as something I can produce by a script, on demand. want to try your app on a new version of Lucee? Change the LUCEE_VERSION polaceholder "only". Run the start-up script - you now have your app / your DB / etc all working on a different version of Lucee. CommandBox (as a built-in function) - will download the version you specify - if you haven't previously downloaded by CommandBox. Want to try your application on ACF instead of Lucee? Imagine how you would have done it before? Download the installer from Adobe Configure everything in the installer Configure everything in the CF Admin. (and I previously allowed 3 hours for that process) Now with CommandBox, Change the line in "server.config" from Lucee@VERSION to ACF@version You now have your application running on ACF and all you changed was one line in the server.json file to accomplish this. CommandBox downloaded the ACF CFML server for you. Your previous .config.json all still works on the ACF server. No changes necessary... mappings / datasources / mail server config / etc. All set in .cfconfig.json - used by CommandBox to correctly set up the CFML server - you told it to load. Oh and you can use CommandBox to run as many servers as you like (have resources for) You CAN run a Lucee server and an ACF server both at the same time, on the same physical box. Or load the previous version of Lucee, the current version and the latest snapshot, too - all using the exact same source code - so you can diagnose which Lucee version is messing with your code and which one fixes it. It takes a while to get here - to this level of comfort to this level of evangelism - but it is worth it. Oh I forgot to mention... CommandBox is NOT just for dev or test. It is Production ready and capable. It is not a toy version of anything. Maybe if you think of CommandBox as an orchestration tool - rather than a product of anything "specific" - it might help? Anyway - this is a huge post and a lot to digest. Do not hesitate to ask anything at all.