Update localstack services + loki (dev and CI) (#2649)
This commit is contained in:
parent
e0e9e3ef16
commit
1530d93fc1
4 changed files with 26 additions and 19 deletions
20
.github/workflows/go-tests.yml
vendored
20
.github/workflows/go-tests.yml
vendored
|
@ -24,10 +24,9 @@ env:
|
||||||
RICHGO_FORCE_COLOR: 1
|
RICHGO_FORCE_COLOR: 1
|
||||||
AWS_HOST: localstack
|
AWS_HOST: localstack
|
||||||
# these are to mimic aws config
|
# these are to mimic aws config
|
||||||
AWS_ACCESS_KEY_ID: AKIAIOSFODNN7EXAMPLE
|
AWS_ACCESS_KEY_ID: test
|
||||||
AWS_SECRET_ACCESS_KEY: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
|
AWS_SECRET_ACCESS_KEY: test
|
||||||
AWS_REGION: us-east-1
|
AWS_REGION: us-east-1
|
||||||
KINESIS_INITIALIZE_STREAMS: "stream-1-shard:1,stream-2-shards:2"
|
|
||||||
CROWDSEC_FEATURE_DISABLE_HTTP_RETRY_BACKOFF: true
|
CROWDSEC_FEATURE_DISABLE_HTTP_RETRY_BACKOFF: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
@ -36,7 +35,7 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
services:
|
services:
|
||||||
localstack:
|
localstack:
|
||||||
image: localstack/localstack:1.3.0
|
image: localstack/localstack:3.0
|
||||||
ports:
|
ports:
|
||||||
- 4566:4566 # Localstack exposes all services on the same port
|
- 4566:4566 # Localstack exposes all services on the same port
|
||||||
env:
|
env:
|
||||||
|
@ -45,7 +44,7 @@ jobs:
|
||||||
KINESIS_ERROR_PROBABILITY: ""
|
KINESIS_ERROR_PROBABILITY: ""
|
||||||
DOCKER_HOST: unix:///var/run/docker.sock
|
DOCKER_HOST: unix:///var/run/docker.sock
|
||||||
KINESIS_INITIALIZE_STREAMS: ${{ env.KINESIS_INITIALIZE_STREAMS }}
|
KINESIS_INITIALIZE_STREAMS: ${{ env.KINESIS_INITIALIZE_STREAMS }}
|
||||||
HOSTNAME_EXTERNAL: ${{ env.AWS_HOST }} # Required so that resource urls are provided properly
|
LOCALSTACK_HOST: ${{ env.AWS_HOST }} # Required so that resource urls are provided properly
|
||||||
# e.g sqs url will get localhost if we don't set this env to map our service
|
# e.g sqs url will get localhost if we don't set this env to map our service
|
||||||
options: >-
|
options: >-
|
||||||
--name=localstack
|
--name=localstack
|
||||||
|
@ -54,7 +53,7 @@ jobs:
|
||||||
--health-timeout=5s
|
--health-timeout=5s
|
||||||
--health-retries=3
|
--health-retries=3
|
||||||
zoo1:
|
zoo1:
|
||||||
image: confluentinc/cp-zookeeper:7.3.0
|
image: confluentinc/cp-zookeeper:7.4.3
|
||||||
ports:
|
ports:
|
||||||
- "2181:2181"
|
- "2181:2181"
|
||||||
env:
|
env:
|
||||||
|
@ -105,12 +104,12 @@ jobs:
|
||||||
--health-retries 5
|
--health-retries 5
|
||||||
|
|
||||||
loki:
|
loki:
|
||||||
image: grafana/loki:2.8.0
|
image: grafana/loki:2.9.1
|
||||||
ports:
|
ports:
|
||||||
- "3100:3100"
|
- "3100:3100"
|
||||||
options: >-
|
options: >-
|
||||||
--name=loki1
|
--name=loki1
|
||||||
--health-cmd "wget -q -O - http://localhost:3100/ready | grep 'ready'"
|
--health-cmd "wget -q -O - http://localhost:3100/ready | grep 'ready'"
|
||||||
--health-interval 30s
|
--health-interval 30s
|
||||||
--health-timeout 10s
|
--health-timeout 10s
|
||||||
--health-retries 5
|
--health-retries 5
|
||||||
|
@ -129,6 +128,11 @@ jobs:
|
||||||
with:
|
with:
|
||||||
go-version: "1.21.5"
|
go-version: "1.21.5"
|
||||||
|
|
||||||
|
- name: Create localstack streams
|
||||||
|
run: |
|
||||||
|
aws --endpoint-url=http://127.0.0.1:4566 --region us-east-1 kinesis create-stream --stream-name stream-1-shard --shard-count 1
|
||||||
|
aws --endpoint-url=http://127.0.0.1:4566 --region us-east-1 kinesis create-stream --stream-name stream-2-shards --shard-count 2
|
||||||
|
|
||||||
- name: Build and run tests, static
|
- name: Build and run tests, static
|
||||||
run: |
|
run: |
|
||||||
sudo apt -qq -y -o=Dpkg::Use-Pty=0 install build-essential libre2-dev
|
sudo apt -qq -y -o=Dpkg::Use-Pty=0 install build-essential libre2-dev
|
||||||
|
|
4
Makefile
4
Makefile
|
@ -212,8 +212,8 @@ testclean: bats-clean ## Remove test artifacts
|
||||||
|
|
||||||
# for the tests with localstack
|
# for the tests with localstack
|
||||||
export AWS_ENDPOINT_FORCE=http://localhost:4566
|
export AWS_ENDPOINT_FORCE=http://localhost:4566
|
||||||
export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
|
export AWS_ACCESS_KEY_ID=test
|
||||||
export AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
|
export AWS_SECRET_ACCESS_KEY=test
|
||||||
|
|
||||||
testenv:
|
testenv:
|
||||||
@echo 'NOTE: You need Docker, docker-compose and run "make localstack" in a separate shell ("make localstack-stop" to terminate it)'
|
@echo 'NOTE: You need Docker, docker-compose and run "make localstack" in a separate shell ("make localstack-stop" to terminate it)'
|
||||||
|
|
|
@ -3,7 +3,7 @@ version: "3.8"
|
||||||
services:
|
services:
|
||||||
localstack:
|
localstack:
|
||||||
container_name: localstack_main
|
container_name: localstack_main
|
||||||
image: localstack/localstack:1.3.0
|
image: localstack/localstack:3.0
|
||||||
network_mode: bridge
|
network_mode: bridge
|
||||||
ports:
|
ports:
|
||||||
- "127.0.0.1:53:53" # only required for Pro (DNS)
|
- "127.0.0.1:53:53" # only required for Pro (DNS)
|
||||||
|
@ -14,21 +14,18 @@ services:
|
||||||
environment:
|
environment:
|
||||||
AWS_HOST: localstack
|
AWS_HOST: localstack
|
||||||
DEBUG: ""
|
DEBUG: ""
|
||||||
LAMBDA_EXECUTOR: ""
|
|
||||||
KINESYS_ERROR_PROBABILITY: ""
|
KINESYS_ERROR_PROBABILITY: ""
|
||||||
DOCKER_HOST: "unix://var/run/docker.sock"
|
DOCKER_HOST: "unix://var/run/docker.sock"
|
||||||
KINESIS_INITIALIZE_STREAMS: "stream-1-shard:1,stream-2-shards:2"
|
LOCALSTACK_HOST: "localstack"
|
||||||
HOSTNAME_EXTERNAL: "localstack"
|
|
||||||
AWS_ACCESS_KEY_ID: "AKIAIOSFODNN7EXAMPLE"
|
|
||||||
AWS_SECRET_ACCESS_KEY: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
|
|
||||||
AWS_REGION: "us-east-1"
|
AWS_REGION: "us-east-1"
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- "${TMPDIR:-/tmp}/localstack:/var/lib/localstack"
|
- "${TMPDIR:-/tmp}/localstack:/var/lib/localstack"
|
||||||
- "/var/run/docker.sock:/var/run/docker.sock"
|
- "/var/run/docker.sock:/var/run/docker.sock"
|
||||||
|
- "./scripts/init_script.sh:/etc/localstack/init/ready.d/init_script.sh"
|
||||||
|
|
||||||
zoo1:
|
zoo1:
|
||||||
image: confluentinc/cp-zookeeper:7.3.0
|
image: confluentinc/cp-zookeeper:7.4.3
|
||||||
ports:
|
ports:
|
||||||
- "2181:2181"
|
- "2181:2181"
|
||||||
environment:
|
environment:
|
||||||
|
@ -79,6 +76,6 @@ services:
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
|
|
||||||
loki:
|
loki:
|
||||||
image: grafana/loki:2.8.0
|
image: grafana/loki:2.9.1
|
||||||
ports:
|
ports:
|
||||||
- "3100:3100"
|
- "127.0.0.1:3100:3100"
|
||||||
|
|
6
test/localstack/scripts/init_script.sh
Executable file
6
test/localstack/scripts/init_script.sh
Executable file
|
@ -0,0 +1,6 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Create Kinesis streams
|
||||||
|
aws --endpoint-url=http://localstack:4566 --region us-east-1 kinesis create-stream --stream-name stream-1-shard --shard-count 1
|
||||||
|
aws --endpoint-url=http://localstack:4566 --region us-east-1 kinesis create-stream --stream-name stream-2-shards --shard-count 2
|
||||||
|
|
Loading…
Reference in a new issue