My experience with upgrading my self-hosted Joplin server from 2.10 to 2.14.
I'm hosting my server using docker since the beginnig. I'm hosting Nextcloud using traefik reverse proxy for long time already so adding Joplin server to my setup was a no-brainer once it was it was introduced. and since this days I was upgrading the server once a while without issues. Today I first time hit a significant issue since I'm hosting my server and I want to share my experience so other user can avoid my problems. following this step.
problem
starting with working setup with Joplin desktop, and Joplin server server:2.10.10-beta
I recognized there is new image joplin/server:2.14.2-beta
(shame on me I missed the intermediate step - definitely good sign as happy user doesn't frequently look for updates ) I'm running docker-compose so my plan was to upgrade joplin-server by performing common steps
- adjust image: to
image: joplin/server:2.14.2-beta
- docker compose pull
- docker compose up -d
so far this worked good and I could login to the server website, check my users, notes side etc.. but my client reported sync issues and claimed it needs an upgrade on sync target which could take few minutes.. ok why not - go! the result was disappointing
Joplin upgrade in progress...
Please wait while the sync target is being upgraded. It may take a few seconds or a few minutes depending on the upgrade. The application will automatically restart once it is completed.
The sync target could not be upgraded due to an error. For support, please copy the complete content of this page and paste it in the forum: https://discourse.joplinapp.org/
The full error was:
Could not upgrade from version 1 to version 2: This item is already present and cannot be added again: info.json
Error: Could not upgrade from version 1 to version 2: This item is already present and cannot be added again: info.json
at FileApiDriverJoplinServer.<anonymous> (C:\Program Files\Joplin\resources\app.asar\node_modules\@joplin\lib\file-api-driver-joplinServer.js:196:27)
at Generator.throw (<anonymous>)
at rejected (C:\Program Files\Joplin\resources\app.asar\node_modules\@joplin\lib\file-api-driver-joplinServer.js:6:65)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
and the start for further troubleshooting journey.. and revealed some issues on the docker container logs:
joplin-server | 13:22:28 0|app | 2024-03-13 13:22:28: TaskService: Completed #11 (Process shared items) in 92ms
joplin-server | 13:22:38 0|app | 2024-03-13 13:22:38: TaskService: Running #11 (Process shared items) (scheduled)...
joplin-server | 13:22:38 0|app | 2024-03-13 13:22:38: [error] TaskService: On #11 (Process shared items) TypeError: Cannot use 'in' operator to search for 'name' in undefined
joplin-server | 13:22:38 0|app | at UserItemModel.<anonymous> (/home/joplin/packages/server/src/models/UserItemModel.ts:126:17)
joplin-server | 13:22:38 0|app | at Generator.next (<anonymous>)
joplin-server | 13:22:38 0|app | at /home/joplin/packages/server/dist/models/UserItemModel.js:8:71
joplin-server | 13:22:38 0|app | at new Promise (<anonymous>)
joplin-server | 13:22:38 0|app | at __awaiter (/home/joplin/packages/server/dist/models/UserItemModel.js:4:12)
joplin-server | 13:22:38 0|app | at /home/joplin/packages/server/src/models/UserItemModel.ts:124:41
joplin-server | 13:22:38 0|app | at UserItemModel.<anonymous> (/home/joplin/packages/server/src/models/BaseModel.ts:221:19)
joplin-server | 13:22:38 0|app | at Generator.next (<anonymous>)
joplin-server | 13:22:38 0|app | at fulfilled (/home/joplin/packages/server/dist/models/BaseModel.js:5:58)
joplin-server | 13:22:38 0|app | at processTicksAndRejections (node:internal/process/task_queues:95:5)
joplin-server | 13:22:38 0|app | 2024-03-13 13:22:38: TaskService: Completed #11 (Process shared items) in 162ms
joplin-server | 13:22:48 0|app | 2024-03-13 13:22:48: TaskService: Running #11 (Process shared items) (scheduled)...
joplin-server | 13:22:48 0|app | 2024-03-13 13:22:48: [error] TaskService: On #11 (Process shared items) TypeError: Cannot use 'in' operator to search for 'name' in undefined
joplin-server | 13:22:48 0|app | at UserItemModel.<anonymous> (/home/joplin/packages/server/src/models/UserItemModel.ts:126:17)
joplin-server | 13:22:48 0|app | at Generator.next (<anonymous>)
joplin-server | 13:22:48 0|app | at /home/joplin/packages/server/dist/models/UserItemModel.js:8:71
joplin-server | 13:22:48 0|app | at new Promise (<anonymous>)
joplin-server | 13:22:48 0|app | at __awaiter (/home/joplin/packages/server/dist/models/UserItemModel.js:4:12)
joplin-server | 13:22:48 0|app | at /home/joplin/packages/server/src/models/UserItemModel.ts:124:41
joplin-server | 13:22:48 0|app | at UserItemModel.<anonymous> (/home/joplin/packages/server/src/models/BaseModel.ts:221:19)
joplin-server | 13:22:48 0|app | at Generator.next (<anonymous>)
joplin-server | 13:22:48 0|app | at fulfilled (/home/joplin/packages/server/dist/models/BaseModel.js:5:58)
joplin-server | 13:22:48 0|app | at processTicksAndRejections (node:internal/process/task_queues:95:5)
joplin-server | 13:22:48 0|app | 2024-03-13 13:22:48: TaskService: Completed #11 (Process shared items) in 159ms
joplin-server | 13:22:58 0|app | 2024-03-13 13:22:58: TaskService: Running #11 (Process shared items) (scheduled)...
joplin-server | 13:22:58 0|app | 2024-03-13 13:22:58: [error] TaskService: On #11 (Process shared items) TypeError: Cannot use 'in' operator to search for 'name' in undefined
solution
this logs repeated all the time.. OK back to the homework and review the docker-compose example.. this was using postgres:16 in opposite to my long-lived setup based on postgres:15. I recognized this difference in advance I was reluctant to upgrade the database as I know PG version upgrades are not "self-running" and the admin must dump/restore the DB using the new version. once I hit the issue I was looking for options to adopt my setup to the "working example" and decided to go the upgrade way. duplicated my db service using image: postgres:16
and performed
# local backup
docker compose exec pgdb15 bash -c 'pg_dump -d "$POSTGRES_DB" -U "$POSTGRES_USER"' > postgres.bck.sql
# local restore
cat postgres.sql| docker compose exec -i pgdb16 bash -c 'psql -d "$POSTGRES_DB" -U "$POSTGRES_USER"'
it was easy as I was able to keep my joplin-server unchanged using container_name: joplin-db
moved from pgdb15 to pgdb16 service. and voila there are no more errors in joplin-server logs and upgrading sync target worked within seconds.
conclusion
I recognized in advance postgres:16 was used but postgres is a stable advanced database I was choose the lazy path expecting my setup Joplin server running postgres:15 would survive this upgrade without issues.. but turns out this is not the case. this is not a dig deal to upgrade postgres using docker but you have to sometimes
disclaimer
I hope this article helps others how self-host their Joplin server as I didn't find any reports in this forum and at Github so far..I'm sorry if this is the wrong category. It looks most server posts live here and usual Support template doesn't fit for #server issues.