Removes files used to install libreoffice-docker service in previous approach

This commit is contained in:
Gustavo Trott 2021-03-29 17:18:31 -03:00
parent e5a235efa5
commit d44bf40f27
3 changed files with 0 additions and 124 deletions

View File

@ -1,19 +0,0 @@
[Unit]
Description=BigBlueButton Libre Office container %i
Requires=network.target
[Service]
Type=simple
WorkingDirectory=/tmp
ExecStart=/usr/share/bbb-libreoffice/libreoffice_container.sh %i
ExecStop=/usr/bin/docker kill bbb-libreoffice-%i
Restart=always
RestartSec=60
SuccessExitStatus=
TimeoutStopSec=30
PermissionsStartOnly=true
LimitNOFILE=1024
[Install]
WantedBy=multi-user.target

View File

@ -1,46 +0,0 @@
#!/bin/bash
set -e
INSTANCE_NUMBER=$1
if [ -z "$INSTANCE_NUMBER" ]; then
INSTANCE_NUMBER=0
fi;
_kill() {
CHECK_CONTAINER=`docker inspect bbb-libreoffice-${INSTANCE_NUMBER} &> /dev/null && echo 1 || echo 0`
if [ "$CHECK_CONTAINER" = "1" ]; then
echo "Killing container"
docker kill bbb-libreoffice-${INSTANCE_NUMBER};
sleep 1
fi;
}
trap _kill SIGINT
if (($INSTANCE_NUMBER >= 1)); then
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
_kill
let PORT=8200+${INSTANCE_NUMBER}
SOFFICE_WORK_DIR="/var/tmp/soffice_"`printf "%02d\n" $INSTANCE_NUMBER`
INPUT_RULE="INPUT -i br-soffice -m state --state NEW -j DROP"
iptables -C $INPUT_RULE || iptables -I $INPUT_RULE
FORWARD_RULE="FORWARD -i br-soffice -m state --state NEW -j DROP"
iptables -C $FORWARD_RULE || iptables -I $FORWARD_RULE
docker run --network bbb-libreoffice --user `id -u bigbluebutton` --name bbb-libreoffice-${INSTANCE_NUMBER} -p $PORT:8000 -v${SOFFICE_WORK_DIR}:${SOFFICE_WORK_DIR} --rm bbb-libreoffice &
wait $!
else
echo ;
echo "Invalid or missing parameter INSTANCE_NUMBER"
echo " Usage: $0 INSTANCE_NUMBER"
exit 1
fi;

View File

@ -1,59 +0,0 @@
#!/bin/bash
if [ "$EUID" -ne 0 ]; then
echo "Please run this script as root ( or with sudo )" ;
exit 1;
fi;
DOCKER_CHECK=`docker --version &> /dev/null && echo 1 || echo 0`
if [ "$DOCKER_CHECK" = "0" ]; then
echo "Docker not found";
apt update;
apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
apt update
apt install docker-ce -y
systemctl enable docker
systemctl start docker
systemctl status docker
else
echo "Docker already installed";
fi
IMAGE_CHECK=`docker image inspect bbb-libreoffice &> /dev/null && echo 1 || echo 0`
if [ "$IMAGE_CHECK" = "0" ]; then
echo "Docker image doesn't exists, building"
docker build --no-cache -t bbb-libreoffice docker/
else
echo "Docker image already exists";
fi
NETWORK_CHECK=`docker network inspect bbb-libreoffice &> /dev/null && echo 1 || echo 0`
if [ "$NETWORK_CHECK" = "0" ]; then
echo "Docker network doesn't exists, creating"
docker network create bbb-libreoffice -d bridge --opt com.docker.network.bridge.name=br-soffice
fi
FOLDER_CHECK=`[ -d /usr/share/bbb-libreoffice/ ] && echo 1 || echo 0`
if [ "$FOLDER_CHECK" = "0" ]; then
echo "Install folder doesn't exists, installing"
mkdir -m 755 /usr/share/bbb-libreoffice/
cp assets/libreoffice_container.sh /usr/share/bbb-libreoffice/
chmod 700 /usr/share/bbb-libreoffice/libreoffice_container.sh
chown -R root /usr/share/bbb-libreoffice/
cp assets/bbb-libreoffice.service /lib/systemd/system/bbb-libreoffice@.service
systemctl daemon-reload
for i in `seq 1 4` ; do
systemctl enable bbb-libreoffice@${i}
systemctl start bbb-libreoffice@${i}
done
else
echo "Install folder already exists"
fi;