Comments (18)
from docker.
You do need the nginx service! The Django application doesn't serve any static files, you need a different service for that
from docker.
Thanks for responding, please could you elaborate a bit more ? What different service do I need ?
I'm new to nginx, but always understood it to be a reverse proxy to gain access to an internal service externally ? (As I use a vpn to connect into my network, I always look for things to be local ?)
from docker.
from docker.
Thanks again @rolandgeider , really appreciate the help and the insight..
I've added the nginx element back into the docker compose and run it again, but sadly nothing seems to have changed I still have a basic text/html UI ? (Any ideas?)
My Compose and nginx.conf are below..
version: '3'
services:
web:
image: wger/server:latest
container_name: wger_server
depends_on:
db:
condition: service_healthy
cache:
condition: service_healthy
environment:
- SECRET_KEY=wger-docker-supersecret-key
- SIGNING_KEY=wger-docker-secret-jwtkey
- [email protected]
- TIME_ZONE=Europe/London
- ALLOW_REGISTRATION=True
- ALLOW_GUEST_USERS=True
- ALLOW_UPLOAD_VIDEOS=True
- MIN_ACCOUNT_AGE_TO_TRUST=18
- SYNC_EXERCISES_ON_STARTUP=True
- DOWNLOAD_EXERCISE_IMAGES_ON_STARTUP=True
# Database
- DJANGO_DB_ENGINE=django.db.backends.postgresql
- DJANGO_DB_DATABASE=wger
- DJANGO_DB_USER=wger
- DJANGO_DB_PASSWORD=wger
- DJANGO_DB_HOST=db
- DJANGO_DB_PORT=5432
- DJANGO_PERFORM_MIGRATIONS=True
# Cache
- DJANGO_CACHE_BACKEND=django_redis.cache.RedisCache
- DJANGO_CACHE_LOCATION=redis://cache:6379/1
# 60*60*24*15, 15 Days
- DJANGO_CACHE_TIMEOUT=12
- DJANGO_CACHE_CLIENT_CLASS=django_redis.client.DefaultClient
# Brute force login attacks - https://django-axes.readthedocs.io/en/latest/index.html
- AXES_ENABLED=True
- AXES_FAILURE_LIMIT=10
# in minutes
- AXES_COOLOFF_TIME=30
- AXES_HANDLER=axes.handlers.cache.AxesCacheHandler
# Others
- DJANGO_DEBUG=False
- WGER_USE_GUNICORN=True
- EXERCISE_CACHE_TTL=10
- SITE_URL=http://localhost
# JWT auth - The lifetime duration of the access token, in minutes
- ACCESS_TOKEN_LIFETIME=10
# The lifetime duration of the refresh token, in hours
- REFRESH_TOKEN_LIFETIME=24
# Other possible settings
# RECAPTCHA_PUBLIC_KEY
# RECAPTCHA_PRIVATE_KEY
# NOCAPTCHA
# https://docs.djangoproject.com/en/4.1/topics/email/#smtp-backend
# ENABLE_EMAIL
# EMAIL_HOST
# EMAIL_PORT
# EMAIL_HOST_USER
# EMAIL_HOST_PASSWORD
# EMAIL_USE_TLS
# EMAIL_USE_SSL
# DJANGO_MEDIA_ROOT
# DJANGO_STATIC_ROOT
volumes:
- /share/Container/wger/static:/home/wger/static
- /share/Container/wger/media:/home/wger/media
ports:
- "8000"
healthcheck:
test: wget --no-verbose --tries=1 --spider http://localhost:8000
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
nginx:
image: nginx:stable
container_name: wger_nginx
depends_on:
- web
volumes:
#- ./config/nginx.conf:/etc/nginx/conf.d/default.conf
- /share/Container/wger/config/nginx.conf:/etc/nginx/conf.d/default.conf
- /share/Container/wger/static:/wger/static:ro
- /share/Container/wger/media:/wger/media:ro
ports:
- "8001:80"
healthcheck:
test: service nginx status
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
db:
image: postgres:12-alpine
container_name: wger_db
environment:
- POSTGRES_USER=wger
- POSTGRES_PASSWORD=wger
- POSTGRES_DB=wger
volumes:
- postgres-data:/var/lib/postgresql/data/
expose:
- 5432
healthcheck:
test: pg_isready -U wger
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
cache:
image: redis
container_name: wger_cache
expose:
- 6379
healthcheck:
test: redis-cli ping
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
volumes:
postgres-data:
static:
media:
networks:
default:
name: wger_network
And my nginx.conf file is below..
upstream wger {
server web:8000;
}
server {
listen 80;
listen [::]:80;
location / {
proxy_pass http://localhost:8001;
}
# Increase max body size to allow for video uploads
client_max_body_size 100M;
}
from docker.
You need to use the one from the repo (or some that does the same things). Also, don't change the ports there, those are only used within the wger network and are not used outside of it
https://github.com/wger-project/docker/blob/master/config/nginx.conf
from docker.
Thanks again @rolandgeider
I've replaced the nginx.conf, and restarted the containers, but I'm still getting the basic text/html UI ?
from docker.
mhhh, can the "web" container write to /share/Container/wger/static? It should try to copy everything during startup, perhaps there's something in the logs?
from docker.
Hi @rolandgeider - looking in the logs it shows the following..
[/] # docker logs -f wger_server
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 36.59s.
yarn run v1.22.19
$ sass wger/core/static/scss/main.scss:wger/core/static/yarn/bootstrap-compiled.css
Done in 5.12s.
Running in production mode, running collectstatic now
5726 static files copied to '/home/wger/static', 10012 unmodified.
Performing database migrations
Operations to perform:
Apply all migrations: actstream, auth, authtoken, axes, config, contenttypes, core, easy_thumbnails, exercises, gallery, gym, mailer, manager, measurements, nutrition, sessions, sites, weight
Running migrations:
No migrations to apply.
Your models in app(s): 'config' have changes that are not yet reflected in a migration, and so won't be applied.
Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.
Synchronizing exercises
*** Synchronizing categories...
done!
*** Synchronizing muscles...
done!
*** Synchronizing equipment...
done!
*** Synchronizing exercises...
done!
Downloading exercise images
*** Processing images ***
*** Page 1
Processing image ef0b00e2-3323-4e7f-88fe-d71ef34b3384
Image already present locally, skipping...
Processing image bed4f21b-28be-4ef1-bd88-1a4e3db66c5c
Image already present locally, skipping...
Processing image 59efcec2-a7ce-40ba-bf2b-1a6eabe52fbd
Image already present locally, skipping...
Processing image 1c37e4e1-5144-4a50-8294-16180a9bc767
Image already present locally, skipping...
Processing image 065f9418-6245-46ae-8e24-b4013ce084e4
Image already present locally, skipping...
Processing image ca71df8e-a6d6-453f-a25a-f4cebae3b970
Image already present locally, skipping...
Processing image 7276a19e-06d0-45ae-a2a3-569bed75686b
Image already present locally, skipping...
Processing image c64a9199-5ad7-4552-abdd-491deb02296a
Image already present locally, skipping...
Processing image dd0a0445-11cf-45d3-bbd1-6ae0add6b39c
Image already present locally, skipping...
Processing image f22c1928-fc70-4595-b090-af73e7a019fe
Image already present locally, skipping...
Processing image aa574839-4a7e-4c0d-ac72-2f7448478a1c
Image already present locally, skipping...
Processing image 4545b1ab-bf7f-4626-894e-b801047f2fa9
Image already present locally, skipping...
Processing image f3ea8468-02df-4022-a8ef-17700c98d63c
Image already present locally, skipping...
Processing image ad26f561-e80b-43e2-93ed-07c0fba63a3d
Image already present locally, skipping...
Processing image a02c9c7d-f42d-43e0-9946-1b99b014daee
Image already present locally, skipping...
Processing image 08517378-bc36-4f6b-9952-1f45a02d936e
Image already present locally, skipping...
Processing image 6c1a7459-266d-491a-bd50-7cbaea2bc771
Image already present locally, skipping...
Processing image 94347272-2ea7-407f-9362-cde777bc908d
Image already present locally, skipping...
Processing image 63da5c54-7f1d-4a09-9867-2bdda2a6ddeb
Image already present locally, skipping...
Processing image 90e32fa6-a90d-46b3-8ea8-c9ec8e666eca
Image already present locally, skipping...
*** Page 2
It then goes on with pretty much the same for 5 pages..
And looking in my mapped location /share/Container/wger/static
it does have a lot of things in there ?
from docker.
FYI - permissions for Container/wger/
are as follows.
[/share/Container/wger] # ls -la
total 24
drwxrwxrwx 5 linuxserver linuxserver 4096 2022-12-13 08:58 ./
drwxrwxrwx 72 admin administrators 4096 2022-12-12 21:32 ../
drwxrwxrwx 2 linuxserver linuxserver 4096 2022-12-13 09:04 config/
drwxrwxrwx 3 linuxserver linuxserver 4096 2022-12-12 23:19 media/
drwxrwxrwx 13 linuxserver linuxserver 4096 2022-12-12 22:45 static/
from docker.
and when you access the site, there's just 404 errors, nothing else right? Did you modify the nginx.conf somehow? If everything is collected nginx should serve those files
from docker.
Interesting, looking in static
folder it has the following..
[/share/Container/wger/static] # ls -la
total 52
drwxrwxrwx 13 linuxserver linuxserver 4096 2022-12-12 22:45 ./
drwxrwxrwx 5 linuxserver linuxserver 4096 2022-12-13 08:58 ../
drwxr-xr-x 4 pani linuxserver 4096 2022-12-12 22:45 CACHE/
drwxr-xr-x 3 pani linuxserver 4096 2022-12-12 22:44 css/
drwxr-xr-x 5 pani linuxserver 4096 2022-12-12 22:44 django_extensions/
drwxr-xr-x 12 pani linuxserver 4096 2022-12-12 22:45 fontawesomefree/
drwxr-xr-x 2 pani linuxserver 4096 2022-12-12 22:44 fonts/
drwxr-xr-x 6 pani linuxserver 4096 2022-12-12 22:44 images/
drwxr-xr-x 2 pani linuxserver 4096 2022-12-12 22:44 js/
drwxr-xr-x 4 pani linuxserver 4096 2022-12-12 22:44 react/
drwxr-xr-x 7 pani linuxserver 4096 2022-12-12 22:44 rest_framework/
drwxr-xr-x 2 pani linuxserver 4096 2022-12-12 22:44 scss/
drwxr-xr-x 59 pani linuxserver 4096 2022-12-13 09:58 yarn/
Not an expert in Linux, but it looks like wger writes the files using an ID which has an existing mapping on my system (FYI - pani
has limited privileges as it was set upfor my TV to access read media files in the media directory)... ?
I guess it should ideally use 1005
which is the UID of the linuxserver
account which I created those initial Wger folders with..?
from docker.
it's probably using the user id of the wger user in the container which maps to something else on the host (that's one of the reasons I used volumes for this, it makes these things much easier)
from docker.
but as long as nginx can access them, it shouldn't matter
from docker.
If it helps, the user ID pani
is 1000 and for a number of the other docker install I have running, the compose has the ability to define the UID & GID (example of one below). I'm not sure if that would help here, but sharing as an FYI..
environment:
- PUID=1005
- PGID=1000
- TZ=Europe/London
from docker.
can this be closed?
from docker.
Hi @rolandgeider , not yet, I’m still getting the basic text, and the logs are showing that it can’t find the static content..
One part is says image found, and then in another it’s missing ? (Log extract below) - any ideas ?
17/12/2022 23:22:25
Processing image d7c5c697-8a93-4d69-8c9d-a919cb4e1f77
17/12/2022 23:22:25
Image already present locally, skipping...
17/12/2022 23:22:25
Processing image a7d82572-ca40-4616-a13d-a359d7efae20
17/12/2022 23:22:25
Image already present locally, skipping...
17/12/2022 23:22:25
Processing image aa0ff663-f593-465e-9fce-c01b77c6eb9c
17/12/2022 23:22:25
Image already present locally, skipping...
17/12/2022 23:22:27
Set site URL to http://localhost
17/12/2022 23:22:28
Using gunicorn...
17/12/2022 23:22:28
[2022-12-17 23:22:28 +0000] [110] [INFO] Starting gunicorn 20.1.0
17/12/2022 23:22:28
[2022-12-17 23:22:28 +0000] [110] [INFO] Listening at: http://0.0.0.0:8000 (110)
17/12/2022 23:22:28
[2022-12-17 23:22:28 +0000] [110] [INFO] Using worker: sync
17/12/2022 23:22:28
[2022-12-17 23:22:28 +0000] [111] [INFO] Booting worker with pid: 111
17/12/2022 23:23:26
Not Found: /static/yarn/bootstrap/dist/css/bootstrap.min.css
17/12/2022 23:23:26
Not Found: /static/yarn/components-font-awesome/css/all.css
17/12/2022 23:23:26
Not Found: /static/css/agency.css
17/12/2022 23:23:26
Not Found: /static/yarn/shariff/dist/shariff.min.css
17/12/2022 23:23:26
Not Found: /static/yarn/jquery/dist/jquery.js
17/12/2022 23:23:26
Not Found: /static/yarn/bootstrap/dist/js/bootstrap.min.js
17/12/2022 23:23:26
Not Found: /static/yarn/shariff/dist/shariff.min.js
17/12/2022 23:23:26
Not Found: /static/images/weight-chart.png
17/12/2022 23:23:26
Not Found: /static/images/calendar.png
17/12/2022 23:23:26
Not Found: /static/images/muscle-overview.png
from docker.
Accessing the command line I can see that wger has access to my mapped volume, as I can retrieve information on what’s in there - yet when it tries to read from it, it is reporting the content is not found..
Hope the following helps extract from the command line of the docker instance helps, it feels like a permissions issue, as itr was showing UID 1000 before, so i updated those to the UID I used to create the volumes which was 1005 - not 100% if/how that relates but hopefully it helps..
wger@160b144870f3:/$ ls
bin boot dev etc home lib lib32 lib64 libx32 media mnt opt proc root run sbin srv sys tmp usr var wheels
wger@160b144870f3:/$ cd home
wger@160b144870f3:/home$ cd wger
wger@160b144870f3:~$ ls -la
total 64
drwxr-x--- 1 wger wger 4096 Dec 17 23:21 .
drwxr-xr-x 1 root root 4096 Dec 15 08:08 ..
-rw-r--r-- 1 wger wger 220 Dec 15 08:08 .bash_logout
-rw-r--r-- 1 wger wger 3771 Dec 15 08:08 .bashrc
drwxr-xr-x 3 wger wger 4096 Dec 17 23:21 .cache
drwxr-xr-x 2 wger wger 4096 Dec 15 14:21 db
-rwxr-xr-x 1 root root 1720 Dec 15 14:19 entrypoint.sh
drwx------ 4 wger wger 4096 Dec 15 14:21 .local
drwxrwxrwx 2 1005 wger 4096 Dec 13 21:11 media
-rw-r--r-- 1 wger wger 807 Dec 15 08:08 .profile
drwxr-xr-x 1 wger wger 4096 Dec 15 14:21 src
drwxrwxrwx 14 1005 wger 4096 Dec 18 12:45 static
drwxr-xr-x 3 wger wger 4096 Dec 17 23:21 .yarn
wger@160b144870f3:~$ cd static
wger@160b144870f3:~/static$ ls -la
total 60
drwxrwxrwx 14 1005 wger 4096 Dec 18 12:45 .
drwxr-x--- 1 wger wger 4096 Dec 17 23:21 ..
drwxr-xr-x 4 1005 wger 4096 Dec 13 21:18 CACHE
drwxr-xr-x 3 1005 wger 4096 Dec 13 21:14 css
drwxr-xr-x 5 1005 wger 4096 Dec 13 21:14 django_extensions
drwxr-xr-x 12 1005 wger 4096 Dec 13 21:15 fontawesomefree
drwxr-xr-x 2 1005 wger 4096 Dec 13 21:14 fonts
drwxr-xr-x 7 1005 wger 4096 Dec 17 23:26 images
drwxr-xr-x 2 1005 wger 4096 Dec 13 21:14 js
drwxr-xr-x 4 1005 wger 4096 Dec 13 21:14 react
drwxr-xr-x 7 1005 wger 4096 Dec 13 21:14 rest_framework
drwxr-xr-x 2 1005 wger 4096 Dec 13 21:14 scss
drwxrwxrwx 2 root root 4096 Dec 18 12:45 'TEST IF YOU CAN SEE'
drwxr-xr-x 59 1005 wger 4096 Dec 13 21:14 yarn
wger@160b144870f3:~/static$
from docker.
Related Issues (20)
- Possible bug on arm7 HOT 1
- dependency failed to start: container for service "web" is unhealthy HOT 12
- My static and media folders aren't being populated. HOT 2
- Can't upload pictures after moving volumes to another machine HOT 1
- CSRF error HOT 2
- Added new exercise - untranslated - now have a broken install. "An error occurred" HOT 1
- Install via Portainer fails HOT 7
- Error when attempting login 'ip-address' lockout parameter is not allowed. HOT 2
- Error web_server unhealty HOT 3
- load-online-fixtures hanging HOT 2
- wger with nginx proxy manager HOT 5
- DETAIL: Key (language_id)=(4) is not present in table "core_language". HOT 9
- password authentication failed for user "wger" HOT 4
- How to enter ingredients based on serving size and not 100g HOT 2
- Using wger on UNRAID Server -> Permission denied HOT 5
- dependency failed to start: container wger_server is unhealthy HOT 7
- How can I provide a Redis Password? HOT 2
- Error: for celery_worker. `wger_server` is unhealthy. DB authentication issue? HOT 6
- django.db.utils.OperationalError: connection to server at "db" (172.20.0.3), port 5432 failed: FATAL: password authentication failed for user "wger"
- Error when performing migrations on intial startup (wger library fails to install) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker.