There are two ways to run the application. The first is to setup all dependencies manually. The second is to use docker image and docker compose.
-
Create
.envfileYou can copy the
env.exampleand change its values accordingly$ cp env.example .env -
Fill all env variables with prefix
POSTGRES_according to your PostgreSQL settings -
Run or start PostgreSQL
-
Fill the
REDIS_*envsREDIS_TTLis a Time to Live for a key-value in redis.REDIS_TTL=5means its TTL is 5 minutes -
Run or start Redis
-
Fill
PORT_GRPCandPORT_GRPC_GATEWAYvalue as you wish. We use8080as default value forPORT_GRPCand8081forPORT_GRPC_GATEWAY.PORT_GRPCis a port for HTTP/2 gRPC.PORT_GRPC_GATEWAYis port for HTTP/1.1. We encourage to let both values as default -
Run or start Kafka
-
Download the dependencies
$ make tidy -
It is always good to have your database migration up-to-date. Run the following command to make your database stays up-to-date with the current migrations.
$ make migrate url=<postgres url>e.g:
$ make migrate url="postgres://user:password@host:port/dbname?sslmode=disable"DON'T FORGET to supply/change the
user,password,host,port,dbname, andsslmodeaccording to your database settings. -
Run the application
$ go run cmd/server/main.go
-
Install Docker Compose.
-
Run docker compose
$ docker-compose up -
In another terminal window, download the dependencies for the application
$ make tidy -
Create
.envfileYou can copy the
env.exampleand change its values accordingly$ cp env.example .env -
Run the application
$ go run cmd/server/main.go