Use docker-compose to run commands

master
Baptiste Bouchereau 2020-02-24 19:28:01 +01:00
rodzic 926b4e05fe
commit d4c1456e1d
2 zmienionych plików z 5 dodań i 5 usunięć

Wyświetl plik

@ -10,7 +10,6 @@ Usage
Run
```bash
git clone https://github.com/Ovski4/tutorials.git
cd localstack-part-3
@ -22,9 +21,9 @@ docker-compose logs -f docker-events-listener
Wait for the resources to be deployed, then invoke the lambda multiple times and scan the table to see new items and their counters being incremented:
```bash
aws lambda invoke --function-name counter --endpoint-url=http://localhost:4574 --payload '{"id": "test"}' output.txt
aws dynamodb scan --endpoint-url http://localhost:4569 --table-name table_1
docker-compose exec docker-events-listener aws lambda invoke --function-name counter --endpoint-url=http://localstack:4574 --payload '{"id": "test"}' output.txt
docker-compose exec docker-events-listener aws dynamodb scan --endpoint-url http://localstack:4569 --table-name table_1
aws lambda invoke --function-name counter --endpoint-url=http://localhost:4574 --payload '{"id": "test2"}' output.txt
aws dynamodb scan --endpoint-url http://localhost:4569 --table-name table_1
docker-compose exec docker-events-listener aws lambda invoke --function-name counter --endpoint-url=http://localstack:4574 --payload '{"id": "test2"}' output.txt
docker-compose exec docker-events-listener aws dynamodb scan --endpoint-url http://localstack:4569 --table-name table_1
```

Wyświetl plik

@ -10,6 +10,7 @@ do
echo "$container_name: status = ${event}"
if [[ $APPLY_TERRAFORM_ON_START == "true" ]] && [[ $container_name = "localstack" ]] && [[ $event == "start" ]]; then
sleep 20 # let localstack some time to start
terraform init
terraform apply --auto-approve
echo "The terraform configuration has been applied."