Skip to content

Latest commit

 

History

History
300 lines (195 loc) · 6.61 KB

how-to-run-local-hawk.md

File metadata and controls

300 lines (195 loc) · 6.61 KB

How to use hawk.mono to run local Hawk

This guide will help you to run Hawk locally for a development needs:

  • project structure
  • how to clone the repo and run
  • how to update and rebuild containers

Let's go!

Structure

Installation

How to clone the repo and run containers.

Preparation

You need to create a new chat in Telegram with a @codex_bot to get notifications and any code errors from local's Hawk.

Telegram

New Group -> Enter a name -> Add @codex_bot

Then use command /notify in chat to get a webhook for notifications.

Use it in .env files as CODEX_BOT_WEBHOOK param where it needs.

Hawk Token

Go to garage.hawk.so, create a new project and get a token.

Use it in .env files as HAWK_TOKEN or HAWK_CATCHER_TOKEN param where it needs.

Getting sources

Clone the repo.

git clone https://github.com/codex-team/hawk.mono

Init and pull submodules.

git submodule init && git submodule update

Now you have a complete structure for all folders.

You can check it by entering the api folder. If it is not an empty then you may go next step.

Setting up env files

You should create a few .env files according to their samples .sample or .docker.

accounting/.env.sample -> accounting/.env

- HAWK_CATCHER_TOKEN

api/.env.sample -> api/.env

To enable email sending from the server use your email keys.

  • SMTP_USERNAME=user@hawk.so

  • SMTP_PASSWORD=mySecretPwd

  • SMTP_SENDER_NAME=Hawk local

  • SMTP_SENDER_ADDRESS=user@hawk.so

  • HAWK_CATCHER_TOKEN

  • TELEGRAM_MAIN_CHAT_URL

  • TELEGRAM_MONEY_CHAT_URL

collector/.env.docker -> collector/.env

- HAWK_TOKEN - NOTIFY_URL

cron-manager/config.sample.yml -> cron-manager/config.yml

Just copy the file.

garage/.env.sample -> garage/.env

- VUE_APP_HAWK_TOKEN

workers/.env.sample -> workers/.env

- MONGO_ACCOUNTS_DATABASE_URI=mongodb://mongodb:27017/hawk - MONGO_EVENTS_DATABASE_URI=mongodb://mongodb:27017/hawk_events - HAWK_CATCHER_TOKEN - CODEX_BOT_WEBHOOK

workers/workers/archiver/.env.sample -> workers/workers/archiver/.env

- REPORT_NOTIFY_URL - REGISTRY_URL=amqp://guest:guest@rabbitmq

workers/workers/email/.env.sample -> workers/workers/email/.env

- SMTP_USERNAME=user@hawk.so - SMTP_PASSWORD=mySecretPwd - SMTP_SENDER_NAME=Hawk local worker - SMTP_SENDER_ADDRESS=user@hawk.so

workers/workers/grouper/.env.sample -> workers/workers/grouper/.env

Just copy the file.

workers/workers/limiter/.env.sample -> workers/workers/limiter/.env

- REPORT_NOTIFY_URL

workers/workers/paymaster/.env.sample -> workers/workers/paymaster/.env

- REPORT_NOTIFY_URL

workers/workers/sender/.env.sample -> workers/workers/sender/.env

Just copy the file.

Create a needed dirs

mkdir dump

Starting containers

The moment of truth. Running containers from docker-compose.yml file.

docker compose up 

Post running

Apply api database migration.

docker-compose exec api yarn migrate-mongo up

Run the site

Go to localhost:8080 and see the Hawk's log in page.

Sign in for the first time and you'll get a password to your email.

Yard is available here: localhost:3900

Run workers

Go to workers dir

cd workers

Run all workers

docker-compose -f docker-compose.dev.yml up

Updates

How to get updates for the code and apply it to containers.

Sources

If you want to switch all submodules to the latest version checked in hawk.mono repo use the following command:

git submodule update --recursive

Containers

How to apply updates to containers.

Garage

You can simply update any code and watch the result on the site page.

To update node dependencies you should rebuild container.

docker-compose up -d --build garage

API

Code reloading is also work here as for Garage. Update the code and see results.

To update node dependencies you should rebuild container.

docker-compose up -d --build api

Yard

Rebuild container

docker-compose up -d --build yard

Collector

Rebuild container

docker-compose up -d --build collector

Workers

Go to workers dir

cd workers

Stop all workers

docker-compose -f docker-compose.dev.yml down

Remove deps volume

docker volume rm workers_workers-deps

Rebuild and run containers

docker-compose -f docker-compose.dev.yml up --build -d

Events endpoint

Use token for a project from your local Hawk.

Set collector endpoint value:

  • ws://localhost:3000/ws for JS events
  • http://localhost:3000/ for all other events

Dashboards

Rabbit MQ Management board

Go to localhost:15672

user: guest

pass: guest

MongoDB

You can use MongoDB Compass GUI app to access database.

Connection string: mongodb://localhost:27017/.

Redis

You can use RedisInsight GUI to access database.

Host: localhost

Port: 6379

Name: Hawk Local