Answer the question
In order to leave comments, you need to log in
Docker compose does not start, writes that the page is not available, how to fix it?
I access this path localhost:8081/api/v1/clients
version: '3.3'
services:
db-enterprise:
image: pryby/db:latest
networks:
- enterprise-network
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=root
- POSTGRES_DB=enterprise
ports:
- 5432:5432
container_name: db-enterprise
backend:
image: pryby/backend:latest
ports:
- 8080:8080
container_name: backend
environment:
- LISTEN=0.0.0.0:8080
- DB_USERS_HOST=db-enterprise
- DB_USERS_PORT=5432
- DB_USERS_USER=postgres
- DB_USERS_DBNAME=enterprise
- DB_USERS_PASSWORD=root
- DB_USERS_SSL=disable
depends_on:
- db-enterprise
networks:
- enterprise-network
gateway:
image: pryby/client:latest
ports:
- 8081:8081
container_name: gateway
depends_on:
- backend
environment:
- backend=backend:8080
- LISTEN=0.0.0.0:8081
networks:
- enterprise-network
networks:
enterprise-network:
name: enterprise-network
conn, err := grpc.Dial("localhost:8080", grpc.WithInsecure(), grpc.WithBlock())
if err != nil {
log.Fatal(err)
}
defer conn.Close()
grpcMux := runtime.NewServeMux()
api.RegisterAllServiceHandler(context.Background(), grpcMux, conn)
log.Fatal(http.ListenAndServe("localhost:8081", grpcMux))
ctx := context.Background()
ctx, error := context.WithCancel(ctx)
ctx, error = context.WithTimeout(ctx, time.Second*30)
if error != nil {
log.Println(error)
}
listener, err := net.Listen("tcp", ":8080")
if err != nil {
log.Fatal(err)
}
server := grpc.NewServer()
conn, err := connectToDbWithTimeout(ctx)
if err != nil {
log.Fatal(err)
}
api.RegisterAllServices(server, conn)
if err = server.Serve(listener); err != nil {
log.Fatal(err)
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question