Docker - Unable to start up (OD-2291)
Sam opened 10 months ago

Hi there! I am new here and wanting to get onedev up and running on my nas to help organize some of my coding projects. I am attempting to run this via docker within synology container manager and hitting a little snag in connecting to the mysql db which will be running alongside it. I am able to talk to the db and verify that the credentials are valid which I am specifying but I am getting a sql connection error.


version: '3.8'

networks:
   onedev-network:
      name: 'onedev-network'

services:
   app:
      hostname: 'onedev'
      image: '1dev/server:latest'
      container_name: 'onedev-server'
      restart: unless-stopped
      environment:
         - PUID=1031 # onedev
         - PGID=65538
         - hibernate_dialect=org.hibernate.dialect.MySQL5InnoDBDialect
         - hibernate_connection_driver_class=com.mysql.cj.jdbc.Driver
         - hibernate_connection_url="jdbc:mysql://onedev-db-mysql:3306/onedev?serverTimezone=UTC&allowPublicKeyRetrieval=true&useSSL=false&disableMariaDbDriver=true"
         - hibernate_connection_username="onedev"
         - hibernate_connection_password="*Redacted*"
         - initial_user=*Redacted*
         - initial_password=*Redacted*
         - initial_email=*Redacted*
         - initial_server_url=http://1dev
         - initial_ssh_root_url=ssh://1dev
      volumes:
         - './onedev-app-data:/opt/onedev'
         - '/var/run/docker.sock:/var/run/docker.sock'
      networks:
         - 'onedev-network'
      ports:
         - '6610:6610'
      depends_on:
         - onedev-db-mysql

   onedev-db-mysql:
     container_name: onedev-db-mysql
     image: docker.io/library/mysql:8
     restart: always
     user: "1031:65538"
    healthcheck:
      test: ["CMD", "mysmql", "-u", "root", "-p*Redacted*", "--execute", "SHOW DATABASES;"]
      interval: 3s
      retries: 5
      timeout: 5s
      start_period: 90s
     environment:
       - PUID=1031 # onedev
       - PGID=65538
       - MYSQL_ROOT_PASSWORD=*Redacted*
       - MYSQL_USER=onedev
       - MYSQL_PASSWORD=*Redacted*
       - MYSQL_DATABASE=onedev
     networks:
       - 'onedev-network'
     command: --mysql-native-password=ON
     volumes:
       - ./onedev-db-mysql:/var/lib/mysql:rw
       - /etc/passwd:/etc/passwd:ro
       - /etc/group:/etc/group:ro
     ports:
       - 3306:3306

log

onedev-server
date,stream,content
2025/02/24 21:29:10,stdout,<-- Wrapper Stopped

2025/02/24 21:29:10,stdout,20:29:08 INFO  io.onedev.commons.loader.AppLoader - Stopping application...

2025/02/24 21:29:10,stdout,	at java.base/java.lang.Thread.run(Thread.java:829)

2025/02/24 21:29:10,stdout,	at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:349)

2025/02/24 21:29:10,stdout,	at java.base/java.lang.reflect.Method.invoke(Method.java:566)

2025/02/24 21:29:10,stdout,	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

2025/02/24 21:29:10,stdout,	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

2025/02/24 21:29:10,stdout,	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

2025/02/24 21:29:10,stdout,	at io.onedev.commons.bootstrap.Bootstrap.main(Bootstrap.java:200)

2025/02/24 21:29:10,stdout,	at io.onedev.commons.loader.AppLoader.start(AppLoader.java:60)

2025/02/24 21:29:10,stdout,	at io.onedev.commons.loader.DefaultPluginManager.start(DefaultPluginManager.java:44)

2025/02/24 21:29:10,stdout,	at io.onedev.server.OneDev.start(OneDev.java:140)

2025/02/24 21:29:10,stdout,	at io.onedev.server.ee.clustering.DefaultClusterManager.start(DefaultClusterManager.java:102)

2025/02/24 21:29:10,stdout,	at io.onedev.server.data.DefaultDataManager.openConnection(DefaultDataManager.java:280)

2025/02/24 21:29:10,stdout,	at io.onedev.server.persistence.PersistenceUtils.openConnection(PersistenceUtils.java:42)

2025/02/24 21:29:10,stdout,"io.onedev.commons.utils.ExplicitException: Failed to create database connection (driver: com.mysql.cj.jdbc.Driver, url: \"jdbc:mysql://onedev-db-mysql:3306/onedev?serverTimezone=UTC&allowPublicKeyRetrieval=true&useSSL=false&disableMariaDbDriver=true\")
"
2025/02/24 21:29:10,stdout,20:29:08 ERROR i.onedev.commons.bootstrap.Bootstrap - Error booting application

2025/02/24 21:29:10,stdout,20:29:02 INFO  io.onedev.commons.loader.AppLoader - Starting application...

2025/02/24 21:29:10,stdout,20:29:01 INFO  i.onedev.commons.bootstrap.Bootstrap - Cleaning temp directory...

2025/02/24 21:29:10,stdout,20:29:01 INFO  i.onedev.commons.bootstrap.Bootstrap - Launching application from '/opt/onedev'...

2025/02/24 21:29:10,stdout,WrapperManager: Initializing...

2025/02/24 21:29:10,stdout,Launching a JVM...

2025/02/24 21:29:10,stdout,

2025/02/24 21:29:10,stdout,  Licensed to OneDev for Service Wrapping

2025/02/24 21:29:10,stdout,    http://wrapper.tanukisoftware.com

2025/02/24 21:29:10,stdout,"  Copyright (C) 1999-2022 Tanuki Software, Ltd. All Rights Reserved.
"
2025/02/24 21:29:10,stdout,]0;OneDevJava Service Wrapper Standard Edition 64-bit 3.5.51

2025/02/24 21:29:10,stdout,--> Wrapper Started as Console

  • Robin Shen commented 10 months ago

    The problem is caused by surrounding quotes of the connection string:

    - hibernate_connection_url="jdbc:mysql://onedev-db-mysql:3306/onedev?serverTimezone=UTC&allowPublicKeyRetrieval=true&useSSL=false&disableMariaDbDriver=true"
    

    Please change it to:

    - hibernate_connection_url=jdbc:mysql://onedev-db-mysql:3306/onedev?serverTimezone=UTC&allowPublicKeyRetrieval=true&useSSL=false&disableMariaDbDriver=true
    

    Another issue in this docker compose file is that OneDev can only run as root user inside the container. Please remove uid/gid assignment in OneDev container.

    At last, add property tty: true to OneDev container, otherwise logging will not work correctly in OneDev.

  • Sam commented 10 months ago

    Ah thanks for that, malformed connection string was definitely an issue. Also good to know about the user, I have tried to configure my other images to run as users which were already permitted to access my existing storage.

    Once it was past the initial startup issue the logs showed that it was waiting to start up but the server component hadn't started until I connected to the container and poked at some of the scripts. It looks like the file structure was created properly though. I tried running the server.sh script but this failed, but when checking the docker logs, they showed that the server had started and was waiting for connections. Is there a post run script I should kick off to prime the server instance or something?

  • Robin Shen commented 10 months ago

    Have you added tty: true to OneDev container?

  • Robin Shen changed state to 'Closed' 10 months ago
    Previous Value Current Value
    Open
    Closed
issue 1/1
Type
Question
Priority
Normal
Assignee
Labels
No labels
Issue Votes (0)
Watchers (2)
Reference
OD-2291
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover