| 1234567891011121314151617181920212223242526272829303132 |
- [Unit]
- Description=IoT Platform Service
- After=network.target mysqld.service redis.service
-
- [Service]
- Type=simple
- User=root
- Group=root
- WorkingDirectory=/opt/iot-platform
-
- # JVM options
- Environment="JVM_OPTS=-server -Duser.timezone=Asia/Shanghai -Dfile.encoding=UTF-8 -Xms1g -Xmx2g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=256m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/opt/iot-platform/logs/heapdump.hprof -XX:+UseG1GC -XX:MaxGCPauseMillis=200"
-
- # Load environment variables from .env (passwords, credentials)
- EnvironmentFile=/opt/iot-platform/.env
-
- ExecStart=/bin/bash -c 'exec java ${JVM_OPTS} -jar /opt/iot-platform/iot-platform.jar --spring.profiles.include=online'
-
- ExecStop=/bin/kill -SIGTERM $MAINPID
- ExecReload=/bin/kill -SIGUSR1 $MAINPID
-
- Restart=always
- RestartSec=10
- StartLimitInterval=60
- StartLimitBurst=3
-
- # Graceful shutdown: wait up to 60s for the app to stop
- TimeoutStopSec=60
- KillSignal=SIGTERM
-
- [Install]
- WantedBy=multi-user.target
|