From b8547da4c3b629f51a54e0f48978010cfc072f79 Mon Sep 17 00:00:00 2001 From: mmetc <92726601+mmetc@users.noreply.github.com> Date: Tue, 17 May 2022 15:54:52 +0200 Subject: [PATCH] "make localstack" target, link to docs/contributing (#1522) --- CONTRIBUTING.md | 3 +++ Makefile | 10 ++++++++- cmd/crowdsec-cli/README.md | 1 - tests/localstack/docker-compose.yml | 32 +++++++++++++++++++++++++++++ 4 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 CONTRIBUTING.md delete mode 100644 cmd/crowdsec-cli/README.md create mode 100644 tests/localstack/docker-compose.yml diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..29baa7265 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,3 @@ + +Please refer to [Contributing to CrowdSec](https://doc.crowdsec.net/docs/next/contributing/getting_started). + diff --git a/Makefile b/Makefile index e924c4239..dd15ec243 100644 --- a/Makefile +++ b/Makefile @@ -166,11 +166,19 @@ dummy-plugin_static:goversion testclean: bats-clean @$(RM) pkg/apiserver/ent $(WIN_IGNORE_ERR) @$(RM) pkg/cwhub/hubdir $(WIN_IGNORE_ERR) + @$(RM) pkg/cwhub/install $(WIN_IGNORE_ERR) + @$(RM) pkg/types/example.txt $(WIN_IGNORE_ERR) .PHONY: test +test: export AWS_ENDPOINT_FORCE=http://localhost:4566 test: goversion + @echo NOTE: You need Docker, docker-compose and run \"make localstack\" in a separate shell $(GOTEST) $(LD_OPTS) ./... +.PHONY: localstack +localstack: + docker-compose -f tests/localstack/docker-compose.yml up + package-common: @echo "Building Release to dir $(RELDIR)" @$(MKDIR) $(RELDIR)/cmd/crowdsec @@ -227,4 +235,4 @@ windows_installer: build chocolatey: windows_installer @.\make_chocolatey.ps1 -version $(BUILD_VERSION) -include tests/bats.mk \ No newline at end of file +include tests/bats.mk diff --git a/cmd/crowdsec-cli/README.md b/cmd/crowdsec-cli/README.md deleted file mode 100644 index a9218b8c4..000000000 --- a/cmd/crowdsec-cli/README.md +++ /dev/null @@ -1 +0,0 @@ -see doc in `doc/` diff --git a/tests/localstack/docker-compose.yml b/tests/localstack/docker-compose.yml new file mode 100644 index 000000000..7e10ee88c --- /dev/null +++ b/tests/localstack/docker-compose.yml @@ -0,0 +1,32 @@ +version: "3.8" + +services: + localstack: + container_name: localstack_main + image: localstack/localstack + network_mode: bridge + ports: + - "127.0.0.1:53:53" # only required for Pro (DNS) + - "127.0.0.1:53:53/udp" # only required for Pro (DNS) + - "127.0.0.1:443:443" # only required for Pro (LocalStack HTTPS Edge Proxy) + - "127.0.0.1:4510-4559:4510-4559" # external service port range + - "127.0.0.1:4566:4566" # LocalStack Edge Proxy + environment: + AWS_HOST: localstack + SERVICES: "cloudwatch,logs,kinesis" + DEBUG: "" + DATA_DIR: "" + LAMBDA_EXECUTOR: "" + KINESYS_ERROR_PROBABILITY: "" + DOCKER_HOST: "unix://var/run/docker.sock" + HOST_TMP_FOLDER: "/tmp" + KINESIS_INITIALIZE_STREAMS: "stream-1-shard:1,stream-2-shards:2" + HOSTNAME_EXTERNAL: "localstack" + AWS_ACCESS_KEY_ID: "AKIAIOSFODNN7EXAMPLE" + AWS_SECRET_ACCESS_KEY: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" + AWS_REGION: "us-east-1" + AWS_ENDPOINT_FORCE: "http://localhost:4566" + + volumes: + - "${TMPDIR:-/tmp}/localstack:/tmp/localstack" + - "/var/run/docker.sock:/var/run/docker.sock"