Skip to content
This repository has been archived by the owner on Mar 27, 2022. It is now read-only.

Commit

Permalink
Updat Podman config (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
kiancross authored Jan 6, 2021
1 parent e5665bb commit bc41987
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 31 deletions.
1 change: 1 addition & 0 deletions Makefile.docker
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ DOCKER_COMPOSE_COMMAND:=docker-compose \

.PHONY: start
start:
yarn install
$(DOCKER_COMPOSE_COMMAND) up --build -d

.PHONY: stop
Expand Down
30 changes: 22 additions & 8 deletions Makefile.podman
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ POD_NAME:=unifed
PODMAN_COMMAND:=podman

.PHONY: start
start: unifed-backend unifed-frontend reset
start: yarn-install unifed-backend-internal unifed-backend-federation unifed-frontend reset
@# Podman doesn't support passing an environment file :(
$(PODMAN_COMMAND) play kube <(source ./$(CONFIG_PATH); \
variable_names=$$(grep -v '^\s*#.*$$' $(CONFIG_PATH) | grep -v '^\s*$$' | cut -f1 -d=); \
Expand All @@ -31,13 +31,27 @@ stop:

.PHONY: logs
logs:
$(PODMAN_COMMAND) logs $$($(PODMAN_COMMAND) ps | \
grep "localhost/unifed-backend.*unifed-backend" | awk '{print $$1}')

.PHONY: unifed-backend
unifed-backend:
$(PODMAN_COMMAND) build -f Dockerfile.backend -t unifed-backend .
@$(PODMAN_COMMAND) logs -n $$($(PODMAN_COMMAND) ps | \
grep "localhost/unifed-.*unifed-.*" | awk '{print $$1}') | \
awk '{ \
if ($$1 == "unifed-frontend") {printf "\033[0;31m"}; \
if ($$1 == "unifed-backend-internal") {printf "\033[0;34m"}; \
if ($$1 == "unifed-backend-federation") {printf "\033[0;32m"}; \
printf $$1 "\033[0m"; $$1 = ""; print $$0 \
}'

.PHONY: yarn-install
yarn-install:
yarn install

.PHONY: unifed-backend-internal
unifed-backend-internal:
$(PODMAN_COMMAND) build -f configs/backend-internal.Dockerfile -t unifed-backend-internal .

.PHONY: unifed-backend-federation
unifed-backend-federation:
$(PODMAN_COMMAND) build -f configs/backend-federation.Dockerfile -t unifed-backend-federation .

.PHONY: unifed-frontend
unifed-frontend:
$(PODMAN_COMMAND) build -f Dockerfile.frontend -t unifed-frontend .
$(PODMAN_COMMAND) build -f configs/frontend.Dockerfile -t unifed-frontend .
111 changes: 88 additions & 23 deletions configs/kube-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ spec:
hostAliases:
- ip: "127.0.0.1"
hostnames:
- "backend"
- "backend-internal"
- "backend-federation"
- "frontend"
- "mongo"

Expand All @@ -30,8 +31,6 @@ spec:
value: ${MONGO_ADMIN_USERNAME}
- name: MONGO_INITDB_ROOT_PASSWORD
value: ${MONGO_ADMIN_PASSWORD}
- name: MONGO_INITDB_DATABASE
value: ${MONGO_DATABASE}

- name: nginx
image: docker.io/corfr/nginx-dnsmasq
Expand Down Expand Up @@ -61,55 +60,121 @@ spec:
- name: ME_CONFIG_BASICAUTH_PASSWORD
value: ${MONGO_INSPECT_PASSWORD}

- name: backend
image: localhost/unifed-backend
- name: backend-internal
image: localhost/unifed-backend-internal
volumeMounts:
- mountPath: /usr/src/unifed/packages/backend/src
name: backend
- mountPath: /usr/src/unifed/packages/backend-internal-server/src
name: backend-internal-server
- mountPath: /usr/src/unifed/packages/backend-core/src
name: backend-core
- mountPath: /usr/src/unifed/packages/backend-federation-client/src
name: backend-federation-client
- mountPath: /usr/src/unifed/packages/shared/src
name: shared
env:
- name: SMTP_USERNAME
- name: UNIFED_SMTP_USERNAME
value: ${SMTP_USERNAME}
- name: SMTP_PASSWORD
- name: UNIFED_SMTP_PASSWORD
value: ${SMTP_PASSWORD}
- name: SMTP_HOST
- name: UNIFED_SMTP_HOST
value: ${SMTP_HOST}
- name: SMTP_PORT
- name: UNIFED_SMTP_PORT
value: ${SMTP_PORT}
- name: MONGO_HOSTNAME
- name: UNIFED_MONGO_HOSTNAME
value: mongo
- name: MONGO_PORT
- name: UNIFED_MONGO_PORT
value: 27017
- name: MONGO_DATABASE
value: ${MONGO_DATABASE}
- name: MONGO_USERNAME
- name: UNIFED_MONGO_DATABASE
value: unifed-internal
- name: UNIFED_MONGO_USERNAME
value: user
- name: MONGO_PASSWORD
- name: UNIFED_MONGO_PASSWORD
value: pass
- name: JWT_SECRET
- name: UNIFED_JWT_SECRET
value: ${JWT_SECRET}
- name: SITE_HOST
- name: UNIFED_SITE_HOST
value: ${SITE_HOST}
- name: SITE_PROTOCOL
- name: UNIFED_SITE_PROTOCOL
value: ${SITE_PROTOCOL}
- name: APPLICATION_NAME
- name: UNIFED_APPLICATION_NAME
value: ${APPLICATION_NAME}
- name: UNIFED_LOGGING_LEVEL
value: ${LOGGING_LEVEL}
- name: UNIFED_SERVER_PORT
value: 7080
- name: NODE_ENV
value: ${NODE_ENV}

- name: backend-federation
image: localhost/unifed-backend-federation
volumeMounts:
- mountPath: /usr/src/unifed/packages/backend-federation-server/src
name: backend-federation-server
- mountPath: /usr/src/unifed/packages/backend-core/src
name: backend-core
- mountPath: /usr/src/unifed/packages/shared/src
name: shared
env:
- name: UNIFED_MONGO_HOSTNAME
value: mongo
- name: UNIFED_MONGO_PORT
value: 27017
- name: UNIFED_MONGO_DATABASE
value: unifed-federation
- name: UNIFED_MONGO_USERNAME
value: user
- name: UNIFED_MONGO_PASSWORD
value: pass
- name: UNIFED_SITE_HOST
value: ${SITE_HOST}
- name: UNIFED_SITE_PROTOCOL
value: ${SITE_PROTOCOL}
- name: UNIFED_APPLICATION_NAME
value: ${APPLICATION_NAME}
- name: UNIFED_LOGGING_LEVEL
value: ${LOGGING_LEVEL}
- name: UNIFED_SERVER_PORT
value: 7081
- name: NODE_ENV
value: ${NODE_ENV}

- name: frontend
image: localhost/unifed-frontend
volumeMounts:
- mountPath: /usr/src/unifed/packages/frontend/src
name: frontend
- mountPath: /usr/src/unifed/packages/shared/src
name: shared

volumes:
- name: frontend
hostPath:
path: ./packages/frontend/src
type: Directory

- name: backend
- name: shared
hostPath:
path: ./packages/shared/src
type: Directory

- name: backend-internal-server
hostpath:
path: ./packages/backend-internal-server/src
type: Directory

- name: backend-federation-server
hostpath:
path: ./packages/backend-federation-server/src
type: Directory

- name: backend-federation-client
hostpath:
path: ./packages/backend-federation-client/src
type: Directory

- name: backend-core
hostpath:
path: ./packages/backend/src
path: ./packages/backend-core/src
type: Directory

- name: nginx-conf
Expand Down

0 comments on commit bc41987

Please sign in to comment.