Skip to content

Commit 66c2ce2

Browse files
bpamiriPeter Amiriclaude
authored
fix(build): make wheels-starter-app installable and bootable from ForgeBox (#3199)
The published ForgeBox starter app was unusable end-to-end: (a) `box install wheels-starter-app` FAILED. box.json declared a dependency on slug "wheels-authenticateThis" which does not exist on ForgeBox ("entry slug invalid or does not exist"), aborting the whole install. The authenticateThis() mechanism the app uses is the plugin already vendored under plugins/authenticateThis/ — the ForgeBox dependency was redundant. Drop the bogus dependency + installPath; keep wheels-core so the framework still lands in vendor/wheels/. (b) Even when installed, the app booted HTTP 500 "key [DB_CLASS] doesn't exist" at config/app.cfm:14 — the datasource read this.env.DB_CLASS but no .env shipped or scaffolded (only .env.example). Replace the env-driven MySQL datasource with a zero-config H2 embedded database (org.h2.Driver, bundled with Lucee). The H2 Lucee extension is declared in server.json so `box server start` auto-installs it — no manual LUCEE_EXTENSIONS or .env needed. Add a starterApp_test datasource for the app test suite and a db/h2/ data directory. .env is now optional and documented as such (server-based DB instructions preserved in .env.example comments + README). README Quick Start rewritten to the real flow: box install -> box server start -> wheels migrate latest. Verified in CommandBox docker (ortussolutions/commandbox:latest) against the prepare-starterApp.sh build output: box install succeeds (wheels-core only), the server boots and the H2 datasource loads, `migrate latest` creates the schema + seeds, and GET / returns HTTP 200 with the seeded site title. Fixes #3181 Signed-off-by: Peter Amiri <petera@pai.com> Co-authored-by: Peter Amiri <petera@pai.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent 856c49e commit 66c2ce2

7 files changed

Lines changed: 94 additions & 41 deletions

File tree

examples/starter-app/.env.example

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,35 @@
1-
LUCEE_EXTENSIONS=465E1E35-2425-4F4E-8B3FAB638BD7280A;name=H2;version=1.3.172
2-
cfconfig_adminPassword=commandbox
1+
# .env is OPTIONAL for the starter app.
2+
#
3+
# Out of the box the app uses an H2 embedded database configured directly in
4+
# config/app.cfm, so it boots with NO .env file and NO external database
5+
# server. Copy this file to .env only when you want to:
6+
# - set a reload password (WHEELS_RELOAD_PASSWORD), or
7+
# - point the app at a server-based database (MySQL/PostgreSQL/etc.).
8+
#
9+
# The H2 Lucee extension is declared in server.json and installed
10+
# automatically by `box server start` — you do NOT need to set
11+
# LUCEE_EXTENSIONS yourself.
12+
313
environment=development
4-
# Reload password for ?reload=true and `wheels reload`. Blank disables URL-based reload.
14+
15+
# Reload password for ?reload=true and `wheels reload`. Blank disables
16+
# URL-based reload (and the state-changing CLI bridge commands).
517
WHEELS_RELOAD_PASSWORD=
618

7-
DB_HOST=localhost
8-
DB_PORT=3306
9-
DB_NAME=wheelsStarterApp
10-
DB_USER=root
11-
DB_PASSWORD=2a26eae88f2d1144bde37c5aef530354ee689c2ec7c6306877a4b34b41ae6999
12-
DB_CLASS=com.mysql.cj.jdbc.Driver
13-
DB_BUNDLENAME=com.mysql.cj
14-
DB_BUNDLEVERSION=9.3.0
15-
DB_CONNECTIONLIMIT=-1
16-
DB_LIVETIMEOUT=15
17-
DB_ALWAYSSETTIMEOUT=true
18-
DB_VALIDATE=false
19+
# ---------------------------------------------------------------------------
20+
# Server-based database (OPTIONAL — only if you swap the datasource in
21+
# config/app.cfm to read these this.env.DB_* values instead of H2). Example
22+
# below is for MySQL; the password value is the Lucee-encrypted form.
23+
# ---------------------------------------------------------------------------
24+
# DB_HOST=localhost
25+
# DB_PORT=3306
26+
# DB_NAME=wheelsStarterApp
27+
# DB_USER=root
28+
# DB_PASSWORD=2a26eae88f2d1144bde37c5aef530354ee689c2ec7c6306877a4b34b41ae6999
29+
# DB_CLASS=com.mysql.cj.jdbc.Driver
30+
# DB_BUNDLENAME=com.mysql.cj
31+
# DB_BUNDLEVERSION=9.3.0
32+
# DB_CONNECTIONLIMIT=-1
33+
# DB_LIVETIMEOUT=15
34+
# DB_ALWAYSSETTIMEOUT=true
35+
# DB_VALIDATE=false

examples/starter-app/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,8 @@ settings.json
1717
/plugins/**/
1818
.env
1919
/vendor
20+
21+
# H2 embedded database data files (created at runtime; keep the directory)
22+
/db/h2/*.db
23+
/db/h2/*.trace.db
24+
!/db/h2/.keep

examples/starter-app/README.md

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -147,18 +147,41 @@ plugins/ # Third-party plugins
147147
- Adobe ColdFusion 2018/2021/2023/2025
148148
- Lucee 5, Lucee 6, Lucee 7
149149
- Boxlang
150-
- **Database Engine**: Choose one of the following:
151-
- MySQL
152-
- PostgreSQL
153-
- Microsoft SQL Server
154-
- Oracle Database
155-
- SQLite Database
156-
- H2 Database (for development/testing)
157150

158-
### Environment Configuration
151+
### Install and Run (zero-config)
152+
153+
The starter app boots out of the box with no database server and no `.env` file.
154+
It ships with an **H2 embedded database** (the H2 Lucee extension is declared in
155+
`server.json`, so CommandBox installs it automatically on first start) and the
156+
`authenticateThis` plugin is bundled under `plugins/`.
157+
158+
```bash
159+
# 1. Install the framework (lands in vendor/wheels/)
160+
box install
161+
162+
# 2. Start the server (auto-installs the H2 extension, boots the app)
163+
box server start
164+
165+
# 3. Create the schema and seed the default data
166+
wheels migrate latest
167+
168+
# 4. Reload the application so the seeded settings load
169+
# (or just restart the server). Then open the site:
170+
box server open
171+
```
172+
173+
Default sign-in credentials are seeded by the migrations — see
174+
`app/migrator/migrations/20180519105944_Adds_Default_UserAccounts.cfc`.
175+
176+
### Using a server-based database instead
177+
178+
To point the app at MySQL, PostgreSQL, SQL Server, or Oracle:
159179

160180
1. Copy `.env.example` to `.env`
161-
2. Configure database settings based on your chosen database:
181+
2. Configure database settings based on your chosen database (see below)
182+
3. Replace the H2 datasource block in `config/app.cfm` with one that reads the
183+
`this.env.DB_*` values (the original env-driven MySQL example is preserved in
184+
the comments of `.env.example`)
162185

163186
#### MySQL Configuration
164187

examples/starter-app/box.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,10 @@
2828
".env.example"
2929
],
3030
"dependencies": {
31-
"wheels-core": "^4.0.0",
32-
"wheels-authenticateThis":"^1"
31+
"wheels-core": "^4.0.0"
3332
},
3433
"installPaths": {
35-
"wheels-core": "vendor/wheels/",
36-
"wheels-authenticateThis":"plugins/authenticateThis/"
34+
"wheels-core": "vendor/wheels/"
3735
},
3836
"private":false,
3937
"license":[

examples/starter-app/config/app.cfm

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,27 @@
1010
// Added via Wheels CLI
1111
this.name = "starterApp";
1212
13+
// H2 embedded database — boots out of the box with no .env or external
14+
// database server. The H2 driver (org.h2.Driver) is bundled with Lucee, so
15+
// it works on a plain `box install` / CommandBox install without any extra
16+
// JDBC driver. MODE=MySQL gives MySQL-compatible SQL. Data files live under
17+
// db/h2/. Run `wheels migrate latest` after install to create the schema.
18+
//
19+
// To use a server-based database (MySQL/PostgreSQL/etc.) instead, copy
20+
// .env.example to .env, fill in your credentials, and swap the datasource
21+
// definition below for one that reads this.env.DB_* (see .env.example for
22+
// the full set of keys).
1323
this.datasources["starterApp"] = {
14-
class: this.env.DB_CLASS,
15-
bundleName: this.env.DB_BUNDLENAME,
16-
bundleVersion: this.env.DB_BUNDLEVERSION,
17-
connectionString: "jdbc:mysql://#this.env.DB_HOST#:#this.env.DB_PORT#/#this.env.DB_NAME#?characterEncoding=UTF-8&serverTimezone=UTC&maxReconnects=3",
18-
username: this.env.DB_USER,
19-
password: "encrypted:#this.env.DB_PASSWORD#",
20-
21-
// optional settings
22-
connectionLimit: val(this.env.DB_CONNECTIONLIMIT), // default:-1
23-
liveTimeout: val(this.env.DB_LIVETIMEOUT), // default: -1; unit: minutes
24-
alwaysSetTimeout: this.env.DB_ALWAYSSETTIMEOUT EQ "true", // default: false
25-
validate: this.env.DB_VALIDATE EQ "true" // default: false
26-
24+
class: "org.h2.Driver",
25+
connectionString: "jdbc:h2:file:" & expandPath("../db/h2/starterApp") & ";MODE=MySQL",
26+
username: "sa"
27+
};
28+
29+
// Test database datasource (used by the app test suite).
30+
this.datasources["starterApp_test"] = {
31+
class: "org.h2.Driver",
32+
connectionString: "jdbc:h2:file:" & expandPath("../db/h2/starterApp_test") & ";MODE=MySQL",
33+
username: "sa"
2734
};
2835
2936
// buffer the output of a tag/function body to output in case of a exception

examples/starter-app/db/h2/.keep

Whitespace-only changes.

examples/starter-app/server.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,8 @@
1414
},
1515
"app":{
1616
"cfengine":"lucee"
17+
},
18+
"env":{
19+
"LUCEE_EXTENSIONS":"465E1E35-2425-4F4E-8B3FAB638BD7280A;name=H2;version=1.3.172"
1720
}
1821
}

0 commit comments

Comments
 (0)