meeb / tubesync

Syncs YouTube channels and playlists to a locally hosted media server
GNU Affero General Public License v3.0
1.89k stars 119 forks source link

Migrations on MariaDB never complete #427

Closed perry-mitchell closed 11 months ago

perry-mitchell commented 11 months ago

Hello, after clearing all downloads/config and reconfiguring my TubeSync container to use MariaDB, I can't seem to get it to start. It simply returns a 502 error in the browser, and the logs finish here:

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service tubesync-init: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
2023-10-23 13:06:53,341 [tubesync/INFO] Using database connection: django.db.backends.mysql://tubesync:[hidden]@MariaDB:3306/tubesync
s6-rc: info: service tubesync-init successfully started
s6-rc: info: service gunicorn: starting
s6-rc: info: service gunicorn successfully started
s6-rc: info: service tubesync-worker: starting
s6-rc: info: service nginx: starting
s6-rc: info: service tubesync-worker successfully started
s6-rc: info: service nginx successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
[2023-10-23 13:06:55 +0300] [313] [INFO] Starting gunicorn 21.2.0
[2023-10-23 13:06:55 +0300] [313] [INFO] Listening at: http://127.0.0.1:4848 (313)
[2023-10-23 13:06:55 +0300] [313] [INFO] Using worker: sync
[2023-10-23 13:06:55 +0300] [355] [INFO] Booting worker with pid: 355
[2023-10-23 13:06:55 +0300] [356] [INFO] Booting worker with pid: 356
[2023-10-23 13:06:55 +0300] [359] [INFO] Booting worker with pid: 359
2023-10-23 13:06:55,298 [tubesync/INFO] Using database connection: django.db.backends.mysql://tubesync:[hidden]@MariaDB:3306/tubesync
2023-10-23 13:06:55,360 [tubesync/INFO] Using database connection: django.db.backends.mysql://tubesync:[hidden]@MariaDB:3306/tubesync
2023-10-23 13:06:55,383 [tubesync/INFO] Using database connection: django.db.backends.mysql://tubesync:[hidden]@MariaDB:3306/tubesync
2023-10-23 13:06:55,402 [tubesync/INFO] Using database connection: django.db.backends.mysql://tubesync:[hidden]@MariaDB:3306/tubesync
usermod: no changes
TUBESYNC_RESET_DOWNLOAD_DIR=True, Resetting /downloads directory permissions
Operations to perform:
  Apply all migrations: admin, auth, background_task, contenttypes, sessions, sync
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying admin.0003_logentry_add_action_flag_choices... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying auth.0009_alter_user_last_name_max_length... OK
  Applying auth.0010_alter_group_name_max_length... OK
  Applying auth.0011_update_proxy_permissions... OK
  Applying auth.0012_alter_user_first_name_max_length... OK
  Applying background_task.0001_initial... OK
  Applying background_task.0002_auto_20170927_1109... OK
  Applying sessions.0001_initial... OK
  Applying sync.0001_initial... OK
  Applying sync.0002_auto_20201213_0817... OK
  Applying sync.0003_source_copy_thumbnails... OK
  Applying sync.0004_source_media_format... OK
  Applying sync.0005_auto_20201219_0312... OK
  Applying sync.0006_source_write_nfo... OK
  Applying sync.0007_auto_20201219_0645... OK
  Applying sync.0008_source_download_cap... OK
  Applying sync.0009_auto_20210218_0442... OK
  Applying sync.0010_auto_20210924_0554... OK
  Applying sync.0011_auto_20220201_1654... OK
  Applying sync.0012_alter_media_downloaded_format... OK
  Applying sync.0013_fix_elative_media_file... OK
  Applying sync.0014_alter_media_media_file... OK
  Applying sync.0015_auto_20230213_0603... OK
  Applying sync.0016_auto_20230214_2052... OK
  Applying sync.0017_alter_source_sponsorblock_categories... OK
  Applying sync.0018_source_subtitles... OK
  Applying sync.0019_add_delete_removed_media... OK

Running with the following options:

PUID=99
PGID=100
TZ=Europe/Helsinki
TUBESYNC_WORKERS=1
DATABASE_CONNECTION=<snip>
LISTEN_PORT=4848

I'm using Docker on Unraid. Any idea what I might be missing? It worked mostly OK on Sqlite before I changed it.

EDIT: Deleting and recreating the container doesn't help. DB looks like the following:

image

EDIT 2: I should add that upon restarting I get the following:

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service tubesync-init: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
2023-10-23 18:10:17,520 [tubesync/INFO] Using database connection: django.db.backends.mysql://tubesync:[hidden]@MariaDB:3306/tubesync
s6-rc: info: service tubesync-init successfully started
s6-rc: info: service gunicorn: starting
s6-rc: info: service gunicorn successfully started
s6-rc: info: service tubesync-worker: starting
s6-rc: info: service nginx: starting
s6-rc: info: service nginx successfully started
s6-rc: info: service tubesync-worker successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
[2023-10-23 18:10:18 +0300] [319] [INFO] Starting gunicorn 21.2.0
[2023-10-23 18:10:18 +0300] [319] [INFO] Listening at: http://127.0.0.1:4848 (319)
[2023-10-23 18:10:18 +0300] [319] [INFO] Using worker: sync
[2023-10-23 18:10:18 +0300] [362] [INFO] Booting worker with pid: 362
2023-10-23 18:10:18,144 [tubesync/INFO] Using database connection: django.db.backends.mysql://tubesync:[hidden]@MariaDB:3306/tubesync
[2023-10-23 18:10:18 +0300] [366] [INFO] Booting worker with pid: 366
2023-10-23 18:10:18,242 [tubesync/INFO] Using database connection: django.db.backends.mysql://tubesync:[hidden]@MariaDB:3306/tubesync
[2023-10-23 18:10:18 +0300] [368] [INFO] Booting worker with pid: 368
2023-10-23 18:10:18,341 [tubesync/INFO] Using database connection: django.db.backends.mysql://tubesync:[hidden]@MariaDB:3306/tubesync
2023-10-23 18:10:18,435 [tubesync/INFO] Using database connection: django.db.backends.mysql://tubesync:[hidden]@MariaDB:3306/tubesync
TUBESYNC_RESET_DOWNLOAD_DIR=True, Resetting /downloads directory permissions
Operations to perform:
  Apply all migrations: admin, auth, background_task, contenttypes, sessions, sync
Running migrations:
  No migrations to apply.
  Your models in app(s): 'sync' have changes that are not yet reflected in a migration, and so won't be applied.
  Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.

So it looks like the migrations actually finished? However when I try to load the UI I always get 502 Bad Gateway:

2023/10/23 18:10:39 [error] 345#345: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.0.50, server: _, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8080/", host: "192.168.0.100:4848"
192.168.0.50 - - [23/Oct/2023:18:10:39 +0300] "GET / HTTP/1.1" 502 150 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/118.0"
perry-mitchell commented 11 months ago

Nevermind, it was actually finished and I'd somehow managed to modify the listen port. Apologies for the noise.