Skip to content

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

task: Add CONTRIBUTING.md with development setup instructions (#395)

Dennis Telf490e8de528f
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000000..d673b53a37
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,22 @@
+# Contributing
+
+## Development setup
+
+The easiest way to get up and running is to [install](https://docs.docker.com/get-docker/) and use Docker for running both Postgres and Clickhouse.
+
+### Start the environment:
+
+1. Run both `make postgres` and `make clickhouse`.
+2. Run `mix ecto.create`. This will create the required databases in both Postgres and Clickhouse.
+3. Run `mix ecto.migrate` to build the database schema.
+4. Run `npm ci --prefix assets` to install the required node dependencies.
+5. Run `mix phx.server` to start the Phoenix server.
+6. The system is now available on `localhost:8000`.
+
+### Creating an account
+
+1. Navigate to `http://localhost:8000/register` and fill in the form.
+2. An e-mail won't actually be sent, but you can find the activation in the Phoenix logs in your terminal. Search for `%Bamboo.Email{assigns: %{link: "` and open the link listed.
+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!
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000000..49c4805d26
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,20 @@
+clickhouse:
+ docker run -p 8123:8123 --ulimit nofile=262144:262144 --volume=$$HOME/clickhouse_db_vol:/var/lib/clickhouse yandex/clickhouse-server
+
+postgres:
+ docker run -e POSTGRES_PASSWORD="postgres" -p 5432:5432 postgres
+
+dummy_event:
+ curl 'http://localhost:8000/api/event' \
+ -H 'authority: localhost:8000' \
+ -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36 OPR/71.0.3770.284' \
+ -H 'content-type: text/plain' \
+ -H 'accept: */*' \
+ -H 'origin: http://dummy.site' \
+ -H 'sec-fetch-site: cross-site' \
+ -H 'sec-fetch-mode: cors' \
+ -H 'sec-fetch-dest: empty' \
+ -H 'referer: http://dummy.site' \
+ -H 'accept-language: en-US,en;q=0.9' \
+ --data-binary '{"n":"pageview","u":"http://dummy.site","d":"dummy.site","r":null,"w":1666}' \
+ --compressed