-
-
Notifications
You must be signed in to change notification settings - Fork 777
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docker-compose: can't connect to DB #3198
Comments
Please restart from scratch and provide:
|
Thanks @Alkarex, I'll do that as soon as I get back home! |
Well, I think you found the culprit! I have tt-rss mounted up as well and it is also using a postgres container listening on port 5432... I know that eventually I'll remove tt-rss, but do you know if there is a way with docker-compose to really create a networking bubble where I could put both FreshRss and PostgreSQL using standard port 5432 without interfering with the other containers? I don't know if I'm asking too much here (both from you and from docker ;) ) Edit: Here's the output of
|
So I dug a little further and got into PostgreSQL and connected to freshrss-db server from the freshrss-app container. It seems even after validating the form, I don't have any tables in the DB. Here are the command lines and the output I did:
|
Hello @Alkarex, sorry to bother you 😕 do you have any idea what could be the problem? |
As a plan B, you can always use SQLite. The performances are good. |
Hello @Alkarex ! Note: I tried again and pulled the latest image using
Yes, always, I use the command
I've tried with SQLite, but the result is the same: when clinking on "Validate", I am being redirected to
Here are the freshrss-app logs when using SQLite (I've obfuscated the domain name):
I've clicked several time on "Validate", that's why I have lots of POST->GET->GET triplets at the end. Apparently, what's happening is "Validate" requests Compared to last time (with older images) there is a new entry in the log each time between the last two GETs:
Just to be sure, I've tried in a private tab and the log above is the result of it.
I guess that's the next step then 😉 |
Did you try with our most recent release |
I've tested again with the latest version (image ID: 82a10e9a838f, digest: 95e4e67fb6a8) but the result is the same. Then I've tested with 1.17.0 (and postgres 12-alpine as it is set in the latest docker-compose.yml), but same result again. I'm sure it has something to do with my setup, because you should have more people with the same issue by now. Though, I don't have anything extraordinary, it is a basic Kimsufi/OVH server with Ubuntu 18.04. |
I wanted to leave a comment that I'm trying to set this up on a remote postgresql server on Azure and I'm getting the same error. If I test with the proper query form the command line on the web server I can connect but I can't connect through the configuration screen:
Was there ever a solution found for this? |
I'm facing exactly the same issue here. Same version, same status. |
Besides, the |
@jinyu121 Could you please share the docker-compose you are trying? |
The docker-compose file
|
When you submit your database setting for the first time, there is an error in the docker-compose log:
Other info are just the same with #3198 (comment) and #3198 (comment) |
@jinyu121 Could you please try the docker-compose below, based on yours but with slight modifications, just for debugging? version: "3.6"
volumes:
freshrss-postgres-data:
freshrss-web-data:
freshrss-web-extensions:
services:
freshrss-web:
image: freshrss/freshrss:latest
container_name: freshrss-web
restart: always
depends_on:
- freshrss-postgres
volumes:
- freshrss-web-data:/var/www/FreshRSS/data
- freshrss-web-extensions:/var/www/FreshRSS/extensions
ports:
- 8080:80
environment:
CRON_MIN: '*/20'
TZ: Asia/Shanghai
freshrss-postgres:
image: postgres:alpine
container_name: freshrss-postgres
restart: always
volumes:
- freshrss-postgres-data:/var/lib/postgresql/data
environment:
POSTGRES_USER: freshrss
POSTGRES_PASSWORD: freshrss
POSTGRES_DB: freshrss |
@Alkarex This file works fine. But back to my config, the first step is language select, right? When I select Chinese and submit, the UI is still English. But this configuration works as exactly what have expected. |
Not all strings are translated into Chinese, although I believe most are. |
@jinyu121 Ok. The usual suspect is then nginx, which is very error prone and therefore often badly configured. Could you please share your configuration? But except if you really want nginx, I suggest to use a dedicated reverse proxy software such as Traefik (better, easier, safer). In case that might be relevant, here is a full example with Traefik + Let's Encrypt, IPv6-enabled (I will put it in our documentation via #3351 ) version: "2.4"
networks:
network:
enable_ipv6: true
ipam:
config:
- subnet: 172.20.0.0/16
- subnet: fd10::/80
volumes:
postgres-data:
freshrss-data:
freshrss-extensions:
services:
traefik:
image: traefik:2.3
container_name: traefik
restart: unless-stopped
logging:
options:
max-size: 10m
ports:
- 80:80
- 443:443
networks:
- network
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- /mnt/ssd/docker/volumes/traefik-tmp:/tmp
- /mnt/ssd/docker/volumes/traefik-letsencrypt:/etc/traefik/acme
- ./traefik/tls.yaml:/etc/traefik/tls.yaml:ro
command:
- --global.sendAnonymousUsage
- --accesslog=false
- --api=false
- --providers.docker=true
- --providers.docker.exposedByDefault=false
- --log.level=INFO
- --entryPoints.http.address=:80
- --entryPoints.https.address=:443
- --entryPoints.http.http.redirections.entryPoint.to=https
- --entryPoints.http.http.redirections.entryPoint.scheme=https
- --certificatesResolvers.letsEncrypt.acme.storage=/etc/traefik/acme/acme.json
- --certificatesResolvers.letsEncrypt.acme.email=${ADMIN_EMAIL}
- --certificatesResolvers.letsEncrypt.acme.tlsChallenge=true
- --providers.file.filename=/etc/traefik/tls.yaml
labels:
- traefik.enable=false
postgres:
image: postgres:13
container_name: postgres
restart: unless-stopped
logging:
options:
max-size: 10m
networks:
- network
expose:
- 5432
volumes:
- postgres-data:/var/lib/postgresql/data
environment:
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_DB=${POSTGRES_DB}
labels:
- traefik.enable=false
freshrss:
image: freshrss/freshrss
container_name: freshrss
restart: unless-stopped
depends_on:
- postgres
logging:
options:
max-size: 10m
networks:
- network
volumes:
- /mnt/ssd/git/FreshRSS:/var/www/FreshRSS
- freshrss-data:/var/www/FreshRSS/data
- freshrss-extensions:/var/www/FreshRSS/extensions
environment:
- CRON_MIN=4,34
- TZ=Europe/Paris
- FRESHRSS_ENV=development
labels:
- traefik.enable=true
- traefik.http.middlewares.freshrssM1.compress=true
- traefik.http.middlewares.freshrssM2.headers.forceSTSHeader=true
- traefik.http.middlewares.freshrssM2.headers.stsSeconds=31536000
- traefik.http.routers.freshrss.middlewares=freshrssM1,freshrssM2
- traefik.http.routers.freshrss.entryPoints=https
- traefik.http.routers.freshrss.rule=Host(`freshrss.${SERVER_DNS}`)
- traefik.http.routers.freshrss.tls=true
- traefik.http.routers.freshrss.tls.certResolver=letsEncrypt
ipv6nat:
image: robbertkl/ipv6nat
container_name: ipv6nat
privileged: true
restart: unless-stopped
logging:
options:
max-size: 10m
network_mode: host
volumes:
- /lib/modules:/lib/modules:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
labels:
- traefik.enable=false
tls:
options:
default:
minVersion: VersionTLS12
sniStrict: true
cipherSuites:
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
- TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
- TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
- TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305
- TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305
- TLS_AES_128_GCM_SHA256
- TLS_AES_256_GCM_SHA384
- TLS_CHACHA20_POLY1305_SHA256
ADMIN_EMAIL=admin@example.net
POSTGRES_DB=freshrss
POSTGRES_USER=freshrss
POSTGRES_PASSWORD=freshrss
SERVER_DNS=example.net |
I can reproduce your symptoms, when the PHP session is not working (typically due to a cookie misconfiguration in nginx). I will try to add a test for that in the installer. |
@Frenzie , I'm willing to join the translation group. But the question here is not about translation itself. If I use Nginx, the language selection is not working at all, and almost all configuration do not work. As @Alkarex mentioned, the cookie/session seems broken. |
@jinyu121 I am making a patch, so it will not be possible to pass the step 1 of the installer if the session/cookies are broken. |
* Check that PHP session is working during install #fix #3198 * Minor whitespace * Missing he
@jinyu121 In a few minutes, there will be a new build a626e5f on https://hub.docker.com/r/freshrss/freshrss/builds ; please give it a try |
Thank you for your fix. Here is my Nginx configuration:
And after upgrade to the newest docker/code, as you said, I can not get into step1 (checks) of installation. I checked my cookie, and saw this:
But the URL of the install guide is
So I think the cookie here should be But I added
into the Nginx configuration, not work. solved:
|
Right, but then this might be a sign of yet another nginx-related wrong configuration, making FreshRSS unable to detect its public address properly. docker exec freshrss-web cat data/config.php When the |
P.S. If the proxy changes the path, it needs to provide a |
Thank you @Alkarex. |
@jinyu121 Excellent. Would you mind editing https://github.com/FreshRSS/FreshRSS/blob/master/Docker/README.md#alternative-reverse-proxy-using-nginx to add the missing information? Thanks! |
Well... bad news for me it still doesn't work (it's even a bit worse now) 😞 I've pulled the most recent docker-compose.yml and docker images. Here's my docker-compose.yml:
And I've configured my nginx config file like so:
As you can see:
The result is that I can't pass the first step now (the language selection), when it tries to go to
(I prefer nginx for now because I have several services running behind my nginx web server and I'd prefer not to mix different web servers on the host machine). |
@MightyCreak Ok, that is actually an improvement, because at least now you know that it is not a database connection issue, but a wrong nginx configuration related to cookies / sessions. |
Indeed, it is an improvement in that aspect 😉 So, for
|
At a quick glance, this response does not look valid, the |
You're right.. I thought it was a typo from the copy/paste, but no, I've tried again and have the same response header. I've also checked in the nginx config and it is as I have posted in #3198 (comment). It seems like nginx is appending |
@Alkarex do you want me to edit https://github.com/FreshRSS/FreshRSS/blob/master/Docker/README.md#alternative-reverse-proxy-using-nginx with an alternative without a subdirectory? |
@MightyCreak I think the proper fix might be to properly define |
P.S. Not tested, but probably just something like:
Patch welcome |
I'm not sure exactly what |
|
I've made a PR: #3438 I think having both nginx config file is better. I personally prefer not to set a property if the value is already the default value. Hope it's fine. |
I am trying to install FreshRSS on my server using docker-compose, but I get this error when setting up the database:
Steps to reproduce
I tried the same steps on Fedora 32 (the Linux on my local machine) using
podman-compose
and it worked as expected.It is when I installed FreshRSS on my server that I got the error. The differences are that my server is on Ubuntu 18.04 and I use Nginx on my server (while I was using
localhost:8080
on my machine)Be on Ubuntu 18.04
Copy the
docker-compose.yml
file locallyRun
docker-compose up -d
Set up nginx using the conf given in the FreshRSS repo but removing the SSL part for now:
Restart Nginx:
sudo systemctl reload nginx.service
Go to
http://feed.example.net
Set up the language, pass the verifications, and set up the database like this:
db type: postgresql
host: localhost
user: freshrss
passwd: freshrss
database: freshrss
Validate
See the error appear in red at the top:
Debugging
I learned that with PostgreSQL we can test the db connection with
pg_isready
so I did that, first in thedb
container and then in theapp
container.In freshrss-db
Get into the container:
Run:
See the output:
In freshrss-app
Get into the container:
Update the packages and install postgresql-client
Run:
See the output:
Try with the host
freshrss-db
instead:See the output:
As you can see, the connections are accepted on
freshrss-db
, but then if I change db host fromlocalhost
tofreshrss-db
in the form, I get a weird behavior: it reload the DB setup page as if I first arrived on it (with only SQLite selected in the dropdown).The text was updated successfully, but these errors were encountered: