Running Wheels 4 in a subfolder - And figuring out tests (broken) #2887
Replies: 5 comments 2 replies
-
|
Hi @mikegrogan — this is a genuinely great write-up, thank you. The level of detail (rewrite rules, the The runtime layer is in better shape than it looks — and that's by design. The Our rough thinking is to phase it: (1) docs/templates + the CLI base-path fix + the Before we commit, a few questions where your real-world setup is the deciding factor:
If you're up for it, sharing your IIS |
Beta Was this translation helpful? Give feedback.
-
|
I know I'm talking to AI, but I'm here for it. Realize it's hard to respond to everything! Hopefully a human can review at some point as needed. Web.config that is in the root of each wheels instance, under the root. So far it seems to work with Wheels 4 on our DEV server. None of this is in production yet. This uses the URL Rewrite module for IIS.<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="CFWheels Static Assets Pass" stopProcessing="true">
<match url="^(?:public/)?(files|images|javascripts|miscellaneous|stylesheets|robots.txt|favicon.ico|sitemap.xml)(.*)$" ignoreCase="true" />
<action type="Rewrite" url="public/{R:1}{R:2}" />
</rule>
<rule name="CFWheels Public Form POST Pass" stopProcessing="true">
<match url="^public/(?!index\.cfm)(.*)$" ignoreCase="true" />
<conditions>
<add input="{REQUEST_METHOD}" pattern="^POST$" />
</conditions>
<action type="Rewrite" url="public/index.cfm/{R:1}" />
</rule>
<rule name="CFWheels Strip Public GET Redirect" stopProcessing="true">
<match url="^public/(?!index\.cfm|files|images|javascripts|miscellaneous|stylesheets|robots.txt|favicon.ico|sitemap.xml)(.*)$" ignoreCase="true" />
<conditions>
<add input="{REQUEST_METHOD}" pattern="^GET$" />
</conditions>
<action type="Redirect" url="wheelsproject1/{R:1}" redirectType="Found" />
</rule>
<rule name="CFWheels MVC Routing" stopProcessing="true">
<match url="^(?!public/)(.*)$" ignoreCase="true" />
<conditions logicalGrouping="MatchAll">
<add input="{SCRIPT_NAME}" negate="true" pattern="^/wheelsproject1/(cf_script|flex2gateway|jrunscripts|cfide|cfformgateway|cffileservlet|lucee)" />
</conditions>
<action type="Rewrite" url="public/index.cfm/{R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>Yes on instance of Adobe Coldfusion, with complete wheels instances running in subfolders. Nothing shared really. Wheels 4 mostly seems to know where it is with the URL rewriting tweaks, but Coldfusion might not completely understand it inside /tests. I'm honestly not sure know if the issues I'm seeing our because i'm in a sub folder or it's just a possible bug. I'm setting up our 3rd wheels application and it seemed to go a little better. I need to write more tests though to get a better sense for it. It looks like this is still using Testbox under the hood? I see that in wheelstest/system/testbox.cfc. It's only on version 6.5 though? Assuming it might upgrade to 7 at some point. The streaming results will be nice. I'm reading the test docs, but still somewhat confusing. Maybe a new version of https://github.com/wheels-dev/cfwheels-example-app, but for wheels 4 with some tests, etc. would be great. Just suggestions. Thanks. |
Beta Was this translation helpful? Give feedback.
-
|
Thanks @mikegrogan. Let me look through what you have provided. I also have an old archived repo called wheels-big-rig which is an old attempt to get multiple wheels apps working in sub directories. To address your TestBox question, the built in WheelsTest is based on TestBox as you noticed and is vendor in so we can tweak it to work with Wheels better. Wheels 4.0 brings in Hotwire support which has streams support so adding streams to WheelsTest looking at the Rails model or TestBox model should be fairly easy. |
Beta Was this translation helpful? Give feedback.
-
|
Thanks @bpamiri! When I said streaming results I was mostly talking about https://testbox.ortusbooks.com/readme/release-history/whats-new-with-7.0.0#real-time-streaming-test-tree. Regarding sub folders if you have more questions I can try to help. Basically it's just having the Here's my stripped down root server.json{
"name":"Local Environment",
"cfconfigfile":"../config/coldfusion/cfconfig.json",
"app":{
"cfengine":"adobe@2023",
"libDirs":"../config/jars"
},
"web":{
"host":"test.local",
"webroot":"./",
"http":{
"port":"80"
},
"bindings":{
"HTTP":{
"listen":"0.0.0.0:80",
"host":"test.local"
},
"SSL":{
"listen":"0.0.0.0:443",
"HTTP2Enable":true,
"certFile":"../config/ssl/test.local.crt",
"keyFile":"../config/ssl/test.local.key",
"host":"test.local"
}
},
"rewrites":{
"enable":true,
"logEnable":false
},
"rulesFile":"../config/urlrewriting/rules.txt",
"http2":{
"enable":"true"
}
},
"scripts":{
"onServerInitialInstall":"cfpm install chart,caching,debugger,document,feed,ftp,htmltopdf,image,mail,oracle,pdf,print,scheduler,spreadsheet,zip"
},
"jvm":{
"minHeapSize":"1024",
"heapSize":"4096",
"javaVersion":"openjdk17",
"args":[
"-Dcoldfusion.compiler.block.bytecode=false",
"-Dcom.sun.management.jmxremote",
"-Xlog:gc*:file=../config/logs/gc.log",
"-XX:+HeapDumpOnOutOfMemoryError",
"-XX:HeapDumpPath=./heapdump.hprof"
]
},
"runwar":{
"options":{
"ssl":{
"eccdisable":false
}
}
}
} |
Beta Was this translation helpful? Give feedback.
-
|
@mikegrogan — closing the loop on this with concrete news: the first-class knob shipped, and the test-runner work you identified is now formally tracked. What's on
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi. Our local environment uses Commandbox using a single site architecture. On our production server it's ACF with IIS in front of it. We have 6 or so separate Wheels instances running under subfolders.
Directory Structure
Wheels obviously wasn't completely intended to be used under a subfolder, but it's worked well for years. In trying to move to wheels 3 and then 4 quickly i had to rewrite the URL rules.
Commandbox URL rewriting in wheels 4 (rules.txt) (when setup as a subfolder)
For IIS in wheels4 I'm setting up web.config files under each application.
config/settings.cfm Tweak to hide public in urls
Everything just loads up like: https://hostname:443/wheelsproject1, https://hostname:443/wheelsproject2, https://hostname:443/wheelsproject3, etc.
Again, this has worked fine for years under 2.5. However the wheels-core pages and testing always kind of break slightly. Navigation links don't work as they are hard coded. Minor things that I can tweak.
But now with the new vendor architecture and the possibility of overwriting any core tweaks with an update using Box install I'm wondering if any consideration could be made to allow wheels to run under a sub folder? To be clear, the only thing really not working from what I can see is the
testsfolder. Have the code not assume it's always running under the root?Tests Review so far (running under a subfolder)
I'm not really at the point to understand it enough to create a PR, but I did finally get it working in a hacked sort of way through the web interface. The CLI is still broken, but haven't reviewed.
Using the wheels bottom nav I can finally load up https://localhost/wheelsproject1/wheels/app/tests and have a successful page load and tests passing. It's not perfect though. The application scope hacks break the main application, which a reload=true fixes. They seem to fight each other and haven't figured it out.
public/application.cfc. It sets the this.wheels.rootPath = getDirectoryFromPath(getBaseTemplatePath());. I had to tweak it to something likelocal.currentDirectory = getDirectoryFromPath(getCurrentTemplatePath());
this.wheels.rootPath = getCanonicalPath(local.currentDirectory & "../");
That's about as far as I got. I'm trying to run a test wheels4 app under the root and compare, but again not perfect yet. Thanks for any review of running wheels as as subfolder!
Beta Was this translation helpful? Give feedback.
All reactions