Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker-compose-yml complete deployment #29

Open
mStirner opened this issue Nov 29, 2022 · 3 comments
Open

docker-compose-yml complete deployment #29

mStirner opened this issue Nov 29, 2022 · 3 comments

Comments

@mStirner
Copy link
Member

mStirner commented Nov 29, 2022

Create a "complete" deployment docker compose file, which start:

  • mongodb
  • backend
  • frontend
  • connector
  • nginx
version: "2"
services:
  nginx:
    image: "nginx:1.23.2-alpine"
    volumes:
      - "./nginx.conf:/etc/nginx/nginx.conf"
    ports:
      - "80:80"
      - "443:443"
  database:
    image: mongo
    ports:
      - "27017:27017"
  backend:
    image: "openhaus/backend:latest"
    environment:
      - NODE_ENV=production
      - DATABASE_HOST=database
      - UUID=00000000-0000-0000-0000-000000000000
      - VAULT_MASTER_PASSWORD=Pa$$w0rd
    ports:
      - "8080:8080"
    depends_on:
      - database
      - nginx
  frontend:
    image: "openhaus/frontend:latest"
    ports:
      - "3000:3000"
    depends_on:
      - backend
      - nginx
  connector:
    image: "openhaus/connector:latest"
    depends_on:
      - backend
    net: host

"Pseudo" config, not tested and may contain bugs.
This was just a quick draft.

https://business-science.github.io/shiny-production-with-aws-book/https-nginx-docker-compose.html

@mStirner
Copy link
Member Author

To import the docker images:

curl "https://github.com/OpenHausIO/backend/releases/download/v2.0.0/backend-v2.0.0-docker.tgz" | docker import openhaus/backend:latest
curl "https://github.com/OpenHausIO/frontend/releases/download/v1.0.0/frontend-v1.0.0-docker.tgz" | docker import openhaus/frontend:latest
curl "https://github.com/OpenHausIO/connector/releases/download/v1.0.0/connector-v1.0.0-docker.tgz" | docker import openhaus/connector:latest

@mStirner
Copy link
Member Author

The connector multicast/dns resolution to backend stuff does not work at the same time.
Instead, publish/expose the frontend ports, and use this from he connector container when it is on the host network.

https://stackoverflow.com/a/53525524/5781499

https://stackoverflow.com/q/74934134/5781499
https://stackoverflow.com/q/47303141/5781499

Since the frontend needs to be public any way to access the UI, this seems like a "OK" way to go.

@mStirner
Copy link
Member Author

version: "3"
services:

  database:
    image: mongo
    container_name: database
    hostname: database

  backend:
    image: "openhaus/backend:latest"
    container_name: backend
    hostname: backend
    environment:
      - NODE_ENV=production
      - DATABASE_HOST=database
      - UUID=5025f846-7587-11ed-9ca7-8b992b5e7dd3
      - VAULT_MASTER_PASSWORD=Pa$$w0rd
      - USERS_JWT_SECRET=Pa$$W0rd
      - API_AUTH_ENABLED=false
    depends_on:
      - database
    tty: true

  frontend:
    image: "openhaus/frontend:latest"
    container_name: frontend
    hostname: frontend
    ports:
      - "80:80"
      - "443:443"
    depends_on:
      - backend
    environment:
      - BACKEND_HOST=backend
      - NODE_ENV=production

  connector:
    image: "openhaus/connector:latest"
    container_name: connector
    hostname: connector
    environment:
      - NODE_ENV=production
      - BACKEND_HOST=127.0.0.1
      - BACKEND_PORT=80 # Frontend container exposed http port
      - STARTUP_DELAY=2000
    network_mode: host
    depends_on:
      - frontend
    tty: true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant