NginxProxyManager / nginx-proxy-manager

Docker container for managing Nginx proxy hosts with a simple, powerful interface
https://nginxproxymanager.com
MIT License
22.59k stars 2.62k forks source link

[Bug] "The migration directory is corrupt, the following files are missing:" when re-building the container ("Bad Gateway" at login) #1907

Closed ErikUden closed 2 years ago

ErikUden commented 2 years ago

I am on a Raspberry Pi 4b with 4GB of RAM on Raspbian Lite (Debian) obviously with an arm processor!

Checklist

Describe the bug image This is what it shows on the login page when I try to login with the proper credentials. I am using the yobasystems/alpine-mariadb:latest database. I am getting the following error(s) when trying to build the image:

pi@Pi-Server:~/nginx $ docker-compose up
Starting nginx_db_1  ... done
Starting nginx_app_1 ... done
Attaching to nginx_db_1, nginx_app_1
db_1   | [i] mysqld already present, skipping creation
db_1   | [i] MySQL directory already present, skipping creation
db_1   | 2022-03-04 16:12:21 0 [Note] /usr/bin/mysqld (mysqld 10.4.15-MariaDB) starting as process 1 ...
db_1   | 2022-03-04 16:12:21 0 [Note] InnoDB: Using Linux native AIO
db_1   | 2022-03-04 16:12:21 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
db_1   | 2022-03-04 16:12:21 0 [Note] InnoDB: Uses event mutexes
db_1   | 2022-03-04 16:12:21 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
db_1   | 2022-03-04 16:12:21 0 [Note] InnoDB: Number of pools: 1
db_1   | 2022-03-04 16:12:21 0 [Note] InnoDB: Using generic crc32 instructions
db_1   | 2022-03-04 16:12:21 0 [Note] mysqld: O_TMPFILE is not supported on /var/tmp (disabling future attempts)
db_1   | 2022-03-04 16:12:21 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
db_1   | 2022-03-04 16:12:21 0 [Note] InnoDB: Completed initialization of buffer pool
db_1   | 2022-03-04 16:12:21 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
db_1   | 2022-03-04 16:12:21 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
db_1   | 2022-03-04 16:12:21 0 [Note] InnoDB: Creating shared tablespace for temporary tables
db_1   | 2022-03-04 16:12:21 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
db_1   | 2022-03-04 16:12:21 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
db_1   | 2022-03-04 16:12:21 0 [Note] InnoDB: 10.4.15 started; log sequence number 8798007; transaction id 56715
db_1   | 2022-03-04 16:12:21 0 [Note] Plugin 'FEEDBACK' is disabled.
db_1   | 2022-03-04 16:12:21 0 [Note] Server socket created on IP: '::'.
db_1   | 2022-03-04 16:12:22 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
db_1   | 2022-03-04 16:12:22 0 [Warning] 'user' entry '@60a7e75e7f80' ignored in --skip-name-resolve mode.
db_1   | 2022-03-04 16:12:22 0 [Warning] 'proxies_priv' entry '@% root@60a7e75e7f80' ignored in --skip-name-resolve mode.
db_1   | 2022-03-04 16:12:22 0 [Note] Reading of all Master_info entries succeeded
db_1   | 2022-03-04 16:12:22 0 [Note] Added new Master_info '' to hash table
db_1   | 2022-03-04 16:12:22 0 [Note] /usr/bin/mysqld: ready for connections.
db_1   | Version: '10.4.15-MariaDB'  socket: '/run/mysqld/mysqld.sock'  port: 3306  MariaDB Server
db_1   | 2022-03-04 16:12:22 0 [Note] InnoDB: Buffer pool(s) load completed at 220304 16:12:22
app_1  | [s6-init] making user provided files available at /var/run/s6/etc...exited 0.
app_1  | [s6-init] ensuring user provided files have correct perms...exited 0.
app_1  | [fix-attrs.d] applying ownership & permissions fixes...
app_1  | [fix-attrs.d] done.
app_1  | [cont-init.d] executing container initialization scripts...
app_1  | [cont-init.d] 01_s6-secret-init.sh: executing...
app_1  | [cont-init.d] 01_s6-secret-init.sh: exited 0.
app_1  | [cont-init.d] done.
app_1  | [services.d] starting services
app_1  | [services.d] done.
app_1  | ❯ Enabling IPV6 in hosts: /etc/nginx/conf.d
app_1  |   ❯ /etc/nginx/conf.d/include/letsencrypt-acme-challenge.conf
app_1  |   ❯ /etc/nginx/conf.d/include/assets.conf
app_1  |   ❯ /etc/nginx/conf.d/include/ip_ranges.conf
app_1  |   ❯ /etc/nginx/conf.d/include/force-ssl.conf
app_1  |   ❯ /etc/nginx/conf.d/include/block-exploits.conf
app_1  |   ❯ /etc/nginx/conf.d/include/ssl-ciphers.conf
app_1  |   ❯ /etc/nginx/conf.d/include/proxy.conf
app_1  |   ❯ /etc/nginx/conf.d/include/resolvers.conf
app_1  |   ❯ /etc/nginx/conf.d/production.conf
app_1  |   ❯ /etc/nginx/conf.d/default.conf
app_1  | ❯ Enabling IPV6 in hosts: /data/nginx
app_1  |   ❯ /data/nginx/proxy_host/36.conf
app_1  |   ❯ /data/nginx/proxy_host/6.conf
app_1  |   ❯ /data/nginx/proxy_host/35.conf
app_1  |   ❯ /data/nginx/proxy_host/33.conf
app_1  |   ❯ /data/nginx/proxy_host/30.conf
app_1  |   ❯ /data/nginx/proxy_host/16.conf
app_1  |   ❯ /data/nginx/proxy_host/19.conf
app_1  |   ❯ /data/nginx/proxy_host/11.conf
app_1  |   ❯ /data/nginx/proxy_host/15.conf
app_1  |   ❯ /data/nginx/proxy_host/24.conf
app_1  |   ❯ /data/nginx/proxy_host/21.conf
app_1  |   ❯ /data/nginx/proxy_host/38.conf
app_1  |   ❯ /data/nginx/proxy_host/9.conf
app_1  |   ❯ /data/nginx/proxy_host/23.conf
app_1  |   ❯ /data/nginx/proxy_host/31.conf
app_1  |   ❯ /data/nginx/proxy_host/17.conf
app_1  |   ❯ /data/nginx/proxy_host/13.conf
app_1  |   ❯ /data/nginx/proxy_host/40.conf
app_1  |   ❯ /data/nginx/proxy_host/29.conf
app_1  |   ❯ /data/nginx/proxy_host/39.conf
app_1  |   ❯ /data/nginx/proxy_host/22.conf
app_1  |   ❯ /data/nginx/proxy_host/4.conf
app_1  |   ❯ /data/nginx/proxy_host/34.conf
app_1  |   ❯ /data/nginx/proxy_host/26.conf
app_1  |   ❯ /data/nginx/proxy_host/32.conf
app_1  |   ❯ /data/nginx/proxy_host/37.conf
app_1  |   ❯ /data/nginx/proxy_host/20.conf
app_1  |   ❯ /data/nginx/proxy_host/28.conf
app_1  |   ❯ /data/nginx/proxy_host/5.conf
app_1  |   ❯ /data/nginx/proxy_host/12.conf
app_1  |   ❯ /data/nginx/proxy_host/14.conf
app_1  |   ❯ /data/nginx/redirection_host/3.conf
app_1  |   ❯ /data/nginx/redirection_host/6.conf
app_1  |   ❯ /data/nginx/redirection_host/4.conf
app_1  |   ❯ /data/nginx/redirection_host/5.conf
app_1  |   ❯ /data/nginx/custom/http_top.conf
app_1  | sed: can't move '/data/nginx/custom/http_top.conffjcgGF' to '/data/nginx/custom/http_top.conf': Resource busy
app_1  |   ❯ /data/nginx/default_host/site.conf
app_1  | [3/4/2022] [4:12:27 PM] [Migrate  ] › ℹ  info      Current database version: 20211108145214
app_1  | [3/4/2022] [4:12:27 PM] [Global   ] › ✖  error     The migration directory is corrupt, the following files are missing: 20210423103500_stream_domain.js, 20211108145214_regenerate_default_host.js
app_1  | [3/4/2022] [4:12:28 PM] [Migrate  ] › ℹ  info      Current database version: 20211108145214
app_1  | [3/4/2022] [4:12:28 PM] [Global   ] › ✖  error     The migration directory is corrupt, the following files are missing: 20210423103500_stream_domain.js, 20211108145214_regenerate_default_host.js
app_1  | [3/4/2022] [4:12:29 PM] [Migrate  ] › ℹ  info      Current database version: 20211108145214
app_1  | [3/4/2022] [4:12:29 PM] [Global   ] › ✖  error     The migration directory is corrupt, the following files are missing: 20210423103500_stream_domain.js, 20211108145214_regenerate_default_host.js

