mirror of
https://github.com/flynx/proxmox-utils.git
synced 2025-12-25 21:02:04 +00:00
Compare commits
No commits in common. "90a142ad3c7a53484c4faf22c86e7f43ae27c72c" and "95369a63add5f38a0691aa248fb2777bc4b769ff" have entirely different histories.
90a142ad3c
...
95369a63ad
16
.pct-helpers
16
.pct-helpers
@ -148,8 +148,7 @@ normpath(){
|
|||||||
# https://pve.proxmox.com/wiki/Linux_Container
|
# https://pve.proxmox.com/wiki/Linux_Container
|
||||||
getLatestTemplate(){
|
getLatestTemplate(){
|
||||||
#IFS=$'\n'
|
#IFS=$'\n'
|
||||||
#@ pveam update
|
local pattern=$1
|
||||||
|
|
||||||
local templates=($(pveam available | grep -o ''${1}'.*$'))
|
local templates=($(pveam available | grep -o ''${1}'.*$'))
|
||||||
local latest=${templates[-1]}
|
local latest=${templates[-1]}
|
||||||
|
|
||||||
@ -199,18 +198,6 @@ xreadpass(){
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
|
||||||
# readConfig
|
|
||||||
#
|
|
||||||
readConfig(){
|
|
||||||
if [ -z $NO_DEFAULTS ] ; then
|
|
||||||
[ -e ../config.global ] \
|
|
||||||
&& source ../config.global
|
|
||||||
[ -e ./config ] \
|
|
||||||
&& source ./config
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# readVars
|
# readVars
|
||||||
#
|
#
|
||||||
@ -245,7 +232,6 @@ readVars(){
|
|||||||
xread "Hostname: " CTHOSTNAME
|
xread "Hostname: " CTHOSTNAME
|
||||||
|
|
||||||
# hardware...
|
# hardware...
|
||||||
xread "CPU cores: " CORES
|
|
||||||
xread "RAM (MB): " RAM
|
xread "RAM (MB): " RAM
|
||||||
xread "SWAP (MB): " SWAP
|
xread "SWAP (MB): " SWAP
|
||||||
xread "DRIVE (GB): " DRIVE
|
xread "DRIVE (GB): " DRIVE
|
||||||
|
|||||||
10
Makefile
10
Makefile
@ -29,17 +29,9 @@ wireguard:
|
|||||||
syncthing:
|
syncthing:
|
||||||
$@/make.sh
|
$@/make.sh
|
||||||
|
|
||||||
.PHONY: nextcloud
|
|
||||||
nextcloud:
|
|
||||||
$@/make.sh
|
|
||||||
|
|
||||||
.PHONY: gitea
|
|
||||||
gitea:
|
|
||||||
$@/make.sh
|
|
||||||
|
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: config gate ns ssh wireguard syncthing nextcloud gitea
|
all: config gate ns ssh wireguard syncthing
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -12,7 +12,11 @@ source ../.pct-helpers
|
|||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
readConfig
|
[ -e ../config.global ] \
|
||||||
|
&& source ../config.global
|
||||||
|
|
||||||
|
[ -e ./config ] \
|
||||||
|
&& source ./config
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
@ -20,7 +24,6 @@ readConfig
|
|||||||
DFL_ID=${DFL_ID:=101}
|
DFL_ID=${DFL_ID:=101}
|
||||||
DFL_CTHOSTNAME=${GATE_HOSTNAME:=${DFL_CTHOSTNAME:=gate}}
|
DFL_CTHOSTNAME=${GATE_HOSTNAME:=${DFL_CTHOSTNAME:=gate}}
|
||||||
|
|
||||||
CORES=1
|
|
||||||
RAM=128
|
RAM=128
|
||||||
SWAP=$RAM
|
SWAP=$RAM
|
||||||
DRIVE=0.5
|
DRIVE=0.5
|
||||||
@ -42,7 +45,6 @@ readVars
|
|||||||
|
|
||||||
OPTS_STAGE_1="\
|
OPTS_STAGE_1="\
|
||||||
--hostname $CTHOSTNAME \
|
--hostname $CTHOSTNAME \
|
||||||
--cores $CORES \
|
|
||||||
--memory $RAM \
|
--memory $RAM \
|
||||||
--swap $SWAP \
|
--swap $SWAP \
|
||||||
--net0 name=wan,bridge=vmbr${WAN_BRIDGE},firewall=1${WAN_GATE:+,gw=${WAN_GATE}}${WAN_IP:+,ip=${WAN_IP}},type=veth \
|
--net0 name=wan,bridge=vmbr${WAN_BRIDGE},firewall=1${WAN_GATE:+,gw=${WAN_GATE}}${WAN_IP:+,ip=${WAN_IP}},type=veth \
|
||||||
|
|||||||
@ -1,7 +0,0 @@
|
|||||||
auto lo
|
|
||||||
iface lo inet loopback
|
|
||||||
|
|
||||||
auto lan
|
|
||||||
iface lan inet dhcp
|
|
||||||
hostname $(hostname)
|
|
||||||
|
|
||||||
@ -1,102 +0,0 @@
|
|||||||
#!/usr/bin/bash
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
|
|
||||||
cd $(dirname $0)
|
|
||||||
PATH=$PATH:$(dirname "$(pwd)")
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
|
|
||||||
source ../.pct-helpers
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
|
|
||||||
readConfig
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
|
|
||||||
DFL_ID=${DFL_ID:=300}
|
|
||||||
DFL_CTHOSTNAME=${DFL_CTHOSTNAME:=nextcloud}
|
|
||||||
|
|
||||||
DFL_CORES=${DFL_CORES:=2}
|
|
||||||
DFL_RAM=${DFL_RAM:=2048}
|
|
||||||
DFL_SWAP=${DFL_SWAP:=${DFL_RAM:=2048}}
|
|
||||||
DFL_DRIVE=${DFL_DRIVE:=40}
|
|
||||||
|
|
||||||
WAN_IP=-
|
|
||||||
WAN_GATE=-
|
|
||||||
ADMIN_IP=-
|
|
||||||
ADMIN_GATE=-
|
|
||||||
LAN_IP=-
|
|
||||||
LAN_GATE=-
|
|
||||||
|
|
||||||
REBOOT=${REBOOT:=1}
|
|
||||||
|
|
||||||
readVars
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
|
|
||||||
# XXX cores...
|
|
||||||
OPTS_STAGE_1="\
|
|
||||||
--hostname $CTHOSTNAME \
|
|
||||||
--cores $CORES \
|
|
||||||
--memory $RAM \
|
|
||||||
--swap $SWAP \
|
|
||||||
--net0 name=lan,bridge=vmbr${LAN_BRIDGE},firewall=1,ip=dhcp,type=veth \
|
|
||||||
--storage local-lvm \
|
|
||||||
--rootfs local-lvm:$DRIVE \
|
|
||||||
--unprivileged 1 \
|
|
||||||
${PCT_EXTRA} \
|
|
||||||
"
|
|
||||||
|
|
||||||
OPTS_STAGE_2="\
|
|
||||||
--startup order=90,up=10 \
|
|
||||||
--onboot 1 \
|
|
||||||
"
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
|
|
||||||
echo "# Building config..."
|
|
||||||
buildAssets "$TEMPLATE_DIR" "$ASSETS_DIR"
|
|
||||||
|
|
||||||
echo "# Creating CT..."
|
|
||||||
getLatestTemplate '.*-turnkey-nextcloud' TEMPLATE
|
|
||||||
pctCreate $ID "$TEMPLATE" "$OPTS_STAGE_1" "$PASS"
|
|
||||||
sleep ${TIMEOUT:=5}
|
|
||||||
|
|
||||||
#echo "# Starting TKL Setup (this may take a few minutes to start)..."
|
|
||||||
#@ lxc-attach $ID -- bash --login -i
|
|
||||||
##@ lxc-attach $ID -- /usr/sbin/trunkey-init
|
|
||||||
#
|
|
||||||
#echo "# Updating config..."
|
|
||||||
## XXX update /var/www/nextcloud/config/config.php
|
|
||||||
## - trusted_domains
|
|
||||||
## - trusted_proxies
|
|
||||||
#@ lxc-attach $ID -- \
|
|
||||||
# sed \
|
|
||||||
# -e 's/^\(\s*\)\('\''trusted_domains\)/\1'\''trusted_proxies'\'' =>\n\1array (\n\1\1'${GATE_LAN_IP}'\/32\n\1)\n\1\2/' \
|
|
||||||
# -i /var/www/nextcloud/config/config.php
|
|
||||||
|
|
||||||
echo "# Copying assets..."
|
|
||||||
@ pct-push-r $ID ./assets /
|
|
||||||
|
|
||||||
echo "# Disabling fail2ban..."
|
|
||||||
# NOTE: we do not need this as we'll be running from behind a reverse proxy...
|
|
||||||
@ lxc-attach $ID systemctl stop fail2ban
|
|
||||||
@ lxc-attach $ID systemctl disable fail2ban
|
|
||||||
|
|
||||||
echo "# Post config..."
|
|
||||||
pctSet $ID "${OPTS_STAGE_2}" $REBOOT
|
|
||||||
|
|
||||||
echo "# Done."
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# vim:set ts=4 sw=4 :
|
|
||||||
|
|
||||||
|
|
||||||
@ -12,7 +12,11 @@ source ../.pct-helpers
|
|||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
readConfig
|
[ -e ../config.global ] \
|
||||||
|
&& source ../config.global
|
||||||
|
|
||||||
|
[ -e ./config ] \
|
||||||
|
&& source ./config
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
@ -20,7 +24,6 @@ readConfig
|
|||||||
DFL_ID=${DFL_ID:=100}
|
DFL_ID=${DFL_ID:=100}
|
||||||
DFL_CTHOSTNAME=${NS_HOSTNAME:=${DFL_CTHOSTNAME:=ns}}
|
DFL_CTHOSTNAME=${NS_HOSTNAME:=${DFL_CTHOSTNAME:=ns}}
|
||||||
|
|
||||||
CORES=1
|
|
||||||
RAM=128
|
RAM=128
|
||||||
SWAP=$RAM
|
SWAP=$RAM
|
||||||
DRIVE=0.5
|
DRIVE=0.5
|
||||||
@ -42,7 +45,6 @@ readVars
|
|||||||
|
|
||||||
OPTS_STAGE_1="\
|
OPTS_STAGE_1="\
|
||||||
--hostname $CTHOSTNAME \
|
--hostname $CTHOSTNAME \
|
||||||
--cores $CORES \
|
|
||||||
--memory $RAM \
|
--memory $RAM \
|
||||||
--swap $SWAP \
|
--swap $SWAP \
|
||||||
--net0 name=lan,bridge=vmbr${LAN_BRIDGE},firewall=1${LAN_GATE:+,gw=$LAN_GATE}${LAN_IP:+,ip=$LAN_IP},type=veth \
|
--net0 name=lan,bridge=vmbr${LAN_BRIDGE},firewall=1${LAN_GATE:+,gw=$LAN_GATE}${LAN_IP:+,ip=$LAN_IP},type=veth \
|
||||||
|
|||||||
@ -12,7 +12,11 @@ source ../.pct-helpers
|
|||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
readConfig
|
[ -e ../config.global ] \
|
||||||
|
&& source ../config.global
|
||||||
|
|
||||||
|
[ -e ./config ] \
|
||||||
|
&& source ./config
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
@ -20,7 +24,6 @@ readConfig
|
|||||||
DFL_ID=${DFL_ID:=102}
|
DFL_ID=${DFL_ID:=102}
|
||||||
DFL_CTHOSTNAME=${DFL_CTHOSTNAME:=ssh}
|
DFL_CTHOSTNAME=${DFL_CTHOSTNAME:=ssh}
|
||||||
|
|
||||||
DFL_CORES=${DFL_CORES:=1}
|
|
||||||
DFL_RAM=${DFL_RAM:=1024}
|
DFL_RAM=${DFL_RAM:=1024}
|
||||||
DFL_SWAP=${DFL_SWAP:=${DFL_RAM:=1024}}
|
DFL_SWAP=${DFL_SWAP:=${DFL_RAM:=1024}}
|
||||||
DFL_DRIVE=${DFL_DRIVE:=16}
|
DFL_DRIVE=${DFL_DRIVE:=16}
|
||||||
@ -42,7 +45,6 @@ readVars
|
|||||||
|
|
||||||
OPTS_STAGE_1="\
|
OPTS_STAGE_1="\
|
||||||
--hostname $CTHOSTNAME \
|
--hostname $CTHOSTNAME \
|
||||||
--cores $CORES \
|
|
||||||
--memory $RAM \
|
--memory $RAM \
|
||||||
--swap $SWAP \
|
--swap $SWAP \
|
||||||
--net0 name=lan,bridge=vmbr${LAN_BRIDGE},firewall=1,ip=dhcp,type=veth \
|
--net0 name=lan,bridge=vmbr${LAN_BRIDGE},firewall=1,ip=dhcp,type=veth \
|
||||||
|
|||||||
@ -12,7 +12,11 @@ source ../.pct-helpers
|
|||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
readConfig
|
[ -e ../config.global ] \
|
||||||
|
&& source ../config.global
|
||||||
|
|
||||||
|
[ -e ./config ] \
|
||||||
|
&& source ./config
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
@ -20,7 +24,6 @@ readConfig
|
|||||||
DFL_ID=${DFL_ID:=301}
|
DFL_ID=${DFL_ID:=301}
|
||||||
DFL_CTHOSTNAME=${DFL_CTHOSTNAME:=syncthing}
|
DFL_CTHOSTNAME=${DFL_CTHOSTNAME:=syncthing}
|
||||||
|
|
||||||
DFL_CORES=${DFL_CORES:=1}
|
|
||||||
DFL_RAM=${DFL_RAM:=1024}
|
DFL_RAM=${DFL_RAM:=1024}
|
||||||
DFL_SWAP=${DFL_SWAP:=${DFL_RAM:=1024}}
|
DFL_SWAP=${DFL_SWAP:=${DFL_RAM:=1024}}
|
||||||
DFL_DRIVE=${DFL_DRIVE:=8}
|
DFL_DRIVE=${DFL_DRIVE:=8}
|
||||||
@ -41,7 +44,6 @@ readVars
|
|||||||
|
|
||||||
OPTS_STAGE_1="\
|
OPTS_STAGE_1="\
|
||||||
--hostname $CTHOSTNAME \
|
--hostname $CTHOSTNAME \
|
||||||
--cores $CORES \
|
|
||||||
--memory $RAM \
|
--memory $RAM \
|
||||||
--swap $SWAP \
|
--swap $SWAP \
|
||||||
--net0 name=lan,bridge=vmbr${LAN_BRIDGE},firewall=1,ip=dhcp,type=veth \
|
--net0 name=lan,bridge=vmbr${LAN_BRIDGE},firewall=1,ip=dhcp,type=veth \
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user