From 30c70ca449f1c5e9175450b89d2433f98c7890f9 Mon Sep 17 00:00:00 2001 From: Romain Failliot <romain.failliot@foolstep.com> Date: Mon, 7 Feb 2022 00:46:49 -0500 Subject: [PATCH] Add clean script --- .gitlab-ci.yml | 2 +- README.md | 15 +++++++++++++++ clean.sh | 22 ++++++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100755 clean.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5a67b93..02b94f1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,4 +5,4 @@ linter: stage: test image: koalaman/shellcheck-alpine script: - - shellcheck setup.sh + - shellcheck **/*.sh diff --git a/README.md b/README.md index f2facd9..493bded 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,8 @@ This repo is here to help installing Funkwhale using Docker. It follows the Prerequisites: * docker-compose +## Setup + To set up your instance, clone this repo and enter the directory, then run the script `./setup.sh`. @@ -18,9 +20,22 @@ pass them to it directly. See the help with this command: ./setup --help ``` +## Clean + +If you are doing tests, you might want to start from a blank slate each time. + +The `clean.sh` script cleans the Docker containers, their volumes and the +residual files. Since running the containers needs to create volume bindings, +this script needs sudo rights in order to clean the files created with root +access. + +Because of the security risk, please take a look at the script to understand +what it does: [`clean.sh`](./clean.sh) + ## Developer Prerequisites: * spellchecker + [docs-multi-container]: https://docs.funkwhale.audio/installation/docker.html#docker-multi-container diff --git a/clean.sh b/clean.sh new file mode 100755 index 0000000..29a8c25 --- /dev/null +++ b/clean.sh @@ -0,0 +1,22 @@ +#!/bin/bash +set -e + +if [ -d funkwhale ]; then + pushd funkwhale + + docker-compose down + docker volume prune -f + + if [ -d data ]; then + sudo rm -rf data + fi + + popd + rm -rf funkwhale +fi + +if [ -d /srv/funkwhale ]; then + sudo rm -rf /srv/funkwhale +fi + +rm -rf templates -- GitLab