Skip to content

Instantly share code, notes, and snippets.

@SleepingPanda
Last active February 20, 2021 10:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SleepingPanda/68f446ea3c04436dbe525da1a9736a4a to your computer and use it in GitHub Desktop.
Save SleepingPanda/68f446ea3c04436dbe525da1a9736a4a to your computer and use it in GitHub Desktop.
TrueNAS Jail Setup Guide for TheLounge IRC
## Make a handy json file to automatically install the needed packages for TheLounge to build and execute when the jail is made.
echo '{"pkgs":["python2","ca_root_nss","yarn","gmake"]}' > /tmp/pkg.json
## Create the jail using that json file we created earlier.
## I use 12.2-RELEASE as it's the most recent at the time of writing.
## Replace <IP>, <MASK> and <GATEWAY> with your own.
iocage create -n "thelounge" -p /tmp/pkg.json -r 12.2-RELEASE ip4_addr="vnet0|<IP>/<MASK>" defaultrouter="<GATEWAY>" vnet="on" allow_raw_sockets="1" boot="on"
## Delete the now useless file we created at the beginning.
rm /tmp/pkg.json
## Check to see if your jail was created and running properly.
iocage list
## Make the directory TheLounge will save its data to.
## Link it to a location outside of the jail for safe keeping, then take ownership of it.
## Replace <DIR> with your own.
iocage exec thelounge mkdir -p /root/.thelounge
iocage fstab -a thelounge /<DIR>/.thelounge /root/.thelounge nullfs rw 0 0
iocage exec thelounge chown -R root /root/.thelounge
## Make an rcd init directory for PM2 (more info here https://pm2.keymetrics.io/docs/usage/startup/).
iocage exec thelounge mkdir -p /usr/local/etc/rc.d
## Link the Python executables to locations Yarn needs for building TheLounge's dependencies.
iocage exec thelounge ln -s /usr/local/bin/python2.7 /usr/bin/python
iocage exec thelounge ln -s /usr/local/bin/python2.7 /usr/bin/python2
## Install TheLounge and PM2 with Yarn.
iocage exec thelounge yarn global add thelounge
iocage exec thelounge yarn global add pm2
## Set PM2 to automatically start when the jail starts.
iocage exec thelounge pm2 startup
## Tell PM2 to start TheLounge.
iocage exec thelounge pm2 start /usr/local/bin/thelounge -- start
## Tell PM2 to save the applications you want to launch when the jail starts.
iocage exec thelounge pm2 save
@SleepingPanda
Copy link
Author

This guide is mainly for my own personal use and it's not recommended to run TheLounge as root. It's in its own jail so it should be fine but if you plan to do other things with the jail, use another guide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment