Micronaut on a server of your own
Micronaut does dependency injection and AOP at compile time, which keeps startup time and memory low. A service often runs in a heap of 128 to 256 MB. If you run several microservices, a single VPS with enough RAM is usually cheaper than a container platform.
How we run it
- You build a runnable JAR (the shadow or "all" JAR) or a native image in CI.
- The artifact runs as a systemd service under its own user and restarts after a failure.
- Settings come from environment variables, such as
MICRONAUT_SERVER_PORTandMICRONAUT_SERVER_HOST, kept in a file readable only by the service. - Nginx terminates HTTPS and proxies to the service on localhost.
- Run several services on one server by giving each a port and a server block.
Deploying
./gradlew shadowJar
scp build/libs/myservice-all.jar you@your-server:/tmp/
ssh you@your-server sudo deploy-app /tmp/myservice-all.jar
Native images
GraalVM native images start almost instantly. Build them on your CI runner for Linux x86-64 and upload the binary. We can adapt the service unit for a native executable on request.
Questions about micronaut hosting
Can I run several Micronaut services on one server?
Yes. Each service runs as its own systemd unit on its own port, and Nginx routes by hostname or path.