madeofpendletonwool / PinePods

Pinepods is a complete podcast management system and allows you to play, download, and keep track of podcasts you enjoy. All self hosted and enjoyed on your own server!
https://pinepods.online
GNU General Public License v3.0
187 stars 13 forks source link

Host is not allowed to connect to this mariadb server #74

Closed mansguiche closed 11 months ago

mansguiche commented 1 year ago

Hello, I am trying to run the system using a slightly modified version of the docker compose file from the installation docs. I am getting an issue where the web app can't connect to the database container. I have tried various changes to the docker compose file to try to fix the issue but so far nothing i have tried has worked.

Logs:

         A
        d$b
      .d\$$b.
    .d$i$$\$$b.      _______   __                                                __           
       d$$@b        /       \ /  |                                              /  |          
      d\$$$ib       $$$$$$$  |$$/  _______    ______    ______    ______    ____$$ |  _______ 
    .d$$$\$$$b      $$ |__$$ |/  |/       \  /      \  /      \  /      \  /    $$ | /       |
  .d$$@$$$$\$$ib.   $$    $$/ $$ |$$$$$$$  |/$$$$$$  |/$$$$$$  |/$$$$$$  |/$$$$$$$ |/$$$$$$$/ 
      d$$i$$b       $$$$$$$/  $$ |$$ |  $$ |$$    $$ |$$ |  $$ |$$ |  $$ |$$ |  $$ |$$      \ 
     d\$$$$@$b.     $$ |      $$ |$$ |  $$ |$$$$$$$$/ $$ |__$$ |$$ \__$$ |$$ \__$$ | $$$$$$  |
  .d$@$$\$$$$$@b.   $$ |      $$ |$$ |  $$ |$$       |$$    $$/ $$    $$/ $$    $$ |/     $$/ 
.d$$$$i$$$\$$$$$$b. $$/       $$/ $$/   $$/  $$$$$$$/ $$$$$$$/   $$$$$$/   $$$$$$$/ $$$$$$$/  
        ###                                           $$ |                                    
        ###                                           $$ |                                    
        ###                                           $$/                                     
