Skip to content

Commit

Permalink
Merge pull request #4 from meateam/feature/add-index-integration
Browse files Browse the repository at this point in the history
 change listener-service and integrate with Barak's index
  • Loading branch information
nettashviro authored May 20, 2021
2 parents d0346f5 + bf8407e commit a682069
Show file tree
Hide file tree
Showing 32 changed files with 14,674 additions and 983 deletions.
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#build stage
FROM node:10.16.0-alpine AS builder
RUN GRPC_HEALTH_PROBE_VERSION=v0.3.0 && \
wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 && \
chmod +x /bin/grpc_health_probe
WORKDIR /usr/src/app
COPY ["package.json", "package-lock.json*", "./"]
RUN npm install --silent && cp -r node_modules ../
Expand All @@ -8,7 +11,9 @@ RUN npm run build

FROM node:10.16.0-alpine
COPY --from=builder /usr/src/app/package.json /usr/src/app/package-lock.json ./
COPY --from=builder /bin/grpc_health_probe /bin/grpc_health_probe
COPY --from=builder /usr/src/app/dist /dist
COPY --from=builder /usr/src/app/proto /proto
COPY --from=builder /usr/src/app/node_modules /node_modules
LABEL Name=listener-service Version=0.0.1
EXPOSE 3000
Expand Down
9 changes: 6 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,39 @@ services:
- mongo2
- mongo3
- rabbitmq

rabbitmq:
image: rabbitmq:3-management-alpine
container_name: rabbitmq
ports:
- 5672:5672
- 15672:15672

# The mongo replicaSet. to initiate, run rs.initiate() on one of the containers.
# To run the service locally, run `sudo nano /etc/hosts` and add mongo1,2,3 as localhost
mongo1:
hostname: mongo1
container_name: mongo1
image: mongo:4.0-xenial
image: mongo:4.4
ports:
- 27017:27017
restart: always
entrypoint: [ "/usr/bin/mongod", "--bind_ip_all", "--replSet", "rs0" ]
mongo2:
hostname: mongo2
container_name: mongo2
image: mongo:4.0-xenial
image: mongo:4.4
ports:
- 27018:27017
restart: always
entrypoint: [ "/usr/bin/mongod", "--bind_ip_all", "--replSet", "rs0" ]
mongo3:
hostname: mongo3
container_name: mongo3
image: mongo:4.0-xenial
image: mongo:4.4
ports:
- 27019:27017
restart: always
entrypoint: [ "/usr/bin/mongod", "--bind_ip_all", "--replSet", "rs0" ]


30 changes: 30 additions & 0 deletions generate-proto.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
# run the script after `npm i` using:
# > ./generate-proto.sh permission
# common problem with solution: https://github.com/grpc/grpc-node/issues/1014

PROTO_IMPORT_DIR="./proto/$1"
GEN_OUT_DIR="./proto/$1/generated"

# Create the generated output dir if it doesn't exist
if [ ! -d "$GEN_OUT_DIR" ]; then
mkdir -p ${GEN_OUT_DIR}
fi

FILE_PATHS="./proto/$1/*.proto"

# Generate JavaScript
./node_modules/.bin/grpc_tools_node_protoc \
--js_out=import_style=commonjs,binary:${GEN_OUT_DIR} \
--grpc_out=${GEN_OUT_DIR} \
--plugin=protoc-gen-grpc=`which ./node_modules/.bin/grpc_tools_node_protoc_plugin` \
-I ${PROTO_IMPORT_DIR} \
${FILE_PATHS}


# Generate TypeScript definitions
./node_modules/.bin/grpc_tools_node_protoc \
--plugin=protoc-gen-ts=./node_modules/.bin/protoc-gen-ts \
--ts_out=${GEN_OUT_DIR} \
-I ${PROTO_IMPORT_DIR} \
${FILE_PATHS}
Loading

0 comments on commit a682069

Please sign in to comment.