- from the root folder
cd client - run
npm install - run
npm run dev(required nvm >= 22)
- run these command in from the root folder
cd server - create .env (not .docker.env), see .example.env for reference
- Make sure to first create a database in your local mysql environment
- Run the migration
mysql -u root -p <dbName> < migrations/init.sql
- run
go run cmd/api/main.goor using air runair -c .air.api.toml
- run
go run cmd/worker/main.goor using air runair -c .air.worker.toml - do this for as many workers you want
- run these command in from the root folder
cd server - create .docker.env (not .env), see .example.env for reference
- run
docker compose up --build - this will:
- Pull mysql:8.4
- Build Dockerfile.api
- Build Dockerfile.worker
- Create the mysql_data volume
- Start MySQL (also run the migration file)
- Wait for MySQL healthcheck
- Start API
- Start Worker
- verify that the services are running using
docker compose psanddocker compose logs -f
- pull mysql:8.4 image from docker hub
- build Dockerfile.api using
docker build -f Dockerfile.api -t hls-api . - build Dockerfile.worker using
docker build -f Dockerfile.worker -t hls-worker .
- first run
docker compose up -d mysqlseperately - make sure the sql container is healthy using
docker compose ps, because api and worker are dependent on it - inside the container, run the migration command
docker exec -i hls-mysql mysql -u <user-name> -p<password> <dbName> < migrations/init.sql
- To start the api server run
docker compose up -d api
-
To start a single worker run
docker compose up -d workerand to see its logsdocker logs <container name> -f -
To start another one, dont run the same command again it will just attach the terminal to the previous run container.
-
Instead use
docker compose up -d --scale worker=2, now two different worker containers run, with their own seperate logging -
similary, if want to run multiple workers at once run
docker compose up -d --scale worker=4
- To stop a running containter use
docker compose down <container name> - To remove volume use
docker compose down mysql -v - To stop all containers at once and remove volumne use
docker compose down -v

