coder weekend

This commit is contained in:
DerFossibaer 2022-01-14 22:44:06 +01:00
parent f6cafff82e
commit bda8bb9e86
18 changed files with 168 additions and 10 deletions

13
install.sh Normal file → Executable file
View File

@ -93,15 +93,15 @@ fi
source $PWD/src/$service/constants-service.conf source $PWD/src/$service/constants-service.conf
# CHeck is the newest template available, else download it. # CHeck is the newest template available, else download it.
DEB_LOC=$(pveam list $LXC_TEMPLATE_STORAGE | grep debian-10-standard | cut -d'_' -f2) DEB_LOC=$(pveam list $LXC_TEMPLATE_STORAGE | grep $LXC_TEMPLATE_VERSION | cut -d'_' -f2)
DEB_REP=$(pveam available --section system | grep debian-10-standard | cut -d'_' -f2) DEB_REP=$(pveam available --section system | grep $LXC_TEMPLATE_VERSION | cut -d'_' -f2)
if [[ $DEB_LOC == $DEB_REP ]]; if [[ $DEB_LOC == $DEB_REP ]];
then then
echo "Newest Version of Debian 10 Standard $DEP_REP exists."; echo "Newest Version of $LXC_TEMPLATE_VERSION $DEP_REP exists.";
else else
echo "Will now download newest Debian 10 Standard $DEP_REP."; echo "Will now download newest $LXC_TEMPLATE_VERSION $DEP_REP.";
pveam download $LXC_TEMPLATE_STORAGE debian-10-standard_$DEB_REP\_amd64.tar.gz pveam download $LXC_TEMPLATE_STORAGE "$LXC_TEMPLATE_VERSION"_$DEB_REP\_amd64.tar.gz
fi fi
if [ $ctid -gt 99 ]; then if [ $ctid -gt 99 ]; then
@ -120,7 +120,7 @@ fi
echo "Will now create LXC Container $LXC_NBR!"; echo "Will now create LXC Container $LXC_NBR!";
# Create the container # Create the container
pct create $LXC_NBR -unprivileged $LXC_UNPRIVILEGED $LXC_TEMPLATE_STORAGE:vztmpl/debian-10-standard_$DEB_REP\_amd64.tar.gz -rootfs $LXC_ROOTFS_STORAGE:$LXC_ROOTFS_SIZE; pct create $LXC_NBR -unprivileged $LXC_UNPRIVILEGED $LXC_TEMPLATE_STORAGE:vztmpl/"$LXC_TEMPLATE_VERSION"_$DEB_REP\_amd64.tar.gz -rootfs $LXC_ROOTFS_STORAGE:$LXC_ROOTFS_SIZE;
sleep 2; sleep 2;
# Check vlan configuration # Check vlan configuration
@ -147,7 +147,6 @@ sleep 5;
echo -e "$LXC_PWD\n$LXC_PWD" | lxc-attach -n$LXC_NBR passwd; echo -e "$LXC_PWD\n$LXC_PWD" | lxc-attach -n$LXC_NBR passwd;
lxc-attach -n$LXC_NBR mkdir /root/.ssh; lxc-attach -n$LXC_NBR mkdir /root/.ssh;
pct push $LXC_NBR $LXC_AUTHORIZED_KEY /root/.ssh/authorized_keys pct push $LXC_NBR $LXC_AUTHORIZED_KEY /root/.ssh/authorized_keys
pct push $LXC_NBR $PWD/src/sources.list /etc/apt/sources.list
pct push $LXC_NBR $config /root/zamba.conf pct push $LXC_NBR $config /root/zamba.conf
pct push $LXC_NBR $PWD/src/constants.conf /root/constants.conf pct push $LXC_NBR $PWD/src/constants.conf /root/constants.conf
pct push $LXC_NBR $PWD/src/lxc-base.sh /root/lxc-base.sh pct push $LXC_NBR $PWD/src/lxc-base.sh /root/lxc-base.sh

View File

@ -7,6 +7,9 @@
# This file contains the project constants on service level # This file contains the project constants on service level
# Debian Version, which will be installed
LXC_TEMPLATE_VERSION="debian-11-standard"
# Create sharefs mountpoint # Create sharefs mountpoint
LXC_MP="0" LXC_MP="0"

View File

@ -7,6 +7,9 @@
# This file contains the project constants on service level # This file contains the project constants on service level
# Debian Version, which will be installed
LXC_TEMPLATE_VERSION="debian-11-standard"
# Create sharefs mountpoint # Create sharefs mountpoint
LXC_MP="0" LXC_MP="0"

View File

@ -7,6 +7,9 @@
# This file contains the project constants on service level # This file contains the project constants on service level
# Debian Version, which will be installed
LXC_TEMPLATE_VERSION="debian-10-standard"
# Create sharefs mountpoint # Create sharefs mountpoint
LXC_MP="0" LXC_MP="0"

