Skip to content

Commit 28ed82f

Browse files
Services (#23)
* Two separate microservices. Lots of refactoring. Still broken * Compiled protos * grpc + kontext packages * Update README 📚 * Add postgres to Docker-Compose file * Dependencies * sqlboiler models * User API * Implement persistence layer functions * README * Connect to Users service * Refactor directories * Add Compose file entry for go-sqlboiler-user-api * gRPC call works * JAEGER_SERVICE_NAME * Bump deps
1 parent 9e11fb5 commit 28ed82f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+378
-282
lines changed

api/Makefile

+10-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ all:
2222
start:
2323
@env \
2424
GO111MODULE=${GO111MODULE} \
25+
JAEGER_SERVICE_NAME=todo-api \
2526
go run main.go
2627

27-
include makefiles/*.mk
28+
.PHONY: dc-start
29+
dc-start:
30+
docker-compose up -d
31+
32+
.PHONY: dc-stop
33+
dc-stop:
34+
docker-compose stop
35+
36+
include makefiles/*.mk

api/README.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
# api
22

3+
If you're using an editor like VSCode or JetBrains, it's best to open the individual APIs as separate projects,
4+
since I wanted to avoid the complexity that comes with using a parent go.mod file.
5+
36
## Getting started
47
Running
58
```
69
docker-compose up -d
710
```
8-
should spin up the dependencies: Jaeger, Redis, Dgraph.
11+
should spin up the dependencies: Jaeger, Redis, Postgres, Meilisearch, and Dgraph.
912

1013
Then running
1114
```
@@ -40,4 +43,4 @@ This is a Go-based back-end using:
4043
* [rs/zerolog](https://github.com/rs/zerolog) for performant structured logging
4144
* [spf13/pflag](https://github.com/spf13/pflag) and [spf13/viper](https://github.com/spf13/viper) for config binding
4245
* [otel](https://go.opentelemetry.io/otel) for [OpenTelemetry](https://opentelemetry.io/)
43-
* [go-ozzo/ozzo-validation](https://github.com/go-ozzo/ozzo-validation) for struct validation
46+
* [go-ozzo/ozzo-validation](https://github.com/go-ozzo/ozzo-validation) for struct validation

api/db/Dockerfile-sqlboiler

-9
This file was deleted.

api/db/migrations/20200906103403_init.down.sql

-1
This file was deleted.

api/db/migrations/20200906103403_init.up.sql

-6
This file was deleted.

api/db/sqlboiler.toml

-8
This file was deleted.

api/docker-compose.yml

+25-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
version: '3.7'
22

33
services:
4+
users:
5+
image: kevinmichaelchen/go-sqlboiler-user-api:latest
6+
ports:
7+
- 8086:8084
8+
depends_on:
9+
- postgres
10+
- redis
11+
- jaeger
12+
environment:
13+
JAEGER_SERVICE_NAME: users-api
14+
415
meilisearch:
516
image: getmeili/meilisearch:latest
617
environment:
@@ -38,6 +49,19 @@ services:
3849
volumes:
3950
- dgraphdata:/dgraph
4051

52+
postgres:
53+
image: postgres
54+
restart: always
55+
environment:
56+
POSTGRES_USER: myorg
57+
POSTGRES_PASSWORD: myorg
58+
POSTGRES_DB: myorg
59+
volumes:
60+
- pgdata:/var/lib/postgresql/data
61+
ports:
62+
- 5432:5432
63+
4164
volumes:
4265
dgraphdata:
43-
meilisearchdata:
66+
meilisearchdata:
67+
pgdata:

api/go.mod

+12-14
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,31 @@
1-
module github.com/MyOrg/go-dgraph-starter
1+
module github.com/MyOrg/todo-api
22

33
go 1.15
44

55
require (
6-
github.com/dgraph-io/dgo/v200 v200.0.0-20210212152539-e0a5bde40ba2
6+
github.com/dgraph-io/dgo/v200 v200.0.0-20210308191403-7844be8b0a6a
77
github.com/go-ozzo/ozzo-validation/v4 v4.3.0
88
github.com/go-redis/cache/v8 v8.3.1
9-
github.com/go-redis/redis/v8 v8.6.0
10-
github.com/golang/protobuf v1.4.3
9+
github.com/go-redis/redis/v8 v8.8.0
10+
github.com/golang/protobuf v1.5.1
1111
github.com/gorilla/handlers v1.5.1
1212
github.com/gorilla/mux v1.8.0
1313
github.com/graphql-go/graphql v0.7.9
1414
github.com/graphql-go/handler v0.2.3
1515
github.com/grpc-ecosystem/go-grpc-middleware/providers/zerolog/v2 v2.0.0-rc.2
1616
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.0.0-rc.2
17+
github.com/kevinmichaelchen/go-sqlboiler-user-api v0.0.0-20210324192557-384ef88dd265
1718
github.com/meilisearch/meilisearch-go v0.14.1
1819
github.com/rs/xid v1.2.1
19-
github.com/rs/zerolog v1.20.0
20+
github.com/rs/zerolog v1.21.0
2021
github.com/smartystreets/goconvey v1.6.4
21-
github.com/spf13/cast v1.3.1 // indirect
2222
github.com/spf13/pflag v1.0.5
2323
github.com/spf13/viper v1.7.1
24-
github.com/stretchr/objx v0.2.0 // indirect
25-
go.opentelemetry.io/otel v0.17.0
26-
go.opentelemetry.io/otel/exporters/trace/jaeger v0.17.0
27-
go.opentelemetry.io/otel/sdk v0.17.0
28-
go.opentelemetry.io/otel/trace v0.17.0
29-
google.golang.org/genproto v0.0.0-20210226172003-ab064af71705
24+
go.opentelemetry.io/otel v0.19.0
25+
go.opentelemetry.io/otel/exporters/trace/jaeger v0.19.0
26+
go.opentelemetry.io/otel/sdk v0.19.0
27+
go.opentelemetry.io/otel/trace v0.19.0
28+
google.golang.org/genproto v0.0.0-20210325141258-5636347f2b14
3029
google.golang.org/grpc v1.36.0
31-
google.golang.org/protobuf v1.25.0
32-
gopkg.in/yaml.v2 v2.4.0 // indirect
30+
google.golang.org/protobuf v1.26.0
3331
)

0 commit comments

Comments
 (0)