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

* task: Add CONTRIBUTING.md with development setup instructions

* Add --prefix assets to npm install instructions

Co-authored-by: Dennis Tel <dennis@aiden.cx>
This commit is contained in:
Dennis Tel 2020-11-05 12:43:24 +01:00 committed by GitHub
parent d206ec85cf
commit f490e8de52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 42 additions and 0 deletions

22
CONTRIBUTING.md Normal file
View File

@ -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!

20
Makefile Normal file
View File

@ -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