Skip to content

Commit

Permalink
Merge pull request #7 from JordanPawlett/enforce-database-per-service…
Browse files Browse the repository at this point in the history
…-architecture

Enforce database per service architecture
  • Loading branch information
JordanPawlett authored Jun 13, 2020
2 parents 60460a2 + 25e1656 commit eed4926
Show file tree
Hide file tree
Showing 35 changed files with 281 additions and 37 deletions.
1 change: 0 additions & 1 deletion config/base-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ metadata:
data:
NODE_ENV: development
TRANSPORTER_URI: nats://nats-client.default.svc.cluster.local:4222
MONGO_URI: mongodb://mongo-mongodb.default.svc.cluster.local:27017
REDIS_HOST: redis-master.default.svc.cluster.local
REDIS_PORT: "6379"
1 change: 1 addition & 0 deletions services/admin-gateway-service/dev.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ WORKDIR /home/service/admin-gateway-service
COPY ./package.json ./
RUN yarn
COPY . .
ENV NODE_ENV=development
CMD yarn run dev
2 changes: 1 addition & 1 deletion services/admin-gateway-service/k8s-pod.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
Expand Down
2 changes: 1 addition & 1 deletion services/admin-gateway-service/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ const broker = new ServiceBroker({
metrics: false,
cacher: {
type: 'Redis',
prefix: 'ADMIN-MOL',
options: {
prefix: 'ADMIN-MOL',
redis: {
host: process.env.REDIS_HOST,
port: process.env.REDIS_PORT,
Expand Down
1 change: 1 addition & 0 deletions services/cards-service/dev.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ WORKDIR /home/service/cards-service
COPY ./package.json ./
RUN yarn
COPY . .
ENV NODE_ENV=development
CMD yarn run dev
4 changes: 3 additions & 1 deletion services/cards-service/k8s-pod.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
Expand Down Expand Up @@ -32,4 +32,6 @@ spec:
env:
- name: PORT
value: "80"
- name: MONGO_URI
value: mongodb://cards-mongo-mongodb.default.svc.cluster.local:27017
restartPolicy: Always
2 changes: 1 addition & 1 deletion services/cards-service/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ const broker = new ServiceBroker({
metrics: false,
cacher: {
type: 'Redis',
prefix: 'CARDS-MOL',
options: {
prefix: 'CARDS-MOL',
redis: {
host: process.env.REDIS_HOST,
port: process.env.REDIS_PORT,
Expand Down
3 changes: 2 additions & 1 deletion services/clients-service/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ Dockerfile*
docker-compose*
.dockerignore
.git
.gitignore
.gitignore
src/clean-up.js
3 changes: 2 additions & 1 deletion services/clients-service/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ package-lock.json
build
node_modules
data
/src/auth.json
/src/auth.json
src/clean-up.js
1 change: 1 addition & 0 deletions services/clients-service/dev.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ WORKDIR /home/service/clients-service
COPY ./package.json ./
RUN yarn
COPY . .
ENV NODE_ENV=development
CMD yarn run dev
4 changes: 3 additions & 1 deletion services/clients-service/k8s-pod.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
Expand Down Expand Up @@ -32,6 +32,8 @@ spec:
env:
- name: PORT
value: "80"
- name: MONGO_URI
value: mongodb://clients-mongo-mongodb.default.svc.cluster.local:27017
- name: JWT_SECRET
valueFrom:
secretKeyRef:
Expand Down
4 changes: 2 additions & 2 deletions services/clients-service/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ const broker = new ServiceBroker({
logLevel: 'info',
logFormatter: 'short',
metrics: false,
cacher: {
cacher: {
type: 'Redis',
prefix: 'CLIENTS-MOL',
options: {
prefix: 'CLIENTS-MOL',
redis: {
host: process.env.REDIS_HOST,
port: process.env.REDIS_PORT,
Expand Down
1 change: 1 addition & 0 deletions services/decks-service/dev.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ WORKDIR /home/service/decks-service
COPY ./package.json ./
RUN yarn
COPY . .
ENV NODE_ENV=development
CMD yarn run dev
4 changes: 3 additions & 1 deletion services/decks-service/k8s-pod.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
Expand Down Expand Up @@ -32,4 +32,6 @@ spec:
env:
- name: PORT
value: "80"
- name: MONGO_URI
value: mongodb://decks-mongo-mongodb.default.svc.cluster.local:27017
restartPolicy: Always
4 changes: 2 additions & 2 deletions services/decks-service/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ const broker = new ServiceBroker({
logLevel: 'info',
logFormatter: 'short',
metrics: false,
cacher: {
cacher: {
type: 'Redis',
prefix: 'DECKS-MOL',
options: {
prefix: 'DECKS-MOL',
redis: {
host: process.env.REDIS_HOST,
port: process.env.REDIS_PORT,
Expand Down
4 changes: 3 additions & 1 deletion services/games-service/k8s-pod.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
Expand Down Expand Up @@ -32,4 +32,6 @@ spec:
env:
- name: PORT
value: "80"
- name: MONGO_URI
value: mongodb://games-mongo-mongodb.default.svc.cluster.local:27017
restartPolicy: Always
2 changes: 1 addition & 1 deletion services/games-service/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ const broker = new ServiceBroker({
metrics: false,
cacher: {
type: 'Redis',
prefix: 'GAMES-MOL',
options: {
prefix: 'GAMES-MOL',
redis: {
host: process.env.REDIS_HOST,
port: process.env.REDIS_PORT,
Expand Down
2 changes: 1 addition & 1 deletion services/nginx/k8s-pod.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
Expand Down
1 change: 1 addition & 0 deletions services/rooms-service/dev.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ WORKDIR /home/service/rooms-service
COPY ./package.json ./
RUN yarn
COPY . .
ENV NODE_ENV=development
CMD yarn run dev
4 changes: 3 additions & 1 deletion services/rooms-service/k8s-pod.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
Expand Down Expand Up @@ -32,4 +32,6 @@ spec:
env:
- name: PORT
value: "80"
- name: MONGO_URI
value: mongodb://rooms-mongo-mongodb.default.svc.cluster.local:27017
restartPolicy: Always
4 changes: 2 additions & 2 deletions services/rooms-service/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ const broker = new ServiceBroker({
logLevel: 'info',
logFormatter: 'short',
metrics: false,
cacher: {
cacher: {
type: 'Redis',
prefix: 'ROOMS-MOL',
options: {
prefix: 'ROOMS-MOL',
redis: {
host: process.env.REDIS_HOST,
port: process.env.REDIS_PORT,
Expand Down
1 change: 1 addition & 0 deletions services/web-gateway-service/dev.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ WORKDIR /home/service/web-gateway-service
COPY ./package.json ./
RUN yarn
COPY . .
ENV NODE_ENV=development
CMD yarn run dev
2 changes: 1 addition & 1 deletion services/web-gateway-service/k8s-pod.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
Expand Down
4 changes: 2 additions & 2 deletions services/web-gateway-service/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ const broker = new ServiceBroker({
logLevel: 'info',
logFormatter: 'short',
metrics: false,
cacher: {
cacher: {
type: 'Redis',
prefix: 'WEB-G-MOL',
options: {
prefix: 'WEB-G-MOL',
redis: {
host: process.env.REDIS_HOST,
port: process.env.REDIS_PORT,
Expand Down
1 change: 1 addition & 0 deletions services/websocket-gateway-service/dev.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ WORKDIR /home/service/websocket-gateway-service
COPY ./package.json ./
RUN yarn
COPY . .
ENV NODE_ENV=development
CMD yarn run dev
2 changes: 1 addition & 1 deletion services/websocket-gateway-service/k8s-pod.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
Expand Down
2 changes: 1 addition & 1 deletion services/websocket-gateway-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"moleculer-web": "^0.9.1",
"nats": "^1.4.0",
"socket.io": "^2.3.0",
"socket.io-redis": "^5.2.0"
"socket.io-redis": "^5.3.0"
},
"engines": {
"node": ">= 8.x.x"
Expand Down
Loading

0 comments on commit eed4926

Please sign in to comment.