Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

chore(docker): improve repeat contributions workflow (#1057)

Ru Singh7153b366e52f
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 3f96b4fd6c..1435daf2bb 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -23,3 +23,10 @@ Make sure Docker, Elixir, Erlang and Node.js are all installed on your developme
3. Fill in the rest of the forms and for the domain use `dummy.site`
4. Run `make dummy_event` from the terminal to generate a fake pageview event for the dummy site.
5. You should now be all set!
+
+### Stopping Docker containers
+
+1. Stop and remove the Postgres container with `make postgres-stop`.
+2. Stop and remove the Clickhouse container with `make clickhouse-stop`.
+
+Volumes are preserved. You'll find that the Postgres and Clickhouse state are retained when you bring them up again the next time: no need to re-register and so on.
\ No newline at end of file
diff --git a/Makefile b/Makefile
index e669b6326b..5e7c5c94e4 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,14 @@
clickhouse:
- docker run --detach -p 8123:8123 --ulimit nofile=262144:262144 --volume=$$PWD/.clickhouse_db_vol:/var/lib/clickhouse yandex/clickhouse-server:21.3.2.5
+ docker run --detach -p 8123:8123 --ulimit nofile=262144:262144 --volume=$$PWD/.clickhouse_db_vol:/var/lib/clickhouse --name plausible_clickhouse yandex/clickhouse-server:21.3.2.5
+
+clickhouse-stop:
+ docker stop plausible_clickhouse && docker rm plausible_clickhouse
postgres:
- docker run --detach -e POSTGRES_PASSWORD="postgres" -p 5432:5432 postgres:12
+ docker run --detach -e POSTGRES_PASSWORD="postgres" -p 5432:5432 --volume=plausible_db:/var/lib/postgresql/data --name plausible_db postgres:12
+
+postgres-stop:
+ docker stop plausible_db && docker rm plausible_db
dummy_event:
curl 'http://localhost:8000/api/event' \