I use cloudflare for my forum for multiple reasons, but I want to get the real IP of my visitors so I can get accurate data of how many people are signed up with that IP address, and so IP banning, etc works.
Is there any way to do this?
You need to add cloudflare.template.yml
to your app.yml
file templates section.
Actually, now when I try to visit my website the web server is down?
What is the error? What is the content of the log files?
If I visit the forum it just gives me a Error 521 Web server down.
This is what was in the current log file:
2021-08-11 12:14:46.898 UTC [556] LOG: starting PostgreSQL 13.3 (Debian 13.3-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
2021-08-11 12:14:46.899 UTC [556] LOG: listening on IPv4 address "0.0.0.0", port 5432
2021-08-11 12:14:46.899 UTC [556] LOG: listening on IPv6 address "::", port 5432
2021-08-11 12:14:46.996 UTC [556] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2021-08-11 12:14:47.112 UTC [577] LOG: database system was interrupted; last known up at 2021-08-10 14:46:03 UTC
2021-08-11 12:14:47.852 UTC [577] LOG: database system was not properly shut down; automatic recovery in progress
2021-08-11 12:14:47.902 UTC [577] LOG: redo starts at 0/3DFE308
2021-08-11 12:14:47.905 UTC [577] LOG: invalid record length at 0/3E0A2D8: wanted 24, got 0
2021-08-11 12:14:47.905 UTC [577] LOG: redo done at 0/3E0A2B0
2021-08-11 12:14:48.332 UTC [556] LOG: database system is ready to accept connections
2021-08-11 15:09:07.632 UTC [556] LOG: received smart shutdown request
2021-08-11 15:09:08.970 UTC [556] LOG: background worker "logical replication launcher" (PID 585) exited with exit code 1
2021-08-11 15:09:08.973 UTC [580] LOG: shutting down
2021-08-11 15:09:09.018 UTC [556] LOG: database system is shut down
2021-08-11 15:14:54.109 UTC [564] LOG: starting PostgreSQL 13.3 (Debian 13.3-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
2021-08-11 15:14:54.110 UTC [564] LOG: listening on IPv4 address "0.0.0.0", port 5432
2021-08-11 15:14:54.110 UTC [564] LOG: listening on IPv6 address "::", port 5432
2021-08-11 15:14:54.132 UTC [564] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2021-08-11 15:14:54.136 UTC [576] LOG: database system was shut down at 2021-08-11 15:14:20 UTC
2021-08-11 15:14:54.147 UTC [564] LOG: database system is ready to accept connections
2021-08-11 15:48:11.435 UTC [564] LOG: received smart shutdown request
2021-08-11 15:48:12.349 UTC [564] LOG: background worker "logical replication launcher" (PID 582) exited with exit code 1
2021-08-11 15:48:12.349 UTC [577] LOG: shutting down
2021-08-11 15:48:12.397 UTC [564] LOG: database system is shut down
2021-08-11 15:48:17.233 UTC [555] LOG: starting PostgreSQL 13.3 (Debian 13.3-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
2021-08-11 15:48:17.233 UTC [555] LOG: listening on IPv4 address "0.0.0.0", port 5432
2021-08-11 15:48:17.233 UTC [555] LOG: listening on IPv6 address "::", port 5432
2021-08-11 15:48:17.245 UTC [555] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2021-08-11 15:48:17.255 UTC [570] LOG: database system was shut down at 2021-08-11 15:48:12 UTC
2021-08-11 15:48:17.271 UTC [555] LOG: database system is ready to accept connections
2021-08-11 18:24:06.544 UTC [555] LOG: received smart shutdown request
2021-08-11 18:24:11.892 UTC [555] LOG: background worker "logical replication launcher" (PID 576) exited with exit code 1
2021-08-11 18:24:11.895 UTC [571] LOG: shutting down
2021-08-11 18:24:11.936 UTC [555] LOG: database system is shut down
2021-08-11 18:59:31.940 UTC [554] LOG: starting PostgreSQL 13.3 (Debian 13.3-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
2021-08-11 18:59:31.940 UTC [554] LOG: listening on IPv4 address "0.0.0.0", port 5432
2021-08-11 18:59:31.940 UTC [554] LOG: listening on IPv6 address "::", port 5432
2021-08-11 18:59:31.964 UTC [554] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2021-08-11 18:59:31.977 UTC [570] LOG: database system was shut down at 2021-08-11 18:24:11 UTC
2021-08-11 18:59:32.004 UTC [554] LOG: database system is ready to accept connections
That is the database log. Can you check the logs at /var/discourse/shared/standalone/log/var-log/nginx/error.log
?
error.zip (123.2 KB)
The error.log file is in this zip file, It’s mostly just the same thing. (I can’t post the .log file because it’s not supported, and everything in the error.log file as its a super large amount of text)
Looks like the cloudflare template is broken at the moment. Last update was in 2016. Please remove it and rebuild. I will take a look at fixing it, time permiting.
Alright, thank you for the help!
I’m getting the same issue, glad there is a solution here
Weird thing is that it seems to only be affecting rebuilds done today. Other servers (same Discourse version - Stable 2.7.7) are running ok.
Though started getting some strange errors recently on a few forums (not after an update):
Oops
The software powering this discussion forum encountered an unexpected problem. We apologize for the inconvenience.
Detailed information about the error was logged, and an automatic notification generated. We'll take a look at it.
No further action is necessary. However, if the error condition persists, you can provide additional detail, including steps to reproduce the error, by posting a discussion topic in the site's feedback category.
Not sure if it’s related, the error was why I was recently doing rebuilds on the same version.
Edit: Confirmed, removing the Cloudflare template fixed the 521 error.
Update: Looks like @Zenexer made a PR for this: Cloudflare template broken again
If i comment the cloudflare template line in app.yml
, then how would it affect my [site] ?(https://howtodiscuss.com)? we are using cloudflare on our site.
Also, is my problem is the same? https://meta.discourse.org/t/discourse-updated-from-admin-not-working-after-rebuild-fatal-error-site-does-not-load-anymore-after-rebuild/200443
@markersocial my site is running on cloudflare if i remove that line, what would happen to my site?
As far as I know, people will have their registration and recently used IPs logged as Cloudflare IPs instead of their real IPs. So if you ban someone, the Cloudflare IPs will be added to your ban log. Which isn’t good yeah.
I believe this will mean users cannot sign in or register if they by chance get one of the banned Cloudflare IPs (while the template is not being used). Users already logged in will not be affected I think. In the past (likely still now, not sure), this could cause even admins and moderators to not be able to log in to a new session.
Might be a good call to disable public registrations and not use IP banning until the template is available.
ok thanks , do you really think that my problem is also same as to this cloudflare template bug? please see my topic link in my last post and please confirm me.
Which log command I should use to diagnose the same bug?
And how did you make sure that your bug of getting 502 is also due to same CF error?
It is fixed by Cloudflare template broken again - #3 by Zenexer. Please try using it again.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.