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!
How to clone the repo and run containers.
You need to create a new chat in Telegram with a @codex_bot to get notifications and any code errors from local's Hawk.
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.
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.
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.
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.
mkdir dump
The moment of truth. Running containers from docker-compose.yml
file.
docker compose up
Apply api database migration.
docker-compose exec api yarn migrate-mongo up
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
Go to workers
dir
cd workers
Run all workers
docker-compose -f docker-compose.dev.yml up
How to get updates for the code and apply it to containers.
If you want to switch all submodules to the latest version checked in hawk.mono repo use the following command:
git submodule update --recursive
How to apply updates to containers.
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
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
Rebuild container
docker-compose up -d --build yard
Rebuild container
docker-compose up -d --build collector
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
Use token for a project from your local Hawk.
Set collector endpoint value:
ws://localhost:3000/ws
for JS eventshttp://localhost:3000/
for all other events
Go to localhost:15672
user: guest
pass: guest
You can use MongoDB Compass GUI app to access database.
Connection string: mongodb://localhost:27017/
.
You can use RedisInsight GUI to access database.
Host: localhost
Port: 6379
Name: Hawk Local