I’m wanting to set the session storage to a Redis ...
# lucee
d
I’m wanting to set the session storage to a Redis Cache programmatically rather than through the Lucee admin UI. In the UI, it is this option in the screenshot, which defaults to
Memory
but I want to set it to `cache: RedisTest`…
In our Docker environment, we are using the Lucee images and have a line in the
lucee-server.xml
for the scope settings, but the examples don’t show how to change this specific scope setting. We have something like this, but I don’t see a parameter for the session storage, that I can see anywhere as I’ve searched.
<scope applicationtimeout="1,0,0,0" cascade-to-resultset="yes" cascading="strict" client-directory-max-size="10mb" client-max-age="90" clientmanagement="no" merge-url-form="no" requesttimeout="0,0,0,50" sessionmanagement="yes" sessiontimeout="0,0,30,0" setclientcookies="yes" setdomaincookies="no" local-mode="classic"/>
g
If you were using CommandBox, you could set that in cfconfig.
d
Yeah, it is something we have looked at. Our use of Docker and the Lucee images pre-dates the commandbox images.
g
I highly recommend it. You can have all your server configuration as code, which makes it very easy to spin up environments.
d
Which is what we have now, albeit in xml files and not in the cfconfig file.
g
You can also easily test different versions of Lucee. Simply stop the site, update the env to whichever version you want, then start the site.
c
You can specify a redis cache in Application.cfc and then use it for session storage https://docs.lucee.org/guides/cookbooks/caches-in-application-cfc.html
🙏 1
If using the Lucee extension, the class name will be
<http://lucee.extension.io|lucee.extension.io>.cache.redis.simple.RedisCache
...and the bundle name
redis.extension
d
Ok, this is helpful. I found the “copy this to your Application.cfc” link on both the cache creation and the session storage option.
👍 1
Clicking on the
<?/>
under the setting gave me the answer for the Application.cfc, which is way better than playing around with the XML files.
👍 1
b
Yeah, Application.cfc is prolly best for your use case. But switching to CommandBox long-term will make this sort of thing super easy. You an also use env vars for every single thing CFConfig can set, which Lucee proper doesn't have.
☝️ 2
👍 1
And if you use CommandBox for local dev as well, you can get 95% the same setup across the board with very little local installs to mess with. (I hate local Docker development with a passion 🙂 )
☝️ 1
p
Commandbox+CFConfig is simplicity city and saves massive amounts of time.
b
simplicity city
I need this on a T-shirt, lol
😂 1
These "Server Is Up" shirts actually came from a conversation in Slack, no joke. https://www.ortussolutions.com/about-us/shop#!/server+is+up!?idea=60b4a32396e7c070517d5872
p
Haha I will have to trademark it! jk I will just take a name drop if ya use it 😆
💯 1
d
I have used cfconfig to export settings and import to another server and such. But has anyone done a specific demo or blog post or something on converting from the Lucee to CommandBox image? That would be cool to see.
b
It really depends on your current image and how it's setup
generally it all gets simpler since there are bult-in way to accomplish most of what you had to do manually in the past
I'm not clear if you have a custom made Lucee docker container or if you're using the Daemonite's image for Lucee
Custom made ones can be real snowflakes (in terms of being special and custom) so there's no one guide to convert
But even with the Lucee one-- what you'd need to do would depend on which configuration features you were using
Stuff can be spread all over Tomcat's config files, but generally, it all just goes in the
server.json
file like CommandBox needs
If you know how to start up a CommandBox server, then you pretty much know how to configure the CommandBox-based docker images.
d
We probably just need to bite the bullet and try it out at some point. In a nutshell, we have our own image that pulls from
FROM <http://harbor.octanner.io/hub/lucee/lucee:5.4.5.23-nginx|harbor.octanner.io/hub/lucee/lucee:5.4.5.23-nginx>
, but we have the
lucee-server.xml
,
lucee-web.xml.cfm
,
nginx.conf
,
supervisor.conf
,
cupsd.conf
, etc. that are configuring all the things for us.
p
I mean its so simple, just try a local setup of it…doesnt require a ton of production/server setup stuff…can just run it locally to validate the baseline config stuff loads accordingly even if you dont have direct DB access locally (datasources would fail but still could confirm it loaded in admin)
And your nginx config could be its own container setup / repo that loads already
g
You don't need nginx. CommandBox is a full service tool.
b
I would be curious to know what features you're using in Nginx (if any) that CommandBox doesn't support natively
Our goal has been for CommandBox to be a full production web server. Now with multi-site, lockdown profiles, HTTP/SSL bindings, SNI, and rewrites, it should pretty much do it all
☝️ 1
p
Not against it being full production, but scalability, load balancing and memory usage are areas that are in the dark
are there publicly available load testing against the server and Pen testing for vulnerabilities running daily?
and published results of these tests
b
Are you asking about CommandBox
p
Yea
b
We rely on JBoss Undertow for all web server features. Undertow is what powers JBoss WildFly, which is the foundation of their EAP offering
It's a very powerful enterprise tool with a lot of production usage, and they have very fast response to any vulns
We always update to the latest Undertow version every release
CommandBox itself has gone through a lot of security scans, but generally ones customers do which aren't published per se. In production mode, it will pass pretty much any scanner test, including hackmyCF
p
Yea but that requires user’s to dig for that info and if its your product you should be sharing resources, links etc for tracking everything about Undertow and devote an entire area of Commandbox docs to the underlying body
b
As far as load testing, we've done a lot of that but again usually for customers. Kai K. uses 6 CommandBox servers in production to server over 1 Billion API requests per month and Undertow itself has a very low footprint and you can find general performance tests for Undertow compared to Tomcat, etc online
p
I dont have time right now but I should run some scans with Nessus just to give it a whirl
b
Your CF processing is going to be much slower than Undertow's nominal handling of the request
p
Well yea Undertow is geared at java etc..
b
Undertow is written in Java, but it's a general purpose web server service layer that can be built into any Java app
Generally speaking, people don't generally care what's inside the box so long as it's fast and secure. We keep all our libraries up to date and RedHat worries about keeping Undertow patched.
It's all worth noting, most of this has nothing to do with whether or not you use Nginx. Whether or not you put a proxy in front of your servlet, the traffic still passes through the HTTP listener that's baked into Tomcat/Undertow/etc. So fronting with Nginx doesn't make anything faster-- it just adds a network hop to the traffic!
The two main reasons people tend to front with a web server is usually to serve static assets or because they need features not supported like client cert auth, etc (which CommandBox supports 🙂 )
d
Maybe it is better to ask this in the
box-products
channel, if we are using cbsecurity v2 with cbauth, do we also need to do something there to point all session storage to our new Redis instance? It looks like we are all set up correctly, but we are still not sharing sessions across different instances/pods of the same app, it seems.
In the cbauth docs, it shows…
Copy code
settings = {
            userServiceClass = "",
            sessionStorage = "SessionStorage@cbstorages",
            requestStorage = "RequestStorage@cbstorages"
        };
Where does
SessionStorage@cbstorages
point to?
b
I'd start a new thread for this one
👍 1
p
Yea sorry, took topic off track
d
It’s related to the Redis stuff I initally asked about, but more cbsecurity-ish probably.