Starting, stopping and draining an application
A Mojara application has a lifecycle: startup, accepting requests, shutdown and exit.
1. Start development
mojara dev
Use the URL Mojara prints after the server starts. Press Ctrl+C to stop the development server.
2. Start a compiled application
mojara build
mojara start
A supervisor such as systemd can start the compiled application after reboot.
3. Health and readiness
curl -i http://127.0.0.1:8000/api/live
curl -i http://127.0.0.1:8000/api/ready
In the bundled reference application, liveness responds 200 while the process runs. Readiness may respond 503 during shutdown/drain. These routes must be registered by the application; they are not necessarily present in every starter.
4. Shutdown under systemd
sudo systemctl stop your-mojara-service
sudo systemctl status your-mojara-service
The service manager sends termination signals and tracks process exit. Keep in-flight requests and database leases in mind while stopping a busy service.
5. Protect long operations
For database work, always release your lease:
var lease = db.acquire()
var result = lease.query("SELECT 1")
lease.release()
Releasing an open transaction rolls it back. Ensure every database pool is closed after its active leases have finished.
See Deployment for a reverse proxy and Observability for health monitoring.