From b160f8452efd0e5a8e529bbb83b77fa0000efcb7 Mon Sep 17 00:00:00 2001 From: boring-nick <107642431+boring-nick@users.noreply.github.com> Date: Sat, 9 Sep 2023 15:48:10 +0300 Subject: [PATCH] Add contributing guide and setup files (#16) * Add contributing guide and setup files * set the default db url to localhost * minor clarifications * update docs on installing from source --------- Co-authored-by: boring_nick --- README.md | 50 +++++++++++++++++++++++++++++++++++++++--- config.dist.json | 12 ++++++++++ docker-compose.dev.yml | 15 +++++++++++++ 3 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 config.dist.json create mode 100644 docker-compose.dev.yml diff --git a/README.md b/README.md index 968b17a..b67e98b 100644 --- a/README.md +++ b/README.md @@ -36,9 +36,9 @@ services: ### From source -- Set up Clickhouse -- `cargo install --locked --git https://github.com/boring-nick/rustlog` -- You can now run the `rustlog` binary +- Follow the [Contributing](Contributing) excluding the last step +- `cargo build --release` +- The resulting binary will be at `target/release/rustlog` ## Advantages over justlog @@ -46,5 +46,49 @@ services: - Blazing fast log queries with response streaming and a [highly performant IRC parser](https://github.com/jprochazk/twitch-rs) - Support for ndjson logs responses +## Contributing + +Requirements: +- rust +- yarn +- docker with docker-compose (optional, will need to set up Clickhouse manually without it) + +Steps: + +0. Clone the repository (make sure to include submodules!): +``` +git clone --recursive https://github.com/boring-nick/rustlog +``` +If you already cloned the repo without `--recursive`, you can initialize submodules with: +``` +git submodule update --init --recursive +``` + +1. Set up the database (Clickhouse): + +This repository provides a docker-compose to quickly set up Clickhouse. You can use it with: +``` +docker-compose -f docker-compose.dev.yml up -d +``` +Alternatively, you can install Clickhouse manually using the [official guide](https://clickhouse.com/docs/en/install). + +2. Create a config file + +Copy `config.dist.json` to `config.json` and configure your database and twitch credentials. If you installed Clickhouse with Docker, the default database configuration works. + +3. Build the frontend: +``` +cd web +yarn install +yarn build +cd .. +``` +4. Build and run rustlog: +``` +cargo run +``` + +You can now access rustlog at http://localhost:8025. + ## Migrating from justlog See [MIGRATION.md](./docs/MIGRATION.md) diff --git a/config.dist.json b/config.dist.json new file mode 100644 index 0000000..77b84bf --- /dev/null +++ b/config.dist.json @@ -0,0 +1,12 @@ +{ + "clickhouseUrl": "http://localhost:8123", + "clickhouseDb": "rustlog", + "clickhouseUsername": null, + "clickhousePassword": null, + "listenAddress": "0.0.0.0:8025", + "channels": ["12345"], + "clientID": "id", + "clientSecret": "secret", + "admins": [], + "optOut": {} +} diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml new file mode 100644 index 0000000..225ae9c --- /dev/null +++ b/docker-compose.dev.yml @@ -0,0 +1,15 @@ +version: "3.8" + +services: + clickhouse: + image: clickhouse/clickhouse-server:latest + volumes: + - "rustlog_ch_data:/var/lib/clickhouse:rw" + environment: + CLICKHOUSE_DB: "rustlog" + ports: + - 8123:8123 + - 9000:9000 + +volumes: + rustlog_ch_data: