The recent days I have worked some more on this. I had not gotten media upload to work (but had the same error with a normal docker image so it seemed not related to kubernetes). I fixed that error (mainly it was absolute paths which do not work, all media has to have relative paths). A kubernetes specific problem was that the default ingress (in minikube) has a size limit in proxying (leading to 413 errors). I do not know how to define that in the dockerfile so it gets taken over by kompose so I had to fix a helm template.
docker.yml:
version: "3.7"
services:
grampsweb: &grampsweb
image: ghcr.io/gramps-project/grampsweb:latest
restart: always
ports:
- "81:5000" # host:docker
environment:
GRAMPSWEB_TREE: "Gramps Web" # will create a new tree if not exists
GRAMPSWEB_BASE_URL: "https://grampsweb.some.url"
GRAMPSWEB_CELERY_CONFIG__broker_url: "redis://grampswebredis:6379/0"
GRAMPSWEB_CELERY_CONFIG__result_backend: "redis://grampswebredis:6379/0"
GRAMPSWEB_RATELIMIT_STORAGE_URI: redis://grampswebredis:6379/1
GRAMPSWEB_EMAIL_HOST: "somehost"
GRAMPSWEB_EMAIL_PORT: 587
GRAMPSWEB_EMAIL_USE_TLS: False
GRAMPSWEB_EMAIL_HOST_USER: "some@us.er"
GRAMPSWEB_EMAIL_HOST_PASSWORD: "password"
GRAMPSWEB_DEFAULT_FROM_EMAIL: "gramps@some.host"
depends_on:
- grampswebredis
volumes:
- gramps_users:/app/users # persist user database
- gramps_index:/app/indexdir # persist search index
- gramps_thumb_cache:/app/thumbnail_cache # persist thumbnails
- gramps_cache:/app/cache # persist export and report caches
- gramps_secret:/app/secret # persist flask secret
- gramps_db:/root/.gramps/grampsdb # persist Gramps database
- gramps_media:/app/media # persist media files
- gramps_tmp:/tmp
networks:
- gramps-network
labels:
kompose.service.expose: "grampsweb.some.url"
kompose.service.expose.ingress-class-name: "nginx"
grampsweb_celery:
<<: *grampsweb # YAML merge key copying the entire grampsweb service config
ports: []
container_name: grampsweb_celery
depends_on:
- grampswebredis
command: celery -A gramps_webapi.celery worker --loglevel=INFO
grampswebredis:
image: redis:alpine
container_name: grampswebredis
restart: always
ports:
- "6379"
networks:
- gramps-network
volumes:
gramps_users:
gramps_index:
gramps_thumb_cache:
gramps_cache:
gramps_secret:
gramps_db:
gramps_media:
gramps_tmp:
networks:
gramps-network:
then run
kompose convert -c
in the directory containing docker-compose.yml.
This creates template files in subfolder docker-compose.
Modify the ingress template to allow bigger requests. With my biggest image being about 70MB a limit of 256MB more than worked and has now allowed me to upload all media with gramps websync:
Beginning of template file docker-compose/templates/grampsweb-ingress.yaml
:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
kompose.cmd: kompose convert -c
...
add this line to annotations:
nginx.ingress.kubernetes.io/proxy-body-size: 256m
finally
helm install gramps ./docker-compose
and for modifications (like version updates) of the helm templates
helm upgrade gramps ./docker-compose
I use minikube. The ingress provides a domain that is working in minikube. To get connected to the internet I use an apache reverse proxy. The config is as follows. For simplicity I only include the http version. Https for proxying is in principal identical but adds settings specific for ssl.
<VirtualHost IP-OF-SERVER:80>
ServerName grampsweb.some.url
ProxyPreserveHost On
ProxyRequests Off
ProxyVia Off
ProxyPass / http://MINIKUBE-IP/ nocanon
ProxyPassReverse / http://MINIKUBE-IP/
AllowEncodedSlashes NoDecode
</VirtualHost>
Insert IP-OF-SERVER as the external IP of the server running the apache proxa and MINIKUBE-IP as the local ip of the minikube cluster. MINIKUBE-IP can be found using the command minikube ip
. Providing IP-OF-SERVER might not be necessary in all cases.