Systemd Service Configuration

Overview

All RentOne backend microservices are deployed as Linux systemd services and are automatically managed by the operating system.

Service files are located at:

/etc/systemd/system/

Deployment directories are located at:

/var/www/backend/

Common Service Configuration

All backend services follow the same deployment pattern.

[Unit]
Description=<service-name>
After=network.target

[Service]
User=shriccointernational
WorkingDirectory=/var/www/backend/<service-directory>
ExecStart=/usr/bin/java -jar /var/www/backend/<service-directory>/app.jar
Environment=SPRING_PROFILES_ACTIVE=prod
SuccessExitStatus=143
Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target

Configuration Explanation

Property Description
After=network.target Service starts after networking is available
User Linux user running the service
WorkingDirectory Service deployment directory
ExecStart Java application startup command
SPRING_PROFILES_ACTIVE Runs Spring Boot using production profile
SuccessExitStatus=143 Allows graceful shutdown
Restart=on-failure Automatically restart if service crashes
RestartSec=10 Wait 10 seconds before restart
WantedBy=multi-user.target Auto-start on server boot

Production Service Inventory

Service Name Working Directory Port
backend-rentone-service-registry /var/www/backend/backend-rentone-service-registry 6001
backend-rentone-api-gateway /var/www/backend/backend-rentone-api-gateway 6002
backend-rentone-tenants /var/www/backend/backend-rentone-tenants 6003
backend-rentone-cloud-app /var/www/backend/backend-rentone-cloud-app 6004
backend-rentone-users /var/www/backend/backend-rentone-users 6005
backend-rentone-product-catalog /var/www/backend/backend-rentone-product-catalog 6006
backend-rentone-inventory-system /var/www/backend/backend-rentone-inventory-system 6007
backend-rentone-commerce-service /var/www/backend/backend-rentone-commerce-service 6008
backend-rentone-payment-gateway /var/www/backend/backend-rentone-payment-gateway 6009
backend-rentone-file-mgmt /var/www/backend/backend-rentone-file-mgmt 6010
backend-rentone-notifications /var/www/backend/backend-rentone-notifications 6011
backend-rentone-commerce-feedback-service /var/www/backend/backend-rentone-commerce-feedback-service 6012
backend-rentone-operation-service /var/www/backend/backend-rentone-operation-service 6013

Service Management Commands

Check Service Status:

sudo systemctl status backend-rentone-users

Start Service:

sudo systemctl start backend-rentone-users

Stop Service:

sudo systemctl stop backend-rentone-users

Restart Service:

sudo systemctl restart backend-rentone-users

Enable Auto Start:

sudo systemctl enable backend-rentone-users

View Logs:

journalctl -u backend-rentone-users -f

Payment Gateway Environment Variables

The Payment Gateway service requires additional environment variables configured in its systemd service file.

Example:

Environment="RAZORPAY_KEY_ID=<razorpay-key>"
Environment="RAZORPAY_KEY_SECRET=<razorpay-secret>"
Environment="RAZORPAY_WEBHOOK_SECRET=<webhook-secret>"

These credentials should never be committed to source control and must be managed securely on the production server.


Recovery Procedure

If a service becomes unavailable:

  1. Check service status.
  2. Review application logs.
  3. Restart the service.
  4. Verify Eureka registration.
  5. Confirm API Gateway routing.
  6. Verify MongoDB connectivity.

Example:

sudo systemctl status backend-rentone-commerce-service
journalctl -u backend-rentone-commerce-service -f
sudo systemctl restart backend-rentone-commerce-service