Run the following command to start the frontend, backend containers and DB container(but now just the backend and db container):
sudo docker-compose up -d --buildEvery time you change the DB data ex: add a new table, add a new column, change a column type, add a new data(order..), etc. You need to run the following command to update the DB backup file. DB is built up based on the data in the backup file.
cd backend/scripts/testDB
sh backup-db.shFor a full Kafka setup demoed previously, please refer to this.
Env file is in the line group. Copy and paste the env file to the root dir layer~~
sudo docker-compose up -ddocker pull mysql:8.0docker pull node:20.4-alpinedocker pull wurstmeister/zookeeper:latestdocker pull wurstmeister/kafka:latestsudo chmod -R 755 ~/.dockersudo docker-compose up --build ds_backend註解:如果開啟時有 "Topic 'buy_topic' already exists" 的錯誤,應該不會影響系統的正常運行。
docker-compose downcurl -X POST http://localhost/api/purchase -H "Content-Type: application/json" -d '{"name": "Alice"}'curl -X POST http://localhost/api/purchase -H "Content-Type: application/json" -d '{"name": "Bob"}'docker exec -it kafka--kafka-1 /bin/bashkafka-topics.sh --bootstrap-server localhost:9092 --listdocker logs ds_backend_containerdocker-compose exec mysql mysql -u ds -pds2024 dsSHOW DATABASES;SHOW TABLES;DESCRIBE orders;INSERT INTO orders (name) VALUES ('Test');SELECT * FROM orders;Install wscat
npm install -g wscatTest WebSocket Server 1 - Counter 1
wscat -c ws://localhost:8083 Test WebSocket Server 2 - Counter 2
wscat -c ws://localhost:8085