Joplin server fails with upgrading database

Hi,

I did a Joplin Dokcer pull yesterday. I now see that it fails some database upgrade in the logs.

There were no problems with it since I have been using it for months without issues. Has there been a new change in the server setup or database stuff?

I am using it on Debian Testing, Docker

docker compose

version: '3'

services:
    db:
        image: postgres:13.1
        volumes:
            - /media/docker/joplin/data/postgres:/var/lib/postgresql/data
        ports:
            - "45432:5432"
        restart: always
        environment:
            - APP_PORT=22300
            - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
            - POSTGRES_USER=${POSTGRES_USER}
            - POSTGRES_DB=${POSTGRES_DATABASE}
    app:
        image: joplin/server:latest
        depends_on:
            - db
        ports:
            - "22300:22300"
        restart: always
        environment:
            - APP_BASE_URL=${APP_BASE_URL}
            - DB_CLIENT=pg
            - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
            - POSTGRES_DATABASE=${POSTGRES_DATABASE}
            - POSTGRES_USER=${POSTGRES_USER}
            - POSTGRES_PORT=${POSTGRES_PORT}
            - POSTGRES_HOST=db


logs, this art of the log keeps repeating, it seems like it is in a crash loop.

> @joplin/server@2.6.5 start                                                                                                                                                                                                                                                    
> node dist/app.js                                                                                                                                                                                                                                                              
                                                                                                                                                                                                                                                                                
2021-11-12 09:06:58: App: Starting server v2.6.5 (prod) on port 22300 and PID 19...                                                                                                                                                                                             
2021-11-12 09:06:58: App: Running in Docker: true                                                                                                                                                                                                                               
2021-11-12 09:06:58: App: Public base URL: https://server/joplin                                                                                                                                                                                                        
2021-11-12 09:06:58: App: API base URL: https://server/joplin                                                                                                                                                                                                           
2021-11-12 09:06:58: App: User content base URL: https://server/joplin                                                                                                                                                                                                  
2021-11-12 09:06:58: App: Log dir: /home/joplin/packages/server/logs                                                                                                                                                                                                            
2021-11-12 09:06:58: App: DB Config: {                                                                                                                                                                                                                                          
  client: 'pg',                                                                                                                                                                                                                                                                 
  name: 'joplin',                                                                                                                                                                                                                                                               
  slowQueryLogEnabled: false,                                                                                                                                                                                                                                                   
  slowQueryLogMinDuration: 1000,                                                                                                                                                                                                                                                
  autoMigration: true,                                                                                                                                                                                                                                                          
  user: 'admin',                                                                                                                                                                                                                                                           
  password: '********',                                                                                                                                                                                                                                                         
  port: 0,                                                                                                                                                                                                                                                                      
  host: 'db'                                                                                                                                                                                                                                                                    
}                                                                                                                                                                                                                                                                               
2021-11-12 09:06:58: App: Mailer Config: {                                                                                                                                                                                                                                      
  enabled: false,                                                                                                                                                                                                                                                               
  host: '',                                                                                                                                                                                                                                                                     
  port: 587,                                                                                                                                                                                                                                                                    
  secure: true,                                                                                                                                                                                                                                                                 
  authUser: '',                                                                                                                                                                                                                                                                 
  authPassword: '********',                                                                                                                                                                                                                                                     
  noReplyName: '',                                                                                                                                                                                                                                                              
  noReplyEmail: ''                                                                                                                                                                                                                                                              
}                                                                                                                                                                                                                                                                               
2021-11-12 09:06:58: App: Content driver: { type: 1 }                                                                                                                                                                                                                           
2021-11-12 09:06:58: App: Content driver (fallback): null                                                                                                                                                                                                                       
2021-11-12 09:06:58: App: Trying to connect to database...                                                                                                                                                                                                                      
2021-11-12 09:06:58: App: Connection check: {                                                                                                                                                                                                                                   
  latestMigration: { name: '20210927183928_events.js', done: true },                                                                                                                                                                                                            
  isCreated: true,                                                                                                                                                                                                                                                              
  error: null                                                                                                                                                                                                                                                                   
}                                                                                                                                                                                                                                                                               
2021-11-12 09:07:22: App: Auto-migrating database...                                                                                                                                                                                                                            
Processing items 0 / 11211                                                                                                                                                                                                                                                      
Processing items 1000 / 11211                                                                                                                                                                                                                                                   
Processing items 2000 / 11211                                                                                                                                                                                                                                                   
Processing items 3000 / 11211                                                                                                                                                                                                                                                   
Processing items 4000 / 11211                                                                                                                                                                                                                                                   
Processing items 5000 / 11211                                                                                                                                                                                                                                                   
Processing items 6000 / 11211                                                                                                                                                                                                                                                   
Processing items 7000 / 11211                                                                                                                                                                                                                                                   
Processing items 8000 / 11211                                                                                                                                                                                                                                                   
Processing items 9000 / 11211                          
Processing items 10000 / 11211                                
Processing items 11000 / 11211                                     
migration file "20211030103016_item_owner_name_unique.js" failed                                                                        
migration failed with error: alter table "items" add constraint "items_name_owner_id_unique" unique ("name", "owner_id") - could not create unique index "items_name_owner_id_unique"                                                                                                                                        
error: alter table "items" add constraint "items_name_owner_id_unique" unique ("name", "owner_id") - could not create unique index "items_name_owner_id_unique"                                                                                                                                                              
    at Parser.parseErrorMessage (/home/joplin/packages/server/node_modules/pg-protocol/src/parser.ts:357:11)                                                  
    at Parser.handlePacket (/home/joplin/packages/server/node_modules/pg-protocol/src/parser.ts:186:21)      
    at Parser.parse (/home/joplin/packages/server/node_modules/pg-protocol/src/parser.ts:101:30)                                                              
    at Socket.<anonymous> (/home/joplin/packages/server/node_modules/pg-protocol/src/index.ts:7:48)                                                           
    at Socket.emit (node:events:390:28)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at Socket.Readable.push (node:internal/streams/readable:228:10)
    at TCP.onStreamRead (node:internal/stream_base_commons:199:23) {                                                                                          
  length: 287,      
  severity: 'ERROR',  
  code: '23505',                           
  detail: 'Key (name, owner_id)=(temp/timeCheck299477.txt, l16aNcKWxJMS4SfaZdBrHBPukzL4bdBp) is duplicated.',                                                 
  hint: undefined,
  position: undefined,                                                         
  internalPosition: undefined,                                                 
  internalQuery: undefined,                                                    
  where: 'parallel worker',                                                    
  schema: 'public',                                                            
  table: 'items',                                                              
  column: undefined,                                                           
  dataType: undefined,                                                         
  constraint: 'items_name_owner_id_unique',                                    
  file: 'tuplesort.c',                                                         
  line: '4226',                                                                
  routine: 'comparetup_index_btree'                                            
}                                                                              

> @joplin/server@2.6.5 start                                                   
> node dist/app.js                                                             

2021-11-12 09:11:03: App: Starting server v2.6.5 (prod) on port 22300 and PID 20...                                                                           
2021-11-12 09:11:03: App: Running in Docker: true                              



Have you had a look at this post?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.