nicholaswilde / docker-babybuddy

โ›” DEPRECATED A multi-architecture image for Baby Buddy.
https://hub.docker.com/r/nicholaswilde/babybuddy
Apache License 2.0
1 stars 1 forks source link

Add mariadb support #17

Open nicholaswilde opened 3 years ago

nicholaswilde commented 3 years ago

Currently, mariadb throws an error when trying use mariadb instead of postgres.

Perhaps this will help https://github.com/babybuddy/babybuddy/issues/154

milkplus27 commented 3 years ago

Hi Nicolas. I managed to get your version of BB up and running in a Docker container on a RPi3 and connected to Home Assistant (via a custom component and some rest_commands) with only a couple days left before my son is born. However, today i switched my HA (which is on a separate RPi4) instance to boot off of an SSD rather than the SD card and also upgraded it to MariaDB. Since doing this I am no longer able to connect to BB and the logs are spitting back some things I don't understand. I cam here hoping to find answers and noticed this mention of mariadb and wondered if it's connected? i wouldn't have thought that the database on Home Assistant would affect Baby Buddy in any way but thought I would ask?

milkplus27 commented 3 years ago

I should add. I'm very green to Docker and linux in general so have been basically flying a little blind setting all this up. It's been a very learn-as-you-go process with a lot more stop than go haha

these are the logs:

