mirror of
https://github.com/bashclub/proxmox-zfs-postinstall.git
synced 2025-12-06 08:38:44 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3ca96f6f35 | ||
|
|
68e85b8ecd | ||
|
|
696bbef89c | ||
|
|
064491d1a8 | ||
|
|
276da4fe43 | ||
|
|
994001a7a3 | ||
|
|
9b4b99dca4 | ||
|
|
e62e3d3557 |
@@ -12,6 +12,7 @@ Following settings are made:
|
||||
- Configure `vm.swappiness` interactively
|
||||
- Install checkmk Agent with optional encryption and registration
|
||||
- Added Support for Proxmox VE 7.0
|
||||
- Added Proxmox SDN features
|
||||
|
||||
# Usage
|
||||
|
||||
|
||||
61
install-cockpit-zfs-manager
Normal file
61
install-cockpit-zfs-manager
Normal file
@@ -0,0 +1,61 @@
|
||||
#!/bin/bash
|
||||
source /etc/os-release
|
||||
echo "deb http://deb.debian.org/debian $VERSION_CODENAME-backports main" > /etc/apt/sources.list.d/$VERSION_CODENAME-backports.list
|
||||
apt update
|
||||
cat << EOF > /etc/apt/preferences.d/90_cockpit
|
||||
Package: cockpit cockpit-*
|
||||
Pin: release n=$VERSION_CODENAME-backports
|
||||
Pin-Priority: 990
|
||||
EOF
|
||||
apt install --yes --no-install-recommends cockpit
|
||||
git clone https://github.com/optimans/cockpit-zfs-manager.git && cp -r cockpit-zfs-manager/zfs /usr/share/cockpit
|
||||
mkdir -p /etc/cockpit/zfs
|
||||
mkdir -p /etc/cockpit/zfs/shares
|
||||
mkdir -p /etc/cockpit/zfs/snapshots
|
||||
cat << EOF > /etc/cockpit/zfs/config.json
|
||||
{
|
||||
"#1": "COCKPIT ZFS MANAGER",
|
||||
"#2": "WARNING: DO NOT EDIT, AUTO-GENERATED CONFIGURATION",
|
||||
"cockpit": {
|
||||
"manage": true
|
||||
},
|
||||
"disks": {
|
||||
"base2": false
|
||||
},
|
||||
"loglevel": "2",
|
||||
"samba": {
|
||||
"manage": false,
|
||||
"windowscompatibility": true
|
||||
},
|
||||
"updates": {
|
||||
"check": true
|
||||
},
|
||||
"zfs": {
|
||||
"filesystem": {
|
||||
"cloneorigin": false,
|
||||
"quotarestrict": true,
|
||||
"readonlylockdown": false,
|
||||
"snapshotactions": true
|
||||
},
|
||||
"snapshot": {
|
||||
"filesystemlist": true
|
||||
},
|
||||
"status": {
|
||||
"errorcolors": true,
|
||||
"trimunsupported": false
|
||||
},
|
||||
"storagepool": {
|
||||
"activetab": 1,
|
||||
"boot": true,
|
||||
"bootlockdown": true,
|
||||
"count": true,
|
||||
"refreshall": false,
|
||||
"root": true
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
cat << EOF > /etc/cockpit/zfs/shares.conf
|
||||
# COCKPIT ZFS MANAGER
|
||||
# WARNING: DO NOT EDIT, AUTO-GENERATED CONFIGURATION
|
||||
EOF
|
||||
34
install-docker-portainer
Normal file
34
install-docker-portainer
Normal file
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
|
||||
# create zfs filesystems
|
||||
zfs create -o com.sun:auto-snapshot=false -o mountpoint=/var/lib/docker rpool/docker
|
||||
zfs create -o com.sun:auto-snapshot=true -o mountpoint=/portainer rpool/portainer
|
||||
|
||||
# add docker repository
|
||||
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
||||
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||
|
||||
# update package lists and install docker engine + docker-compose
|
||||
apt update
|
||||
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt install -y -qq --no-install-recommends docker-ce docker-ce-cli containerd.io docker-compose
|
||||
|
||||
# install portainer
|
||||
cd /portainer
|
||||
mkdir data
|
||||
cat << EOF > /portainer/docker-compose.yml
|
||||
version: '3.2'
|
||||
|
||||
services:
|
||||
|
||||
portainer:
|
||||
image: portainer/portainer-ce
|
||||
ports:
|
||||
- "9443:9443"
|
||||
- "8000:8000"
|
||||
volumes:
|
||||
- /portainer/data:/data
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
restart: always
|
||||
EOF
|
||||
# start portainer
|
||||
docker-compose up -d
|
||||
@@ -3,7 +3,7 @@
|
||||
###### CONFIG SECTION ######
|
||||
|
||||
# Define basic tools to install
|
||||
TOOLS="sudo vim ifupdown2 net-tools dnsutils ethtool git curl unzip screen iftop lshw smartmontools nvme-cli lsscsi sysstat zfs-auto-snapshot htop mc rpl lsb-release"
|
||||
TOOLS="sudo vim ifupdown2 libpve-network-perl net-tools dnsutils ethtool git curl unzip screen iftop lshw smartmontools nvme-cli lsscsi sysstat zfs-auto-snapshot htop mc rpl lsb-release"
|
||||
|
||||
#### PVE CONF BACKUP CONFIGURATION ####
|
||||
|
||||
@@ -169,11 +169,21 @@ if [[ "$(uname -r)" == *"-pve" ]]; then
|
||||
echo "Deactivating pve-enterprise repository"
|
||||
mv /etc/apt/sources.list.d/pve-enterprise.list /etc/apt/sources.list.d/pve-enterprise.list.bak > /dev/null 2>&1
|
||||
echo "Activating pve-no-subscription repository"
|
||||
echo "deb http://download.proxmox.com/debian/pve $VERSION_CODENAME pve-no-subscription" > /etc/apt/sources.list.d/pve-no-subscription.list
|
||||
q=$(cat /etc/apt/sources.list | grep "pve-no-subscription")
|
||||
if [ $? -gt 0 ]; then
|
||||
echo "deb http://download.proxmox.com/debian/pve $VERSION_CODENAME pve-no-subscription" >> /etc/apt/sources.list
|
||||
fi
|
||||
rm -f /etc/apt/sources.list.d/pve-no-subscription.list
|
||||
fi
|
||||
echo "Getting latest package lists"
|
||||
apt update > /dev/null 2>&1
|
||||
|
||||
# include interfaces.d to enable SDN features
|
||||
q=$(cat /etc/network/interfaces | grep "source /etc/network/interfaces.d/*")
|
||||
if [ $? -gt 0 ]; then
|
||||
echo "source /etc/network/interfaces.d/*" >> /etc/network/interfaces
|
||||
fi
|
||||
|
||||
# update system and install basic tools
|
||||
echo "Upgrading system to latest version - Depending on your version this could take a while..."
|
||||
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt -y -qq dist-upgrade > /dev/null 2>&1
|
||||
@@ -206,7 +216,10 @@ zfs list $PVE_CONF_BACKUP_TARGET > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
zfs create $PVE_CONF_BACKUP_TARGET
|
||||
fi
|
||||
|
||||
if [[ "$(df -h -t zfs | grep /$ | cut -d ' ' -f1)" == "rpool/ROOT/pve-1" ]] ; then
|
||||
echo "$PVE_CONF_BACKUP_CRON_TIMER root rsync -va --delete /etc /$PVE_CONF_BACKUP_TARGET > /$PVE_CONF_BACKUP_TARGET/pve-conf-backup.log" > /etc/cron.d/pve-conf-backup
|
||||
fi
|
||||
|
||||
ZFS_ARC_MIN_BYTES=$((ZFS_ARC_MIN_MEGABYTES * 1024 *1024))
|
||||
ZFS_ARC_MAX_BYTES=$((ZFS_ARC_MAX_MEGABYTES * 1024 *1024))
|
||||
|
||||
Reference in New Issue
Block a user