Database settings are invalid?

Hello dear community,

I have created a Gitea server via a Docker container on a test instance (VirtualBox) - everything works wonderfully here.
Now I want to do the same on my web server but I get the following error message in the setup:

Database settings are invalid: dial tcp 172.21.0.2:3306: connect: connection timed out

I would like to use the host’s database - on Virtualbox it worked with this IP. Port 3306 + 3300 is free in the FW, the access data to the database is also correct and I have now even allowed the user access from any host - but the error message simply does not change :rage:

/etc/gitea# cat docker-compose.yml
    version: '3'
    networks:
      gitea:
        external: false
    volumes:
      gitea:
        driver: local
    services:   
      server:
        image: gitea/gitea:1.13.6
        container_name: gitea
        environment:
          - DB_TYPE=mysql
          - DB_HOST=172.21.0.2
          - DB_NAME=DBNAME
          - DB_USER=DBUSER
          - DB_PASSWD=DBPW
        restart: always
        networks:
          - gitea
        volumes:
          - /var/www/clients/clientx/weby/private/giteadata/data:/data
          - /var/www/clients/clientx/weby/private/giteadata/config:/config
          - /etc/timezone:/etc/timezone:ro
          - /etc/localtime:/etc/localtime:ro
          - /var/run/mysqld:/var/run/mysqld
        ports:
          - "3300:3000"
          - "222:22"

Since port 3000 is already occupied for Rocketchat, I switched to 3300 - everything works wonderfully on Virtualbox ^^

The Apache conf as follows:

## gitea
<Proxy *>
         Order allow,deny
        Allow from all
  </Proxy>
AllowEncodedSlashes NoDecode
# Note: no trailing slash after either /git or port
ProxyPass /git http://127.0.0.1:3300 nocanon
    ProxyPassReverse /git http://127.0.0.1:3300     

Whats going on here ? Many thanks in advance

1 Like

You are using a significantly out of date version of Gitea ( 1.13.6), please instead update to latest stable (at time of writing it is 1.15.10 soon to be 1.16.0)

1 Like

Hi, thanks but on another mashine this old version does a very well job.

Now I changed the yml to the new version, pulled again, tried teh setup - same error (of course)

isn’t there a log to examine ? i started getting sick and tired of repeating and repeating the same steps which just cannot work…

why was that working exactliy tzhis way on test-server on virtual box and wjhy does not work in a webserver ???

Can I somehow remove the gitea completely with all files, configs and everything (without affecting other docker images running) and just reinstall new ?

I got it now - somehow the containers IP address was different to the one on my other mashine. I changed the IPs and all working now.

Identified IP of container by executing:

docker inspect <Container> | grep -i ipaddress	

It gave me 172.20.0.2. Then I changed the DB-IP in the yml to 172.20.0.1 - all good now

How can I mark this thread as solved ?