babybuddyapp | File "manage.py", line 27, in babybuddyapp | execute_from_command_line(sys.argv) babybuddyapp | File "/usr/local/lib/python3.7/site-packages/django/core/management/init.py", line 419, in execute_from_command_line babybuddyapp | utility.execute() babybuddyapp | File "/usr/local/lib/python3.7/site-packages/django/core/management/init.py", line 413, in execute babybuddyapp | self.fetch_command(subcommand).run_from_argv(self.argv) babybuddyapp | File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 354, in run_from_argv babybuddyapp | self.execute(*args, cmd_options) babybuddyapp | File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 398, in execute babybuddyapp | output = self.handle(*args, *options) babybuddyapp | File "/app/babybuddy/management/commands/migrate.py", line 10, in handle babybuddyapp | super(Command, self).handle(args, kwargs) babybuddyapp | File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 89, in wrapped babybuddyapp | res = handle_func(*args, kwargs) babybuddyapp | File "/usr/local/lib/python3.7/site-packages/django/core/management/commands/migrate.py", line 75, in handle babybuddyapp | self.check(databases=[database]) babybuddyapp | File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 423, in check babybuddyapp | databases=databases, babybuddyapp | File "/usr/local/lib/python3.7/site-packages/django/core/checks/registry.py", line 76, in run_checks babybuddyapp | new_errors = check(app_configs=app_configs, databases=databases) babybuddyapp | File "/usr/local/lib/python3.7/site-packages/django/contrib/admin/checks.py", line 78, in check_dependencies babybuddyapp | for engine in engines.all(): babybuddyapp | File "/usr/local/lib/python3.7/site-packages/django/template/utils.py", line 90, in all babybuddyapp | return [self[alias] for alias in self] babybuddyapp | File "/usr/local/lib/python3.7/site-packages/django/template/utils.py", line 90, in babybuddyapp | return [self[alias] for alias in self] babybuddyapp | File "/usr/local/lib/python3.7/site-packages/django/template/utils.py", line 81, in getitem babybuddyapp | engine = engine_cls(params) babybuddyapp | File "/usr/local/lib/python3.7/site-packages/django/template/backends/django.py", line 25, in init babybuddyapp | options['libraries'] = self.get_templatetag_libraries(libraries) babybuddyapp | File "/usr/local/lib/python3.7/site-packages/django/template/backends/django.py", line 43, in get_templatetag_libraries babybuddyapp | libraries = get_installed_libraries() babybuddyapp | File "/usr/local/lib/python3.7/site-packages/django/template/backends/django.py", line 108, in get_installed_libraries babybuddyapp | for name in get_package_libraries(pkg): babybuddyapp | File "/usr/local/lib/python3.7/site-packages/django/template/backends/django.py", line 121, in get_package_libraries babybuddyapp | module = import_module(entry[1]) babybuddyapp | File "/usr/local/lib/python3.7/importlib/init.py", line 127, in import_module babybuddyapp | return _bootstrap._gcd_import(name[level:], package, level) babybuddyapp | File "", line 1006, in _gcd_import babybuddyapp | File "", line 983, in _find_and_load babybuddyapp | File "", line 967, in _find_and_load_unlocked babybuddyapp | File "", line 677, in _load_unlocked babybuddyapp | File "", line 724, in exec_module babybuddyapp | File "", line 857, in get_code babybuddyapp | File "", line 525, in _compile_bytecode babybuddyapp | ValueError: bad marshal data (invalid reference) babybuddyapp | Traceback (most recent call last): babybuddyapp | File "/usr/local/lib/python3.7/site-packages/django/template/utils.py", line 66, in getitem babybuddyapp | return self._engines[alias] babybuddyapp | KeyError: 'django' babybuddyapp | babybuddyapp | During handling of the above exception, another exception occurred: babybuddyapp | babybuddyapp | Traceback (most recent call last): babybuddyapp | File "manage.py", line 27, in babybuddyapp | execute_from_command_line(sys.argv) babybuddyapp | File "/usr/local/lib/python3.7/site-packages/django/core/management/init.py", line 419, in execute_from_command_line babybuddyapp | utility.execute() babybuddyapp | File "/usr/local/lib/python3.7/site-packages/django/core/management/init.py", line 413, in execute babybuddyapp | self.fetch_command(subcommand).run_from_argv(self.argv) babybuddyapp | File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 354, in run_from_argv babybuddyapp | self.execute(*args, *cmd_options) babybuddyapp | File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 398, in execute babybuddyapp | output = self.handle(args, options) babybuddyapp | File "/app/babybuddy/management/commands/migrate.py", line 10, in handle babybuddyapp | super(Command, self).handle(*args, *kwargs) babybuddyapp | File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 89, in wrapped babybuddyapp | res = handle_func(args, **kwargs) babybuddyapp | File "/usr/local/lib/python3.7/site-packages/django/core/management/commands/migrate.py", line 75, in handle babybuddyapp | self.check(databases=[database]) babybuddyapp | File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 423, in check babybuddyapp | databases=databases, babybuddyapp | File "/usr/local/lib/python3.7/site-packages/django/core/checks/registry.py", line 76, in run_checks babybuddyapp | new_errors = check(app_configs=app_configs, databases=databases) babybuddyapp | File "/usr/local/lib/python3.7/site-packages/django/contrib/admin/checks.py", line 78, in check_dependencies babybuddyapp | for engine in engines.all(): babybuddyapp | File "/usr/local/lib/python3.7/site-packages/django/template/utils.py", line 90, in all babybuddyapp | return [self[alias] for alias in self] babybuddyapp | File "/usr/local/lib/python3.7/site-packages/django/template/utils.py", line 90, in babybuddyapp | return [self[alias] for alias in self] babybuddyapp | File "/usr/local/lib/python3.7/site-packages/django/template/utils.py", line 81, in getitem babybuddyapp | engine = engine_cls(params) babybuddyapp | File "/usr/local/lib/python3.7/site-packages/django/template/backends/django.py", line 25, in init babybuddyapp | options['libraries'] = self.get_templatetag_libraries(libraries) babybuddyapp | File "/usr/local/lib/python3.7/site-packages/django/template/backends/django.py", line 43, in get_templatetag_libraries babybuddyapp | libraries = get_installed_libraries() babybuddyapp | File "/usr/local/lib/python3.7/site-packages/django/template/backends/django.py", line 108, in get_installed_libraries babybuddyapp | for name in get_package_libraries(pkg): babybuddyapp | File "/usr/local/lib/python3.7/site-packages/django/template/backends/django.py", line 121, in get_package_libraries babybuddyapp | module = import_module(entry[1]) babybuddyapp | File "/usr/local/lib/python3.7/importlib/init.py", line 127, in import_module babybuddyapp | return _bootstrap._gcd_import(name[level:], package, level) babybuddyapp | File "", line 1006, in _gcd_import babybuddyapp | File "", line 983, in _find_and_load babybuddyapp | File "", line 967, in _find_and_load_unlocked babybuddyapp | File "", line 677, in _load_unlocked babybuddyapp | File "", line 724, in exec_module babybuddyapp | File "", line 857, in get_code babybuddyapp | File "", line 525, in _compile_bytecode babybuddyapp | ValueError: bad marshal data (invalid reference)

nicholaswilde commented 3 years ago

