From 8616f69ff674e5de1aff3df8a56ec995f7f8a7f0 Mon Sep 17 00:00:00 2001 From: Michael Schramm Date: Thu, 4 Jun 2020 11:48:33 +0200 Subject: [PATCH] add a few more examples --- examples/docker_for_load_balancing/README.md | 26 ++++++++++++++ .../docker-compose.yml | 35 +++++++++++++++++++ examples/docker_minimal/README.md | 10 ++++++ examples/docker_minimal/docker-compose.yml | 23 ++++++++++++ examples/docker_nginx/README.md | 9 +++++ examples/docker_nginx/default.conf | 16 +++++++++ examples/docker_nginx/docker-compose.yml | 31 ++++++++++++++++ 7 files changed, 150 insertions(+) create mode 100644 examples/docker_for_load_balancing/README.md create mode 100644 examples/docker_for_load_balancing/docker-compose.yml create mode 100644 examples/docker_minimal/README.md create mode 100644 examples/docker_minimal/docker-compose.yml create mode 100644 examples/docker_nginx/README.md create mode 100644 examples/docker_nginx/default.conf create mode 100644 examples/docker_nginx/docker-compose.yml diff --git a/examples/docker_for_load_balancing/README.md b/examples/docker_for_load_balancing/README.md new file mode 100644 index 00000000..35117d3f --- /dev/null +++ b/examples/docker_for_load_balancing/README.md @@ -0,0 +1,26 @@ +# Load Balancing Config + +## Required changes + +`MAILER_URI` should be set to allow emails to be sent. + +Further you have to setup a Load Balancer (more in the Configuration section) + +## Configuration + +for this setup it is important to have either an +ingress server that does load balancing on paths +or to expose the api on a different host. + +If you expose the api on a different host do not forget +to change the API_HOST env variable on the ui +container to route the requests properly. + + +# AWS Cloudfront Ingress + +both ui and api would run behind a load balancer. + +the default path should then be routed to the ui container +and the /graphql path to the api container. + diff --git a/examples/docker_for_load_balancing/docker-compose.yml b/examples/docker_for_load_balancing/docker-compose.yml new file mode 100644 index 00000000..dc350d1c --- /dev/null +++ b/examples/docker_for_load_balancing/docker-compose.yml @@ -0,0 +1,35 @@ +version: "3" +services: + redis: + image: redis + mongo: + image: mongo + volumes: + - "./data/mongo:/data" + ui: + image: ohmyform/ui + environment: + API_HOST: http://localhost:8090/graphql + PORT: 5000 + ports: + - "8080:5000" + api: + image: ohmyform/api + environment: + CREATE_ADMIN: "true" + ADMIN_EMAIL: admin@local.host + ADMIN_USERNAME: admin + ADMIN_PASSWORD: admin + MONGODB_URI: mongodb://mongo/ohmyform + MAILER_URI: smtp://local.host + REDIS_URL: redis://redis + PORT: 5000 + links: + - mongo + - redis + - mail + ports: + - "8090:5000" + depends_on: + - mongo + - redis diff --git a/examples/docker_minimal/README.md b/examples/docker_minimal/README.md new file mode 100644 index 00000000..643a34f7 --- /dev/null +++ b/examples/docker_minimal/README.md @@ -0,0 +1,10 @@ +# Minimal Config + +will start one omf container with mongodb, persisting data. + +after startup you can access it at *:8080 + + +## Required changes + +`MAILER_URI` should be set to allow emails to be sent. diff --git a/examples/docker_minimal/docker-compose.yml b/examples/docker_minimal/docker-compose.yml new file mode 100644 index 00000000..325fa32c --- /dev/null +++ b/examples/docker_minimal/docker-compose.yml @@ -0,0 +1,23 @@ +version: "3" +services: + mongo: + image: mongo + volumes: + - "./data/mongo:/data" + ohmyform: + image: ohmyform/ohmyform + environment: + CREATE_ADMIN: "TRUE" + ADMIN_EMAIL: admin@local.host + ADMIN_USERNAME: admin + ADMIN_PASSWORD: admin + MONGODB_URI: mongodb://mongo/ohmyform + MAILER_URI: smtp://local.host + PORT: 5000 + links: + - mongo + - mail + ports: + - "8080:5000" + depends_on: + - mongo diff --git a/examples/docker_nginx/README.md b/examples/docker_nginx/README.md new file mode 100644 index 00000000..aeabd4e3 --- /dev/null +++ b/examples/docker_nginx/README.md @@ -0,0 +1,9 @@ +# Nginx Config + +ServerSideRendering for the UI with configured Reverse Proxy (Nginx) + +after startup you can access your page at *:8080, forms will be persisted between docker runs + +## Required changes + +`MAILER_URI` should be set to allow emails to be sent. diff --git a/examples/docker_nginx/default.conf b/examples/docker_nginx/default.conf new file mode 100644 index 00000000..1dad0765 --- /dev/null +++ b/examples/docker_nginx/default.conf @@ -0,0 +1,16 @@ + +server { + listen 80; + + location / { + proxy_pass http://ui:5000; + proxy_redirect off; + proxy_set_header Host $host; + } + + location /graphql { + proxy_pass http://api:5000; + proxy_redirect off; + proxy_set_header Host $host; + } +} diff --git a/examples/docker_nginx/docker-compose.yml b/examples/docker_nginx/docker-compose.yml new file mode 100644 index 00000000..a12e9123 --- /dev/null +++ b/examples/docker_nginx/docker-compose.yml @@ -0,0 +1,31 @@ +version: "3" +services: + mongo: + image: mongo + volumes: + - "./data/mongo:/data" + nginx: + image: nginx:alpine + volumes: + - "./default.conf:/etc/nginx/conf.d/default.conf" + ports: + - "8080:80" + ui: + image: ohmyform/ui + environment: + PORT: 5000 + api: + image: ohmyform/api + environment: + CREATE_ADMIN: "true" + ADMIN_EMAIL: admin@local.host + ADMIN_USERNAME: admin + ADMIN_PASSWORD: admin + MONGODB_URI: mongodb://mongo/ohmyform + MAILER_URI: smtp://local.host + REDIS_URL: redis://redis + PORT: 5000 + links: + - mongo + depends_on: + - mongo