diff --git a/install.sh b/install.sh index 5bef031..2bab1d5 100755 --- a/install.sh +++ b/install.sh @@ -119,8 +119,7 @@ if [ $ctid -gt 99 ]; then LXC_CHK=$ctid else # Get next free LXC-number - LXC_LST=$( lxc-ls -1 | tail -1 ) - LXC_CHK=$((LXC_LST+1)); + LXC_CHK=$(($(pct list | cut -d' ' -f1 | tail -1) + 1)) fi if [ $LXC_CHK -lt 100 ] || [ -f /etc/pve/qemu-server/$LXC_CHK.conf ]; then @@ -160,9 +159,11 @@ sleep 2 if [ $LXC_MP -gt 0 ]; then pct set $LXC_NBR -mp0 $LXC_SHAREFS_STORAGE:$LXC_SHAREFS_SIZE,backup=1,mp=/$LXC_SHAREFS_MOUNTPOINT - pool=$(grep -A 4 $LXC_SHAREFS_STORAGE /etc/pve/storage.cfg | grep -m1 "pool " | cut -d ' ' -f2) - dataset=$(grep mp0 /etc/pve/lxc/$LXC_NBR.conf | cut -d ':' -f3 | cut -d',' -f1) - zfs set recordsize=$LXC_MP_RECORDSIZE $pool/$dataset + if [[ "$(pvesm status | grep $LXC_SHAREFS_STORAGE | cut -d ' ' -f6)" == "zfspool" ]]; then + pool=$(grep -A 4 $LXC_SHAREFS_STORAGE /etc/pve/storage.cfg | grep -m1 "pool " | cut -d ' ' -f2) + dataset=$(grep mp0 /etc/pve/lxc/$LXC_NBR.conf | cut -d ':' -f3 | cut -d',' -f1) + zfs set recordsize=$LXC_MP_RECORDSIZE $pool/$dataset + fi fi sleep 2; diff --git a/src/cloudpanel/constants-service.conf b/src/cloudpanel/constants-service.conf new file mode 100644 index 0000000..d207969 --- /dev/null +++ b/src/cloudpanel/constants-service.conf @@ -0,0 +1,31 @@ +#!/bin/bash + +# Authors: +# (C) 2024 Thorsten Spille + +# This file contains the project constants on service level + +# Debian Version, which will be installed +LXC_TEMPLATE_VERSION="debian-12-standard" + +# Create sharefs mountpoint +LXC_MP=1 +# Defines the mountpoint of the filesystem shared by Zamba inside your LXC container (default: tank) +LXC_SHAREFS_MOUNTPOINT="home" +# Defines the recordsize of mp0 +LXC_MP_RECORDSIZE="16K" + +# Create unprivileged container +LXC_UNPRIVILEGED="1" + +# enable nesting feature +LXC_NESTING="1" + +# enable keyctl feature +LXC_KEYCTL="0" + +# Sets the minimum amount of RAM the service needs for operation +LXC_MEM_MIN=2048 + +# service dependent meta tags +SERVICE_TAGS="php-fpm,nginx,mariadb" \ No newline at end of file diff --git a/src/cloudpanel/install-service.sh b/src/cloudpanel/install-service.sh new file mode 100644 index 0000000..9bce99b --- /dev/null +++ b/src/cloudpanel/install-service.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +# Author: +# (C) 2024 Thorsten Spille + +set -euo pipefail + +source zamba.conf + +wget -O - https://apt.bashclub.org/gpg/bashclub.pub | gpg --dearmor > /usr/share/keyrings/bashclub-keyring.gpg + +curl -sS https://installer.cloudpanel.io/ce/v2/install.sh -o install.sh +echo "2aefee646f988877a31198e0d84ed30e2ef7a454857b606608a1f0b8eb6ec6b6 install.sh" | sha256sum -c +DB_ENGINE=MARIADB_10.11 SWAP=false bash install.sh