some fixes and necessary updates for init-letsencrypt.sh

This commit is contained in:
jfederico
2022-06-17 15:52:50 -04:00
parent 170e488765
commit b9b2fad521
5 changed files with 48 additions and 48 deletions

View File

@@ -8,7 +8,7 @@ It was released by [Blindside Networks](https://blindsidenetworks.com/) under th
The full source code is available on GitHub and pre-built docker images can be found on [DockerHub](https://hub.docker.com/r/blindsidenetwks/scalelite).
Scaleite itself is a ruby on rails application.
Scaleite itself is a ruby on rails application.
For its deployment it is required some experience with bigbluebutton and scalelite itself, and all the tools and components used as part of the stack such as redis, postgres, nginx, docker and docker-compose, as well as ubuntu and AWS infrastructure.
@@ -32,6 +32,11 @@ Create a new .env file based on the dotenv file included.
```
cp dotenv .env
sed -e '/SECRET_KEY_BASE=/ s/^${openssl rand -hex 64}*/#/' -i .env
sed -i 's/SECRET_KEY_BASE=.*/SECRET_KEY_BASE=[${openssl rand -hex 64}]/' .env
```
Most required variables are pre-set by default, the ones that must be set before starting are:
@@ -43,3 +48,8 @@ URL_HOST=
NGINX_SSL=
```
Also, when using the `init-letsencrypt.sh` script, you should add the email.
```
LETSENCRYPT_EMAIL=
```

View File

@@ -61,7 +61,7 @@ services:
restart: unless-stopped
volumes:
- ./log/recordings/:/var/log/nginx
- ${SCALELITE_RECORDING_DIR-/mnt/scalelite-recordings/var/bigbluebutton}/published:/var/bigbluebutton/published
- ${SCALELITE_RECORDING_DIR:-/mnt/scalelite-recordings/var/bigbluebutton}/published:/var/bigbluebutton/published
depends_on:
- scalelite-api
@@ -74,12 +74,12 @@ services:
environment:
- REDIS_URL=${REDIS_URL:-redis://redis:6379}
- DATABASE_URL=${DATABASE_URL:-postgres://postgres:password@postgres:5432/scalelite?pool=5}
- RECORDING_DISABLED=${RECORDING_DISABLED-false}
- SERVER_ID_IS_HOSTNAME=${SERVER_ID_IS_HOSTNAME-false}
- RAILS_LOG_TO_STDOUT=${RAILS_LOG_TO_STDOUT}
- RECORDING_DISABLED=${RECORDING_DISABLED:-false}
- SERVER_ID_IS_HOSTNAME=${SERVER_ID_IS_HOSTNAME:-false}
- RAILS_LOG_TO_STDOUT=${RAILS_LOG_TO_STDOUT:-false}
volumes:
- ./log/scalelite-api/:/srv/scalelite/log/
- ${SCALELITE_RECORDING_DIR-/mnt/scalelite-recordings/var/bigbluebutton}:/var/bigbluebutton
- ${SCALELITE_RECORDING_DIR:-/mnt/scalelite-recordings/var/bigbluebutton}:/var/bigbluebutton
depends_on:
- postgres
- redis
@@ -94,8 +94,8 @@ services:
- .env
environment:
- REDIS_URL=${REDIS_URL:-redis://redis:6379}
- SERVER_ID_IS_HOSTNAME=${SERVER_ID_IS_HOSTNAME-false}
- RAILS_LOG_TO_STDOUT=${RAILS_LOG_TO_STDOUT}
- SERVER_ID_IS_HOSTNAME=${SERVER_ID_IS_HOSTNAME:-false}
- RAILS_LOG_TO_STDOUT=${RAILS_LOG_TO_STDOUT:-false}
volumes:
- ./log/scalelite-poller/:/app/log
command: /bin/sh -c "bin/start-poller"
@@ -113,11 +113,11 @@ services:
environment:
- DATABASE_URL=${DATABASE_URL:-postgres://postgres:password@postgres:5432/scalelite?pool=5}
- RECORDING_DISABLED=false
- RAILS_LOG_TO_STDOUT=${RAILS_LOG_TO_STDOUT}
- RAILS_LOG_TO_STDOUT=${RAILS_LOG_TO_STDOUT:-false}
volumes:
- ./log/scalelite-recording-importer/:/app/log
- ${SCALELITE_RECORDING_DIR-/mnt/scalelite-recordings/var/bigbluebutton}:/var/bigbluebutton
- ${SCALELITE_RECORDING_DIR-/mnt/scalelite-recordings/var/bigbluebutton}/spool:/var/bigbluebutton/spool
- ${SCALELITE_RECORDING_DIR:-/mnt/scalelite-recordings/var/bigbluebutton}:/var/bigbluebutton
- ${SCALELITE_RECORDING_DIR:-/mnt/scalelite-recordings/var/bigbluebutton}/spool:/var/bigbluebutton/spool
command: /bin/sh -c "bin/start-recording-importer"
depends_on:
- scalelite-api

17
dotenv
View File

@@ -45,8 +45,15 @@ SCALELITE_RECORDINGS_DOCKER_IMAGE=bigbluebutton/bbb-playback-proxy:bionic-230-am
# DOCKER_VOL_REDIS_DATA=~/scalelite-run/data/redis
#
### Optional for development when using different profiles
#DOCKER_PROXY_NGINX_TEMPLATE=scalelite-proxy
DOCKER_PROXY_NGINX_TEMPLATE=scalelite-proxy-protected
#DOCKER_PROXY_NGINX_TEMPLATE=scalelite-local
#DOCKER_PROXY_NGINX_TEMPLATE=scalelite-local-protected
#DOCKER_PROXY_NGINX_TEMPLATE=scalelite-cluster
# DOCKER_PROXY_NGINX_TEMPLATE=scalelite-proxy
# Examples:
# scalelite-proxy <default>
# scalelite-proxy-protected
# scalelite-local
# scalelite-local-protected
# scalelite-cluster
### Optional for the deployment, but required when using init-letsencrypt.sh script
# LETSENCRYPT_EMAIL=
# LETSENCRYPT_STAGING=0
# Set to 1 if you're testing your setup to avoid hitting request limits

View File

@@ -1,22 +0,0 @@
SECRET_KEY_BASE=secret
LOADBALANCER_SECRET=secret
URL_HOST=sl.example.com
SCALELITE_DOCKER_IMAGE=blindsidenetwks/master:v1.0
SCALELITE_RECORDINGS_DOCKER_IMAGE=bigbluebutton/bbb-playback-proxy:bionic-230-amazonlinux
DB_DISABLED: "false"
POLL_INTERVAL: "60"
RECORDING_DISABLED: "false"
RECORDING_IMPORT_POLL: "true"
RECORDING_IMPORT_POLL_INTERVAL: "60"
DOCKER_VOL_SCALELITE_API=/home/ubuntu/scalelite-run/data/scalelite
DOCKER_VOL_POSTGRES_DATA=/home/ubuntu/scalelite-run/data/postgres
DOCKER_VOL_REDIS_DATA=/home/ubuntu/scalelite-run/data/redis
DOCKER_PROXY_NGINX_TEMPLATE=scalelite-proxy
#DOCKER_PROXY_NGINX_TEMPLATE=scalelite-proxy-protected
#DOCKER_PROXY_NGINX_TEMPLATE=scalelite-local
#DOCKER_PROXY_NGINX_TEMPLATE=scalelite-local-protected
#DOCKER_PROXY_NGINX_TEMPLATE=scalelite-cluster

View File

@@ -10,6 +10,17 @@ if [[ ! -f ./.env ]]; then
exit 1
fi
# Local .env
if [ -f .env ]; then
# Load Environment Variables
export $(cat .env | grep -v '#' | sed 's/\r$//' | awk '/=/ {print $1}' )
fi
if [[ -z "$LETSENCRYPT_EMAIL" ]]; then
echo "Settung up an email for letsencrypt certificates is strongly recommended."
exit 1
fi
usage() {
echo -e "Initializes letsencrypt certificates for Nginx proxy container\n"
echo -e "Usage: $0 [-z|-r|-h]\n"
@@ -33,18 +44,13 @@ do
esac
done
URL_HOST=$(grep URL_HOST .env | cut -d '=' -f2)
echo $URL_HOST
NGINX_CONTAINER_NAME=$(grep DOCKER_PROXY_NGINX_TEMPLATE .env | cut -d '=' -f2)
if [[ -z "$NGINX_CONTAINER_NAME" ]]; then
NGINX_CONTAINER_NAME=scalelite-proxy
fi
domains=($URL_HOST)
rsa_key_size=4096
data_path="./data/certbot"
email="$LETSENCRYPT_EMAIL" # Adding a valid address is strongly recommended
staging=${LETSENCRYPT_STAGING:-0} # Set to 1 if you're testing your setup to avoid hitting request limits
email="$LETSENCRYPT_EMAIL" # Adding a valid address is strongly recommended.
staging=${LETSENCRYPT_STAGING:-0}
if [ -d "$data_path" ] && [ "$replaceExisting" -eq 0 ]; then
if [ "$interactive" -eq 0 ]; then
@@ -76,9 +82,8 @@ docker-compose run --rm --entrypoint "\
-subj '/CN=localhost'" certbot
echo
echo "### Starting $NGINX_CONTAINER_NAME ..."
docker-compose up --force-recreate -d $NGINX_CONTAINER_NAME
echo "### Starting scalelite-proxy ..."
docker-compose up --force-recreate -d scalelite-proxy
echo
echo "### Deleting dummy certificate for $domains ..."