From 15ee850e8ad31683ff30069deaf6b3cc748c06c4 Mon Sep 17 00:00:00 2001 From: Rafael Lefever Date: Thu, 2 Jun 2022 10:23:03 +0200 Subject: [PATCH] added kafka, zookeeper, cockroachdb --- backend/cockroachdb/.env | 0 backend/cockroachdb/Dockerfile | 1 + backend/kafka/.env | 7 ++++++ backend/kafka/Dockerfile | 1 + backend/zookeeper/.env | 2 ++ backend/zookeeper/Dockerfile | 1 + cockroachdb.yml | 28 +++++++++++++++++++++++ kafka.yml | 41 ++++++++++++++++++++++++++++++++++ mockery.yml | 34 ++++++++++++++++++++++++++++ run-minimal.sh | 13 +++++++++-- test.sh | 0 tools/.keep | 0 tools/mockery/.env | 0 tools/mockery/Dockerfile | 1 + 14 files changed, 127 insertions(+), 2 deletions(-) create mode 100644 backend/cockroachdb/.env create mode 100644 backend/cockroachdb/Dockerfile create mode 100644 backend/kafka/.env create mode 100644 backend/kafka/Dockerfile create mode 100644 backend/zookeeper/.env create mode 100644 backend/zookeeper/Dockerfile create mode 100644 cockroachdb.yml create mode 100644 kafka.yml create mode 100644 mockery.yml create mode 100755 test.sh create mode 100644 tools/.keep create mode 100644 tools/mockery/.env create mode 100644 tools/mockery/Dockerfile diff --git a/backend/cockroachdb/.env b/backend/cockroachdb/.env new file mode 100644 index 0000000..e69de29 diff --git a/backend/cockroachdb/Dockerfile b/backend/cockroachdb/Dockerfile new file mode 100644 index 0000000..0d87fc4 --- /dev/null +++ b/backend/cockroachdb/Dockerfile @@ -0,0 +1 @@ +FROM cockroachdb/cockroach \ No newline at end of file diff --git a/backend/kafka/.env b/backend/kafka/.env new file mode 100644 index 0000000..4f4ab55 --- /dev/null +++ b/backend/kafka/.env @@ -0,0 +1,7 @@ +KAFKA_BROKER_ID=1 +KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181 +KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=PLAINTEXT:PLAINTEXT,PLAINTEXT_INTERNAL:PLAINTEXT +KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://localhost:9092,PLAINTEXT_INTERNAL://broker:29092 +KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1 +KAFKA_TRANSACTION_STATE_LOG_MIN_ISR=1 +KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR=1 diff --git a/backend/kafka/Dockerfile b/backend/kafka/Dockerfile new file mode 100644 index 0000000..eb7f329 --- /dev/null +++ b/backend/kafka/Dockerfile @@ -0,0 +1 @@ +FROM confluentinc/cp-kafka:7.0.1 \ No newline at end of file diff --git a/backend/zookeeper/.env b/backend/zookeeper/.env new file mode 100644 index 0000000..1b8f605 --- /dev/null +++ b/backend/zookeeper/.env @@ -0,0 +1,2 @@ +ZOOKEEPER_CLIENT_PORT=2181 +ZOOKEEPER_TICK_TIME=2000 diff --git a/backend/zookeeper/Dockerfile b/backend/zookeeper/Dockerfile new file mode 100644 index 0000000..d8b64a0 --- /dev/null +++ b/backend/zookeeper/Dockerfile @@ -0,0 +1 @@ +FROM confluentinc/cp-zookeeper:7.0.1 diff --git a/cockroachdb.yml b/cockroachdb.yml new file mode 100644 index 0000000..e3607cc --- /dev/null +++ b/cockroachdb.yml @@ -0,0 +1,28 @@ +version: '3.5' + +services: + + crdb: + image: local/crdb + container_name: crdb + hostname: crdb + build: + context: ./backend/cockroachdb + ports: + - "26257:26257" + - "8080:8080" + command: start-single-node --insecure + env_file: + - ./backend/cockroachdb/.env + volumes: + - cockroach-data:/cockroach/cockroach-data + + +volumes: + + cockroach-data: + driver: local + driver_opts: + type: none + device: /volume/crdb/data + o: bind \ No newline at end of file diff --git a/kafka.yml b/kafka.yml new file mode 100644 index 0000000..12d74ca --- /dev/null +++ b/kafka.yml @@ -0,0 +1,41 @@ +version: '3.5' +services: + zookeeper: + image: local/zookeeper + build: + context: ./backend/zookeeper + hostname: zookeeper + container_name: zookeeper + networks: + - dev-net + env_file: + - ./backend/zookeeper/.env + + kafka: + image: local/kafka + container_name: kafka-dev + build: + context: ./backend/kafka + hostname: kafka + networks: + - dev-net + ports: + # To learn about configuring Kafka for access across networks see + # https://www.confluent.io/blog/kafka-client-cannot-connect-to-broker-on-aws-on-docker-etc/ + - "9092:9092" + depends_on: + - zookeeper + volumes: + - kafka-data:/var/lib/kafka/data + env_file: + - ./backend/kafka/.env + + +volumes: + + kafka-data: + driver: local + driver_opts: + type: none + device: /volume/kafka/data + o: bind diff --git a/mockery.yml b/mockery.yml new file mode 100644 index 0000000..02e9cb6 --- /dev/null +++ b/mockery.yml @@ -0,0 +1,34 @@ +version: '3.5' + +services: + mockery: + image: local/mockery + build: + context: ./tools/mockery + env_file: + - ./tools/mockery/.env + container_name: mockery + hostname: mockery + ports: + - "9666:9666" + networks: + - dev-net + volumes: + - spacedeck-storage:/app/storage + - spacedeck-db:/app/database + + +volumes: + spacedeck-storage: + driver: local + driver_opts: + type: none + device: /volume/spacedeck/storage + o: bind + + spacedeck-db: + driver: local + driver_opts: + type: none + device: /volume/spacedeck/db + o: bind \ No newline at end of file diff --git a/run-minimal.sh b/run-minimal.sh index 251617c..c03f67e 100755 --- a/run-minimal.sh +++ b/run-minimal.sh @@ -42,6 +42,13 @@ sudo mkdir -p /volume/postgres/data sudo mkdir -p /volume/spacedeck/storage sudo mkdir -p /volume/spacedeck/db +# KAFKA +sudo mkdir -p /volume/kafka/data + +# COCKROACHDB +sudo mkdir -p /volume/crdb/data + + @@ -58,7 +65,8 @@ docker-compose -f couchdb.yml \ -f rabbitmq.yml \ -f postgresql.yml \ -f mongodb.yml \ - -f spacedeck.yml \ + -f kafka.yml \ + -f cockroachdb.yml \ -f networks.yml \ down @@ -69,7 +77,8 @@ docker-compose -f couchdb.yml \ -f rabbitmq.yml \ -f postgresql.yml \ -f mongodb.yml \ - -f spacedeck.yml \ + -f kafka.yml \ + -f cockroachdb.yml \ -f networks.yml \ up --build $1 diff --git a/test.sh b/test.sh new file mode 100755 index 0000000..e69de29 diff --git a/tools/.keep b/tools/.keep new file mode 100644 index 0000000..e69de29 diff --git a/tools/mockery/.env b/tools/mockery/.env new file mode 100644 index 0000000..e69de29 diff --git a/tools/mockery/Dockerfile b/tools/mockery/Dockerfile new file mode 100644 index 0000000..76eea85 --- /dev/null +++ b/tools/mockery/Dockerfile @@ -0,0 +1 @@ +FROM vektra/mockery \ No newline at end of file