A project created and written by Collin Pendleton
collinp@gooseberrydevelopment.com
wait-for-it.sh: waiting 60 seconds for db:3306
wait-for-it.sh: db:3306 is available after 0 seconds
Traceback (most recent call last):
  File "/pinepods/startup/setupdatabase.py", line 35, in <module>
    cnx = mysql.connector.connect(
          ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/mysql/connector/pooling.py", line 294, in connect
    return MySQLConnection(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/mysql/connector/connection.py", line 169, in __init__
    self.connect(**kwargs)
  File "/usr/local/lib/python3.12/site-packages/mysql/connector/abstracts.py", line 1217, in connect
    self._open_connection()
  File "/usr/local/lib/python3.12/site-packages/mysql/connector/connection.py", line 578, in _open_connection
    self._do_handshake()
  File "/usr/local/lib/python3.12/site-packages/mysql/connector/connection.py", line 200, in _do_handshake
    raise get_exception(packet)
mysql.connector.errors.DatabaseError: 1130: Host '192.168.80.3' is not allowed to connect to this MariaDB server
[2023-07-30 12:20:16 +0000] [24] [INFO] Starting gunicorn 21.2.0
[2023-07-30 12:20:16 +0000] [24] [INFO] Listening at: http://0.0.0.0:8033 (24)
[2023-07-30 12:20:16 +0000] [24] [INFO] Using worker: sync
[2023-07-30 12:20:16 +0000] [27] [INFO] Booting worker with pid: 27
[2023-07-30 12:20:16 +0000] [28] [INFO] Booting worker with pid: 28
[2023-07-30 12:20:16 +0000] [29] [INFO] Booting worker with pid: 29
[2023-07-30 12:20:16 +0000] [30] [INFO] Booting worker with pid: 30
Client API Server is Starting!
Proxy url is configured to http://proxy.pinepods.home.arpa/proxy?url=
Traceback (most recent call last):
  File "/pinepods/clients/clientapi.py", line 100, in <module>
    connection_pool = setup_connection_pool()
                      ^^^^^^^^^^^^^^^^^^^^^^^
  File "/pinepods/clients/clientapi.py", line 89, in setup_connection_pool
    return pooling.MySQLConnectionPool(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/mysql/connector/pooling.py", line 430, in __init__
    self.add_connection()
  File "/usr/local/lib/python3.12/site-packages/mysql/connector/pooling.py", line 538, in add_connection
    cnx = connect(**self._cnx_config)  # type: ignore[assignment]
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/mysql/connector/pooling.py", line 294, in connect
    return MySQLConnection(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/mysql/connector/connection.py", line 169, in __init__
    self.connect(**kwargs)
  File "/usr/local/lib/python3.12/site-packages/mysql/connector/abstracts.py", line 1217, in connect
    self._open_connection()
  File "/usr/local/lib/python3.12/site-packages/mysql/connector/connection.py", line 578, in _open_connection
    self._do_handshake()
  File "/usr/local/lib/python3.12/site-packages/mysql/connector/connection.py", line 200, in _do_handshake
    raise get_exception(packet)
mysql.connector.errors.DatabaseError: 1130: Host '192.168.80.3' is not allowed to connect to this MariaDB server
Traceback (most recent call last):
  File "/pinepods/pypods.py", line 59, in <module>
    with open("/tmp/web_api_key.txt", "r") as f:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/web_api_key.txt'

docker-compose.yml file

version: '3'
services:
  db:
    image: mariadb:latest # I also tried specifying the tag as :10
    container_name: pinepods-db
    command: --wait_timeout=1800
    ports:
      - 3306:3306 # I initially did not publish the ports since docker compose networks these two containers together, I have added this to see if it was causing the issue, however it made no difference.
    environment:
      MYSQL_TCP_PORT: 3306
      # MYSQL_RANDOM_ROOT_PASSWORD: yes # I tried with this set and with a specific user instead of root
      # MYSQL_HOST: '%'
      # MYSQL_USER: pinepods
      MYSQL_ROOT_HOST: '%' # I added this after various google results suggested it
      MYSQL_ROOT_PASSWORD: ${MYSQL_PASS} # I am passing the password in as a variable through portainer, the container is picking it up as expected, this is not an issue.
      MYSQL_DATABASE: pypods
      MYSQL_COLLATION_SERVER: utf8mb4_unicode_ci
      MYSQL_CHARACTER_SET_SERVER: utf8mb4
      MYSQL_INIT_CONNECT: 'SET @@GLOBAL.max_allowed_packet=64*1024*1024;'
    volumes:
      - /volume1/docker/pinepods/sql:/var/lib/mysql
    restart: unless-stopped
    networks:
      - pinepods # I am using a caddy reverse proxy in a different compose file, so I have specified a network for pinepods to work on and a separate one that caddy runs on to proxy the webserver, api and image proxy
  pinepods:
    image: madeofpendletonwool/pinepods:latest
    container_name: pinepods
    restart: unless-stopped
    ports:
    # Web Portal Port
      - "8034:8034" # Similarly here, I initially did not publish the port, but added it to debug.
    # # API Server Port - Needed for Client Connections
    #   - "8032:8032"
    # # Image Proxy Port - Needed to Display Some Images
    #   - "8033:8033"
    environment:
      # Default Admin User Information
      USERNAME: ${ADMIN_USER}
      PASSWORD: ${ADMIN_PASS}
      FULLNAME: ${ADMIN_NAME}
      EMAIL: ${ADMIN_EMAIL}
      # Database Vars
      DB_HOST: db
      DB_PORT: 3306
      DB_USER: root
      DB_PASSWORD: ${MYSQL_PASS}
      DB_NAME: pypods
      # Image/Audio Proxy Vars
      PROXY_HOST: proxy.pinepods.home.arpa
      PROXY_PORT: 8033
      PROXY_PROTOCOL: http
      REVERSE_PROXY: "True"
      # Search Index API Vars
      API_URL: 'http://api.pinepods.home.arpa/api/search'
      # Client API Vars
      API_SERVER_PORT: 8032
    volumes:
    # Mount the download location on the server if you want to. You could mount a nas to this folder or something like that
      - /volume1/Media/Podcasts:/opt/pypods/downloads
    networks:
      - pinepods
      - caddy
    links:
      - db # I added this after finding a stack overflow answer that suggested doing so, I have not had to add this before when connecting containers to mariadb instances, however and likely is not needed.
    depends_on:
      - db

networks:
  pinepods:
  caddy:
    external: true

System information:

Intel CPU Synology DS918+ Docker containers/stacks maintained through portainer

madeofpendletonwool commented 1 year ago

Hey! Thanks for reporting the issue! I'm on vacation currently and will be returning next weekend so I'll dig into the problem then. It's very possible you may have found an edge case with a way you're deploying. Either with Caddy or Synology nas's.

Regardless, the setup database script creates a text file with the api key for the web version within it. It appears that's not happening for one reason or another. Perhaps it's not creating that file? You could try exec'ing into the container and ls the /tmp/ folder. Regardless, I can test a bit with your file next week.

arcoast commented 1 year ago

I've got it working fine with the MariaDB container from linuxserver.io so it's definitely possible to swap things out a bit.

Currently on mobile but I'll post a compose file and env file later, might be useful as a starting point.

Once I'm on desktop I'll see if anything springs out for me in your compose file.

One thing I did notice is that you've added a container_name to your database, might want to try using the container name as the MariaDB host variable.

I also added a container name to the database and pinepods but I also renamed the service to match the container name.

So perhaps try changing

DB_HOST: db

to

DB_HOST: pinepods-db

and if that doesn't work try also renaming the service from db to pinepods-db

mansguiche commented 1 year ago

Good suggestions. Will try this later today if I get time hopefully. Thanks both for the support

arcoast commented 1 year ago

Here's my compose file which I can confirm connects to MariaDB just fine.

    pinepods:
        image: madeofpendletonwool/pinepods:latest
        container_name: pinepods
        networks:
            - pinepods
            - traefik
        ports:
            - 8034:8034 #Web Portal
            - 8032:8032 # API Server
            - 8000:8000 #Image Proxy
        environment:
            - USERNAME=${PINEPODS_USERNAME}
            - PASSWORD=${PINEPODS_PASSWORD}
            - FULLNAME=${PINEPODS_FULLNAME}
            - EMAIL=${PINEPODS_EMAIL}
            - DB_HOST=${PINEPODS_DB_HOST}
            - DB_PORT=${PINEPODS_DB_PORT}
            - DB_USER=${PINEPODS_DB_USER}
            - DB_PASSWORD=${PINEPODS_DB_PASSWORD}
            - DB_NAME=${PINEPODS_DB_NAME}
            - PROXY_HOST=${PINEPODS_PROXY_HOST}
            - PROXY_PORT=${PINEPODS_PROXY_PORT}
            - PROXY_PROTOCOL=${PINEPODS_PROXY_PROTOCOL}
            - REVERSE_PROXY=${PINEPODS_REVERSE_PROXY}
            - API_URL=${PINEPODS_API_URL}
            - API_SERVER_PORT=${PINEPODS_API_SERVER_PORT}
        volumes:
            - ${CONFIG}/pinepods/podcasts:/opt/pypods/downloads
        depends_on:
            - pinepods-mariadb

    pinepods-mariadb:
        image: lscr.io/linuxserver/mariadb
        container_name: pinepods-mariadb
        networks:
            - pinepods
        environment:
            - TZ=${TZ}
            - HOST_OS=${HOST_OS}
            - PUID=${PUID}
            - PGID=${PGID}
            - MYSQL_ROOT_PASSWORD=${PINEPODS_MARIADB_ROOT_PASSWORD}
            - MYSQL_DATABASE=${PINEPODS_DB_NAME}
            - MYSQL_USER=${PINEPODS_DB_USER}
            - MYSQL_PASSWORD=${PINEPODS_DB_PASSWORD}
#        ports:
#            - 3306:3306
        volumes:
            - ${CONFIG}/pinepods-mariadb:/config
        restart: unless-stopped

My .env file:

# Pinepod  
PINEPODS_USERNAME=admin
PINEPODS_PASSWORD=password
PINEPODS_FULLNAME=Pinepods Admin
PINEPODS_EMAIL=myemail@server.com
## Database Vars
PINEPODS_DB_HOST=pinepods-mariadb
PINEPODS_DB_PORT=3306
PINEPODS_DB_USER=pinepods
PINEPODS_DB_PASSWORD=PASSWORD
PINEPODS_DB_NAME=pinepods
PINEPODS_MARIADB_ROOT_PASSWORD=PASSWORD
## Image/Audio Proxy Vars
PINEPODS_PROXY_HOST=pinepods-proxy.server.com
PINEPODS_PROXY_PORT=8000
PINEPODS_PROXY_PROTOCOL=https
PINEPODS_REVERSE_PROXY=True
## Search Index API Vars
PINEPODS_API_URL=https://search.pinepods.online/api/search
## Client API Vars
PINEPODS_API_SERVER_PORT=8032
arcoast commented 1 year ago

@mansguiche

One other thing, I'm currently working on Traefik reverse proxy, and I believe Collin is working on Nginx/Nginx Proxy Manager, so if you could post some Caddy configs here as well then we'd have reverse proxy solutions all documented for the project going forward.

madeofpendletonwool commented 1 year ago

Correct! I am working with NPM and am working on getting a page added to the documentation site with documentation for each of the reverse proxy options. I'm away until the end of the weekend but will get that page added asap!

mansguiche commented 1 year ago

Righto so I have copied your docker compose file almost identically (couple small changes which I wouldn't have thought would be an issue) and I am getting the same error. This time however, the error is referencing the docker network instead of a host IP which seems more correct

I also executes an ls /tmp/ command while it was booting up which returned nothing (not even . and .. which I would have expected for a directory) I couldn't run it after it had booted up because the container exits on the error.

Logs

         A
        d$b
      .d\$$b.
    .d$i$$\$$b.      _______   __                                                __           
       d$$@b        /       \ /  |                                              /  |          
      d\$$$ib       $$$$$$$  |$$/  _______    ______    ______    ______    ____$$ |  _______ 
    .d$$$\$$$b      $$ |__$$ |/  |/       \  /      \  /      \  /      \  /    $$ | /       |
  .d$$@$$$$\$$ib.   $$    $$/ $$ |$$$$$$$  |/$$$$$$  |/$$$$$$  |/$$$$$$  |/$$$$$$$ |/$$$$$$$/ 
      d$$i$$b       $$$$$$$/  $$ |$$ |  $$ |$$    $$ |$$ |  $$ |$$ |  $$ |$$ |  $$ |$$      \ 
     d\$$$$@$b.     $$ |      $$ |$$ |  $$ |$$$$$$$$/ $$ |__$$ |$$ \__$$ |$$ \__$$ | $$$$$$  |
  .d$@$$\$$$$$@b.   $$ |      $$ |$$ |  $$ |$$       |$$    $$/ $$    $$/ $$    $$ |/     $$/ 
.d$$$$i$$$\$$$$$$b. $$/       $$/ $$/   $$/  $$$$$$$/ $$$$$$$/   $$$$$$/   $$$$$$$/ $$$$$$$/  
        ###                                           $$ |                                    
        ###                                           $$ |                                    
        ###                                           $$/                                     
A project created and written by Collin Pendleton
collinp@gooseberrydevelopment.com
wait-for-it.sh: waiting 60 seconds for pinepods-mariadb:3306
wait-for-it.sh: pinepods-mariadb:3306 is available after 4 seconds
Traceback (most recent call last):
  File "/pinepods/startup/setupdatabase.py", line 35, in <module>
    cnx = mysql.connector.connect(
          ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/mysql/connector/pooling.py", line 294, in connect
    return MySQLConnection(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/mysql/connector/connection.py", line 169, in __init__
    self.connect(**kwargs)
  File "/usr/local/lib/python3.12/site-packages/mysql/connector/abstracts.py", line 1217, in connect
    self._open_connection()
  File "/usr/local/lib/python3.12/site-packages/mysql/connector/connection.py", line 578, in _open_connection
    self._do_handshake()
  File "/usr/local/lib/python3.12/site-packages/mysql/connector/connection.py", line 200, in _do_handshake
    raise get_exception(packet)
mysql.connector.errors.DatabaseError: 1130: Host 'pinepods.pinepods_pinepods' is not allowed to connect to this MariaDB server
[2023-08-03 17:19:00 +0000] [30] [INFO] Starting gunicorn 21.2.0
[2023-08-03 17:19:00 +0000] [30] [INFO] Listening at: http://0.0.0.0:8033 (30)
[2023-08-03 17:19:00 +0000] [30] [INFO] Using worker: sync
[2023-08-03 17:19:00 +0000] [33] [INFO] Booting worker with pid: 33
[2023-08-03 17:19:00 +0000] [34] [INFO] Booting worker with pid: 34
[2023-08-03 17:19:00 +0000] [35] [INFO] Booting worker with pid: 35
[2023-08-03 17:19:00 +0000] [36] [INFO] Booting worker with pid: 36
Client API Server is Starting!
Proxy url is configured to http://proxy.pinepods.home.arpa/proxy?url=
Traceback (most recent call last):
  File "/pinepods/clients/clientapi.py", line 100, in <module>
    connection_pool = setup_connection_pool()
                      ^^^^^^^^^^^^^^^^^^^^^^^
  File "/pinepods/clients/clientapi.py", line 89, in setup_connection_pool
    return pooling.MySQLConnectionPool(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/mysql/connector/pooling.py", line 430, in __init__
    self.add_connection()
  File "/usr/local/lib/python3.12/site-packages/mysql/connector/pooling.py", line 538, in add_connection
    cnx = connect(**self._cnx_config)  # type: ignore[assignment]
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/mysql/connector/pooling.py", line 294, in connect
    return MySQLConnection(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/mysql/connector/connection.py", line 169, in __init__
    self.connect(**kwargs)
  File "/usr/local/lib/python3.12/site-packages/mysql/connector/abstracts.py", line 1217, in connect
    self._open_connection()
  File "/usr/local/lib/python3.12/site-packages/mysql/connector/connection.py", line 578, in _open_connection
    self._do_handshake()
  File "/usr/local/lib/python3.12/site-packages/mysql/connector/connection.py", line 200, in _do_handshake
    raise get_exception(packet)
mysql.connector.errors.DatabaseError: 1130: Host 'pinepods.pinepods_pinepods' is not allowed to connect to this MariaDB server
Traceback (most recent call last):
  File "/pinepods/pypods.py", line 59, in <module>
    with open("/tmp/web_api_key.txt", "r") as f:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/web_api_key.txt'
version: '3.8'
services:
    pinepods:
        image: madeofpendletonwool/pinepods:latest
        container_name: pinepods
        networks:
            - pinepods
            - caddy
        environment:
            - USERNAME=${PINEPODS_USERNAME}
            - PASSWORD=${PINEPODS_PASSWORD}
            - FULLNAME=${PINEPODS_FULLNAME}
            - EMAIL=${PINEPODS_EMAIL}
            - DB_HOST=${PINEPODS_DB_HOST}
            - DB_PORT=${PINEPODS_DB_PORT}
            - DB_USER=${PINEPODS_DB_USER}
            - DB_PASSWORD=${PINEPODS_DB_PASSWORD}
            - DB_NAME=${PINEPODS_DB_NAME}
            - PROXY_HOST=${PINEPODS_PROXY_HOST}
            - PROXY_PORT=${PINEPODS_PROXY_PORT}
            - PROXY_PROTOCOL=${PINEPODS_PROXY_PROTOCOL}
            - REVERSE_PROXY=${PINEPODS_REVERSE_PROXY}
            - API_URL=${PINEPODS_API_URL}
            - API_SERVER_PORT=${PINEPODS_API_SERVER_PORT}
        volumes:
            - ${PINEPODS_DOWNLOADS_PATH}:/opt/pypods/downloads
        depends_on:
            - pinepods-mariadb

    pinepods-mariadb:
        image: lscr.io/linuxserver/mariadb
        container_name: pinepods-mariadb
        networks:
            - pinepods
        environment:
            - TZ=${TZ}
            - HOST_OS=${HOST_OS}
            - PUID=${PUID}
            - PGID=${PGID}
            - MYSQL_RANDOM_ROOT_PASSWORD=yes
            - MYSQL_DATABASE=${PINEPODS_DB_NAME}
            - MYSQL_USER=${PINEPODS_DB_USER}
            - MYSQL_PASSWORD=${PINEPODS_DB_PASSWORD}
        volumes:
            - ${PINEPODS_DB_CONFIG_PATH}:/config
        restart: unless-stopped

networks:
    pinepods:
    caddy:
      external: true

One thing to note is that I am not setting these variables but I feel like that shouldn't matter for this error

- TZ=${TZ}
- HOST_OS=${HOST_OS}
- PUID=${PUID}
- PGID=${PGID}

Also here is my caddy config which you requested. I haven't been able to check if it works yet since the container won't start for long enough to test it. I am running caddy in a docker container which is connected to the caddy network included in the docker-compose.yml pasted above. By doing it this way I can reference the container names and connect to their ports over the docker network without having to expose the ports from the compose file.

proxy.pinepods.home.arpa:80 {
    reverse_proxy pinepods:8033
    log {
        output file /var/caddy/log/pinepods/proxy {
            roll_keep 2
            roll_size 10mb
            roll_keep_for 48h
        }
    }
}

api.pinepods.home.arpa:80 {
    reverse_proxy pinepods:8032
    log {
        output file /var/caddy/log/pinepods/api {
            roll_keep 2
            roll_size 10mb
            roll_keep_for 48h
        }
    }
}

pinepods.home.arpa:80 {
    reverse_proxy pinepods:8034
    log {
        output file /var/caddy/log/pinepods/web {
            roll_keep 2
            roll_size 10mb
            roll_keep_for 48h
        }
    }
}

In the above config I am using port 80 as the ingest route because I am running this all locally on my LAN. If you need it to be external and use https, you can remove the :80 on each route

arcoast commented 1 year ago
- TZ=${TZ}
- HOST_OS=${HOST_OS}

Probably aren't important, however for the MariaDB container (and any linuxserver.io container)

- PUID=${PUID}
- PGID=${PGID}

are extremely important they define the user & group the container runs as, so you set them depending on what user:group has permissions to write to the /config mount.

It's described in the readme here.

I suspect you'll find without the appropriate PUID & PGID variables set that the MariaDB container can't initialise the database correctly and therefore the container isn't starting properly. Logs would likely be useful.

As regards the networking issues. I have my networks setup like this:

networks:

    pinepods:
        external: false
        name: pinepods

    traefik:
        external: false
        name: traefik
madeofpendletonwool commented 1 year ago

What happen if you remove the volume?

volumes:

It should still work without it for testing and that will reveal if it's a permission error. If you ls -la in your db folder on your host machine what permissions does it show? A mariadb container I know needs some fairly specific permission on the database directory. I'll have access to a computer again late tomorrow night and I can post the exact permission set on my working instance.

mansguiche commented 1 year ago

I set the PUID and PGID, set the networks as you suggested and removed the config volume. Still getting the same error.

pinepods docker logs

         A

        d$b

      .d\$$b.

    .d$i$$\$$b.      _______   __                                                __           

       d$$@b        /       \ /  |                                              /  |          

      d\$$$ib       $$$$$$$  |$$/  _______    ______    ______    ______    ____$$ |  _______ 

    .d$$$\$$$b      $$ |__$$ |/  |/       \  /      \  /      \  /      \  /    $$ | /       |

  .d$$@$$$$\$$ib.   $$    $$/ $$ |$$$$$$$  |/$$$$$$  |/$$$$$$  |/$$$$$$  |/$$$$$$$ |/$$$$$$$/ 

      d$$i$$b       $$$$$$$/  $$ |$$ |  $$ |$$    $$ |$$ |  $$ |$$ |  $$ |$$ |  $$ |$$      \ 

     d\$$$$@$b.     $$ |      $$ |$$ |  $$ |$$$$$$$$/ $$ |__$$ |$$ \__$$ |$$ \__$$ | $$$$$$  |

  .d$@$$\$$$$$@b.   $$ |      $$ |$$ |  $$ |$$       |$$    $$/ $$    $$/ $$    $$ |/     $$/ 

.d$$$$i$$$\$$$$$$b. $$/       $$/ $$/   $$/  $$$$$$$/ $$$$$$$/   $$$$$$/   $$$$$$$/ $$$$$$$/  

        ###                                           $$ |                                    

        ###                                           $$ |                                    

        ###                                           $$/                                     

A project created and written by Collin Pendleton

collinp@gooseberrydevelopment.com

wait-for-it.sh: waiting 60 seconds for pinepods-mariadb:3306

wait-for-it.sh: pinepods-mariadb:3306 is available after 0 seconds

Traceback (most recent call last):

  File "/pinepods/startup/setupdatabase.py", line 35, in <module>

    cnx = mysql.connector.connect(

          ^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/site-packages/mysql/connector/pooling.py", line 294, in connect

    return MySQLConnection(*args, **kwargs)

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/site-packages/mysql/connector/connection.py", line 169, in __init__

    self.connect(**kwargs)

  File "/usr/local/lib/python3.12/site-packages/mysql/connector/abstracts.py", line 1217, in connect

    self._open_connection()

  File "/usr/local/lib/python3.12/site-packages/mysql/connector/connection.py", line 578, in _open_connection

    self._do_handshake()

  File "/usr/local/lib/python3.12/site-packages/mysql/connector/connection.py", line 200, in _do_handshake

    raise get_exception(packet)

mysql.connector.errors.DatabaseError: 1130: Host 'pinepods.pinepods_pinepods' is not allowed to connect to this MariaDB server

[2023-08-04 19:36:02 +0000] [22] [INFO] Starting gunicorn 21.2.0

[2023-08-04 19:36:02 +0000] [22] [INFO] Listening at: http://0.0.0.0:8033 (22)

[2023-08-04 19:36:02 +0000] [22] [INFO] Using worker: sync

[2023-08-04 19:36:02 +0000] [25] [INFO] Booting worker with pid: 25

[2023-08-04 19:36:02 +0000] [26] [INFO] Booting worker with pid: 26

Client API Server is Starting!

Proxy url is configured to http://proxy.pinepods.home.arpa/proxy?url=

[2023-08-04 19:36:02 +0000] [27] [INFO] Booting worker with pid: 27

[2023-08-04 19:36:02 +0000] [28] [INFO] Booting worker with pid: 28

Traceback (most recent call last):

  File "/pinepods/clients/clientapi.py", line 100, in <module>

    connection_pool = setup_connection_pool()

                      ^^^^^^^^^^^^^^^^^^^^^^^

  File "/pinepods/clients/clientapi.py", line 89, in setup_connection_pool

    return pooling.MySQLConnectionPool(

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/site-packages/mysql/connector/pooling.py", line 430, in __init__

    self.add_connection()

  File "/usr/local/lib/python3.12/site-packages/mysql/connector/pooling.py", line 538, in add_connection

    cnx = connect(**self._cnx_config)  # type: ignore[assignment]

          ^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/site-packages/mysql/connector/pooling.py", line 294, in connect

    return MySQLConnection(*args, **kwargs)

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/site-packages/mysql/connector/connection.py", line 169, in __init__

    self.connect(**kwargs)

  File "/usr/local/lib/python3.12/site-packages/mysql/connector/abstracts.py", line 1217, in connect

    self._open_connection()

  File "/usr/local/lib/python3.12/site-packages/mysql/connector/connection.py", line 578, in _open_connection

    self._do_handshake()

  File "/usr/local/lib/python3.12/site-packages/mysql/connector/connection.py", line 200, in _do_handshake

    raise get_exception(packet)

mysql.connector.errors.DatabaseError: 1130: Host 'pinepods.pinepods_pinepods' is not allowed to connect to this MariaDB server

Traceback (most recent call last):

  File "/pinepods/pypods.py", line 59, in <module>

    with open("/tmp/web_api_key.txt", "r") as f:

         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

FileNotFoundError: [Errno 2] No such file or directory: '/tmp/web_api_key.txt'

mariadb docker logs

[migrations] started

[migrations] no migrations found

───────────────────────────────────────

      ██╗     ███████╗██╗ ██████╗ 

      ██║     ██╔════╝██║██╔═══██╗

      ██║     ███████╗██║██║   ██║

      ██║     ╚════██║██║██║   ██║

      ███████╗███████║██║╚██████╔╝

      ╚══════╝╚══════╝╚═╝ ╚═════╝ 

   Brought to you by linuxserver.io

───────────────────────────────────────

To support LSIO projects visit:

https://www.linuxserver.io/donate/

───────────────────────────────────────

GID/UID

───────────────────────────────────────

User UID:    1000

User GID:    1000

───────────────────────────────────────

cp: not replacing '/config/custom.cnf'

[custom-init] No custom files found, skipping...

230804 19:27:18 mysqld_safe Logging to '/config/databases/44bf785c79a5.err'.

230804 19:27:18 mysqld_safe Starting mariadbd daemon with databases from /config/databases

[ls.io-init] done.

interestingly /config in the mariadb container is empty

arcoast commented 1 year ago

I think you need to map /config I'm pretty familiar with the linuxserver images and they use s6-init and perms are important.

madeofpendletonwool commented 1 year ago

Hey @mansguiche I came across a really random issue that might have nothing to do with your issue here but wanted to mention it just in case. On a Fedora system I was using the container was unable to write to the volume due to SELinux being enabled. There's two potential fixes to it.

https://blog.ryanmartin.me/selinux-containers

Again, this might have nothing to do with your issue but wanted to mention it just in case.

arcoast commented 1 year ago

I think doing a nuke and pave and lets check MariaDB is starting correctly needs to be the first step now. Unless that's up and running then we don't really have the context for the Pinepod logs.

So for me running just the MariaDB of my stack on a completely fresh install:

version: '3.9'

networks:

    pinepods:
        external: false
        name: pinepods

    traefik:
        external: false
        name: traefik

services:
    pinepods-mariadb:
        image: lscr.io/linuxserver/mariadb
        container_name: pinepods-mariadb
        networks:
            - pinepods
        environment:
            - TZ=${TZ}
            - PUID=${PUID}
            - PGID=${PGID}
            - MYSQL_ROOT_PASSWORD=${PINEPODS_MARIADB_ROOT_PASSWORD}
            - MYSQL_DATABASE=${PINEPODS_DB_NAME}
            - MYSQL_USER=${PINEPODS_DB_USER}
            - MYSQL_PASSWORD=${PINEPODS_DB_PASSWORD}
#        ports:
#            - 3306:3306
        volumes:
            - ${CONFIG}/pinepods-mariadb-test:/config
        restart: unless-stopped

.env

TZ=Europe/London
PUID=99
PGID=100
PINEPODS_DB_USER=pinepods
PINEPODS_DB_PASSWORD=password
PINEPODS_DB_NAME=pinepods
PINEPODS_MARIADB_ROOT_PASSWORD=root-password

Logs

2023-08-09T22:17:57.597462871Z [migrations] started
2023-08-09T22:17:57.597485336Z [migrations] no migrations found
2023-08-09T22:17:57.627448181Z ───────────────────────────────────────
2023-08-09T22:17:57.627465828Z 
2023-08-09T22:17:57.627471453Z       ██╗     ███████╗██╗ ██████╗ 
2023-08-09T22:17:57.627476527Z       ██║     ██╔════╝██║██╔═══██╗
2023-08-09T22:17:57.627481268Z       ██║     ███████╗██║██║   ██║
2023-08-09T22:17:57.627485827Z       ██║     ╚════██║██║██║   ██║
2023-08-09T22:17:57.627490708Z       ███████╗███████║██║╚██████╔╝
2023-08-09T22:17:57.627495218Z       ╚══════╝╚══════╝╚═╝ ╚═════╝ 
2023-08-09T22:17:57.627498192Z 
2023-08-09T22:17:57.627500823Z    Brought to you by linuxserver.io
2023-08-09T22:17:57.627503397Z ───────────────────────────────────────
2023-08-09T22:17:57.627608666Z 
2023-08-09T22:17:57.627619248Z To support LSIO projects visit:
2023-08-09T22:17:57.627622779Z https://www.linuxserver.io/donate/
2023-08-09T22:17:57.627625481Z 
2023-08-09T22:17:57.627628187Z ───────────────────────────────────────
2023-08-09T22:17:57.627631221Z GID/UID
2023-08-09T22:17:57.627633903Z ───────────────────────────────────────
2023-08-09T22:17:57.629152553Z 
2023-08-09T22:17:57.629160827Z User UID:    99
2023-08-09T22:17:57.629164161Z User GID:    100
2023-08-09T22:17:57.629167005Z ───────────────────────────────────────
2023-08-09T22:17:57.629169991Z 
2023-08-09T22:17:57.666580469Z Setting Up Initial Databases
2023-08-09T22:17:57.695685496Z chown: cannot access '/auth_pam_tool_dir/auth_pam_tool': No such file or directory
2023-08-09T22:17:57.695762466Z Couldn't set an owner to '/auth_pam_tool_dir/auth_pam_tool'.
2023-08-09T22:17:57.695774761Z It must be root, the PAM authentication plugin doesn't work otherwise..
2023-08-09T22:17:57.695780803Z 
2023-08-09T22:17:57.696354493Z chown: cannot access '/auth_pam_tool_dir': No such file or directory
2023-08-09T22:17:57.696451480Z Cannot change ownership of the '/auth_pam_tool_dir' directory
2023-08-09T22:17:57.696461369Z to the 'abc' user. Check that you have the necessary permissions and try again.
2023-08-09T22:17:57.696465084Z 
2023-08-09T22:17:57.696562250Z Installing MariaDB/MySQL system tables in '/config/databases' ...
2023-08-09T22:17:57.815763202Z 2023-08-09 23:17:57 1 [Warning] Failed to load slave replication state from table mysql.gtid_slave_pos: 1017: Can't find file: './mysql/' (errno: 2 "No such file or directory")
2023-08-09T22:17:59.986761054Z OK
2023-08-09T22:17:59.986838948Z 
2023-08-09T22:17:59.986849049Z To start mariadbd at boot time you have to copy
2023-08-09T22:17:59.986853947Z support-files/mariadb.service to the right place for your system
2023-08-09T22:17:59.986857002Z 
2023-08-09T22:17:59.986859743Z 
2023-08-09T22:17:59.986862319Z PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
2023-08-09T22:17:59.986865048Z To do so, start the server, then issue the following command:
2023-08-09T22:17:59.986867664Z 
2023-08-09T22:17:59.986870239Z '/usr/bin/mariadb-secure-installation'
2023-08-09T22:17:59.986872849Z 
2023-08-09T22:17:59.986875453Z which will also give you the option of removing the test
2023-08-09T22:17:59.986878891Z databases and anonymous user created by default.  This is
2023-08-09T22:17:59.986881656Z strongly recommended for production servers.
2023-08-09T22:17:59.986884279Z 
2023-08-09T22:17:59.986886802Z See the MariaDB Knowledgebase at https://mariadb.com/kb
2023-08-09T22:17:59.986889436Z 
2023-08-09T22:17:59.986891996Z You can start the MariaDB daemon with:
2023-08-09T22:17:59.986894623Z cd '/usr' ; /usr/bin/mariadb-safe --datadir='/config/databases'
2023-08-09T22:17:59.986897246Z 
2023-08-09T22:17:59.986899725Z You can test the MariaDB daemon with mysql-test-run.pl
2023-08-09T22:17:59.986902308Z cd '/usr/mysql-test' ; perl mariadb-test-run.pl
2023-08-09T22:17:59.986904846Z 
2023-08-09T22:17:59.986907356Z Please report any problems at https://mariadb.org/jira
2023-08-09T22:17:59.986909921Z 
2023-08-09T22:17:59.986912496Z The latest information about MariaDB is available at https://mariadb.org/.
2023-08-09T22:17:59.986915138Z 
2023-08-09T22:17:59.986917731Z Consider joining MariaDB's strong and vibrant community:
2023-08-09T22:17:59.986920328Z https://mariadb.org/get-involved/
2023-08-09T22:17:59.986922898Z 
2023-08-09T22:18:00.005863255Z 2023-08-09 23:18:00 0 [Note] Starting MariaDB 10.11.4-MariaDB-log source revision 4e2b93dffef2414a11ca5edc8d215f57ee5010e5 as process 199
2023-08-09T22:18:00.018330178Z 2023-08-09 23:18:00 0 [Note] Using unique option prefix 'myisam_recover' is error-prone and can break in the future. Please use the full name 'myisam-recover-options' instead.
2023-08-09T22:18:00.025295663Z 2023-08-09 23:18:00 0 [Note] InnoDB: Compressed tables use zlib 1.2.13
2023-08-09T22:18:00.026694011Z 2023-08-09 23:18:00 0 [Note] InnoDB: Number of transaction pools: 1
2023-08-09T22:18:00.026718457Z 2023-08-09 23:18:00 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
2023-08-09T22:18:00.053325035Z 2023-08-09 23:18:00 0 [Note] InnoDB: Using Linux native AIO
2023-08-09T22:18:00.053772891Z 2023-08-09 23:18:00 0 [Note] InnoDB: Initializing buffer pool, total size = 256.000MiB, chunk size = 4.000MiB
2023-08-09T22:18:00.054965747Z 2023-08-09 23:18:00 0 [Note] InnoDB: Completed initialization of buffer pool
2023-08-09T22:18:00.057551005Z 2023-08-09 23:18:00 0 [Note] InnoDB: File system buffers for log disabled (block size=512 bytes)
2023-08-09T22:18:00.080499652Z 2023-08-09 23:18:00 0 [Note] InnoDB: 128 rollback segments are active.
2023-08-09T22:18:00.080778431Z 2023-08-09 23:18:00 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ...
2023-08-09T22:18:00.080832580Z 2023-08-09 23:18:00 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB.
2023-08-09T22:18:00.081773247Z 2023-08-09 23:18:00 0 [Note] InnoDB: log sequence number 46590; transaction id 14
2023-08-09T22:18:00.081849260Z 2023-08-09 23:18:00 0 [Note] InnoDB: Loading buffer pool(s) from /config/databases/ib_buffer_pool
2023-08-09T22:18:00.081930174Z 2023-08-09 23:18:00 0 [Note] Plugin 'FEEDBACK' is disabled.
2023-08-09T22:18:00.088039730Z 2023-08-09 23:18:00 0 [Note] InnoDB: Buffer pool(s) load completed at 230809 23:18:00
2023-08-09T22:18:00.101046514Z 2023-08-09 23:18:00 0 [Note] Server socket created on IP: '0.0.0.0'.
2023-08-09T22:18:00.101063959Z 2023-08-09 23:18:00 0 [Note] Server socket created on IP: '::'.
2023-08-09T22:18:00.134164640Z 2023-08-09 23:18:00 0 [Note] mariadbd: ready for connections.
2023-08-09T22:18:00.134183754Z Version: '10.11.4-MariaDB-log'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  Alpine Linux
2023-08-09T22:18:00.954232437Z 2023-08-09 23:18:00 5 [Warning] Aborted connection 5 to db: 'unconnected' user: 'unauthenticated' host: 'pinepods.pinepods' (This connection closed normally without authentication)
2023-08-09T22:18:02.026401411Z 2023-08-09 23:18:02 0 [Note] mariadbd (initiated by: root[root] @ localhost []): Normal shutdown
2023-08-09T22:18:02.026530029Z 2023-08-09 23:18:02 0 [Note] InnoDB: FTS optimize thread exiting.
2023-08-09T22:18:02.047634906Z 2023-08-09 23:18:02 0 [Note] InnoDB: Starting shutdown...
2023-08-09T22:18:02.047655324Z 2023-08-09 23:18:02 0 [Note] InnoDB: Dumping buffer pool(s) to /config/databases/ib_buffer_pool
2023-08-09T22:18:02.047862934Z 2023-08-09 23:18:02 0 [Note] InnoDB: Buffer pool(s) dump completed at 230809 23:18:02
2023-08-09T22:18:02.295667496Z 2023-08-09 23:18:02 0 [Note] InnoDB: Removed temporary tablespace data file: "./ibtmp1"
2023-08-09T22:18:02.295688554Z 2023-08-09 23:18:02 0 [Note] InnoDB: Shutdown completed; log sequence number 110844; transaction id 104
2023-08-09T22:18:02.305267993Z 2023-08-09 23:18:02 0 [Note] mariadbd: Shutdown complete
2023-08-09T22:18:02.305282244Z 
2023-08-09T22:18:03.026961014Z Database Setup Completed
2023-08-09T22:18:03.040353420Z [custom-init] No custom files found, skipping...
2023-08-09T22:18:03.086139236Z 230809 23:18:03 mysqld_safe Logging to '/config/databases/6034b1cf427d.err'.
2023-08-09T22:18:03.097192792Z 230809 23:18:03 mysqld_safe Starting mariadbd daemon with databases from /config/databases
2023-08-09T22:18:04.088104416Z [ls.io-init] done.