Skip to content

Commit

Permalink
Merge pull request #308 from nevenas-mit/reviewservice
Browse files Browse the repository at this point in the history
add Review Service
  • Loading branch information
cdelimitrou authored Dec 7, 2023
2 parents 25ccc81 + bec0d1b commit c2fcb17
Show file tree
Hide file tree
Showing 1,513 changed files with 143,050 additions and 397,869 deletions.
Binary file added hotelReservation/Docker/._.DS_Store
Binary file not shown.
8 changes: 8 additions & 0 deletions hotelReservation/Docker/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmd/*/data
cmd/api/api
cmd/auth/auth
cmd/geo/geo
cmd/profile/profile
cmd/rate/rate
cmd/www/www
cmd/search/search
41 changes: 11 additions & 30 deletions hotelReservation/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,11 @@
FROM golang:1.21 as builder

WORKDIR /workspace

COPY go.sum go.sum
COPY go.mod go.mod
COPY vendor/ vendor/

COPY cmd/ cmd/
COPY dialer/ dialer/
COPY registry/ registry/
COPY services/ services/
COPY tls/ tls/
COPY tracing/ tracing/
COPY tune/ tune/

RUN CGO_ENABLED=0 GOOS=linux GO111MODULE=on go install -ldflags="-s -w" -mod=vendor ./cmd/...

FROM gcr.io/distroless/static:nonroot

WORKDIR /

COPY --from=builder /go/bin/frontend .
COPY --from=builder /go/bin/geo .
COPY --from=builder /go/bin/profile .
COPY --from=builder /go/bin/rate .
COPY --from=builder /go/bin/recommendation .
COPY --from=builder /go/bin/reservation .
COPY --from=builder /go/bin/search .
COPY --from=builder /go/bin/user .
FROM golang:1.17.3

RUN git config --global http.sslverify false
COPY . /go/src/github.com/harlow/go-micro-services
WORKDIR /go/src/github.com/harlow/go-micro-services
RUN go get gopkg.in/mgo.v2
RUN go get github.com/bradfitz/gomemcache/memcache
RUN go get github.com/google/uuid
RUN go mod init
RUN go mod vendor
RUN go install -ldflags="-s -w" ./cmd/...
194 changes: 194 additions & 0 deletions hotelReservation/Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

58 changes: 58 additions & 0 deletions hotelReservation/Gopkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Gopkg.toml example
#
# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
#
# [prune]
# non-go = false
# go-tests = true
# unused-packages = true


[[constraint]]
name = "github.com/golang/protobuf"
version = "1.5.3"

[[constraint]]
branch = "master"
name = "github.com/hailocab/go-geoindex"

[[constraint]]
name = "github.com/opentracing/opentracing-go"
version = "1.0.2"

[[constraint]]
name = "github.com/uber/jaeger-client-go"
version = "2.11.2"

[[constraint]]
name = "github.com/uber/jaeger-lib"
version = "1.4.0"

[[constraint]]
branch = "master"
name = "golang.org/x/net"

[[constraint]]
name = "google.golang.org/grpc"
version = "1.10.0"

[prune]
go-tests = true
unused-packages = true
25 changes: 6 additions & 19 deletions hotelReservation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Supported actions:
- luarocks (apt-get install luarocks)
- luasocket (luarocks install luasocket)

## Running the hotel reservation application
## Running the social network application
### Before you start
- Install Docker and Docker Compose.
- Make sure exposed ports in docker-compose files are available
Expand All @@ -29,24 +29,11 @@ Supported actions:

### Running the containers
##### Docker-compose
Start docker containers by running `docker-compose up -d`. All images will be pulled from Docker Hub.
- NOTLS: Start docker containers by running `docker-compose up -d`. All images will be pulled from Docker Hub.
- TLS: Start docker containers by running `TLS=1 docker-compose up -d`. All the gRPC communications will be protected by TLS.
- TLS with spcified ciphersuite: Start docker containers by running `TLS=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 docker-compose up -d`. The available cipher suite can be find at the file [options.go](tls/options.go#L21).

The workload itself can be configured using optional enviroment variables. The avaialbe configuration items are:

- TLS: Environment variable TLS controls the TLS enablement of gRPC and HTTP communications of the microservices in hotelReservation.
- TLS=0 or not set(default): No TLS enabled for gRPC and HTTP communication.
- TLS=1: All the gRPC and HTTP communications will be protected by TLS, e.g. `TLS=1 docker-compose up -d`.
- TLS=<ciphersuite>: Use specified ciphersuite for TLS, e.g. `TLS=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 docker-compose up -d`. The avaialbe cipher suite can be found at the file [options.go](tls/options.go#L21).

- GC: Environment variable GC controls the garbage collection target percentage of Golang runtime. The default value is 100. See [golang doc](https://pkg.go.dev/runtime/debug#SetGCPercent) for details.

- JAEGER_SAMPLE_RATIO: Environment variable JAEGER_SAMPLE_RATIO controls the ratio of requests to be traced Jaeger. Default is 0.01(1%).

- MEMC_TIMEOUT: Environment variable MEMC_TIMEOUT controls the timeout value in seconds when communicating with memcached. Default is 2 seconds. We may need to increase this value in case of very high work loads.

- LOG_LEVEL: Environment variable LOG_LEVEL controls the log verbosity. Valid values are: ERROR, WARNING, INFO, TRACE, DEBUG. Default value is INFO.

Users may run `docker-compose logs <service>` to check the corresponding configurations.
Check if TLS is enabled or not: `docker-compose logs <service> | grep TLS`.

##### Openshift
Read the Readme file in Openshift directory.
Expand All @@ -56,7 +43,7 @@ Read the Readme file in Kubernetes directory.

#### workload generation
```bash
../wrk2/wrk -D exp -t <num-threads> -c <num-conns> -d <duration> -L -s ./wrk2/scripts/hotel-reservation/mixed-workload_type_1.lua http://x.x.x.x:5000 -R <reqs-per-sec>
./wrk2/wrk -D exp -t <num-threads> -c <num-conns> -d <duration> -L -s ./wrk2/scripts/hotel-reservation/mixed-workload_type_1.lua http://x.x.x.x:5000 -R <reqs-per-sec>
```

### Questions and contact
Expand Down
Loading

0 comments on commit c2fcb17

Please sign in to comment.