DEV Community

Piotr
Piotr

Posted on • Updated on

Setting up Archivebox on Truenas Scale

I recently got into self-hosting. I've wanted to create a self-hosted web archive and my friend recommended an Archivebox, unfortunately TrueCharts doesn't have a chart for it so I had to do it myself. Here's my guide on how to setup Archivebox on Truenas Scale.

Setting up a Archivebox user

First of all you to setup an Archivebox user. As Archivebox container won't even start as root. Go to Credentials -> Local Users -> Add. Create a new user with a username archivebox and toggle Disable Password

Creating archivebox user in Truenas Scale

Creating an app

To setup Archivebox I you need to use custom-app chart from TrueCharts repository.

Custom-app chart

Change Application name to Archivebox. Then set_Container Image -> Container Repository_ to archivebox/archivebox, Container Tag to latest and Container Pullpolicy to ifNotPresent.

Image description

Enable All liveness probes.

Image description

Then set Networking and Services -> Main Service Port Configuration, Port type to HTTP, Target Port to 8000 and Port to some random port number like 10967.

Service type will depend on your setup.

Image description

Last of all, the storage. You need to mount 2 paths:

  • /data
  • /var/spool/cron/crontabs

For your connivance I recommend to mount /data as hostPath and /var/spool/cron/crontabs as PVC. As /data requires some setup later.

Update: After using this setup I found that mountung/var/spool/cron/crontabs doesn't work as expected - the files are erased and jobs stop.

Image description

Set Pod Security Context -> fsGroup to group id of group archivebox.

Then click Save.

Post chart setup

Setup up Archivebox

Go to System setting -> Shell and cd into /data path.

Then run:

docker run -v $PWD:/data -it archivebox/archivebox init --setup
Enter fullscreen mode Exit fullscreen mode

It will setup Archivebox db. After this step, you should be able to access the webui.

If you cannot do that, make sure, that HostPath directory has correct permissions.

chown archivebox:archivebox YOUR_DIR
Enter fullscreen mode Exit fullscreen mode

Fixing the scheduler

I've noticed that some of my scheduled runs were failing. To fix them i run these commands inside the container.

Change the owner of /var/spool/cron/crontabs to archivebox.

chown -R archivebox:archivebox /var/spool/cron/crontabs
Enter fullscreen mode Exit fullscreen mode

Then change the user to archivebox.

su - archivebox
Enter fullscreen mode Exit fullscreen mode

Go to /data and run:

archivebox init --setup
Enter fullscreen mode Exit fullscreen mode

References

Latest comments (1)

Collapse
 
thesquashsh profile image
Nick Sweeting • Edited

Thanks for writing this guide!

btw, I've fixed the /var/spool/cron/crontabs permissions issue in the next upcoming release v0.7.3, see here: github.com/ArchiveBox/ArchiveBox/c...

It now auto-chown's that dir to PUID:PGID of the archivebox user on launch so you shouldn't have to do that step manually anymore.

We also have a new official TrueNAS chart in development, hopefully we can skip all the manual setup soon :)