WGER does not display correctly
SuperDarius-git opened this issue · comments
Good day
I do not know if this issue has been raised, and I do not know how to search for it. I am running wger in docker, but all of a sudden it looks like the attached photo. Please help. I can't seem to fix it. It looks like it doesn't see or load the CSS on the page, but I'm not sure. It happens in all browsers, so it's not a plugin causing it.
Thank you
Darius
Hi! Yeah, there's something with the static files. Are you using the regular docker compose or did you change something?
Same thing is happening to me, and I did change some things from the provided docker file to adjust to my current home dockers. I'm using traefik as a reverse proxy and let's encrypt, also using an already present postgres container.
volumes:
static: # wger
media: # wger
wger:
image: wger/server:latest
container_name: wger
hostname: wger
domainname: wger.ghl
env_file:
- ./config/wger.env
volumes:
- static:/home/wger/static
- media:/home/wger/media
#- /opt/appdata/wger/src:/home/wger/src
# ports:
# - '80:8000'
labels:
com.centurylinklabs.watchtower.enable: true
traefik.enable: true
traefik.http.routers.wger.rule: Host(`xxxx.xxxx.xxxx`)
traefik.http.routers.wger.entryPoints: websecure
traefik.http.routers.wger.service: wger
traefik.http.services.wger.loadBalancer.server.port: 8000
traefik.http.routers.wger.tls: true
traefik.http.routers.wger.tls.certResolver: gym-tlschallenge
# healthcheck:
# test: curl -f http://wger.ghl:8000
# interval: 10s
# timeout: 5s
# retries: 5
restart: unless-stopped
networks:
- ghl
depends_on:
traefik:
condition: service_healthy
postgresql:
condition: service_healthy
As @SuperDarius-git says, the server spits an error when trying to find anything under '/home/wger/static/'
@gassssss did this also suddenly started happening?
For a bit of background, django doesn't serve any static files during production, this needs to be done by another server (it could be something like a CDN, an S3 bucket, etc.). Django collects all static assets and copies them to, in our case, a folder in a docker volume that is then read by an nginx.
I'm not sure why this stopped working for you guys, but perhaps nuking the volume could help, this is repopulated on startup.
Hi, no for me it's a new install, I was looking to solve it and just found this issue that has been just opened so I jumped in. In my case so I just see what the screenshot shows above, unformatted text and no images/resources at all.
But now that you pointed out that it serves no static content I see what the problem is... obviously user error. I didn't config nginx container because I thought it was there just to do reverse proxy and I simply skipped it all without even looking at it, it also serves the static files...
My sincere apologies and thanks a lot for the promptly answer.
yeah, it's there for a reason 😄 The first times handling static files with django is always fun (and don't worry about asking!)
Yeah, thank you so much for the speedy replies... I am not familiar with Django or Nginx AT ALL! Please guide me through the solution? I did use the docker-compose as is, just changed the ports... And now it dawned on me, it might be the port I changed for Nginx... I thought it might become a problem, but never realised that it could be that... I changed the port from 80 to 803 because it gave me an error when I had it on 80... It said port 80 is already being used on that server... Anyone who could guide me through what to do now, please?
Thanks
Darius
@SuperDarius-git if you use the regular config, everything is already configured, but there might be some folders that got out of sync or something. Could you stop the containers, do a docker volume rm docker_static
, start everything again and post the logs if it still doesn't work?
It should look like this:
wger_nginx | 2022/08/19 12:24:02 [notice] 1#1: start worker process 40
wger_nginx | 2022/08/19 12:24:02 [notice] 1#1: start worker process 41
wger_server | yarn install v1.22.19
wger_server | [1/5] Validating package.json...
wger_server | [2/5] Resolving packages...
wger_server | [3/5] Fetching packages...
wger_server | [4/5] Linking dependencies...
wger_server | [5/5] Building fresh packages...
wger_server | Done in 5.22s.
wger_server | yarn run v1.22.19
wger_server | $ sass wger/core/static/scss/main.scss:wger/core/static/yarn/bootstrap-compiled.css
wger_server | Done in 1.73s.
wger_server | Running in production mode, running collectstatic now
wger_server |
wger_server | 5723 static files copied to '/home/wger/static', 302 unmodified.
wger_server | Performing database migrations
wger_server | Operations to perform:
Ok, so this is what it looks like, and it still does the same thing:
yarn install v1.22.19
,
[1/5] Validating package.json...
,
[2/5] Resolving packages...
,
[3/5] Fetching packages...
,
[4/5] Linking dependencies...
,
[5/5] Building fresh packages...
,
Done in 22.57s.
,
yarn run v1.22.19
,
$ sass wger/core/static/scss/main.scss:wger/core/static/yarn/bootstrap-compiled.css
,
Done in 7.66s.
,
Running in production mode, running collectstatic now,
,
6025 static files copied to '/home/wger/static'.,
Performing database migrations,
Operations to perform:,
Apply all migrations: auth, authtoken, config, contenttypes, core, easy_thumbnails, exercises, gallery, gym, mailer, manager, measurements, nutrition, sessions, sites, weight,
Running migrations:,
No migrations to apply.,
Set site URL to http://fit.super.org.za,
Using gunicorn...,
[2022-08-19 12:40:56 +0000] [86] [INFO] Starting gunicorn 20.1.0,
[2022-08-19 12:40:56 +0000] [86] [INFO] Listening at: http://0.0.0.0:8000 (86),
[2022-08-19 12:40:56 +0000] [86] [INFO] Using worker: sync,
[2022-08-19 12:40:56 +0000] [87] [INFO] Booting worker with pid: 87,
mhhh
I mean, at least everything is getting collected correctly, but why isn't it serving anything? Did you perhaps change some paths in the env file?
I only changed my timezone, my site_url, email address and DJango DB Password...
May I suggest checking the docker-compose and nginx.conf
upstream wger {
server web:8000; ## <-- "web" has to be the same name as the actual wger container or it's "domainname" in case you put one in there
...
services:
web: ## <- same as this
image: wger/server:latest
container_name: wger_server
domainname: wger.ghl ## <--- or this if you have it, either should work
...
I myself made this mistake while setting it up, check just in case.
It all seems correct, if I understand you correctly.
May I suggest checking the docker-compose and nginx.conf
upstream wger { server web:8000; ## <-- "web" has to be the same name as the actual wger container or it's "domainname" in case you put one in there ...
services: web: ## <- same as this image: wger/server:latest container_name: wger_server domainname: wger.ghl ## <--- or this if you have it, either should work ...
I myself made this mistake while setting it up, check just in case.
Could you try docker logs nginx
and then reload the site and check if there is any error or anything in nginx container logs?
might there be some permission errors so that nginx can't access them?
This is my Nginx logs:
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration,
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/,
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh,
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf,
10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf differs from the packaged version,
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh,
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh,
/docker-entrypoint.sh: Configuration complete; ready for start up,
2022/08/19 12:40:11 [notice] 1#1: using the "epoll" event method,
2022/08/19 12:40:11 [notice] 1#1: nginx/1.22.0,
2022/08/19 12:40:11 [notice] 1#1: built by gcc 10.2.1 20210110 (Debian 10.2.1-6) ,
2022/08/19 12:40:11 [notice] 1#1: OS: Linux 5.15.0-46-generic,
2022/08/19 12:40:11 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576,
2022/08/19 12:40:11 [notice] 1#1: start worker processes,
2022/08/19 12:40:11 [notice] 1#1: start worker process 30,
2022/08/19 12:40:11 [notice] 1#1: start worker process 31,
And when you open the application? specially the requests going to /static
There are no extra logs in Docker when I try to open the application?
Do you see the same thing accessing from this two urls?
http://localhost
http://localhost:8000
also check nginx logs to see if anything new is showing up on either.
It's installed on a VPS with a domain name and a subdomain through a NGINX Reverse Proxy server, with a Let's Encrypt certificate. Do you think any of those might be the reason? I also use port 830 instead of 8000 as setup in the Docker Compose file.
Port 8000 is only used internally within the containers, you should change port 80! (I don't think you need to change anything else to expose the whole application on another port)
In any case try to access the docker compose setup as directly as possible and then add more and more layers (like your reverse proxy, HTTPS, etc)
How did you go about nginx and wger?, did you just created another nginx container or updated the one you had with the new stuff from wger?
Did you also update the nginx.conf "upstream" with the 830 port?
Port 8000 is only used internally within the containers, you should change port 80! (I don't think you need to change anything else to expose the whole application on another port)
In any case try to access the docker compose setup as directly as possible and then add more and more layers (like your reverse proxy, HTTPS, etc)
I tried to access the site with only VPS domain name and port 830, bypassing the Proxy server. I also tried to use http instead of https, but with no luck. I still get a page with no CSS and no images. I will try and set it up on another VPS and let you know if it still does the same.
Thank you so much for helping so far...
How did you go about nginx and wger?, did you just created another nginx container or updated the one you had with the new stuff from wger? Did you also update the nginx.conf "upstream" with the 830 port?
I tried to change the upstream port in the NGINX.conf file, but no luck... It is different nginx containers. Also thank you so much for the help so far!
I tried to change the upstream port in the NGINX.conf file, but no luck... It is different nginx containers. Also thank you so much for the help so far!
yeah, you should change it in the docker-compose file only (so e.g. 830:80)
It says in the compose file 8000:8000, which I changed to 830:8000
What is this line? and how must I change this lines:
healthcheck:
test: wget --no-verbose --tries=1 --spider http://localhost:8000
Can't that be a reason?
That line is checking that the server is alive, is internal to the container, doesn't really leave it, and that line is not essential either, I don't think that's the issue, but you can try commenting it out and relaunching it.
Thank you all for your help. I will go on troubleshooting and posting on here tomorrow. In the meantime, I will try installing wger on another server and let you all know.
Thanks again...
Darius
BTW, the line I mean is this one
https://github.com/wger-project/docker/blob/master/docker-compose.yml#L40
Let's hope we can get this working ✌🏻
PROBLEM SOLVED!!!!!!I couldn't go to bed, it kept bothering me! So I got @rolandgeider last post and I realised I changed the wrong port to 830... Thank you to everyone who helped!
Thank you
Darius
🥳