Skip to content

Instantly share code, notes, and snippets.

@djotaku
Created February 4, 2023 14:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djotaku/9c9c067913511805742c5ee1a738b407 to your computer and use it in GitHub Desktop.
Save djotaku/9c9c067913511805742c5ee1a738b407 to your computer and use it in GitHub Desktop.
POSTGRESVERSION=13
FUNKWHALE_VERSION=1.2.9
MEDIAROOT_CONT=/srv/funkwhale/data/media
STATICROOT_CONT=/srv/funkwhale/data/static
CELERYD_CONCURRENCY=0
echo "Pull the latest images for all containers.... (based on versions specified above)"
podman pull postgres:$POSTGRESVERSION
echo "###################################"
podman pull redis:5
echo "#################################"
podman pull funkwhale/funkwhale:$FUNKWHALE_VERSION
echo "#################################"
podman pull nginx
echo "#################################"
echo "Stop the pod"
podman pod stop funkwhale_multi
echo "Removing the containers"
podman rm postgres
podman rm funkwhale_redis
podman rm f_api
podman rm funkwhale_nginx
echo "Removing the pod"
podman pod rm funkwhale_multi
echo "Recreating the pod"
podman pod create --name funkwhale_multi -p 5000:80
echo "Recreating the containers"
podman run -dt --pod funkwhale_multi --env-file=.env -e "POSTGRES_HOST_AUTH_METHOD=trust" -v funkwhale_multi_postgres:/var/lib/postgresql/data --name postgres postgres:$POSTGRESVERSION
podman run -dt --pod funkwhale_multi --env-file=.env -v funkwhale_multi_redis:/data --name funkwhale_redis redis:5
podman run -dt --pod funkwhale_multi --env-file=.env -v /media/backups/backups1/RW/books/ermesa/Music:/music:ro -v funkwhale_multi_frontend:/frontend -v funkwhale_multi_media_root:$MEDIAROOT_CONT -v funkwhale_multi_static_root:$STATICROOT_CONT --name f_api funkwhale/funkwhale:$FUNKWHALE_VERSION
podman run -dt --pod funkwhale_multi --env-file=.env -e "NGINX_MAX_BODY_SIZE=${NGINX_MAX_BODY_SIZE-100M}" -v "./nginx/funkwhale.template:/etc/nginx/conf.d/funkwhale.template:Z" -v "./nginx/funkwhale_proxy.conf:/etc/nginx/funkwhale_proxy.conf:Z" --volumes-from f_api --name funkwhale_nginx nginx
echo "To Activate the right nginx config"
podman exec -it funkwhale_nginx sh -c "envsubst \"`env | awk -F = '{printf \" $$%s\", $$1}'`\" < /etc/nginx/conf.d/funkwhale.template > /etc/nginx/conf.d/default.conf && cat /etc/nginx/conf.d/default.conf"
podman restart funkwhale_nginx
echo "Now let's start up a celery worker"
podman exec -dt f_api sh -c "celery -A funkwhale_api.taskapp worker -l INFO --concurrency=0"
echo "And a Celery Beat"
podman exec -dt f_api sh -c "celery -A funkwhale_api.taskapp beat --pidfile= -l INFO"
echo "Runnining Migrations"
podman exec f_api python manage.py migrate
#echo "Restarting Pod"
#podman pod restart funkwhale_multi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment