User Tools

Nutritrace

Installation

As usual, you need to create the nutritrace user:

useradd -d /data/daemons/nutritrace -m nutritrace

You will need also the proper folders setup:

mkdir /data/nutritrace
mkdir /data/nutritrace/db
mkdir /data/nutritrace/uploads
chown nutritrace:nutritrace -R /data/nutritrace

Then, as user nutritrace, create the following docker compose yaml (see here):

docker-compose.yml
services:
  nutritrace:
    image: ghcr.io/traceapps/nutritrace:latest
    container_name: nutritrace
    ports:
      - "3771:3001"
    volumes:
      - /data/nutritrace/db:/data/db
      - /data/nutritrace/uploads:/data/uploads
    environment:
      - DB_PATH=/data/db/nutritrace.db
      - UPLOADS_PATH=/data/uploads
      - JWT_SECRET=KjS1pf3uiZuX3AM/elCGIi5MvytkzOfZJW7LFUxi5O2hxczN8mfwpYaxQYjZMprK
      - SMTP_HOST=
      - SMTP_PORT=
      - SMTP_SECURE=
      - SMTP_USER=
      - SMTP_PASS=
      - SMTP_FROM=
    networks:
      - nutritrace-net

networks:
  nutritrace-net:

Set a proper port (3771) for your needs, one that is free from all your other services. Double check the various volumes to point to your media collection properly. Populate the various SMTP variables if you want email invites, otherwise it will only produce invite links for new users.

To generate the secret use:

openssl rand -base64 48

Pull the images:

su - nutritrace
podman compose pull

Reverse Proxy

This is my recomended setup for NGINX:

nutritrace.conf
server {
        server_name nutri.mydomain.com;
        listen 8443 ssl;
        listen 443 ssl;

        access_log /var/log/nginx/nutri.mydomain.com_access_log main;
        error_log /var/log/nginx/nutri.mydomain.com_error_log info;

        location / {
                     proxy_set_header X-Forwarded-For    $proxy_add_x_forwarded_for;
                     proxy_set_header  X-Forwarded-Proto $scheme;
                     proxy_set_header  Host              $host;
                     proxy_set_header Upgrade            $http_upgrade;
                     proxy_set_header Connection         $connection_upgrade;

                     proxy_http_version                  1.1;

                     proxy_pass                          http://127.0.0.1:3771;
                     proxy_redirect                      http:// https://;
                   }

        include com.mydomain/certbot.conf;
}

Autostart

To start it, and set it up on boot, as usual follow my indications Using Containers on Gentoo, so link the user-containers init script:

ln -s /etc/init.d/user-containers /etc/init.d/user-containers.nutritrace

and create the following config file:

/etc/conf.d/user-containers.nutritrace
USER=nutritrace
DESCRIPTION="The nutritrace server"

Add the service to the default runlevel and start it now:

rc-update add user-containers.nutritrace default
rc-service user-containers.nutritrace start

Upgrade

Since it's using pdoman, stop the service then, as user nutritrace, run:

podman compose pull

and restart the service.