View File

@ -9,6 +9,7 @@
echo "Loading configuration..." echo "Loading configuration..."
source /root/zamba.conf source /root/zamba.conf
source /root/constants.conf source /root/constants.conf
source /root/constants-service.conf
echo "Updating locales" echo "Updating locales"
# update locales # update locales
@ -19,9 +20,34 @@ LANGUAGE=$LXC_LOCALE
EOF EOF
locale-gen $LXC_LOCALE locale-gen $LXC_LOCALE
# Generate sources
if [ "$LXC_TEMPLATE_VERSION" == "debian-11-standard" ] ; then
cat << EOF > /etc/apt/sources.list
deb http://ftp.de.debian.org/debian bullseye main contrib
deb http://ftp.de.debian.org/debian bullseye-updates main contrib
# security updates
deb http://security.debian.org bullseye-security main contrib
EOF
elif [ "$LXC_TEMPLATE_VERSION" == "debian-10-standard" ] ; then
cat << EOF > /etc/apt/sources.list
deb http://ftp.de.debian.org/debian buster main contrib
deb http://ftp.de.debian.org/debian buster-updates main contrib
# security updates
deb http://security.debian.org buster/updates main contrib
EOF
else echo "LXC Debian Version false. Please check configuration files!" ; exit
fi
# update package lists # update package lists
echo "Updating package database..." echo "Updating package database..."
apt update apt --allow-releaseinfo-change update
# install latest packages # install latest packages
echo "Installing latest updates" echo "Installing latest updates"

View File

@ -7,6 +7,8 @@
# This file contains the project constants on service level # This file contains the project constants on service level
# Debian Version, which will be installed
LXC_TEMPLATE_VERSION="debian-10-standard"
# Create sharefs mountpoint # Create sharefs mountpoint
LXC_MP="0" LXC_MP="0"

View File

@ -7,6 +7,9 @@
# This file contains the project constants on service level # This file contains the project constants on service level
# Debian Version, which will be installed
LXC_TEMPLATE_VERSION="debian-10-standard"
# Create sharefs mountpoint # Create sharefs mountpoint
LXC_MP="0" LXC_MP="0"

View File

@ -7,6 +7,8 @@
# This file contains the project constants on service level # This file contains the project constants on service level
# Debian Version, which will be installed
LXC_TEMPLATE_VERSION="debian-10-standard"
# Create sharefs mountpoint # Create sharefs mountpoint
LXC_MP="1" LXC_MP="1"

View File

@ -7,6 +7,9 @@
# This file contains the project constants on service level # This file contains the project constants on service level
# Debian Version, which will be installed
LXC_TEMPLATE_VERSION="debian-11-standard"
# Create sharefs mountpoint # Create sharefs mountpoint
LXC_MP="0" LXC_MP="0"

View File

@ -7,6 +7,9 @@
# This file contains the project constants on service level # This file contains the project constants on service level
# Debian Version, which will be installed
LXC_TEMPLATE_VERSION="debian-10-standard"
# Create sharefs mountpoint # Create sharefs mountpoint
LXC_MP="0" LXC_MP="0"

View File

@ -0,0 +1,23 @@
#!/bin/bash
# Authors:
# (C) 2021 Idea an concept by Christian Zengel <christian@sysops.de>
# (C) 2021 Script design and prototype by Markus Helmke <m.helmke@nettwarker.de>
# (C) 2021 Script rework and documentation by Thorsten Spille <thorsten@spille-edv.de>
# This file contains the project constants on service level
# Debian Version, which will be installed
LXC_TEMPLATE_VERSION="debian-11-standard"
# Create sharefs mountpoint
LXC_MP="1"
# Create unprivileged container
LXC_UNPRIVILEGED="1"
# enable nesting feature
LXC_NESTING="0"
# Backup ubdir where Urbackup will store backups
PBS_DATA="backup"

View File

@ -0,0 +1,22 @@
#!/bin/bash
# Authors:
# (C) 2021 Idea an concept by Christian Zengel <christian@sysops.de>
# (C) 2021 Script design and prototype by Markus Helmke <m.helmke@nettwarker.de>
# (C) 2021 Script rework and documentation by Thorsten Spille <thorsten@spille-edv.de>
source /root/zamba.conf
source /root/constants-service.conf
cat << EOF > /etc/apt/sources.list.d/pbs-no-subscription.list
# PBS pbs-no-subscription repository provided by proxmox.com,
# NOT recommended for production use
deb http://download.proxmox.com/debian/pbs bullseye pbs-no-subscription
EOF
wget https://enterprise.proxmox.com/debian/proxmox-release-bullseye.gpg -O /etc/apt/trusted.gpg.d/proxmox-release-bullseye.gpg
apt update && apt upgrade -y
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt install -y -o DPkg::options::="--force-confdef" -o DPkg::options::="--force-confold" proxmox-backup-server
proxmox-backup-manager datastore create $PBS_DATA /$LXC_SHAREFS_MOUNTPOINT/$PBS_DATA

