Skip to content

Commit

Permalink
feat: docker orchestration
Browse files Browse the repository at this point in the history
  • Loading branch information
omar-besbes committed Feb 29, 2024
1 parent 4f210d7 commit 4c0273e
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ WORKDIR /app
COPY --from=build /app/dist dist
COPY --from=build /app/node_modules node_modules

# To avoid
# To avoid string interpolation in CMD instruction
RUN ln -vs dist/apps/${OFFICE_TYPE}/main.js main.js

CMD ["node", "main.js"]
37 changes: 37 additions & 0 deletions orchestration/branch-office/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: bo-deployment
spec:
selector:
matchLabels:
app: branch-office
db: branch-office-db
replicas: 3 # tells deployment to run 3 pod matching the template
template:
metadata:
labels:
app: branch-office
db: branch-office-db
spec:
containers:
- name: bo
image: special
- name: db
image: postgres:16
restartPolicy: on-failure
command: [ "/usr/local/bin/database_entrypoint.sh" ]
env:
- name: POSTGRES_PASSWORD
value: /run/secrets/db_password
- name: POSTGRES_USER
value: /run/secrets/db_username
- name: POSTGRES_DB
value: db
volumeMounts:
- name: ssl
mountPath: /ssl
readOnly: true
volumes:
- name: ssl

37 changes: 37 additions & 0 deletions orchestration/head-office/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: ho-deployment
spec:
selector:
matchLabels:
app: head-office
db: head-office-db
replicas: 1 # tells deployment to run 1 pod matching the template
template:
metadata:
labels:
app: head-office
db: head-office-db
spec:
containers:
- name: ho
image: special
- name: db
image: postgres:16
restartPolicy: on-failure
command: ["/usr/local/bin/database_entrypoint.sh"]
env:
- name: POSTGRES_PASSWORD
value: /run/secrets/db_password
- name: POSTGRES_USER
value: /run/secrets/db_username
- name: POSTGRES_DB
value: db
volumeMounts:
- name: ssl
mountPath: /ssl
readOnly: true
volumes:
- name: ssl

8 changes: 8 additions & 0 deletions orchestration/head-office/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

secretGenerator:
- name: postgres-secrets
files:
- db_password.txt
- db_username.txt
35 changes: 35 additions & 0 deletions orchestration/rabbitmq/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: ho-deployment
spec:
selector:
matchLabels:
app: head-office
db: head-office-db
replicas: 1 # tells deployment to run 1 pod matching the template
template:
metadata:
labels:
app: head-office
db: head-office-db
spec:
containers:
- name: ho
image: special
- name: db
image: postgres:16
command: ["/usr/local/bin/database_entrypoint.sh"]
env:
- name: POSTGRES_PASSWORD
value: /run/secrets/db_password
- name: POSTGRES_USER
value: /run/secrets/db_username
- name: POSTGRES_DB
value: db
volumeMounts:
- mountPath: /ssl
name: ssl
volumes:
- name: ssl

0 comments on commit 4c0273e

Please sign in to comment.