Skip to content

NeoHabitat server administration

StuBlad edited this page Aug 22, 2023 · 1 revision

For those who want to operate a NeoHabitat instance, you may find the following information to be helpful.

Bot Daemons

For the NeoHabitat instance running on The MADE's server, we have setup systemd services for our two bots, Elizabot and WelcomeBot. This allows us to bring the bots online or disable them easily, as well as having the benefits of daemonization incase they ever crash.

If you'd like to do this on your own server instance, create a file named yourbotname.service and copy this in.

[Unit]
Description=NeoHabitat Hatchery Welcome Bot

[Service]
ExecStart=node /home/themade/neohabitat/habibots/bots/hatchery.js -g /home/themade/neohabitat/habibots/assets/hatchery.txt -c context-hatchery -h neohabitat -p 1337 -u welcomebot
Restart=always
User=nobody
# Note Debian/Ubuntu uses 'nogroup', RHEL/Fedora uses 'nobody'
Group=nogroup
Environment=PATH=/usr/bin:/usr/local/bin:/home/themade/.nvm/versions/node/v18.16.0/bin
Environment=NODE_ENV=production
WorkingDirectory=/home/themade/neohabitat

[Install]
WantedBy=multi-user.target

The ExecStart line should contain the command you want to use to bring the bot online. Use absolute file paths to make sure the system can find things correctly. Make sure that the Environment PATH line can see where your copy of node is. If you don't know where it is, use whereis node to find the location and make sure it's in the PATH here. Don't forget to change WorkingDirectory to your NeoHabitat root folder.

Once you've made your changes, copy this file into /etc/systemd/system.

To bring the bot online, type in sudo systemctl start yourbotname. To check if it's working try using sudo systemctl status yourbotname. To disable your bot use sudo systemctl stop yourbotname. To view error logs, use journalctl -u yourbotname.

Here is the service file for ElizaBot as it's called slightly differently than WelcomeBot.

[Unit]
Description=NeoHabitat Eliza AI Bot

[Service]
ExecStart=node /home/themade/neohabitat/habibots/bots/eliza.js -c context-Downtown_5f -h neohabitat -p 1337 -u elizabot
Restart=always
User=nobody
# Note Debian/Ubuntu uses 'nogroup', RHEL/Fedora uses 'nobody'
Group=nogroup
Environment=PATH=/usr/bin:/usr/local/bin:/home/themade/.nvm/versions/node/v18.16.0/bin
Environment=NODE_ENV=production
WorkingDirectory=/home/themade/neohabitat

[Install]
WantedBy=multi-user.target