diff options
-rw-r--r-- | .gitignore | 13 | ||||
-rw-r--r-- | README.md | 13 | ||||
-rw-r--r-- | docker-compose.yml | 66 | ||||
-rw-r--r-- | dotenv | 2 | ||||
-rw-r--r-- | nginx/default/html/index.html | 25 | ||||
-rw-r--r-- | nginx/nginx.conf | 37 | ||||
-rw-r--r-- | nginx/sites.template | 37 | ||||
-rw-r--r-- | redis/.keep | 0 | ||||
-rw-r--r-- | scalelite/.env | 1 | ||||
-rwxr-xr-x | scalelite/bin/start | 5 | ||||
-rw-r--r-- | scalelite/dotenv | 1 |
11 files changed, 200 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..22c079d --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +/.env + +/nginx/log* +/nginx/ssl* +/nginx/sites-available* +/nginx/sites-enabled* +/nginx/letsencrypt/live/* + +/redis/log* +/redis/data* + +/scalelite/log* +/scalelite/tmp* diff --git a/README.md b/README.md new file mode 100644 index 0000000..47f6cac --- /dev/null +++ b/README.md @@ -0,0 +1,13 @@ +# scalelite-run + +This document provides instructions on how to deploy scalelite + redis behind a nginx proxy +using docker-compose. + + +## Prerequisites + + +## Preliminary steps + + +## Steps diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..6b1cf5f --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,66 @@ +version: '3' + +volumes: + database_data: + driver: local + +services: + nginx: + image: nginx:latest + restart: "no" + volumes: + - ./nginx/nginx.conf:/etc/nginx/nginx.conf + - ./nginx/sites-enabled:/etc/nginx/sites-enabled + - ./nginx/sites.template:/etc/nginx/sites-available/sites.template + - ./nginx/default/html:/var/www/html + - ./nginx/log/nginx:/var/log/nginx + - ./nginx/letsencrypt/:/etc/letsencrypt + ports: + - "80:80" + - "443:443" + environment: + - NGINX_DOMAIN=${DOMAIN_SUB:-lab}.${DOMAIN_ROOT:-bigbluebutton.org} + depends_on: + - scalelite + command: /bin/bash -c "envsubst '$$NGINX_DOMAIN' < /etc/nginx/sites-available/sites.template > /etc/nginx/sites-enabled/sites.conf && exec nginx -g 'daemon off;'" + + redis: + image: redis + restart: "no" + ports: + - 127.0.0.1:6379:6379 + expose: + - "6379" + networks: + - default +# volumes: +# - ./redis/data/dump.rdb:/var/lib/redis/dump.rdb +# - ./redis/log/:/var/log/ + + scalelite: + entrypoint: [bin/start] +# image: blindsidenetwks/scalelite:master + image: blindsidenetwks/scalelite:docker-pro + restart: "no" + ports: + - 127.0.0.1:3000:3000 + expose: + - "3000" + links: + - redis + networks: + - default + volumes: + - ./scalelite/log:/usr/src/app/log + - ./scalelite/tmp/pids/:/usr/src/app/tmp/pids + - ./scalelite/bin/start:/usr/src/app/bin/start +# logging: +# driver: syslog +# options: +# syslog-address: udp://logs.$DOMAINNAME:1514 +# tag: sl.$DOMAINNAME + env_file: ./scalelite/.env + environment: + - DOMAINNAME=${DOMAIN_SUB:-lab}.${DOMAIN_ROOT:-bigbluebutton.org} + - REDIS_URL=redis://redis.${DOMAIN_SUB:-xlab}.${DOMAIN_ROOT:-bigbluebutton.org}:6379 + - URL_HOST=sl.${DOMAIN_SUB:-lab}.${DOMAIN_ROOT:-bigbluebutton.org} @@ -0,0 +1,2 @@ +DOMAIN_ROOT=bigbluebutton.org +DOMAIN_SUB=lab diff --git a/nginx/default/html/index.html b/nginx/default/html/index.html new file mode 100644 index 0000000..2ca3b95 --- /dev/null +++ b/nginx/default/html/index.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<html> +<head> +<title>Welcome to nginx!</title> +<style> + body { + width: 35em; + margin: 0 auto; + font-family: Tahoma, Verdana, Arial, sans-serif; + } +</style> +</head> +<body> +<h1>Welcome to nginx!</h1> +<p>If you see this page, the nginx web server is successfully installed and +working. Further configuration is required.</p> + +<p>For online documentation and support please refer to +<a href="http://nginx.org/">nginx.org</a>.<br/> +Commercial support is available at +<a href="http://nginx.com/">nginx.com</a>.</p> + +<p><em>Thank you for using nginx.</em></p> +</body> +</html> diff --git a/nginx/nginx.conf b/nginx/nginx.conf new file mode 100644 index 0000000..981c619 --- /dev/null +++ b/nginx/nginx.conf @@ -0,0 +1,37 @@ +user nginx; +worker_processes 1; + +error_log /var/log/nginx/error.log warn; +pid /var/run/nginx.pid; + + +events { + worker_connections 1024; +} + + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + #tcp_nopush on; + + keepalive_timeout 65; + + #gzip on; + + include /etc/nginx/conf.d/*.conf; + + ## + # Virtual Host Configs + ## + + include /etc/nginx/sites-enabled/*; +} diff --git a/nginx/sites.template b/nginx/sites.template new file mode 100644 index 0000000..4252f81 --- /dev/null +++ b/nginx/sites.template @@ -0,0 +1,37 @@ +#### For <sl.$NGINX_DOMAIN> + +upstream docker-scalelite { + server scalelite:3000; +} + +server { + server_name sl.$NGINX_DOMAIN; + + listen 80; + listen [::]:80; + listen 443 ssl; + listen [::]:443; + + ssl_certificate /etc/letsencrypt/live/sl.$NGINX_DOMAIN/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/sl.$NGINX_DOMAIN/privkey.pem; + + location / { + proxy_pass http://docker-scalelite; + proxy_read_timeout 60s; + proxy_redirect off; + + proxy_set_header Host $http_host; + + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Cookie "$http_cookie; ip=$remote_addr"; + + proxy_set_header X-Forwarded-Proto $scheme; + + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + + rewrite ~/(.*)$ /$1 break; + } +} diff --git a/redis/.keep b/redis/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/redis/.keep diff --git a/scalelite/.env b/scalelite/.env new file mode 100644 index 0000000..7cf79e3 --- /dev/null +++ b/scalelite/.env @@ -0,0 +1 @@ +SECRET_KEY_BASE=secret_key_base diff --git a/scalelite/bin/start b/scalelite/bin/start new file mode 100755 index 0000000..3a27841 --- /dev/null +++ b/scalelite/bin/start @@ -0,0 +1,5 @@ +#!/bin/bash + +bundle exec puma -C config/puma.rb +#tail -f /dev/null +#bundle exec rails s -b 0.0.0.0 -p 3000 diff --git a/scalelite/dotenv b/scalelite/dotenv new file mode 100644 index 0000000..7cf79e3 --- /dev/null +++ b/scalelite/dotenv @@ -0,0 +1 @@ +SECRET_KEY_BASE=secret_key_base |