@milkplus27 Thanks for reaching out! Best of luck with birth of your son๐Ÿ‘ถ๐Ÿฝ. I hope all goes well. I think your error is related to the initial issue in this post. I haven't been able to successfully install the dependencies for mariadb in the image. If you need a database, have you tried using postres instead?

milkplus27 commented 3 years ago

thanks for the quick response and thank you! hmm, i actually thought i had set it up on postres - that's just the standard config no? The only thing that i switched to MariaDB is Home Assistant and that's on another raspberry pi altogether

this is what my docker-compose.yml looks like:

version: "2.4" services: app: image: nicholaswilde/babybuddy:latest container_name: babybuddyapp # Container_name is an optional value for single-container

deployments to set a friendly container name.

# Disable in swarm or other multi-container setups.
# See README.md#configuration for other environment configuration options.
environment:
  - ALLOWED_HOSTS=192.168.1.180   # comma separated list of IP addresses or hosts that can access the web UI
  - DB_PASSWORD****       # must correspond with POSTGRES_PASSWORD in DB
  - DJANGO_SETTINGS_MODULE=babybuddy.settings.docker
  - SECRET_KEY=******               # Generate a random string here to secure the Django instance
  - TIME_ZONE=Europe/Oslo                # In the tzdata format, IE, "America/Denver"
  - DEBUG=True               # Turn to False in production
volumes:
  - data:/app/data:rw
  - media:/app/media:rw
ports:
  - "8000:8000"               # For Portainer, select another port for babybuddy such as 7000, for example "7000:80$    restart: unless-stopped

db: image: postgres:11 # pin postgres to a major version container_name: babybuddydb # Container_name is an optional value for single-container

deployments to set a friendly container name.

# Disable in swarm or other multi-container setups.
environment:
  - PGDATA=/db-data
  - POSTGRES_PASSWORD=******  # must correspond with DB_PASSWORD in APP
volumes:
  - db:/db-data:rw
restart: unless-stopped

volumes: data: media: db:

milkplus27 commented 3 years ago

i also just tried removing and re-pulling but now i'm just getting this in the logs:

babybuddydb | PostgreSQL Database directory appears to contain a database; Skipping initialization babybuddydb | babybuddydb | 2021-06-15 20:51:59.117 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432 babybuddydb | 2021-06-15 20:51:59.118 UTC [1] LOG: listening on IPv6 address "::", port 5432 babybuddydb | 2021-06-15 20:51:59.253 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" babybuddydb | 2021-06-15 20:51:59.522 UTC [27] LOG: database system was shut down at 2021-06-15 20:50:17 UTC babybuddydb | 2021-06-15 20:51:59.629 UTC [1] LOG: database system is ready to accept connections babybuddydb | 2021-06-15 21:05:06.819 UTC [1] LOG: received fast shutdown request babybuddydb | 2021-06-15 21:05:06.897 UTC [1] LOG: aborting any active transactions babybuddydb | 2021-06-15 21:05:06.911 UTC [1] LOG: background worker "logical replication launcher" (PID 33) exited with exit code 1 babybuddydb | 2021-06-15 21:05:06.915 UTC [28] LOG: shutting down babybuddydb | 2021-06-15 21:05:09.461 UTC [1] LOG: database system is shut down babybuddydb | babybuddydb | PostgreSQL Database directory appears to contain a database; Skipping initialization babybuddydb | babybuddydb | 2021-06-15 21:06:24.425 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432 babybuddydb | 2021-06-15 21:06:24.426 UTC [1] LOG: listening on IPv6 address "::", port 5432 babybuddydb | 2021-06-15 21:06:24.543 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" babybuddydb | 2021-06-15 21:06:24.792 UTC [26] LOG: database system was shut down at 2021-06-15 21:05:08 UTC babybuddydb | 2021-06-15 21:06:24.983 UTC [1] LOG: database system is ready to accept connections

If i'm not mistaken, it doesn't seem to be picking up the right host. BB should be on 192.168.1.180:8000 on my network

nicholaswilde commented 3 years ago

Hmm, this does look like a bug. I'm getting the same results. I'll look into it to see if it's the Docker side or if it's upstream. Thanks for reporting it!

milkplus27 commented 3 years ago

ok great. thank you! i thought i was going a little bonkers, couldn't figure out what i did wrong haha. thanks for looking into it ๐Ÿ‘