Нужно создать .env файлы из примеров в config и положить рядом.
К примеру: ./config/db/booking_db.env.template -> ./config/db/booking_db.env и т.д.
После того как все .env файлы созданы, проект нужно запустить через
docker compose -f ./deploy/docker-compose.yml up -dЕсли ваша система не linux, то в файле ./deploy/compose/observability.yml нужно убрать все volumes, кроме
- ${PWD}/config/config.alloy:/etc/alloy/config.alloy:ro
POST /{router-prefix}/link
Body:
{
"amount": "string",
"webhook": "string",
"message": "string"
}Response may be:
200 OK
422 Invalid request body
500 Internal Service Error
If code is 200. System return json:
{
"link": "string-url"
}When the user clicks on the link and clicks pay or time`s up, the system will send the following request to the address specified in the webhook field:
{
"status": "string"
}Status meaning:
ok- payment is successfultimeout- the waiting time has expired, timeout
-
DB_HOST— Postgres host (example:localhost) -
DB_PORT— Postgres port (example:5432) -
DB_USER— Postgres user (example:postgres) -
DB_PASSWORD— Postgres password (example:secret) -
DB_DATABASE— Postgres database name (example:hotel_db) -
SERVER_HOST— Service host (example:0.0.0.0) -
SERVER_PORT— Service port (example:8080) -
READ_TIMEOUT_SEC— HTTP read timeout in seconds (example:5) -
WRITE_TIMEOUT_SEC— HTTP write timeout in seconds (example:10) -
IDLE_TIMEOUT_SEC— HTTP idle timeout in seconds (example:15)
GET /v1/hotel/all/— list all hotels.POST /v1/hotel/— create a hotel (body contains hotel fields).GET /v1/hotel/{hotel}/— get hotel details (name and email).GET /v1/hotel/{hotel}/rooms/— list all room numbers in the hotel.GET /v1/hotel/{hotel}/room/{number}— get room cost.PUT /v1/hotel/{hotel}/room/— update room cost (body contains room number and new cost).POST /v1/hotel/{hotel}/room/— create a room (body contains room fields).
Подробнее: Hotel Service Readme
-
DB_HOST— Postgres host (example:localhost) -
DB_PORT— Postgres port (example:5432) -
DB_USER— Postgres user (example:postgres) -
DB_PASSWORD— Postgres password (example:secret) -
DB_DATABASE— Postgres database name (example:hotel_db) -
HOTEL_SERVICE_HOST— Hotel service base URL (include scheme, e.g.http://localhost) -
HOTEL_SERVICE_PORT— Hotel service port (example:8081) -
HOTEL_SERVICE_TIMEOUT— HTTP timeout (example:5s) -
PAYMENT_SERVICE_HOST— Payment service base URL (include scheme, e.g.http://localhost) -
PAYMENT_SERVICE_PORT— Payment service port (example:8081) -
PAYMENT_SERVICE_TIMEOUT— HTTP timeout for payment service (example:5s) -
SERVER_HOST— Service host (example:0.0.0.0) -
SERVER_PORT— Service port (example:8080) -
KAFKA_HOST— Kafka base URL (example:localhost:9092) -
KAFKA_TOPIC— Topic name (example:bookings)
GET /v1/booking/email/{email}/— list all bookings on this email.GET /v1/booking/hotel/{hotel}/— list all booking on this hotel.POST /v1/booking/— Add new booking.GET /v1/available/{hotel}/— list all avaliable now rooms in hotel.
Миграции применяются автоматически при старте контейнеров. Если нужна потребность выполнить миграции вне работы с docker compose, то нужна утилита goose. Заранее нужно определить DB_USER, DB_PASSWORD, DB_HOST, DB_PORT, DB_DATABASE. Вот команда для миграций:
goose -dir ./migrations/ "postgres" "postgres://${DB_USER}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_DATABASE}?sslmode=disable" up