Configuration error in docker

Hello,
i’m trying to install hassio with mariadb, influxdb, grafana, mqtt, node-red…
I mostly stuck to this installation ==> Home Assistant install with docker-compose - iotechonline

But when I boot up, I still get errors that I can’t track and fix

maybe someone can help me here

Everything runs on a Raspberry pi 4 in the local network

on the raspberry i have the users pi and grobot
with grobot i would run all or what is possible

there are some errors ig i start with
docker-compose -up

 sqlalchemy.exc.OperationalError: (MySQLdb.OperationalError) (2002, "Can't connect to MySQL server on '127.0.0.1' (115)")
hass             | (Background on this error at: https://sqlalche.me/e/14/e3q8)
hass             | 2023-02-24 12:53:11.225 ERROR (Recorder) [homeassistant.components.recorder.core] Error during connection setup: (MySQLdb.OperationalError) (2002, "Can't connect to MySQL server on '127.0.0.1' (115)")

the file /home/grobot/homeassistant/hass-config/configuration.yaml
i think the ip adresse orr any other there is wrong
The raspberry pi have the ip
192.168.1.59 GrobotServer
but i try
127.0.0.1, localhost, GrobotServer

with port or without port

nothing works

cat  homeassistant/hass-config/configuration.yaml

# Loads default set of integrations. Do not remove.
#default_config:

# Load frontend themes from the themes folder
#frontend:
#  themes: !include_dir_merge_named themes

# Text to speech
#tts:
#  - platform: google_translate
#
#automation: !include automations.yaml
#script: !include scripts.yaml
#scene: !include scenes.yaml



default_config:
# For homeassistant v2021.7.0 and above add this http block
http:
  use_x_forwarded_for: true
  trusted_proxies:
    - 192.168.1.59 # Add the IP address of the proxy server
frontend:
  themes: !include_dir_merge_named themes

panel_iframe:
  configurator:
    title: Configurator
    icon: mdi:wrench
    url: http://192.168.1.59:3218/
    require_admin: true
  nodered:
    title: Node-Red
    icon: mdi:shuffle-variant
    url: http://<192.168.1.59>:1880/
    require_admin: true
mqtt:
  broker: <192.168.1.59>

recorder:
  db_url: mysql://homeassistant:<mypassword>@<192.168.1.59:3306>/ha_db?charset=utf8
  purge_keep_days: 30

and i get this errors
i try to find in internet but not get a good solution

  |     return _parse_url(name_or_url)
hass             |   File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/url.py", line 794, in _parse_url
hass             |     components["port"] = int(components["port"])
hass             | ValueError: invalid literal for int() with base 10: '3306>'
hass             | 2023-02-24 13:12:49.262 WARNING (MainThread) [homeassistant.setup] Setup of recorder is taking over 10 seconds.
hass             | 2023-02-24 13:12:51.365 ERROR (Recorder) [homeassistant.components.recorder.core] Error during connection setup: invalid literal for int() with base 10: '3306>' (retrying in 3 seconds)
hass             | Traceback (most recent call last):
hass             |   File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 704, in _setup_recorder
hass             |     self._setup_connection()
hass             |   File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 1171, in _setup_connection
hass             |     self.engine = create_engine(self.db_url, **kwargs, future=True)
hass             |   File "<string>", line 2, in create_engine
hass             |   File "/usr/local/lib/python3.10/site-packages/sqlalchemy/util/deprecations.py", line 309, in warned
hass             |     return fn(*args, **kwargs)
hass             |   File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/create.py", line 518, in create_engine
hass             |     u = _url.make_url(url)
hass             |   File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/url.py", line 738, in make_url
hass             |     return _parse_url(name_or_url)
hass             |   File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/url.py", line 794, in _parse_url
hass             |     components["port"] = int(components["port"])
hass             | ValueError: invalid literal for int() with base 10: '3306>'
hass             | 2023-02-24 13:12:54.376 ERROR (Recorder) [homeassistant.components.recorder.core] Error during connection setup: invalid literal for int() with base 10: '3306>' (retrying in 3 seconds)
hass             | Traceback (most recent call last):
hass             |   File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 704, in _setup_recorder
hass             |     self._setup_connection()
hass             |   File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 1171, in _setup_connection
hass             |     self.engine = create_engine(self.db_url, **kwargs, future=True)
hass             |   File "<string>", line 2, in create_engine

there is my docker-compose.yaml

version: "3.9"

volumes:
  mariadb_data:
  influxdb_data:
  mosquitto_data:
#  code:

services:
  apache:
    container_name: apache
    build: apache
    ports:
      - 80:80
      - 443:443
    volumes:
      # - code:/home/grobot/docker/www/html/
      - ./www/html/:/var/www/html/
      - ./apache/php-ini-overrides.ini:/usr/local/etc/php/conf.d/php-ini-overrides.ini
  codeserver:
    container_name: codeserver
    image: ghcr.io/linuxserver/openssh-server
    environment:
      - PASSWORD_ACCESS=true
      - USER_PASSWORD=mypassword
      - USER_NAME=ssh
      - PUID=1000
      - PGID=33
    ports:
      - 222:2222
    volumes:
      # - code:/home/grobot/docker/www/html/
      - ./www/html/:/var/www/html/


  # Mariadb Datenbank hauptsächlich für Fixe und kurzfristige Daten wie 30 Tage
  mariadb:
    image: mariadb:latest
    container_name: mariadb
    restart: unless-stopped
    ports:
      - 3306:3306
    environment:
      #- MYSQL_USER=root
      #- MYSQL_PASSWORD=mypassword
      #- MYSQL_ROOT_PASSWORD=same-same-mypassword
  # Definieren der Datenbanken MYSQL_ROOT_PASSWORD: "${MYSQL_ROOT_PASSWORD}"
      MYSQL_ROOT_PASSWORD: mypassword
      MYSQL_DATABASE: ha_db
      MYSQL_USER: homeassistant
      MYSQL_PASSWORD: mypassword
      PUID: 1001
      PGID: 1001
    restart: always
    # Connect to "grobotnet" network, as defined below
    networks:
      - grobotnet
    volumes:
      - mariadb_data:/var/lib/mysql
     # - ./mariadb:/var/lib/mysql
  # Influxdb Datenbank hauptsächlich für Sensordaten und langfristige Daten wie 1 Jahr oder 3 Jahre
  influxdb:
    image: influxdb:latest
    container_name: influxdb
    ports:
      - "8083:8083"
      - "8086:8086"
      - "8090:8090"
      - "2003:2003"
    env_file:
      - './influxdb/influxdbenv.influxdb'
    networks:
        - grobotnet
    volumes:
      # Data persistency
      # sudo mkdir -p /srv/docker/influxdb/data
      - influxdb_data:/var/lib/influxdb

  portainer:
    image: portainer/portainer-ce:latest
    container_name: portainer
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./portainer/portainer-data:/data
    ports:
      - 9000:9000

  # phpMyAdmin container
  phpmyadmin:
    # Use phpmyadmin/phpmyadmin:5.0.2 image
    image: phpmyadmin
    restart: always
    # Connect to "grobotnet" network, as defined below
    networks:
      - grobotnet
    # Map port 8080 on the host to port 80 inside the container
    # Syntax is: "HOST_PORT:CONTAINER_PORT"
    ports:
      - "8081:80"
    # Pass a list of environment variables to the container
    environment:
      PMA_HOST: mariadb
    # Wait for "mysql" container to start first
    depends_on:
      - mariadb

  homeassistant:
    container_name: hass
    image: homeassistant/home-assistant
    volumes:
      - ./homeassistant/hass-config:/config
      - /etc/localtime:/etc/localtime:ro
    restart: unless-stopped
    user: 1001:1001
    # Define networks
    networks:
      - grobotnet
    # network_mode: host
    depends_on:
      - mariadb
      - influxdb
      - mosquitto

#  hass-configurator:
#    image: "causticlab/hass-configurator-docker:arm"
#    container_name: hass-configurator
#    restart: unless-stopped
#    ports:
#      - "3218:3218/tcp"
#    depends_on:
#      - homeassistant
#    volumes:
#      - ./homeassistant/configurator-config:/config
#      - ./homeassistant/hass-config:/homeassistant/hass-config
#    user: 1001:1001

  nodered:
    container_name: nodered
    image: nodered/node-red
    ports:
      - 1880:1880
    volumes:
      - ./nodered/data:/data
    user: 1001:1001
    depends_on:
      - homeassistant
      - mosquitto
      - influxdb
    # Connect to "grobotnet" network, as defined below
    networks:
      - grobotnet
    environment:
      TZ: "Europe/Berlin"
    restart: unless-stopped

  mosquitto:
    image: eclipse-mosquitto:latest
    container_name: mosquitto
    restart: unless-stopped


sorry for the long text

regards

Achim

Try to use the connect string without the port, i.e.
db_url: mysql://homeassistant:[email protected]/ha_db?charset=utf8

A side note…30 days of history is a lot, do you really need that?

Was there a reason you chose not to use the official instructions for the installation of Home Assistant Container on a Raspberry Pi?

(Just wondering if there’s anything they lack that might cause users to seek other installations instructions.)

What log is that error from? HA log?

Whatever it is it looks like it is not recognizing 3306 as a number. Maybe you input it wrong, added characters(typo) or added blank space that is trying to read in as part of input. I was thinking thats HA log and you should check HA config but not jot sure

thats i tried too already… no works

no i not need 30 days… i take her only a test installation…
but now i have a bigger pproblem

First i installed mariadb, apache, php and phpmyadmin
after that i connect via phpmyadmin to the mariadb
works fine

now, after i tried homeassistant and the other apps to install like node-red and mqtt or grafana… the database looks like she don’t know mor any user like root, grobot or homeassistant

now i can not more connect to the database…
if i show my ports… yes the docker with 0.0.0.0:3306 runs

what is there wrong?
i think a very big misstake what i do…

is delete all better? and start again?
gives there any sample docker-compose installations?

Is your ha on ‘host’?

yes, would be very good if is complete.
I’m sure for user they used HA every day… all is normal… but for new users … i’m not sure if is all normal

Like your link…
normaly i ask… where is the apache and php… i not need there?

My advice: go step by step unless you are comfortable with it all
First install HA without Mariadb…just get it working with sqlite/default db
Then install mariadb and make sure it is all working fine
Then connect HA to mariadb and make sure you see updates in it
then the rest

1 Like

this erreos comes from start
docker compose up

then i get this errors

the 3306 is a port-number…
the mysql-server runs in docker under 0.0.0.0:3306
netstat -lnp told me that

yes i think so. thats the best

ok i delete now all…
sure other i ask her 1 week and not find the misstakes what i do all
Homeassistant comes with sqllite included right ?

but apache and php i need before right?

Yes… just follow the link sent by @123

Baby steps so you also know where you wnet wrong

EDIT…no apache.no php…just HA as a starter

sorry what you mean with that…
my raspberry her is in a local privat network…
and in the /etc/hosts stay the ip-adress and name from this

i not use host in the yaml file i use there networks.

It is in the link…you have to provide the correct container params

ok then i undersr´tood… thats image is complete with webserver and all what HA need

but later i can add and use there my apache-server too right?

You can add whatever you want as separate containers, not sure why you would need apache but that is notthe topic now…get HA running with mariadb

ok i cleaned my system now.
In the link I see that it is a complete Raspi image, including the operating system.
If is possible to let my old system (i installed new is an original Rasp-64bit image for Raspberry4)

I have an SSD disk. And everything is in a Deskpi pro. I may have to remove the disk again.

or is there no ready-made image for already installed Linux Raspberry systems?

or are the latter images not so ideal for beginners?

sorry…
i get a link already

edit:
thats was wrong…

From what I understood that your wanted, is a docker install…each container comes with its own OS

ok, i installed now all and all from
there
i used there docker compose yaml file.
The Homeassistant run and i logged in already.

I need for my system, mariadb and influxdb(Sensor data for long time store)
i need mqtt too for my connections with my wifi components and mobile-app too
grafane for graph my sensor-data
phpmyadmin (i woul like use the mariadb for homeassistant (with influxdb together) and a other web application
EspHome because i need some ESP’s and i think that ESPHome is mor comfortabel

In which order should I install the programs and then test for connection with Homeassistant

regards and thanks a lot for help
Achim

edit:
i see now


Version	core-2023.2.5
Installationstyp	Home Assistant Container
Entwicklung	false
Supervisor	false
Docker	true
Benutzer	root
Virtuelle Umgebung	false
Python-Version	3.10.7
Betriebssystemfamilie	Linux
Betriebssystem-Version	5.15.84-v8+
CPU-Architektur	aarch64
Zeitzone	Europe/Berlin
Konfigurationsverzeichnis	/config

i wonder… i
i use the original yaml file and now i see i have the ha-core

version: '3'
services:
  homeassistant:
    container_name: homeassistant
    image: "ghcr.io/home-assistant/home-assistant:stable"
    volumes:
      -  /home/grobot/docker/homeassistant/config:/config
      - /etc/localtime:/etc/localtime:ro
    restart: unless-stopped
    privileged: true
    network_mode: host

i was not sure if ./docker/homeassistant/config:/config works or not

now i would like installed the VS-Studio addon
but i think i need Home Assistant Supervised
or?

and if i try to install the supervisor-addon the link not work
http://homeassistant.local:8123/_my_redirect/supervisor

thats i not mean.

I have seen that homeassistant offers different variants to install.
One of them would be completely new from the beginning, so also with Rapsberry OS.
I did not want
I then jumped to the docker-compose.yaml installation.
That works now.
But a couple of little things don’t fit like supervisor-add on. I think I also have an HA Core… he probably did that automatically.
But I would need an addon so that I can change my configuration.yaml

and after that I would like to install my other tools

Hi there,

ok now is all running.
Was a very good info from you to start first with HA installation.
Now i install HA-Raspberry-Pi-image (with webserver, php included), influxdb, mariadb, Nodered, mqtt, Grafana ,ESPHome , phpmyadmin and portainer.

if any interested… this webside helps me a lot… if do exactly was stay there then all is running (only grafana don’t start “now” in the HA-Frame.
all other start now in the HA-Frame like Nodered, EspHome, phpmyadmin and inxluxdb

Thanks a lot for your helpings

regards
Achim

I included some like