#1855  Docker upgrade failure -- bad state
Closed
Dave Z opened 2 weeks ago

I was upgrading my local onedev container from 8.x (don't remember the actual version and unable to roll back) to the latest, but the server failed to launch after upgrading in a very similar fashion to https://code.onedev.io/onedev/server/~issues/1725 .

--> Wrapper Started as Console
Java Service Wrapper Standard Edition 64-bit 3.5.51
  Copyright (C) 1999-2022 Tanuki Software, Ltd. All Rights Reserved.
    http://wrapper.tanukisoftware.com
  Licensed to OneDev for Service Wrapping

Launching a JVM...
WrapperManager: Initializing...
INFO  - Launching application from '/app'...
INFO  - Starting application...
INFO  - Upgrading /opt/onedev...
INFO  - >>> INFO  - Launching application from '/opt/onedev'...
INFO  - >>> INFO  - Cleaning temp directory...
INFO  - >>> INFO  - Starting application...
INFO  - >>> INFO  - Waiting for server to stop...
INFO  - >>> INFO  - Stopping application...
INFO  - Backing up old program files as /opt/onedev/site/program-backup/2024-04-19_17-41-13...
INFO  - Copying new program files into /opt/onedev...
INFO  - Successfully upgraded /opt/onedev
INFO  - Stopping application...
<-- Wrapper Stopped

The upgrade did create (or overwrite 🤷‍♂️ ) the release.properties file with the latest version. I tried downgrading to 8.1.3 and using the properties file provided in the aforementioned thread, but the server remained broken as well as after attempting to re-upgrade.

This is the docker compose file I'm using:

version: '3.6'
services:
  web:
    image: 1dev/server
    container_name: onedev
    restart: always
    ports:
      - '6610:6610'
      - '6611:6611'
    volumes:
      - '/srv/onedev/data:/opt/onedev'
      - '/srv/run/docker.sock:/var/run/docker.sock'
    shm_size: '2048m'

(changed image to 1dev/server:8.1.3 when downgrading and 1dev/server:latest when re-upgrading)

What is my best course of action here to ensure I don't lose my repositories?

Thanks.

Robin Shen commented 2 weeks ago

Your repositories will not lost even for a failed upgrade. Please follow below steps to diagnose the issue:

  1. Take a backup of /srv/onedev/data

    cp -r /srv/onedev/data /path/to/backup
    
  2. Install OpenJDK 11 on the machine

    sudo apt install openjdk-11-jdk
    
  3. Run below command to chown of OneDev data directory to be current user and group:

    chown -R $(id -u):$(id -g) /srv/onedev/data
    
  4. Run below command to see if OneDev can start. Please post log here otherwise.

    /srv/onedev/data/bin/server.sh console
    
Dave Z changed fields 2 weeks ago
Name Previous Value Current Value
Priority
Critical
Normal
Dave Z commented 2 weeks ago

Thanks for the help!

Starting it directly worked, and solved the issue running it from the docker container.

Dave Z changed state to 'Closed' 2 weeks ago
Previous Value Current Value
Open
Closed
Dave Z commented 2 weeks ago

Fixed.

Robin Shen commented 2 weeks ago

The upgrade is actually successful. Just that docker compose is not printing the full log. To address the issue, please enable tty mode in your docker compose file like below:

version: '3.6'
services:
  web:
    image: 1dev/server
    container_name: onedev
    restart: always
    ports:
      - '6610:6610'
      - '6611:6611'
    volumes:
      - '/srv/onedev/data:/opt/onedev'
      - '/srv/run/docker.sock:/var/run/docker.sock'
    shm_size: '2048m'
    tty: true
issue 1 of 1
Type
Build Failure
Priority
Normal
Assignee
Failed Build
Labels
No labels
Issue Votes (0)
Watchers (4)
Reference
onedev/server#1855
Please wait...
Page is in error, reload to recover