Phonebook services consists of two micro services. One service creates phone book entities, the other creates reports. A queue mechanism is used for asynchronous processing of reporting requests.
//PostgreSql, Kafka, Zookeeper, PhoneBookApi, PhoneBookReport
//create phonebook-report-api image
docker build --rm --pull -f "src/PhoneBook.Report.Api/Dockerfile" --label "com.microsoft.created-by=visual-studio-code" -t "phonebook-report-api:latest" "."
//create phonebook-api image
docker build --rm --pull -f "src/PhoneBook.Api/Dockerfile" --label "com.microsoft.created-by=visual-studio-code" -t "phonebook-api:latest" "."
cd src
//volumes in docker compose needs to be shared by docker
docker-compose up
docker exec -it postgres_phonebook_api bash
su postgres
createuser -P -d -E -e phonebookuser
//password: phoneBookPass
psql -h localhost -U postgres -c "CREATE DATABASE phonebook;"
psql -h localhost -U postgres -c "GRANT ALL PRIVILEGES ON DATABASE phonebook to phonebookuser;"
exit
exit
//update server info in connection string in ".\src\PhoneBook.Api\appsettings.json"' as localhost , port 5434
cd .\PhoneBook.Api.DataContext\
dotnet ef database update --startup-project ..\PhoneBook.Api\
cd ..
docker exec -it postgres_phonebook_report bash
su postgres
createuser -P -d -E -e phonebookreportuser
//password: phoneBookReportPass
psql -h localhost -U postgres -c "CREATE DATABASE phonebookreport;"
psql -h localhost -U postgres -c "GRANT ALL PRIVILEGES ON DATABASE phonebookreport to phonebookreportuser;"
exit
exit
//update server info in connection string in ".\src\PhoneBook.Report.Api\appsettings.json"' as localhost , port 5433
cd .\PhoneBook.Report.Api.DataContext\
dotnet ef database update --startup-project ..\PhoneBook.Report.Api\
//PhoneBookApi
http://localhost:5000
//PhoneBookReport
http://localhost:5003