View File

@ -0,0 +1,23 @@
#!/bin/bash
# Authors:
# (C) 2021 Idea an concept by Christian Zengel <christian@sysops.de>
# (C) 2021 Script design and prototype by Markus Helmke <m.helmke@nettwarker.de>
# (C) 2021 Script rework and documentation by Thorsten Spille <thorsten@spille-edv.de>
# This file contains the project constants on service level
# Debian Version, which will be installed
LXC_TEMPLATE_VERSION="debian-10-standard"
# Create sharefs mountpoint
LXC_MP="1"
# Create unprivileged container
LXC_UNPRIVILEGED="1"
# enable nesting feature
LXC_NESTING="0"
# Backup ubdir where Urbackup will store backups
URBACKUP_DATA="urbackup"

View File

@ -0,0 +1,20 @@
#!/bin/bash
# Authors:
# (C) 2021 Idea an concept by Christian Zengel <christian@sysops.de>
# (C) 2021 Script design and prototype by Markus Helmke <m.helmke@nettwarker.de>
# (C) 2021 Script rework and documentation by Thorsten Spille <thorsten@spille-edv.de>
source /root/zamba.conf
source /root/constants-service.conf
mkdir /$LXC_SHAREFS_MOUNTPOINT/$URBACKUP_DATA
mkdir /etc/urbackup
echo "/$LXC_SHAREFS_MOUNTPOINT/$URBACKUP_DATA" > /etc/urbackup/backupfolder
echo 'deb http://download.opensuse.org/repositories/home:/uroni/Debian_10/ /' | tee /etc/apt/sources.list.d/home:uroni.list
curl -fsSL https://download.opensuse.org/repositories/home:uroni/Debian_10/Release.key | gpg --dearmor | tee /etc/apt/trusted.gpg.d/home_uroni.gpg > /dev/null
apt update
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt install -y --no-install-recommends -o DPkg::options::="--force-confdef" -o DPkg::options::="--force-confold" urbackup-server
chown urbackup:urbackup /$LXC_SHAREFS_MOUNTPOINT/$URBACKUP_DATA

View File

@ -7,6 +7,9 @@
# This file contains the project constants on service level # This file contains the project constants on service level
# Debian Version, which will be installed
LXC_TEMPLATE_VERSION="debian-11-standard"
# Defines the desired DNS server backend, supported are `SAMBA_INTERNAL` and `BIND9_DLZ` for more advanced usage # Defines the desired DNS server backend, supported are `SAMBA_INTERNAL` and `BIND9_DLZ` for more advanced usage
ZMB_DNS_BACKEND="SAMBA_INTERNAL" ZMB_DNS_BACKEND="SAMBA_INTERNAL"

View File

@ -7,6 +7,9 @@
# This file contains the project constants on service level # This file contains the project constants on service level
# Debian Version, which will be installed
LXC_TEMPLATE_VERSION="debian-11-standard"
# Create sharefs mountpoint # Create sharefs mountpoint
LXC_MP="1" LXC_MP="1"

View File

@ -7,6 +7,9 @@
# This file contains the project constants on service level # This file contains the project constants on service level
# Debian Version, which will be installed
LXC_TEMPLATE_VERSION="debian-11-standard"
# Create sharefs mountpoint # Create sharefs mountpoint
LXC_MP="1" LXC_MP="1"

14
testinstall Executable file
View File

@ -0,0 +1,14 @@
bash -vx install.sh -s checkmk > checkmk.inst.log
bash -vx install.sh -s debian-unpriv > debian-unpriv.inst.log
bash -vx install.sh -s matrix > matrix.inst.log
bash -vx install.sh -s nextcloud > nextcloud.inst.log
bash -vx install.sh -s open3a > open3a.inst.log
bash -vx install.sh -s zmb-ad > zmb-ad.inst.log
bash -vx install.sh -s zmb-member > zmb-member.inst.log
bash -vx install.sh -s zmb-standalone > zmb-standalone.inst.log
bash -vx install.sh -s debian-priv > debian-priv.inst.log
bash -vx install.sh -s mailpiler > mailpiler.inst.log
bash -vx install.sh -s onlyoffice > onlyoffice.inst.log
bash -vx install.sh -s proxmox-pbs > proxmox-pbs.inst.log
bash -vx install.sh -s urbackup > urbackup.inst.log