Skip to content

Commit

Permalink
refactor: ♻️ some refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
mehdihadeli committed Jul 27, 2023
1 parent dfc801d commit 66db289
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 32 deletions.
62 changes: 31 additions & 31 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,40 @@ name: CI

on:
push:
branches: [ "main", "develop" ]
branches: ["main", "develop"]
pull_request:
branches: [ "main", "develop" ]
branches: ["main", "develop"]

jobs:

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19

# https://pkg.go.dev/cmd/go#hdr-Compile_packages_and_dependencies
# https://pkg.go.dev/cmd/go#hdr-Package_lists_and_patterns
- name: Build
run: go build.sh -v ./...

# https://go.dev/doc/articles/race_detector
# https://dev.to/s0xzwasd/run-tests-with-race-flag-in-goland-512j
- name: Building-Blocks Tests
run: go test -v ./... -race

- name: Catalogs Write Service Tests
working-directory: ./services/catalogs_write/catalogs_write
run: go test -v ./... -race

- name: Catalogs Read Service Tests
working-directory: ./services/catalogs_write/catalogs_read
run: go test -v ./... -race

- name: Order Service Tests
working-directory: ./services/orders
run: go test -v ./... -race
- uses: actions/checkout@v3

# https://github.com/actions/setup-go/issues/326
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.20.x

# https://pkg.go.dev/cmd/go#hdr-Compile_packages_and_dependencies
# https://pkg.go.dev/cmd/go#hdr-Package_lists_and_patterns
- name: Build
run: go build -v ./...

# https://go.dev/doc/articles/race_detector
# https://dev.to/s0xzwasd/run-tests-with-race-flag-in-goland-512j
- name: Building-Blocks Tests
run: go test -v ./... -race

- name: Catalogs Write Service Tests
working-directory: ./services/catalogs_write/catalogs_write
run: go test -v ./... -race

- name: Catalogs Read Service Tests
working-directory: ./services/catalogs_write/catalogs_read
run: go test -v ./... -race

- name: Order Service Tests
working-directory: ./services/orders
run: go test -v ./... -race
16 changes: 15 additions & 1 deletion deployments/docker-compose/docker-compose.infrastructure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ services:
rabbitmq:
image: rabbitmq:management
container_name: rabbitmq
pull_policy: if_not_present
restart: on-failure
ports:
- ${RABBITMQ_HOST_PORT:-5672}:${RABBITMQ_PORT:-5672}
Expand All @@ -16,6 +17,7 @@ services:

prometheus:
image: prom/prometheus:latest
pull_policy: if_not_present
container_name: prometheus
restart: on-failure
user: root
Expand All @@ -30,6 +32,7 @@ services:

node_exporter:
container_name: node_exporter
pull_policy: if_not_present
restart: on-failure
image: prom/node-exporter
ports:
Expand All @@ -39,6 +42,7 @@ services:

grafana:
container_name: grafana
pull_policy: if_not_present
restart: on-failure
image: grafana/grafana
ports:
Expand All @@ -48,6 +52,7 @@ services:

postgres:
image: postgres:latest
pull_policy: if_not_present
container_name: postgres
restart: on-failure
ports:
Expand All @@ -59,8 +64,11 @@ services:
networks:
- store

# https://developer.redis.com/howtos/quick-start
# redis-stack is a image with redis modules enabled like JSON module
redis:
image: redis:latest
image: redis/redis-stack:latest
pull_policy: if_not_present
restart: on-failure
container_name: redis
ports:
Expand Down Expand Up @@ -124,6 +132,7 @@ services:

mongo:
image: mongo
pull_policy: if_not_present
container_name: mongo
restart: on-failure
# https://docs.docker.com/compose/environment-variables/env-file/#parameter-expansion
Expand All @@ -137,6 +146,7 @@ services:

jaeger:
container_name: jaeger
pull_policy: if_not_present
restart: on-failure
image: jaegertracing/all-in-one:latest
ports:
Expand All @@ -148,6 +158,7 @@ services:

zipkin:
image: openzipkin/zipkin:latest
pull_policy: if_not_present
restart: on-failure
container_name: zipkin
ports:
Expand All @@ -157,6 +168,7 @@ services:

otel-collector:
image: otel/opentelemetry-collector-contrib-dev:latest
pull_policy: if_not_present
command: ["--config=/etc/otel-collector-config.yaml", ""]
volumes:
- ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
Expand All @@ -176,8 +188,10 @@ services:
# https://developers.eventstore.com/server/v21.10/installation.html#insecure-single-node
# https://hub.docker.com/r/eventstore/eventstore/tags
# https://stackoverflow.com/questions/65272764/ports-are-not-available-listen-tcp-0-0-0-0-50070-bind-an-attempt-was-made-to
# EVENTSTORE_MEM_DB=true, it tells the EventStoreDB container to use an in-memory database, which means that any data stored in EventStoreDB will not be persisted between container restarts. Once the container is stopped or restarted, all data will be lost.
eventstore:
image: eventstore/eventstore:latest
pull_policy: if_not_present
container_name: eventstore
restart: on-failure
environment:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,13 @@ func (g *eventstoredbTestContainers) getRunOptions(
ExposedPorts: g.defaultOptions.Ports,
WaitingFor: wait.ForListeningPort(nat.Port(g.defaultOptions.Ports[0])),
Hostname: g.defaultOptions.Host,
// we use `EVENTSTORE_IN_MEM` for use eventstoredb in-memory mode in tests
Env: map[string]string{
"EVENTSTORE_START_STANDARD_PROJECTIONS": "false",
"EVENTSTORE_INSECURE": "true",
"EVENTSTORE_ENABLE_EXTERNAL_TCP": "true",
"EVENTSTORE_ENABLE_ATOM_PUB_OVER_HTTP": "true",
//"EVENTSTORE_IN_MEM": "true",
},
}

Expand Down

0 comments on commit 66db289

Please sign in to comment.