Starting AMIE

Posted on: 5/30/2023 Last Updated: 6/5/2023
AMIE startup procedures and general Linux Systems Processes
All Articles

AMIE Startup Processes

There are a few ways you can launch AMIE on your environment. Depending on how you want to deploy it. I tried to make it as easy to get started yet lay the initial framework to scale it out if or when needed.


RHEL 8 (and other systemd daemon procedures)

This example service file is using root (for simplicity sake) but you should create a system process account for it to run as (amie or svc_amie).

useradd(8) - Linux man page

Example: useradd -rs /bin/false svc_amie

 [Service]
 User=svc_amie
 Group=svc_amie

Default

# Create and edit a Unit (Service) file.
# In systemd , a unit refers to any resource that the system knows how to operate on and manage.
# This is the primary object that the systemd tools use to manage processes

nano /etc/systemd/system/amie.service

 [Unit]
 Description=AMIE - Automated Monitoring Integration Engine
 Wants=network-online.target
 After=network-online.target
 [Service]
 User=root
 Group=root
 Type=simple
 ExecStart=/usr/bin/node /amie_server/server.js
 WorkingDirectory=/amie_server/
 Restart=on-failure
 [Install]
 WantedBy=multi-user.target

# Then create symlinks for it and reload the daemon
systemctl daemon-reload

# Launch the service
systemctl start amie.service

Quick and easy method

nohup node server.js > /amie_server/logs/amie_api.log &

NodeJS Process Manager

PM2 - Process Manager for NodeJS

npm pm2

Note: This does ask to be installed as a global package and you need to decide for yourself if you want to allow any kind of global packages in your environment.

With that being said, this is a really slick utility and provides a nice alternative to native systemd. It also allows for load balancing and nodemon style process managing --watch. If anything it is work installing on a cloud vm and evaluate it for yourself before making the decision on what will manage your running application.

Tags:
amie startup server