Simply, you can build the environment by running the make run command. then, you can test by
curl -XPOST http://localhost:13000/v1/order/createfor transaction commit test, orcurl -XPOST http://localhost:13000/v1/order/create2for transaction rollback test.
Then check whether the database data is consistent.
Alternatively, you can manually build the environment according to the following steps.
git clone git@github.com:cectc/dbpack.git
git clone git@github.com:cectc/dbpack-samples.git
cd dbpack-samplesdocker run -d --name etcd-server \
--publish 2379:2379 \
--publish 2380:2380 \
--env ALLOW_NONE_AUTHENTICATION=yes \
--env ETCD_ADVERTISE_CLIENT_URLS=http://etcd-server:2379 \
bitnami/etcd:latest./scripts/order.sql
./scripts/product.sql
vim ./configs/config-aggregation.yaml
# update distributed_transaction.etcd_config.endpoints
vim ./configs/config-product.yaml
# update data_source_cluster.dsn
# update distributed_transaction.etcd_config.endpoints
vim ./configs/config-order.yaml
# update data_source_cluster.dsn
# update distributed_transaction.etcd_config.endpoints
cd ../dbpack
make build-local
./dbpack start --config ../dbpack-samples/configs/config-aggregation.yaml
./dbpack start --config ../dbpack-samples/configs/config-product.yaml
./dbpack start --config ../dbpack-samples/configs/config-order.yamlcd ../dbpack-samples/dotnet/
vim ./order_svc/appsettings.Development.json
# update ConnectionStrings.OrderDB
dotnet runcd ../dbpack-samples/dotnet/
vim ./product_svc/appsettings.Development.json
# update ConnectionStrings.ProductDB
dotnet runcd ../dbpack-samples/dotnet/
vim ./aggregation_svc/Controllers/OrderController.cs
# update createSoUrl updateInventoryUrl
dotnet runcurl -XPOST http://localhost:13000/v1/order/create
Check whether the database data is consistent.