You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
FreeDMR/docker-configs/docker-compose_install.sh

104 lines
3.2 KiB

#!/bin/bash
#
###############################################################################
# Copyright (C) 2020 Simon Adlem, G7RZU <g7rzu@gb7fr.org.uk>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
###############################################################################
echo FreeDMR Docker installer...
echo Installing required packages...
echo Install Docker Community Edition...
apt-get -y remove docker docker-engine docker.io &&
apt-get -y update &&
apt-get -y install apt-transport-https ca-certificates curl gnupg2 software-properties-common &&
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add - &&
ARCH=`/usr/bin/arch`
echo "System architecture is $ARCH"
if [ "$ARCH" == "x86_64" ]
then
ARCH="amd64"
fi
add-apt-repository \
"deb [arch=$ARCH] https://download.docker.com/linux/debian \
$(lsb_release -cs) \
stable" &&
apt-get -y update &&
apt-get -y install docker-ce &&
echo Install Docker Compose...
apt-get -y install docker-compose &&
echo Set userland-proxy to false...
cat <<EOF > /etc/docker/daemon.json &&
{
"userland-proxy": false,
"experimental": true,
"log-driver": "json-file",
"log-opts": {
"max-size": "10m",
"max-file": "3"
}
}
EOF
echo Restart docker...
systemctl restart docker &&
echo Make config directory...
mkdir -p /etc/freedmr &&
mkdir -p /etc/freedmr/acme.sh &&
mkdir -p /etc/freedmr/certs &&
chmod -R 755 /etc/freedmr &&
echo make json directory...
mkdir -p /etc/freedmr/json &&
chown 54000:54000 /etc/freedmr/json &&
echo Install /etc/freedmr/freedmr.cfg ...
curl -fsSL https://gitlab.hacknix.net/hacknix/FreeDMR/-/raw/master/FreeDMR.cfg -o /etc/freedmr/freedmr.cfg &&
echo Set perms on config directory...
chown -R 54000 /etc/freedmr &&
echo Get docker-compose.yml...
cd /etc/freedmr &&
curl -fsSL https://gitlab.hacknix.net/hacknix/FreeDMR/-/raw/master/docker-configs/docker-compose.yml -o docker-compose.yml &&
if [ -e /etc/cron.daily/lastheard ]; then
chmod 755 /etc/cron.daily/lastheard
fi
echo Tune network stack...
cat << EOF > /etc/sysctl.conf &&
net.core.rmem_default=134217728
net.core.rmem_max=134217728
net.core.wmem_max=134217728
net.core.rmem_default=134217728
net.core.netdev_max_backlog=250000
net.netfilter.nf_conntrack_udp_timeout=15
net.netfilter.nf_conntrack_udp_timeout_stream=35
EOF
/usr/sbin/sysctl -p &&
echo Run FreeDMR container...
docker-compose up -d
echo Read notes in /etc/freedmr/docker-compose.yml to understand how to implement extra functionality.
echo FreeDMR setup complete!

Powered by TurnKey Linux.