mirror of
https://github.com/docker/awesome-compose.git
synced 2025-04-19 15:28:06 +02:00
Merge 727c96f2e8
into 18f59bdb09
This commit is contained in:
commit
81f0c74f45
5 changed files with 129 additions and 0 deletions
|
@ -75,6 +75,7 @@ with Spring framework and a Postgres database.
|
|||
- [`Pi-hole / cloudflared`](pihole-cloudflared-DoH) - Sample Pi-hole setup with use of DoH cloudflared service
|
||||
- [`Prometheus / Grafana`](prometheus-grafana)
|
||||
- [`Wordpress / MySQL`](wordpress-mysql)
|
||||
- [`LocalStack`](localstack)
|
||||
|
||||
<!--lint disable awesome-toc-->
|
||||
|
||||
|
|
2
localstack/.gitignore
vendored
Normal file
2
localstack/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
.env
|
||||
volume/
|
90
localstack/README.md
Normal file
90
localstack/README.md
Normal file
|
@ -0,0 +1,90 @@
|
|||
# LocalStack
|
||||
|
||||
This example shows how to use [LocalStack](https://localstack.cloud/) to emulate AWS services locally using docker compose.
|
||||
|
||||
Project structure:
|
||||
|
||||
```text
|
||||
.
|
||||
├── init.d/
|
||||
│ └── init.sh
|
||||
├── compose.yaml
|
||||
└── README.md
|
||||
```
|
||||
|
||||
[_compose.yaml_](compose.yaml)
|
||||
|
||||
```yml
|
||||
services:
|
||||
localstack:
|
||||
image: localstack/localstack:2.3.2
|
||||
ports:
|
||||
- "4566:4566" # LocalStack Gateway
|
||||
- "4510-4559:4510-4559" # external services port range
|
||||
...
|
||||
```
|
||||
|
||||
## Deploy with docker compose
|
||||
|
||||
```sh
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
It will execute the scripts located in the `init.d/` folder to bootstrap the resources.
|
||||
|
||||
## Resources
|
||||
|
||||
Once the docker compose is up, it will create the following resources:
|
||||
|
||||
- [DynamoDB Table](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Introduction.html)
|
||||
- [Kinesis Stream](https://docs.aws.amazon.com/streams/latest/dev/getting-started.html)
|
||||
- [S3 Bucket](https://docs.aws.amazon.com/AmazonS3/latest/userguide/Welcome.html)
|
||||
- [SQS Queue](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/welcome.html)
|
||||
|
||||
## LocalStack Desktop
|
||||
|
||||
You can use [LocalStack Desktop](https://docs.localstack.cloud/user-guide/tools/localstack-desktop/) to manage the resources created by the docker compose.
|
||||
|
||||
## Testing the services
|
||||
|
||||
From outside the container you can execute the following commands to test the service each service:
|
||||
|
||||
- **DynamoDB**
|
||||
|
||||
```sh
|
||||
$ awslocal dynamodb list-tables
|
||||
{
|
||||
"TableNames": [
|
||||
"my_table"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
- **Kinesis**
|
||||
|
||||
```sh
|
||||
$ awslocal kinesis list-streams
|
||||
{
|
||||
"StreamNames": [
|
||||
"my_stream"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
- **S3**
|
||||
|
||||
```sh
|
||||
$ awslocal s3 ls
|
||||
2022-08-08 03:16:01 example-bucket
|
||||
```
|
||||
|
||||
- **SQS**
|
||||
|
||||
```sh
|
||||
$ awslocal sqs list-queues
|
||||
{
|
||||
"QueueUrls": [
|
||||
"http://localhost:4566/000000000000/my_queue"
|
||||
]
|
||||
}
|
||||
```
|
22
localstack/compose.yml
Normal file
22
localstack/compose.yml
Normal file
|
@ -0,0 +1,22 @@
|
|||
version: "3.9"
|
||||
|
||||
services:
|
||||
localstack:
|
||||
image: localstack/localstack:2.3.2
|
||||
ports:
|
||||
- "4566:4566" # LocalStack Gateway
|
||||
- "4510-4559:4510-4559" # external services port range
|
||||
- "53:53" # DNS config (only required for Pro)
|
||||
- "53:53/udp" # DNS config (only required for Pro)
|
||||
- "443:443" # LocalStack HTTPS Gateway (only required for Pro)
|
||||
environment:
|
||||
- DEBUG=${DEBUG-}
|
||||
- PERSISTENCE=${PERSISTENCE-}
|
||||
- LAMBDA_EXECUTOR=${LAMBDA_EXECUTOR-}
|
||||
- LOCALSTACK_API_KEY=${LOCALSTACK_API_KEY-} # only required for Pro
|
||||
- DOCKER_HOST=unix:///var/run/docker.sock
|
||||
- SERVICES=dynamodb,kinesis,s3,sqs
|
||||
volumes:
|
||||
- "${LOCALSTACK_VOLUME_DIR:-./volume}:/var/lib/localstack"
|
||||
- "/var/run/docker.sock:/var/run/docker.sock"
|
||||
- "./init.d:/etc/localstack/init/ready.d"
|
14
localstack/init.d/init.sh
Executable file
14
localstack/init.d/init.sh
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/sh
|
||||
|
||||
awslocal kinesis create-stream --stream-name my_stream --shard-count 1
|
||||
|
||||
awslocal s3 mb s3://example-bucket
|
||||
|
||||
awslocal sqs create-queue --queue-name my_queue
|
||||
|
||||
awslocal dynamodb create-table --table-name my_table \
|
||||
--attribute-definitions AttributeName=key,AttributeType=S \
|
||||
--key-schema AttributeName=key,KeyType=HASH \
|
||||
--provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5
|
||||
|
||||
# you can go on and put initial items in tables...
|
Loading…
Add table
Add a link
Reference in a new issue