replace docker container with docker-compose
This commit is contained in:
parent
031eb1cac6
commit
b1e8a05854
|
@ -13,7 +13,6 @@ do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
#DEBUG
|
|
||||||
if [ "$MODE" = "debug" ]; then
|
if [ "$MODE" = "debug" ]; then
|
||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
|
@ -32,7 +31,9 @@ echo '
|
||||||
'
|
'
|
||||||
FORGE_REPO="https://forge.switnet.net/switnet/quick-jibri-installer"
|
FORGE_REPO="https://forge.switnet.net/switnet/quick-jibri-installer"
|
||||||
check_apt_policy() {
|
check_apt_policy() {
|
||||||
apt-cache policy 2>/dev/null| awk "/$1/{print \$3}" | awk -F '/' 'NR==1{print$2}'
|
apt-cache policy 2>/dev/null| \
|
||||||
|
awk "/$1/{print \$3}" | \
|
||||||
|
awk -F '/' 'NR==1{print$2}'
|
||||||
}
|
}
|
||||||
install_ifnot() {
|
install_ifnot() {
|
||||||
if [ "$(dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -c "ok installed")" == "1" ]; then
|
if [ "$(dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -c "ok installed")" == "1" ]; then
|
||||||
|
@ -69,6 +70,7 @@ test_match "$WS_MATCH1" "$WS_CONF"
|
||||||
|
|
||||||
# Install required packages
|
# Install required packages
|
||||||
install_ifnot docker.io
|
install_ifnot docker.io
|
||||||
|
install_ifnot docker-compose
|
||||||
install_ifnot postgresql-"$PSGVER"
|
install_ifnot postgresql-"$PSGVER"
|
||||||
|
|
||||||
# Create DB
|
# Create DB
|
||||||
|
@ -78,29 +80,27 @@ CREATE DATABASE ${ETHERPAD_DB_NAME};
|
||||||
CREATE USER ${ETHERPAD_DB_USER} WITH ENCRYPTED PASSWORD '${ETHERPAD_DB_PASS}';
|
CREATE USER ${ETHERPAD_DB_USER} WITH ENCRYPTED PASSWORD '${ETHERPAD_DB_PASS}';
|
||||||
GRANT ALL PRIVILEGES ON DATABASE ${ETHERPAD_DB_NAME} TO ${ETHERPAD_DB_USER};
|
GRANT ALL PRIVILEGES ON DATABASE ${ETHERPAD_DB_NAME} TO ${ETHERPAD_DB_USER};
|
||||||
DB
|
DB
|
||||||
echo " -- Your etherpad db password is: $ETHERPAD_DB_PASS"
|
|
||||||
echo -e " Please save it somewhere safe.\n"
|
|
||||||
|
|
||||||
# Check fot docker if not running then execute
|
# Set environment varibales for docker
|
||||||
if [ ! "$(docker ps -q -f name=etherpad)" ]; then
|
mkdir /opt/etherpat
|
||||||
if [ "$(docker ps -aq -f status=exited -f name=etherpad)" ]; then
|
cat << EOF > /opt/etherpat/.env
|
||||||
# cleanup
|
DOCKER_COMPOSE_APP_ADMIN_PASSWORD="$ETHERPAD_ADMIN_PASS"
|
||||||
docker rm etherpad
|
DOCKER_COMPOSE_APP_DB_CHARSET="utf8mb4"
|
||||||
fi
|
DOCKER_COMPOSE_POSTGRES_HOST="localhost"
|
||||||
# run your container
|
DOCKER_COMPOSE_POSTGRES_USER="$ETHERPAD_DB_USER"
|
||||||
docker run -d --restart always \
|
DOCKER_COMPOSE_POSTGRES_DATABASE="$ETHERPAD_DB_NAME"
|
||||||
--network=host \
|
DOCKER_COMPOSE_POSTGRES_PASSWORD="$ETHERPAD_DB_PASS"
|
||||||
--name etherpad \
|
DOCKER_COMPOSE_POSTGRES_PORT="5432"
|
||||||
-p 127.0.0.1:9001:9001 \
|
#DOCKER_COMPOSE_APP_DEFAULT_PAD_TEXT=
|
||||||
-e "ADMIN_PASSWORD=$ETHERPAD_ADMIN_PASS" \
|
DOCKER_COMPOSE_APP_DISABLE_IP_LOGGING="false"
|
||||||
-e "DB_TYPE=postgres" \
|
DOCKER_COMPOSE_APP_SOFFICE="null"
|
||||||
-e "DB_HOST=localhost" \
|
DOCKER_COMPOSE_APP_TRUST_PROXY="true"
|
||||||
-e "DB_PORT=5432" \
|
EOF
|
||||||
-e "DB_NAME=$ETHERPAD_DB_NAME" \
|
chmod 600 /opt/etherpat/.env
|
||||||
-e "DB_USER=$ETHERPAD_DB_USER" \
|
cp files/etherpad/docker-compose.yml /opt/etherpat/
|
||||||
-e "DB_PASS=$ETHERPAD_DB_PASS" \
|
chmod 644 /opt/etherpat/docker-compose.yml
|
||||||
-i -t etherpad/etherpad
|
|
||||||
fi
|
docker-compose -f /opt/etherpat/docker-compose.yml up -d
|
||||||
|
|
||||||
# Tune webserver for Jitsi App control
|
# Tune webserver for Jitsi App control
|
||||||
|
|
||||||
|
@ -121,8 +121,8 @@ elif [ -f "$WS_CONF" ]; then
|
||||||
sed -i "/$WS_CONF_MATCH1/i \ \ \ \ }" "$WS_CONF"
|
sed -i "/$WS_CONF_MATCH1/i \ \ \ \ }" "$WS_CONF"
|
||||||
sed -i "/$WS_CONF_MATCH1/i \\\n" "$WS_CONF"
|
sed -i "/$WS_CONF_MATCH1/i \\\n" "$WS_CONF"
|
||||||
else
|
else
|
||||||
echo "> No etherpad config done to server file, please report to:
|
echo "> No etherpad config done to server file, please report to:"
|
||||||
-> https://forge.switnet.net/switnet/quick-jibri-installer/issues"
|
echo " -> https://forge.switnet.net/switnet/quick-jibri-installer/issues"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Configure config.js
|
# Configure config.js
|
||||||
|
@ -140,6 +140,6 @@ if nginx -t 2>/dev/null ; then
|
||||||
# systemctl reload nginx
|
# systemctl reload nginx
|
||||||
else
|
else
|
||||||
echo "Please check your configuration, something may be wrong."
|
echo "Please check your configuration, something may be wrong."
|
||||||
echo "Will not try to enable etherpad nginx configuration, please report to:
|
echo "Will not try to enable etherpad nginx configuration, please report to:"
|
||||||
-> https://forge.switnet.net/switnet/quick-jibri-installer/issues"
|
echo " -> https://forge.switnet.net/switnet/quick-jibri-installer/issues"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue