Open Moonbase59 opened 9 months ago
I found I can do a docker-compose logs app
, which shows a lot of migration errors. Hope this helps:
Ah, I think I managed! I read in some other issue that due to ownership problems the MariaDB and NPM persistent volumes must be separate, so I moved my mysql
folder out of the data
folder into a separate folder.
Before
npm
|-- data
|-- mysql
|-- letsencrypt
After
npm
|-- data
|-- letsencrypt
|-- mysql
These were the steps I did in the console:
cd ~/npm
docker-compose down
mv data/mysql mysql
Edit docker-compose.yml
(change db persistent volume)
version: '3'
services:
app:
image: 'jc21/nginx-proxy-manager:latest'
restart: unless-stopped
ports:
- '80:80'
- '81:81'
- '443:443'
environment:
DB_MYSQL_HOST: "db"
DB_MYSQL_PORT: 3306
DB_MYSQL_USER: "npm"
DB_MYSQL_PASSWORD: "(PASSWORD)"
DB_MYSQL_NAME: "npm"
volumes:
- ./data:/data
- ./letsencrypt:/etc/letsencrypt
db:
image: 'jc21/mariadb-aria:latest'
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: '(PASSWORD)'
MYSQL_DATABASE: 'npm'
MYSQL_USER: 'npm'
MYSQL_PASSWORD: '(PASSWORD)'
volumes:
#- ./data/mysql:/var/lib/mysql
- ./mysql:/var/lib/mysql
Continue in console
docker-compose pull
docker-compose up -d
Result
I can now log in again using the local address and port 81. No "Bad Gateway" anymore.
The docker-compose logs
shows no errors anymore:
Attaching to npm_app_1, npm_db_1
app_1 | ❯ Configuring npm user ...
app_1 | ❯ Configuring npm group ...
app_1 | ❯ Checking paths ...
app_1 | ❯ Setting ownership ...
app_1 | ❯ Dynamic resolvers ...
app_1 | ❯ IPv6 ...
app_1 | Enabling IPV6 in hosts in: /etc/nginx/conf.d
app_1 | - /etc/nginx/conf.d/include/proxy.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/letsencrypt-acme-challenge.conf
app_1 | - /etc/nginx/conf.d/include/force-ssl.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/resolvers.conf
app_1 | - /etc/nginx/conf.d/default.conf
app_1 | - /etc/nginx/conf.d/production.conf
app_1 | Enabling IPV6 in hosts in: /data/nginx
app_1 | - /data/nginx/proxy_host/4.conf
app_1 | - /data/nginx/proxy_host/6.conf
app_1 | - /data/nginx/proxy_host/3.conf
app_1 | - /data/nginx/proxy_host/5.conf
app_1 | - /data/nginx/proxy_host/7.conf
app_1 | - /data/nginx/proxy_host/2.conf
app_1 | - /data/nginx/stream/4.conf
app_1 | - /data/nginx/stream/9.conf
app_1 | - /data/nginx/stream/6.conf
app_1 | - /data/nginx/stream/15.conf
app_1 | - /data/nginx/stream/10.conf
app_1 | - /data/nginx/stream/14.conf
app_1 | - /data/nginx/stream/12.conf
app_1 | - /data/nginx/stream/13.conf
app_1 | - /data/nginx/stream/5.conf
app_1 | - /data/nginx/stream/7.conf
app_1 | - /data/nginx/stream/11.conf
app_1 | - /data/nginx/stream/8.conf
app_1 | - /data/nginx/default_host/site.conf
app_1 | ❯ Docker secrets ...
app_1 |
app_1 | -------------------------------------
app_1 | _ _ ____ __ __
app_1 | | \ | | _ \| \/ |
app_1 | | \| | |_) | |\/| |
app_1 | | |\ | __/| | | |
app_1 | |_| \_|_| |_| |_|
app_1 | -------------------------------------
app_1 | User: npm PUID:0 ID:0 GROUP:0
app_1 | Group: npm PGID:0 ID:0
app_1 | -------------------------------------
app_1 |
app_1 | ❯ Starting nginx ...
app_1 | ❯ Starting backend ...
app_1 | [10/4/2023] [1:14:08 PM] [Global ] › ℹ info Using MySQL configuration
app_1 | [10/4/2023] [1:14:09 PM] [Migrate ] › ℹ info Current database version: 20211108145214
app_1 | [10/4/2023] [1:14:09 PM] [Setup ] › ℹ info Logrotate Timer initialized
app_1 | [10/4/2023] [1:14:09 PM] [Setup ] › ℹ info Logrotate completed.
app_1 | [10/4/2023] [1:14:09 PM] [IP Ranges] › ℹ info Fetching IP Ranges from online services...
app_1 | [10/4/2023] [1:14:09 PM] [IP Ranges] › ℹ info Fetching https://ip-ranges.amazonaws.com/ip-ranges.json
app_1 | [10/4/2023] [1:14:09 PM] [IP Ranges] › ℹ info Fetching https://www.cloudflare.com/ips-v4
db_1 | 2023-10-04 13:13:40 0 [Note] /usr/bin/mysqld (mysqld 10.4.15-MariaDB) starting as process 1 ...
db_1 | [i] pre-init.d - processing /scripts/pre-init.d/01_secret-init.sh
db_1 | [i] mysqld not found, creating....
db_1 | [i] MySQL directory already present, skipping creation
db_1 | 2023-10-04 13:13:40 0 [Note] Plugin 'InnoDB' is disabled.
db_1 | 2023-10-04 13:13:40 0 [Note] Plugin 'FEEDBACK' is disabled.
db_1 | 2023-10-04 13:13:40 0 [Note] Server socket created on IP: '::'.
db_1 | 2023-10-04 13:13:40 0 [Warning] 'user' entry '@4cbbcd2cdde2' ignored in --skip-name-resolve mode.
db_1 | 2023-10-04 13:13:40 0 [Warning] 'proxies_priv' entry '@% root@4cbbcd2cdde2' ignored in --skip-name-resolve mode.
db_1 | 2023-10-04 13:13:40 0 [Note] Reading of all Master_info entries succeeded
db_1 | 2023-10-04 13:13:40 0 [Note] Added new Master_info '' to hash table
db_1 | 2023-10-04 13:13:40 0 [Note] /usr/bin/mysqld: ready for connections.
db_1 | Version: '10.4.15-MariaDB' socket: '/run/mysqld/mysqld.sock' port: 3306 MariaDB Server
I leave this open for others to find (for now) and kindly ask the developers or someone more knowledgeable to confirm that what I did is correct.
After all, NPM is a critical part of the infrastructure and needs to be secure and updatable.
Thanks for giving us this great piece of software!
Thanks a lot for sharing. It worked for me
🙏
I was looking for a fix for month - this worked like a charm. Thank you so much...
thanks,it is really help me.
confirm the fix worked for me- moving the db folder up one level
I'm experiencing the same problem but I'm using database.sqlite file, not MySQL. Any idea how to fix it in that case?
Attaching my composo below
services:
npm:
image: 'jc21/nginx-proxy-manager:latest'
restart: unless-stopped
ports:
- '80:80'
- '81:81'
- '443:443'
volumes:
- /root/docker/npm/data:/data
- /root/docker/npm/letsencrypt:/etc/letsencrypt```
I would assume that if the sqlite db file is located in the /data folder move it one up so mv xxx.slq ../
Thank you! This fixed it for me been running 2.9.19 forever.
I would assume that if the sqlite db file is located in the /data folder move it one up so mv xxx.slq ../
Doesn't work
How to address this if one is using database.sqlite?
I would assume that if the sqlite db file is located in the /data folder move it one up so mv xxx.slq ../
Doesn't work
Same here. Just upgraded npm to 2.11.0 from 2.10.4 and got hit by the Bad gateway-message - again. Luckily I had a snapshot of the vm running portainer and npm.
Also, moving database.sqlite up a level from data/ gives me a "no user related content" or some such at the login screen.
Checking the logs after starting up npm 2.11.0, the log output stops after [Migrate ].
...
app_1 | -------------------------------------
app_1 | _ _ ____ __ __
app_1 | | \ | | _ \| \/ |
app_1 | | \| | |_) | |\/| |
app_1 | | |\ | __/| | | |
app_1 | |_| \_|_| |_| |_|
app_1 | -------------------------------------
app_1 | User: npm PUID:0 ID:0 GROUP:0
app_1 | Group: npm PGID:0 ID:0
app_1 | -------------------------------------
app_1 |
app_1 | ❯ Starting nginx ...
app_1 | ❯ Starting backend ...
app_1 | [1/19/2024] [9:44:55 AM] [Global ] › ℹ info Using Sqlite: /data/database.sqlite
app_1 | [1/19/2024] [9:45:01 AM] [Migrate ] › ℹ info Current database version: none
With npm 2.10.4 it continues with logrotate, ssl renewals etc.
Same here with sqlite
Если удалить полностью файлик database.sqlite тогда создается новая учетная запись и все работает. Если потом перезатереть опять не работает. Проблема в том, что после обновления не читает database.sqlite Как выйти с этой ситуации?
Ah, I think I managed! I read in some other issue that due to ownership problems the MariaDB and NPM persistent volumes must be separate, so I moved my
mysql
folder out of thedata
folder into a separate folder.Before
npm |-- data |-- mysql |-- letsencrypt
After
npm |-- data |-- letsencrypt |-- mysql
These were the steps I did in the console:
cd ~/npm docker-compose down mv data/mysql mysql
Edit
docker-compose.yml
(change db persistent volume)version: '3' services: app: image: 'jc21/nginx-proxy-manager:latest' restart: unless-stopped ports: - '80:80' - '81:81' - '443:443' environment: DB_MYSQL_HOST: "db" DB_MYSQL_PORT: 3306 DB_MYSQL_USER: "npm" DB_MYSQL_PASSWORD: "(PASSWORD)" DB_MYSQL_NAME: "npm" volumes: - ./data:/data - ./letsencrypt:/etc/letsencrypt db: image: 'jc21/mariadb-aria:latest' restart: unless-stopped environment: MYSQL_ROOT_PASSWORD: '(PASSWORD)' MYSQL_DATABASE: 'npm' MYSQL_USER: 'npm' MYSQL_PASSWORD: '(PASSWORD)' volumes: #- ./data/mysql:/var/lib/mysql - ./mysql:/var/lib/mysql
Continue in console
docker-compose pull docker-compose up -d
Result
I can now log in again using the local address and port 81. No "Bad Gateway" anymore.
The
docker-compose logs
shows no errors anymore:Attaching to npm_app_1, npm_db_1 app_1 | ❯ Configuring npm user ... app_1 | ❯ Configuring npm group ... app_1 | ❯ Checking paths ... app_1 | ❯ Setting ownership ... app_1 | ❯ Dynamic resolvers ... app_1 | ❯ IPv6 ... app_1 | Enabling IPV6 in hosts in: /etc/nginx/conf.d app_1 | - /etc/nginx/conf.d/include/proxy.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/letsencrypt-acme-challenge.conf app_1 | - /etc/nginx/conf.d/include/force-ssl.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/resolvers.conf app_1 | - /etc/nginx/conf.d/default.conf app_1 | - /etc/nginx/conf.d/production.conf app_1 | Enabling IPV6 in hosts in: /data/nginx app_1 | - /data/nginx/proxy_host/4.conf app_1 | - /data/nginx/proxy_host/6.conf app_1 | - /data/nginx/proxy_host/3.conf app_1 | - /data/nginx/proxy_host/5.conf app_1 | - /data/nginx/proxy_host/7.conf app_1 | - /data/nginx/proxy_host/2.conf app_1 | - /data/nginx/stream/4.conf app_1 | - /data/nginx/stream/9.conf app_1 | - /data/nginx/stream/6.conf app_1 | - /data/nginx/stream/15.conf app_1 | - /data/nginx/stream/10.conf app_1 | - /data/nginx/stream/14.conf app_1 | - /data/nginx/stream/12.conf app_1 | - /data/nginx/stream/13.conf app_1 | - /data/nginx/stream/5.conf app_1 | - /data/nginx/stream/7.conf app_1 | - /data/nginx/stream/11.conf app_1 | - /data/nginx/stream/8.conf app_1 | - /data/nginx/default_host/site.conf app_1 | ❯ Docker secrets ... app_1 | app_1 | ------------------------------------- app_1 | _ _ ____ __ __ app_1 | | \ | | _ \| \/ | app_1 | | \| | |_) | |\/| | app_1 | | |\ | __/| | | | app_1 | |_| \_|_| |_| |_| app_1 | ------------------------------------- app_1 | User: npm PUID:0 ID:0 GROUP:0 app_1 | Group: npm PGID:0 ID:0 app_1 | ------------------------------------- app_1 | app_1 | ❯ Starting nginx ... app_1 | ❯ Starting backend ... app_1 | [10/4/2023] [1:14:08 PM] [Global ] › ℹ info Using MySQL configuration app_1 | [10/4/2023] [1:14:09 PM] [Migrate ] › ℹ info Current database version: 20211108145214 app_1 | [10/4/2023] [1:14:09 PM] [Setup ] › ℹ info Logrotate Timer initialized app_1 | [10/4/2023] [1:14:09 PM] [Setup ] › ℹ info Logrotate completed. app_1 | [10/4/2023] [1:14:09 PM] [IP Ranges] › ℹ info Fetching IP Ranges from online services... app_1 | [10/4/2023] [1:14:09 PM] [IP Ranges] › ℹ info Fetching https://ip-ranges.amazonaws.com/ip-ranges.json app_1 | [10/4/2023] [1:14:09 PM] [IP Ranges] › ℹ info Fetching https://www.cloudflare.com/ips-v4 db_1 | 2023-10-04 13:13:40 0 [Note] /usr/bin/mysqld (mysqld 10.4.15-MariaDB) starting as process 1 ... db_1 | [i] pre-init.d - processing /scripts/pre-init.d/01_secret-init.sh db_1 | [i] mysqld not found, creating.... db_1 | [i] MySQL directory already present, skipping creation db_1 | 2023-10-04 13:13:40 0 [Note] Plugin 'InnoDB' is disabled. db_1 | 2023-10-04 13:13:40 0 [Note] Plugin 'FEEDBACK' is disabled. db_1 | 2023-10-04 13:13:40 0 [Note] Server socket created on IP: '::'. db_1 | 2023-10-04 13:13:40 0 [Warning] 'user' entry '@4cbbcd2cdde2' ignored in --skip-name-resolve mode. db_1 | 2023-10-04 13:13:40 0 [Warning] 'proxies_priv' entry '@% root@4cbbcd2cdde2' ignored in --skip-name-resolve mode. db_1 | 2023-10-04 13:13:40 0 [Note] Reading of all Master_info entries succeeded db_1 | 2023-10-04 13:13:40 0 [Note] Added new Master_info '' to hash table db_1 | 2023-10-04 13:13:40 0 [Note] /usr/bin/mysqld: ready for connections. db_1 | Version: '10.4.15-MariaDB' socket: '/run/mysqld/mysqld.sock' port: 3306 MariaDB Server
I leave this open for others to find (for now) and kindly ask the developers or someone more knowledgeable to confirm that what I did is correct.
After all, NPM is a critical part of the infrastructure and needs to be secure and updatable.
Thanks for giving us this great piece of software!
well, i can see in newer versions that mysql folder is outside data by default, but still facing that same issue
У меня SQLite а не MySQL!!! Путь менять не нужно. Проблем в том что если создать новый database.sqlite все работает. А вот старый нет.
У меня SQLite а не MySQL!!! Путь менять не нужно. Проблем в том что если создать новый database.sqlite все работает. А вот старый нет.
Translation to english: "I have SQLite and not MySQL!!! There is no need to change the path. The problem is that if you create a new database.sqlite everything works. But the old one doesn't."
If I delete and recreate the sqlite-db, won't I lose all my sites and ssl-certificates?
При создании новой базы, действующие сайты остаются, но управлять ими невозможно! Нужно понять почему после обновления proxy-manager не видит базу. Я надеюсь разработчики исправят это. Пока пришлось откатиться на с 2.11.0 на 2.10.4
Could you please write in English?
When creating a new database, existing sites remain! But it is impossible to control them! You need to understand why after the update proxy-manager does not see the database. I hope the developers will fix this. So far I had to roll back from 2.11.0 to 2.10.4
I think I was able to replicate this on 2.11.0 by letting the login timeout, clicking around the UI, then browser refresh. At the point, when you go to login again, it will give you a bad gateway
error.
Note: My setup consists of the database.sqlite
file
When creating a new database, existing sites remain! But it is impossible to control them! You need to understand why after the update proxy-manager does not see the database. I hope the developers will fix this. So far I had to roll back from 2.11.0 to 2.10.4
This! This really is the only way to make it running again if you are using SQLite like me. Use the image jc21/nginx-proxy-manager:2.10.4
, until the developers get it to work again with a newer version.
When creating a new database, existing sites remain! But it is impossible to control them! You need to understand why after the update proxy-manager does not see the database. I hope the developers will fix this. So far I had to roll back from 2.11.0 to 2.10.4
This! This really is the only way to make it running again if you are using SQLite like me. Use the image
jc21/nginx-proxy-manager:2.10.4
, until the developers get it to work again with a newer version.
I had to remove the "NODE" env but else than that, rolling back to 2.10.4 worked for me too
This! This really is the only way to make it running again if you are using SQLite like me. Use the image
jc21/nginx-proxy-manager:2.10.4
, until the developers get it to work again with a newer version.
Thank you! I had the same problem until I rolled back to 2.10.4
I've created a new fresh container on the latest version, and then restored table by table from my existing SQLite DB, restarting the container for each. It worked until the table "certificate" was restored, then it stopped working and the container log stopped after:
[1/19/2024] [8:02:44 PM] [Global ] info Using Sqlite: /data/database.sqlite
[1/19/2024] [8:02:45 PM] [Migrate ] info Current database version: none
Then I started another new container and added a hosts by hand, restarted container, and it was working. Requested a certificate (which worked), restarted, and it stopped working with the same logs as above.
Same here, broke after this update. Rolling back to 2.10.4 fixed the issue for now.
if you copy the old DB over the the new NGINX it will work. Just dont change any settings until its fixed
if you copy the old DB over the the new NGINX it will work. Just dont change any settings until its fixed
I tried to do this. It didn't work for me! Rolled back.
I had the same issue with SQLite and made it work again by rolling back to 2.10.4. Thank you.
Same issue here. Had to roll back to 2.10.4. Also removed NODE_OPTIONS --openssl-legacy-provider from ENV otherwise backend did not start
I would assume that if the sqlite db file is located in the /data folder move it one up so mv xxx.slq ../
This way I lost all my data. I can login with default admin@example.com only.
Interesting enough my sites are still working?! Would it be possible to transfer the data to new user account?
Experiencing the same issue, attempted a bunch of fixes but nothing worked. Also in the reverted back to 2.10.4 camp till a patch is released, it works fine with that so just gonna chill there. Appreciate all you do jc21+contributors
I'm getting the same 502 with sqlite. Can be reproduced very easily. Just set up a fresh container, as explained in Quick Start. Afterwards stop and re run the container... and you're getting 502.
I have the same issue (on SQLite) trying to go from 2.10.4 to 2.11.0 or 2.11.1. My instance was originally spun up on 2.9.19 and I was able to incrementally update up to 2.10.4 with no issue.
Also we should maybe remove the "[Solved?]" from the title.
Same here. Just upgraded npm to 2.11.0 from 2.10.4 and got hit by the Bad gateway-message - again.
Luckily I had a snapshot of the vm running portainer and npm.
Also, moving database.sqlite up a level from data/ gives me a "no user related content" or > some such at the login screen.
Checking the logs after starting up npm 2.11.0, the log output stops after [Migrate ].
... app_1 | ------------------------------------- app1 | _ __ __ app1 | | \ | | | \/ | app1 | | | | |) | |\/| | app_1 | | |\ | __/| | | | app1 | || _|| || |_| app_1 | ------------------------------------- app_1 | User: npm PUID:0 ID:0 GROUP:0 app_1 | Group: npm PGID:0 ID:0 app_1 | ------------------------------------- app_1 | app_1 | ❯ Starting nginx ... app_1 | ❯ Starting backend ... app_1 | [1/19/2024] [9:44:55 AM] [Global ] › ℹ info Using Sqlite: /data/database.sqlite app_1 | [1/19/2024] [9:45:01 AM] [Migrate ] › ℹ info Current database version: none
With npm 2.10.4 it continues with logrotate, ssl renewals etc.
Thanks @jc21! NPM release 2.11.1 solved the bad gateway issue for me.
For posterity, I use this docker-compose.yml, with sqlite as the database:
root@docker:~/npm# cat docker-compose.yml version: '3.8' services: app: image: 'jc21/nginx-proxy-manager:latest' restart: unless-stopped ports:
- '80:80'
- '81:81'
- '443:443' volumes:
- ./data:/data
- ./letsencrypt:/etc/letsencrypt
root@docker:~/npm#
And this is my upgrade-script:
root@docker:~/npm# cat ./upgrade_npm.sh
!/bin/bash
cd /root/npm docker-compose stop docker-compose pull docker-compose up -d
exit
root@docker:~/npm#
I got the same problem and I solved this by executing chmod 777 database.sqlite
I'm getting the same error.
If I look in the log file (database), I see this:
For the same problem, the best way is to directly deploy version 2.9.19 instead of trying to solve the problem yourself, because it is more time-consuming, unless you plan to spend the extra time solving this problem. The following is my docker orchestration Documents, for reference only:
version: '3'
services:
app:
image: 'jc21/nginx-proxy-manager:2.9.19'
restart: unless-stopped
ports:
- '8881:80'
- '81:81'
- '4483:443'
volumes:
- ./data:/data
- ./letsencrypt:/etc/letsencrypt
Remember that the server panel releases the port required by the service on the left, One more thing, version 2.9.19 has the problem of Internal Error when applying for a certificate. If you encounter this problem, it is recommended to go back to 2.9.18.
I have this issue with 2.9.18 pulled today, its fine on the first start up, but any subsequent restarts of the container have the bad gateway error (using sql lite db)
I tried all the fixes here after updating to 2.11.2. Ended up reverting everything and just needed a reboot, instead of just restarting services, after updating.
Also, be sure your other config files are compliant with the updated nginx. BEFORE you update, Change: (/data/nginx/proxy_host/*)
listen 443 ssl http2;
listen [::]:443 ssl http2;
to:
listen 443 ssl;
http2 on;
listen [::]:443 ssl;
Checklist
jc21/nginx-proxy-manager:latest
docker image?Describe the bug
I’m not much into docker yet but I succeeded to install NPM 2.9.19 a few months ago and now realized I must make manual updates. So I logged into my Proxmox LXC container and did a
docker-compose pull
, which apparently brought me to v2.10.4 (shown on port 81 local login screen).But now on every login attempt, I get a little red "Bad gateway" shown on the login screen and cannot administer my hosts anymore! For the time being, I reverted to my full LXC backup and went back to 2.9.19, which works fine.
docker ps
shows I’m runningjc21/mariadb-aria:latest
andjc21/nginx-proxy-manager:latest
.I don’t know how to diagnose this, or where the logs are kept, help urgently needed.
Nginx Proxy Manager Version
2.10.4
To Reproduce Steps to reproduce the behavior:
ssh
.docker-compose pull
,docker-compose down
,docker-compose up -d
Expected behavior
Local admin login working.
Screenshots
Operating System
Proxmox 7.4, unprivileged Ubuntu 22.04.3 LTS LXC
Additional context
Commands used to update:
Docker version:
docker ps
output:docker-compose.yml
docker-compose.override.yml