Hi everyone, I need some help regarding SocketBox ...
# lucee
a
Hi everyone, I need some help regarding SocketBox setup with Lucee and Apache. I want to enable WebSocket support using SocketBox for my Lucee application, but I am a bit confused about the correct setup. ✅ My current stack: Lucee 6.x (running on Apache Tomcat) Apache HTTPD 2.4 in front (reverse proxy setup) Goal is to use SocketBox for WebSocket features with Lucee I’ve learned that SocketBox is designed to run with CommandBox, which uses the Undertow server. But in my environment, I’m using Lucee deployed on Tomcat, with Apache as the frontend. Questions: 1️⃣ Is it possible to run SocketBox with Lucee + Apache, without using CommandBox? 2️⃣ If not, is the recommended approach to run Lucee via CommandBox, use Apache as a reverse proxy, and enable SocketBox that way? 3️⃣ Can SocketBox be configured to work purely with Lucee on Tomcat? I’d appreciate any clarity on this setup or suggestions from others who have implemented SocketBox with Lucee and Apache.
g
SocketBox is a CommandBox feature and requires it, so options 1 and 3 will not work. You can certainly run Lucee with CommandBox (option 2) and use a reverse proxy. Since CommandBox comes with a very performant web server itself, you don't even need a separate web server as it can serve your website directly. That said, you may have other reasons for wanting to use a reverse proxy. I run a similar config in production, only using nginx instead of Apache.
The only hard requirement of using SocketBox is *YOU MUST BE RUNNING YOUR SERVER ON COMMANDBOX OR THE BOXLANG MINISERVER!*
https://www.ortussolutions.com/blog/introducing-socketbox-a-new-websocket-library
c
Option 4. why don't you use Apache Module mod_proxy_wstunnel and forward to Tomcat HTTP/1.1 Endpoint (most likely port 8888) or very easy nginx https://nginx.org/en/docs/http/websocket.html and then proxy_pass to your tomcat HTTP/1.1 endpoint. Tomcat supports websockets on this connector out of the box I think
a
@garciadev, Thanks for your heads up.
Thanks for the suggestion. @cornelius_rittner. I’ll check those configurations and see if we can set it up accordingly.
b
@cornelius_rittner SocketBox is specifically an implementation which allows you to write websocket listeners entirely in CF, which run on the CF server and don't require any low level Java code to run them, nor proxies between the Java code and CF code to be able to run bits of your app in the correct application/session, etc. In order to use Tomcat's websocket support, you've got to be deploying your own Java-based WAR written in Java, which will NOT be running inside of the CF application.
👍 1
@alagarsamy What Daniel said is correct. Like I mentioned above, the big issue with most websocket implementations is • they must be implemented at the level where the actual HTTP connection is being managed, which rules out 100% CF websocket libraries as the servlet manages the TCP connections. • They don't integrate with CF naturally without building a bridge from Java -> CF Your current options are • Adobe's websocket implementation which doesn't work on Lucee • The Lucee websocket extension, which is tied to Tomcat , and sadly not really supported at all (maintained by Igal, who is no longer in this Slack) I made SocketBox to work better than the other options and be compatible with Adobe CF, Lucee, and BoxLang alike. But since it must integrate at a very low level where the HTTP connections are managed, any CF websocket implementation will be tied to the underlying servlet container. My implementation requires CommandBox as it's built specifically into JBoss Undertow.
I'm completely biased 🙂 but I do recommend you move to CommandBox. It provides extremely simplified deployments with a single moving part and all configuration of the app server, JVM, and web server can go in a single .json file. With CommandBox's Multi-site features, you can replace your ENTIRE setup • IIS/Apache/Nginx • Tomcat • Lucee • proxies They all go in the bin, and
box.exe
does everything for you
☝️ 1
☝🏻 1
CommandBox has a fully feature web server built in supporting • HTTP/HTTPS/AJP listeners • as many SSL certs as you need, including SNI support • virtual dirs/aliases • Java version management • Lucee/Adobe/BoxLang version management • Automatic config import/export • full environment variable-based configuration • basic auth • client cert auth • directory browsing • static file caching • full rewrite engine • out-of-the-box profile-based security lockdowns tailored for CF You name it, we do it.
Not only can CommandBox run anywhere such as a Raspberry pi our Docker images let you deploy easily on any cloud service. It may be a change from how you currently host, but you can stand it up easily and have nearly identical deployments from local dev, stage, to production, even if you dev on windows and deploy on Linux/Docker.
g
And its very performant too. 😉
p
@bdw429s not to hijack a thread but are you suggesting serving the site entirely with commandbox or managing the engines with commandbox? So typically we put code into a directory, go into the directory issue box server start and lets say a lucee server is started up and the webroot is automagically wired to the location of defined in the server.json. Is this what you are talking about or is there another way to use CommandBox that I'm unaware of that uses the engine that runs commandbox itself to host the site.
g
CommandBox can be used wholly standalone to serve your website.
☝️ 1
p
@garciadev do you mean without defining cfengine and pulling in boxlang, lucee, or adobe?
we already use commandbox for dev, mac developers and windows developers, and already do CI/CD testing in GitHub using commandbox containers, and publish to a docker swarm with commandbox containers.
g
Its pretty much the same process as you are currently doing to host a production site.
p
yup, okay just wanted to know I haven't missed anything.
BTW - https://commandbox.ortusbooks.com/embedded-server/multi-engine-support doesn't list Boxlang as supported engine.
and the link on that page to Server Versions is a 404
p
cool
g
we'll need to update the CommandBox docs too.
p
ya, that was where I was going.
b
docs updated
🙌 1