First commit

This commit is contained in:
jfederico
2020-02-03 14:31:56 -05:00
commit e47e1c0d82
11 changed files with 200 additions and 0 deletions

13
.gitignore vendored Normal file
View File

@@ -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*

13
README.md Normal file
View File

@@ -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

66
docker-compose.yml Normal file
View File

@@ -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}

2
dotenv Normal file
View File

@@ -0,0 +1,2 @@
DOMAIN_ROOT=bigbluebutton.org
DOMAIN_SUB=lab

View File

@@ -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>

37
nginx/nginx.conf Normal file
View File

@@ -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/*;
}

37
nginx/sites.template Normal file
View File

@@ -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;
}
}

0
redis/.keep Normal file
View File

1
scalelite/.env Normal file
View File

@@ -0,0 +1 @@
SECRET_KEY_BASE=secret_key_base

5
scalelite/bin/start Executable file
View File

@@ -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

1
scalelite/dotenv Normal file
View File

@@ -0,0 +1 @@
SECRET_KEY_BASE=secret_key_base