0

I'm standing up a Trilium server. There are some issues in the instructions that I've worked through, but this one has me flummoxed. Everything works fine.

It's a docker based setup which looked like this:

sudo docker pull zadam/trilium:latest

sudo docker create --name trilium -t -p 127.0.0.1:8080:8080 -v /mnt/trilium:/home/node/trilium-data zadam/trilium:latest

It runs just fine.

I want this to restart at reboot, so I created

/lib/systemd/system/trilium.service

[Unit]
Description=Trilium Server
Requires=docker.service
After=docker.service

[Service]
Restart=always
ExecStart=/usr/bin/docker start -a trilium
ExecStop=/usr/bin/docker stop -t 2 trilium
    
[Install]
WantedBy=local.target

Then I do the following:

sudo systemctl daemon-reload
sudo systemctl enable trilium.service

Which tells me:

"Unit /lib/systemd/system/trilium.service is added as a dependency to a non-existent unit local.target."

I can start the service manually by:

sudo systemctl start trilium.service

If I reboot, and then do a journalctl -u trilium.service, I get:

-- Boot 2818ab5b51554c668ee44c387c5846a6 --
Jun 19 15:38:41 trilium systemd[1]: Started trilium.service - Trilium Server.
Jun 19 15:38:43 trilium docker[1213]: No USER_UID specified, leaving 1000
Jun 19 15:38:43 trilium docker[1213]: No USER_GID specified, leaving 1000
Jun 19 15:38:49 trilium docker[1213]: DB size: 91996 KB
Jun 19 15:38:52 trilium docker[1213]: {
Jun 19 15:38:52 trilium docker[1213]:   "appVersion": "0.63.7",
Jun 19 15:38:52 trilium docker[1213]:   "dbVersion": 228,
Jun 19 15:38:52 trilium docker[1213]:   "nodeVersion": "v18.18.2",
Jun 19 15:38:52 trilium docker[1213]:   "syncVersion": 32,
Jun 19 15:38:52 trilium docker[1213]:   "buildDate": "2024-05-30T06:59:06+02:00",
Jun 19 15:38:52 trilium docker[1213]:   "buildRevision": "95d46b7ce7e0036eeb72b43e1815cc5c00dc214c",
Jun 19 15:38:52 trilium docker[1213]:   "dataDirectory": "/home/node/trilium-data",
Jun 19 15:38:52 trilium docker[1213]:   "clipperProtocolVersion": "1.0",
Jun 19 15:38:52 trilium docker[1213]:   "utcDateTime": "2024-06-19T19:38:48.370Z"
Jun 19 15:38:52 trilium docker[1213]: }
Jun 19 15:38:52 trilium docker[1213]: CPU model: Cortex-A72, logical cores: 4 freq: 1500 Mhz
Jun 19 15:38:52 trilium docker[1213]: Trusted reverse proxy: false
Jun 19 15:38:52 trilium docker[1213]: App HTTP server starting up at port 8080
Jun 19 15:38:52 trilium docker[1213]: Listening on port 8080
Jun 19 15:38:53 trilium docker[1213]: Becca (note cache) load took 295ms
Jun 19 15:38:57 trilium docker[1213]: Table counts: notes: 984, revisions: 152, attachments: 27, branches: 1002, attributes: 1338, etapi_tokens: 0
Jun 19 15:38:57 trilium docker[1213]: Slow query took 75ms: SELECT id, entityId FROM entity_changes LEFT JOIN notes ON entityId = notes.noteId WHE
Jun 19 15:38:57 trilium docker[1213]: Slow query took 177ms: SELECT notes.noteId, notes.type, notes.mime FROM notes JOIN blobs USING (blobId) WHER
Jun 19 15:38:57 trilium docker[1213]: All consistency checks passed with no errors detected (took 455ms)
Jun 19 15:39:13 trilium docker[1213]: Generated CSRF token 9GBiWzP8-4BBuLehkZz4j9Hj-ZztTMLetCpU with secret undefined
Jun 19 15:39:13 trilium docker[1213]: 200 GET /api/options with 6474 bytes took 5ms
Jun 19 15:39:13 trilium docker[1213]: 200 GET /api/tree with 47128 bytes took 9ms
Jun 19 15:39:13 trilium docker[1213]: 304 GET /api/keyboard-actions with 13999 bytes took 6ms
Jun 19 15:39:13 trilium docker[1213]: Slow 304 GET /api/script/widgets with 2687 bytes took 11ms
Jun 19 15:39:13 trilium docker[1213]: Generated CSRF token HLJwzr2k-ddov_Ld6jFZG6jUOmbOuIspHgWQ with secret undefined
Jun 19 15:39:13 trilium docker[1213]: 200 POST /api/tree/load with 4471 bytes took 4ms
Jun 19 15:39:13 trilium docker[1213]: 304 GET /api/keyboard-shortcuts-for-notes with 2 bytes took 3ms
Jun 19 15:39:14 trilium docker[1213]: 200 GET /api/health-check with 15 bytes took 3ms
Jun 19 15:39:14 trilium docker[1213]: 304 GET /api/notes/Z55TRYwAhQri/blob with 304 bytes took 7ms
Jun 19 15:39:14 trilium docker[1213]: 304 GET /api/note-map/Z55TRYwAhQri/backlink-count with 11 bytes took 6ms
Jun 19 15:39:14 trilium docker[1213]: Generated CSRF token l0rd9aeQ-IrIixKHLet2rQFNCoW7LbJzmm90 with secret undefined
Jun 19 15:39:15 trilium docker[1213]: Generated CSRF token TGRtSpQf-tAWoOVOTsYABKySAZlkhM8I7228 with secret undefined
Jun 19 15:39:15 trilium docker[1213]: 304 GET /api/script/startup with 2 bytes took 9ms
Jun 19 15:39:15 trilium docker[1213]: Updating option 'leftPaneWidth' to '18'
Jun 19 15:39:16 trilium docker[1213]: Slow 204 PUT /api/options with 0 bytes took 26ms
Jun 19 15:39:16 trilium docker[1213]: Generated CSRF token xFNQkGYa-TmkO7lL0sWkqNCSqUBSfjsaEYY4 with secret undefined
Jun 19 15:39:17 trilium docker[1213]: Generated CSRF token 2rI71I58-yYnUK4uP2M9IIqRVUInNcbx045U with secret undefined
Jun 19 15:39:18 trilium docker[1213]: 304 GET /api/setup/status with 59 bytes took 3ms
Jun 19 15:39:18 trilium docker[1213]: 200 POST /api/login/sync with 54 bytes took 6ms
Jun 19 15:39:18 trilium docker[1213]: 200 GET /api/sync/changed?instanceId=hlES0BzvcJGR&lastEntityChangeId=7204&logMarkerId=XQGmU58KWq with 71 byt
Jun 19 15:39:18 trilium docker[1213]: 204 POST /api/sync/finished with 0 bytes took 2ms
Jun 19 15:39:18 trilium docker[1213]: Content hash computation took 95ms
Jun 19 15:39:18 trilium docker[1213]: Slow 304 GET /api/sync/check with 11718 bytes took 102ms
Jun 19 15:39:19 trilium docker[1213]: Generated CSRF token WdnLU7Fq-vK-ONBwvP-CtQc7KrzmHQNWwSNc with secret undefined
Jun 19 15:39:22 trilium systemd[1]: Stopping trilium.service - Trilium Server...
Jun 19 15:39:22 trilium docker[1213]: Generated CSRF token M5Rc1XoP-l55ZV5fzE8inouhQQruv4jowbOI with secret undefined
Jun 19 15:39:22 trilium docker[1213]: Caught interrupt/termination signal. Exiting.
Jun 19 15:39:23 trilium docker[1386]: trilium
Jun 19 15:39:23 trilium systemd[1]: trilium.service: Deactivated successfully.
Jun 19 15:39:23 trilium systemd[1]: Stopped trilium.service - Trilium Server.

Any light you can shed on this would be helpful

chris

1 Answer 1

0

I found a solution:
In the file /lib/systemd/system/trilium.service I created, I changed the following line

ExecStart=/usr/bin/docker start -a trilium

to this:

ExecStart=/usr/bin/docker run --name %n trilium

It solved the problem!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .