Merge branch 'master' into gRPC-endpoints
This commit is contained in:
commit
94a68a6db1
22
Makefile
22
Makefile
@ -1,18 +1,18 @@
|
||||
DB_URL=postgresql://root:secret@localhost:5432/df?sslmode=disable
|
||||
|
||||
reset_docker:
|
||||
docker rm -vf df
|
||||
docker rmi -f df
|
||||
docker rm -vf postgres
|
||||
docker rmi -f postgres
|
||||
docker rm -vf migrate
|
||||
-docker rm -vf df
|
||||
-docker rmi -f df
|
||||
-docker rm -vf postgres
|
||||
-docker rmi -f postgres
|
||||
-docker rm -vf migrate
|
||||
|
||||
backend_build:
|
||||
make network
|
||||
make postgres
|
||||
docker rm -vf df
|
||||
docker rmi -f df:latest
|
||||
docker rmi -f docker.io/library/golang:1.21-alpine3.18
|
||||
make network;
|
||||
make postgres;
|
||||
-docker rm -vf df;
|
||||
-docker rmi -f df:latest;
|
||||
-docker rmi -f docker.io/library/golang:1.21-alpine3.18
|
||||
docker build -t df:latest -f bff/Dockerfile
|
||||
docker exec -it postgres createdb --username=root --owner=root df
|
||||
docker run --name migrateup --rm --privileged=true -v $(PWD)/bff/db/migration:/migrations --network host migrate/migrate -path=/migrations/ -database $(DB_URL) up
|
||||
@ -30,7 +30,7 @@ dev:
|
||||
make migrateup
|
||||
|
||||
network:
|
||||
docker network create df-network
|
||||
-docker network create df-network
|
||||
|
||||
postgres:
|
||||
docker start postgres || docker run --name postgres -p 5432:5432 -e POSTGRES_USER=root -e POSTGRES_PASSWORD=secret --network df-network -d postgres:15-alpine
|
||||
|
23
README.md
23
README.md
@ -3,18 +3,16 @@
|
||||
To first run the application in your local environment you can use
|
||||
|
||||
```
|
||||
# First: (re-)build the app image including migration
|
||||
make backend_build
|
||||
# In the root directory
|
||||
docker-compose -f ./bff/docker-compose.yaml -p df-bff up -d
|
||||
|
||||
# In bff directory
|
||||
docker-compose -p df-bff up -d
|
||||
|
||||
# Second: run the db and the app as docker containers
|
||||
# Using `make`
|
||||
make backend
|
||||
```
|
||||
|
||||
or run those commands, listed in ```Makefile```, ***manually*** with your terminal in the repository root directory.
|
||||
|
||||
**Important**: The docker commands were tested on *fedora*. On *Windows* some commands might differ or do not work at all. E. g. `make migrateup`.
|
||||
That is due to the fact that on *Windows* the parameters `--privileged=true` and `--network host` do not exist or are handled differently.
|
||||
|
||||
# Prerequisites
|
||||
|
||||
To create a local development environment you need some tools.
|
||||
@ -74,11 +72,10 @@ Should you want to make changes you need further tools.
|
||||
- [evans](https://github.com/ktr0731/evans): For testing gRPC endpoints
|
||||
- [protoc](https://grpc.io/docs/protoc-installation/): For generating code from `.proto`-files (gRPC)
|
||||
- *plugins*:```
|
||||
go install \
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway \
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2 \
|
||||
google.golang.org/protobuf/cmd/protoc-gen-go \
|
||||
google.golang.org/grpc/cmd/protoc-gen-go-grpc
|
||||
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway@latest
|
||||
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@latest
|
||||
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
|
||||
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
|
||||
```
|
||||
|
||||
**Important**: If you install `protoc` on *fedora* you will need an additional package to make it work. Use the following command for setup:
|
||||
|
Loading…
x
Reference in New Issue
Block a user