The last error just repeats until infinity. Although the erorr comes from the "app_1" container, so NGINX itself (which is why it is reported as "Unhealthy" when running docker ps) I still think this is an issue with the database. I tried changing to the jc21/mariadb-aria:10.4, but that image seems to not exist, so it did not work out.

Nginx Proxy Manager Version v2.8.1

To Reproduce Steps to reproduce the behavior: On the same server as the NGINX Proxy Manager is running there is also my Pi-hole. I updated the Pi-hole, this, however, deleted the edit I made which turned the admin panel to 8080 instead of 80. After the update, Nginx obviously did not function since the Pi hole was listening on port 80. I made the change in the lighttpd.conf file, restarted the Pi, and the error with NGINX occurred. I am using an NGINX service that rebuilds the container after every reboot to autostart it.

Operating System Raspberry Pi on Raspbian Lite

Additional context Recently updated Pi-Hole which reset the Pi-Hole to running on port 80, after undoing this (without editing anything regarding Nginx) the error occurred.

ErikUden commented 2 years ago

My config.json has private and public keys beyond the standard config, just wanted to add this as a note.

The NGINX Service itself seems to fully function, however, I simply cannot login. Hence I believe this may be a database error.

texneus commented 2 years ago

Same problem here, also on a Pi 4b with Raspian and docker, but just using the docker command line. NginxPM seems to be running and proxying, but I am unable to login. "Bad Gateway" as shown above. Version 2.9.16. Unsure of when this started.

docker create \
                  --name nginxpm \
                  --restart on-failure:5 \
                  -e DISABLE_IPV6="true" \
                  -p 80:80 \
                  -p 81:81 \
                  -p 443:443 \
                  -v /opt/nginxpm/data/nginxpm:/data \
                  -v /opt/nginxpm/data/letsencrypt:/etc/letsencrypt \
                  jc21/nginx-proxy-manager
ErikUden commented 2 years ago

Bruh

ErikUden commented 2 years ago

Any updates?

ErikUden commented 2 years ago

I have found my error: @texneus (maybe you have the same issue too?) I reset my database to yobasystems' maria-db, however, that did not solve it. The issue lied within four files I had:

so nginx/data/mysql/npm In here there there is migrations.frm migrations.ibd migrations_lock.frm migrations_lock.ibd

I replaced all of these files with a backup I made of them a while ago. Now everything works again. I cannot explain why, but these files got corrupted after listening on the same port as my Pi-hole. For everyone reading my solution, I hope you've made a backup, if not, try deleting these files, maybe (only after having made a backup)?

Good luck!