digitalfondue / lavagna

Lavagna: issue tracker/project management tool
http://lavagna.io
GNU General Public License v3.0
636 stars 110 forks source link

Unable to obtain Jdbc connection from DataSource | Connection refused #152

Closed Roy-Z-DevOps closed 3 years ago

Roy-Z-DevOps commented 3 years ago

Im trying to write a docker-compose for a lavagna and mysql container but the Keep getting a 503 on the webpage and in the logs i see the following

lavagna_server | 16:12:24.435 [main] INFO  io.lavagna.common.LavagnaEnvironment - For property datasource.dialect, the value is: MYSQL
lavagna_server | 16:12:24.447 [main] INFO  io.lavagna.common.LavagnaEnvironment - For property datasource.url, the value is: jdbc:mysql://localhost:3306/lavagna
lavagna_server | 16:12:24.447 [main] INFO  io.lavagna.common.LavagnaEnvironment - For property datasource.username, the value is: sa
lavagna_server | 16:12:24.448 [main] INFO  io.lavagna.common.LavagnaEnvironment - For property spring.profiles.active, the value is: dev```
and this 
```lavagna_server | Caused by: java.net.ConnectException: Connection refused (Connection refused)````

this is the script im using to start the server 
```#!/bin/sh
java -Xms64m -Xmx128m -Ddatasource.dialect="MYSQL" \
-Ddatasource.url="jdbc:mysql://localhost:3306/lavagna?useUnicode=true&characterEncoding=utf-8&useSSL=false" \
-Ddatasource.username="root" \
-Ddatasource.password="root" \
-Dspring.profiles.active="dev" \
-jar ./target/lavagna-jetty-console.war --headless

and my docker-compose

version: "3.3"
services:

    db:
        image: mysql:5.7
        container_name: lavagna_db
        volumes: 
            - ./db:/docker-entrypoint-initdb.d/:ro
            - db-data:/var/lib/mysql
        environment: 
            MYSQL_DATABASE: 'lavagna'
            MYSQL_USER: 'sa'
            MYSQL_PASSWORD: '1234'
            MYSQL_ROOT_PASSWORD: 'root'

        ports:
            - "3306:3306"
        networks: 
            - backend

    lavagna:
        image: lavangnatest
        container_name: lavagna_server
        build: project/.
        depends_on: 
            - db
        ports:
            - "8080:8080"
        networks:
            - backend```

volumes: db-data: networks: backend:```

and as for the lavagna its being created by a sql file mounted onto docker-entrypoint-intit db and the only line written in that file is CREATE DATABASE lavagna CHARACTER SET utf8 COLLATE utf8_bin;

EliranBS commented 1 year ago

How did you solve the problem?