Skip to content

Commit cd6183d

Browse files
committed
add more examples on controlling server
1 parent 9a827ba commit cd6183d

1 file changed

Lines changed: 21 additions & 22 deletions

File tree

AGENTS.md

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ sleep 2
141141
# Start server in background (output goes to /tmp/moqui-server.log)
142142
nohup ./gradlew run > /tmp/moqui-server.log 2>&1 &
143143

144-
# Wait for server to be ready (typically 2-5 seconds after previous startup)
144+
# Wait for server to be ready (typically within less than a minute)
145145
for i in {1..60}; do
146146
if grep -q "Started oejs.ServerConnector.*8080" /tmp/moqui-server.log 2>/dev/null || \
147147
strings /tmp/moqui-server.log 2>/dev/null | grep -q "Started oejs.ServerConnector.*8080"; then
@@ -388,27 +388,8 @@ When implementing or modifying services, follow this iterative workflow:
388388
### Entity Development Feedback Loop
389389

390390
When adding or modifying entities:
391-
392391
1. **Define/modify entity** in `entity/*.xml` files
393-
394-
2. **Restart the server** (entity definition changes require restart):
395-
```bash
396-
# Stop the running server
397-
pkill -f "gradlew run"
398-
399-
# Start it again in background
400-
nohup ./gradlew run > /tmp/moqui-server.log 2>&1 &
401-
402-
# Wait for server to be ready
403-
for i in {1..60}; do
404-
if grep -q "Started oejs.ServerConnector.*8080" /tmp/moqui-server.log 2>/dev/null; then
405-
echo "Server is ready!"
406-
break
407-
fi
408-
sleep 1
409-
done
410-
```
411-
392+
2. **Restart the server** (entity definition changes require restart - see "When to Restart the Server" section above)
412393
3. **Test entity operations**:
413394

414395
**Option A: EntityDataFind UI** (Recommended - most visual and interactive):
@@ -457,11 +438,29 @@ When developing screens (XML widget system → FreeMarker macros → HTML):
457438
6. **Fix issues and refresh** browser until UI works correctly
458439

459440
### When to Restart the Server
460-
461441
- **No restart needed**: Service XML/Groovy changes, Screen XML changes, data
462442
file changes
463443
- **Restart required**: Entity definition changes, SECA/EECA rule changes,
464444
configuration changes (MoquiConf.xml), dependency changes
445+
**How to Restart the Server**:
446+
```bash
447+
# Stop the running server
448+
pkill -f "gradlew run"
449+
# Also kill any java process using port 8080 (in case Gradle spawned it)
450+
kill $(ss -tlnp 2>/dev/null | grep :8080 | grep -oP 'pid=\K\d+' | head -1) 2>/dev/null || true
451+
sleep 2
452+
# Start it again in background
453+
nohup ./gradlew run > /tmp/moqui-server.log 2>&1 &
454+
# Wait for server to be ready (typically 2-5 seconds after previous startup)
455+
for i in {1..60}; do
456+
if grep -q "Started oejs.ServerConnector.*8080" /tmp/moqui-server.log 2>/dev/null || \
457+
strings /tmp/moqui-server.log 2>/dev/null | grep -q "Started oejs.ServerConnector.*8080"; then
458+
echo "Server is ready!"
459+
break
460+
fi
461+
sleep 1
462+
done
463+
```
465464

466465
### Key Testing Endpoints
467466

0 commit comments

Comments
 (0)