Skip to content

Commit

Permalink
Fix docker compose in validate examples (#470)
Browse files Browse the repository at this point in the history
* Fix docker compose in validate examples

* Bump examples

* Fix stuff

* Restart
  • Loading branch information
m110 authored Aug 23, 2024
1 parent 60a158a commit 086ec55
Show file tree
Hide file tree
Showing 46 changed files with 106 additions and 134 deletions.
4 changes: 2 additions & 2 deletions _examples/basic/1-your-first-app/.validate_example.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
validation_cmd: "docker-compose up"
teardown_cmd: "docker-compose down"
validation_cmd: "docker compose up"
teardown_cmd: "docker compose down"
timeout: 180
expected_output: "received event {ID:[0-9]+}"
21 changes: 3 additions & 18 deletions _examples/basic/1-your-first-app/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,18 @@
version: '3'
services:
server:
image: golang:1.21
image: golang:1.23
restart: unless-stopped
depends_on:
- kafka
volumes:
- .:/app
- $GOPATH/pkg/mod:/go/pkg/mod
working_dir: /app
command: go run main.go

zookeeper:
image: confluentinc/cp-zookeeper:7.3.1
logging:
driver: none
restart: unless-stopped
environment:
ZOOKEEPER_CLIENT_PORT: 2181

kafka:
image: confluentinc/cp-kafka:7.3.1
logging:
driver: none
image: bitnami/kafka:3.5.0
restart: unless-stopped
depends_on:
- zookeeper
environment:
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
ALLOW_PLAINTEXT_LISTENER: yes
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
4 changes: 2 additions & 2 deletions _examples/basic/1-your-first-app/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"context"
"encoding/json"
"log"
"fmt"
"time"

"github.com/ThreeDotsLabs/watermill"
Expand Down Expand Up @@ -67,7 +67,7 @@ func main() {
return nil, err
}

log.Printf("received event %+v", consumedPayload)
fmt.Printf("received event %+v\n", consumedPayload)

newPayload, err := json.Marshal(processedEvent{
ProcessedID: consumedPayload.ID,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
validation_cmd: "docker-compose up"
teardown_cmd: "docker-compose down"
validation_cmd: "docker compose up"
teardown_cmd: "docker compose down"
timeout: 180
expected_output: "Adding to feed"
5 changes: 2 additions & 3 deletions _examples/basic/2-realtime-feed/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
version: '3'
services:
producer:
image: golang:1.21
image: golang:1.23
restart: unless-stopped
depends_on:
- kafka
Expand All @@ -12,7 +11,7 @@ services:
command: go run main.go

consumer:
image: golang:1.21
image: golang:1.23
restart: unless-stopped
depends_on:
- kafka
Expand Down
4 changes: 2 additions & 2 deletions _examples/basic/4-metrics/.validate_example.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
validation_cmd: "docker-compose up"
teardown_cmd: "docker-compose down"
validation_cmd: "docker compose up"
teardown_cmd: "docker compose down"
timeout: 180
expected_output: "msg=\"Message acked\""
3 changes: 1 addition & 2 deletions _examples/basic/4-metrics/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
version: '3'
services:
golang:
image: golang:1.21
image: golang:1.23
restart: unless-stopped
ports:
- 8080:8080
Expand Down
4 changes: 2 additions & 2 deletions _examples/basic/5-cqrs-protobuf/.validate_example.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
validation_cmd: "docker-compose up"
teardown_cmd: "docker-compose down"
validation_cmd: "docker compose up"
teardown_cmd: "docker compose down"
timeout: 120
expected_output: "beers ordered to room 3"
5 changes: 2 additions & 3 deletions _examples/basic/5-cqrs-protobuf/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
version: '3'
services:
golang:
image: golang:1.20
image: golang:1.23
restart: unless-stopped
ports:
- 8080:8080
Expand All @@ -17,4 +16,4 @@ services:

rabbitmq:
image: rabbitmq:3.7
restart: unless-stopped
restart: unless-stopped
4 changes: 2 additions & 2 deletions _examples/pubsubs/amqp/.validate_example.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
validation_cmd: "docker-compose up"
teardown_cmd: "docker-compose down"
validation_cmd: "docker compose up"
teardown_cmd: "docker compose down"
timeout: 120
expected_output: "received message: [0-9a-f\\-]+, payload: Hello, world!"
3 changes: 1 addition & 2 deletions _examples/pubsubs/amqp/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
version: '3'
services:
server:
image: golang:1.21
image: golang:1.23
restart: unless-stopped
depends_on:
- rabbitmq
Expand Down
4 changes: 2 additions & 2 deletions _examples/pubsubs/googlecloud/.validate_example.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
validation_cmd: "docker-compose up"
teardown_cmd: "docker-compose down"
validation_cmd: "docker compose up"
teardown_cmd: "docker compose down"
timeout: 180
expected_output: "payload: Hello, world!"
3 changes: 1 addition & 2 deletions _examples/pubsubs/googlecloud/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
version: '3'
services:
server:
image: golang:1.21
image: golang:1.23
restart: unless-stopped
depends_on:
- googlecloud
Expand Down
4 changes: 2 additions & 2 deletions _examples/pubsubs/kafka/.validate_example.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
validation_cmd: "docker-compose up"
teardown_cmd: "docker-compose down"
validation_cmd: "docker compose up"
teardown_cmd: "docker compose down"
timeout: 180
expected_output: "payload: Hello, world!"
3 changes: 1 addition & 2 deletions _examples/pubsubs/kafka/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
version: '3'
services:
server:
image: golang:1.21
image: golang:1.23
restart: unless-stopped
depends_on:
- kafka
Expand Down
4 changes: 2 additions & 2 deletions _examples/pubsubs/nats-core/.validate_example.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
validation_cmd: "docker-compose up"
teardown_cmd: "docker-compose down"
validation_cmd: "docker compose up"
teardown_cmd: "docker compose down"
timeout: 180
expected_output: "payload: Hello, world!"
3 changes: 1 addition & 2 deletions _examples/pubsubs/nats-core/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
version: '3'
services:
server:
image: golang:1.21
image: golang:1.23
restart: unless-stopped
depends_on:
- nats
Expand Down
4 changes: 2 additions & 2 deletions _examples/pubsubs/nats-jetstream/.validate_example.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
validation_cmd: "docker-compose up"
teardown_cmd: "docker-compose down"
validation_cmd: "docker compose up"
teardown_cmd: "docker compose down"
timeout: 180
expected_output: "payload: Hello, world!"
3 changes: 1 addition & 2 deletions _examples/pubsubs/nats-jetstream/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
version: '3'
services:
server:
image: golang:1.21
image: golang:1.23
restart: unless-stopped
depends_on:
- nats
Expand Down
4 changes: 2 additions & 2 deletions _examples/pubsubs/nats-streaming/.validate_example.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
validation_cmd: "docker-compose up"
teardown_cmd: "docker-compose down"
validation_cmd: "docker compose up"
teardown_cmd: "docker compose down"
timeout: 180
expected_output: "payload: Hello, world!"
3 changes: 1 addition & 2 deletions _examples/pubsubs/nats-streaming/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
version: '3'
services:
server:
image: golang:1.21
image: golang:1.23
restart: unless-stopped
depends_on:
- nats-streaming
Expand Down
4 changes: 2 additions & 2 deletions _examples/pubsubs/redisstream/.validate_example.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
validation_cmd: "docker-compose up"
teardown_cmd: "docker-compose down"
validation_cmd: "docker compose up"
teardown_cmd: "docker compose down"
timeout: 180
expected_output: "payload: Hello, world!"
5 changes: 2 additions & 3 deletions _examples/pubsubs/redisstream/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
version: '3'
services:
server:
image: golang:1.21
image: golang:1.23
restart: unless-stopped
depends_on:
- redis
Expand All @@ -15,4 +14,4 @@ services:
image: redis:7
ports:
- 6379:6379
restart: unless-stopped
restart: unless-stopped
4 changes: 2 additions & 2 deletions _examples/pubsubs/sql/.validate_example.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
validation_cmd: "docker-compose up"
teardown_cmd: "docker-compose down"
validation_cmd: "docker compose up"
teardown_cmd: "docker compose down"
timeout: 180
expected_output: "Hello, world!"
3 changes: 1 addition & 2 deletions _examples/pubsubs/sql/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
version: '3'
services:
server:
image: golang:1.20
image: golang:1.23
restart: unless-stopped
depends_on:
- mysql
Expand Down
11 changes: 5 additions & 6 deletions _examples/real-world-examples/consumer-groups/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
version: '3'
services:
api:
image: golang:1.21
image: golang:1.23
restart: unless-stopped
depends_on:
- redis
Expand All @@ -13,7 +12,7 @@ services:
command: go run .

newsletter-1:
image: golang:1.21
image: golang:1.23
restart: unless-stopped
depends_on:
- redis
Expand All @@ -25,7 +24,7 @@ services:
REPLICA: 1

newsletter-2:
image: golang:1.21
image: golang:1.23
restart: unless-stopped
depends_on:
- redis
Expand All @@ -37,7 +36,7 @@ services:
REPLICA: 2

crm-1:
image: golang:1.21
image: golang:1.23
restart: unless-stopped
depends_on:
- redis
Expand All @@ -49,7 +48,7 @@ services:
REPLICA: 1

crm-2:
image: golang:1.21
image: golang:1.23
restart: unless-stopped
depends_on:
- redis
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
version: '3'
services:
server:
image: golang:1.20
image: golang:1.23
restart: unless-stopped
ports:
- 8080:8080
Expand All @@ -12,7 +11,7 @@ services:
command: 'go run .'

worker:
image: golang:1.20
image: golang:1.23
restart: unless-stopped
volumes:
- ./worker:/app
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
validation_cmd: "docker-compose up"
teardown_cmd: "docker-compose down"
validation_cmd: "docker compose up"
teardown_cmd: "docker compose down"
timeout: 180
expected_output: "received event"
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
version: '3'
services:
server:
image: golang:1.20
image: golang:1.23
restart: unless-stopped
depends_on:
- mysql
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
validation_cmd: "docker-compose up"
teardown_cmd: "docker-compose down"
validation_cmd: "docker compose up"
teardown_cmd: "docker compose down"
timeout: 180
expected_output: "Starting handler"
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
version: '3'
services:
golang:
image: golang:1.21
image: golang:1.23
restart: unless-stopped
ports:
- 8080:8080
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
validation_cmd: "docker-compose up"
teardown_cmd: "docker-compose down"
validation_cmd: "docker compose up"
teardown_cmd: "docker compose down"
timeout: 180
expected_output: "POST /foo_or_bar: message"
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
version: '3'
services:
webhooks-server:
image: golang:1.21
image: golang:1.23
restart: unless-stopped
volumes:
- .:/app
Expand All @@ -10,7 +9,7 @@ services:
command: go run main.go

router:
image: golang:1.21
image: golang:1.23
restart: unless-stopped
depends_on:
- kafka
Expand All @@ -21,7 +20,7 @@ services:
command: go run main.go

producer:
image: golang:1.21
image: golang:1.23
restart: unless-stopped
depends_on:
- kafka
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.22 AS builder
FROM golang:1.23 AS builder

COPY . /src
WORKDIR /src/
Expand Down
Loading

0 comments on commit 086ec55

Please sign in to comment.