mirror of
https://github.com/community-scripts/ProxmoxVED.git
synced 2026-02-25 05:57:26 +00:00
switch scripts to deferred
This commit is contained in:
83
install/deferred/ampache-install.sh
Normal file
83
install/deferred/ampache-install.sh
Normal file
@@ -0,0 +1,83 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2024 tteck
|
||||
# Author: MickLesk (Canbiz)
|
||||
# License: MIT
|
||||
# https://github.com/tteck/Proxmox/raw/main/LICENSE
|
||||
|
||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing Dependencies (Patience)"
|
||||
apt-get install -y \
|
||||
apache2 \
|
||||
cron \
|
||||
flac \
|
||||
vorbis-tools \
|
||||
lame \
|
||||
ffmpeg \
|
||||
lsb-release \
|
||||
gosu \
|
||||
wget \
|
||||
curl \
|
||||
git \
|
||||
make \
|
||||
inotify-tools \
|
||||
libavcodec-extra \
|
||||
libev-libevent-dev \
|
||||
libmp3lame-dev \
|
||||
libtheora-dev \
|
||||
libvorbis-dev \
|
||||
libvpx-dev
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
PHP_VERSION=8.4
|
||||
PHP_MODULE=bcmath,bz2,cli,common,curl,fpm,gd,imagick,intl,mbstring,mysql,sqlite3,xml,xmlrpc,zip
|
||||
PHP_APACHE=YES
|
||||
install_php
|
||||
install_mariadb
|
||||
|
||||
msg_info "Setting up Database"
|
||||
DB_NAME=ampache2
|
||||
DB_USER=ampache2
|
||||
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
|
||||
sudo mysql -u root -e "CREATE DATABASE $DB_NAME;"
|
||||
sudo mysql -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED WITH mysql_native_password AS PASSWORD('$DB_PASS');"
|
||||
sudo mysql -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;"
|
||||
echo "" >>~/ampache.creds
|
||||
echo -e "Ampache Database User: \e $DB_USER\e" >>~/ampache.creds
|
||||
echo -e "Ampache Database Password: \e$DB_PASS\e" >>~/ampache.creds
|
||||
echo -e "Ampache Database Name: \e$DB_NAME\e" >>~/ampache.creds
|
||||
msg_ok "Set up database"
|
||||
|
||||
msg_info "Installing Ampache(Patience)"
|
||||
cd /opt
|
||||
AMPACHE_VERSION=$(wget -q https://github.com/ampache/ampache/releases/latest -O - | grep "title>Release" | cut -d " " -f 4)
|
||||
wget https://github.com/ampache/ampache/releases/download/${AMPACHE_VERSION}/ampache-${AMPACHE_VERSION}_all_php8.4.zip
|
||||
unzip -q ampache-${AMPACHE_VERSION}_all_php8.4.zip -d ampache
|
||||
rm -rf /var/www/html
|
||||
ln -s /opt/ampache/public /var/www/html
|
||||
sudo mv /opt/ampache/rest/.htaccess.dist /opt/ampache/rest/.htaccess
|
||||
sudo mv /opt/ampache/play/.htaccess.dist /opt/ampache/play/.htaccess
|
||||
sudo mv /opt/ampache/channel/.htaccess.dist /opt/ampache/channel/.htaccess
|
||||
sudo cp /opt/ampache/config/ampache.cfg.php.dist /opt/ampache/config/ampache.cfg.php
|
||||
sudo chmod 664 /opt/ampache/rest/.htaccess /opt/ampache/play/.htaccess
|
||||
sudo sed -i 's/upload_max_filesize = .*/upload_max_filesize = 50M/' /etc/php/8.4/apache2/php.ini &&
|
||||
sudo sed -i 's/post_max_size = .*/post_max_size = 50M/' /etc/php/8.4/apache2/php.ini &&
|
||||
sudo sed -i 's/max_execution_time = .*/max_execution_time = 300/' /etc/php/8.4/apache2/php.ini &&
|
||||
sudo sed -i 's/memory_limit = .*/memory_limit = 256M/' /etc/php/8.4/apache2/php.ini &&
|
||||
sudo systemctl restart apache2
|
||||
msg_ok "Installed Ampache"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning up"
|
||||
$STD apt-get autoremove
|
||||
$STD apt-get autoclean
|
||||
msg_ok "Cleaned"
|
||||
171
install/deferred/freepbx-install_backup.sh
Normal file
171
install/deferred/freepbx-install_backup.sh
Normal file
@@ -0,0 +1,171 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2025 community-scripts ORG
|
||||
# Author: Arian Nasr (arian-nasr)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
|
||||
# Source: https://www.freepbx.org/
|
||||
|
||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apt-get install -y \
|
||||
build-essential \
|
||||
git \
|
||||
libnewt-dev \
|
||||
libssl-dev \
|
||||
libncurses5-dev \
|
||||
subversion \
|
||||
libsqlite3-dev \
|
||||
libjansson-dev \
|
||||
libxml2-dev \
|
||||
uuid-dev \
|
||||
default-libmysqlclient-dev \
|
||||
htop \
|
||||
sngrep \
|
||||
lame \
|
||||
ffmpeg \
|
||||
mpg123 \
|
||||
vim \
|
||||
expect \
|
||||
openssh-server \
|
||||
apache2 \
|
||||
mariadb-server \
|
||||
mariadb-client \
|
||||
bison \
|
||||
flex \
|
||||
php8.2 \
|
||||
php8.2-{curl,cli,common,mysql,gd,mbstring,intl,xml} \
|
||||
php-pear \
|
||||
sox \
|
||||
sqlite3 \
|
||||
pkg-config \
|
||||
automake \
|
||||
libtool \
|
||||
autoconf \
|
||||
unixodbc-dev \
|
||||
uuid \
|
||||
libasound2-dev \
|
||||
libogg-dev \
|
||||
libvorbis-dev \
|
||||
libicu-dev \
|
||||
libcurl4-openssl-dev \
|
||||
odbc-mariadb \
|
||||
libical-dev \
|
||||
libneon27-dev \
|
||||
libsrtp2-dev \
|
||||
libspandsp-dev \
|
||||
subversion \
|
||||
libtool-bin \
|
||||
python-dev-is-python3 \
|
||||
unixodbc \
|
||||
software-properties-common \
|
||||
nodejs \
|
||||
npm \
|
||||
ipset \
|
||||
iptables \
|
||||
fail2ban \
|
||||
php-soap
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
msg_info "Installing Asterisk (Patience)"
|
||||
cd /usr/src
|
||||
curl -fsSL http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-21-current.tar.gz
|
||||
tar xf asterisk-21-current.tar.gz
|
||||
cd asterisk-21.*
|
||||
$STD contrib/scripts/get_mp3_source.sh
|
||||
$STD contrib/scripts/install_prereq install
|
||||
$STD ./configure --libdir=/usr/lib64 --with-pjproject-bundled --with-jansson-bundled
|
||||
$STD make
|
||||
$STD make install
|
||||
$STD make samples
|
||||
$STD make config
|
||||
ldconfig
|
||||
msg_ok "Installed Asterisk"
|
||||
|
||||
msg_info "Setup Asterisk"
|
||||
groupadd asterisk
|
||||
useradd -r -d /var/lib/asterisk -g asterisk asterisk
|
||||
usermod -aG audio,dialout asterisk
|
||||
chown -R asterisk:asterisk /etc/asterisk
|
||||
chown -R asterisk:asterisk /var/{lib,log,spool}/asterisk
|
||||
chown -R asterisk:asterisk /usr/lib64/asterisk
|
||||
sed -i 's|#AST_USER|AST_USER|' /etc/default/asterisk
|
||||
sed -i 's|#AST_GROUP|AST_GROUP|' /etc/default/asterisk
|
||||
sed -i 's|;runuser|runuser|' /etc/asterisk/asterisk.conf
|
||||
sed -i 's|;rungroup|rungroup|' /etc/asterisk/asterisk.conf
|
||||
echo "/usr/lib64" >>/etc/ld.so.conf.d/x86_64-linux-gnu.conf
|
||||
ldconfig
|
||||
msg_ok "Done Setup Asterisk"
|
||||
|
||||
msg_info "Setup Apache"
|
||||
sed -i 's/\(^upload_max_filesize = \).*/\120M/' /etc/php/8.2/apache2/php.ini
|
||||
sed -i 's/\(^memory_limit = \).*/\1256M/' /etc/php/8.2/apache2/php.ini
|
||||
sed -i 's/^\(User\|Group\).*/\1 asterisk/' /etc/apache2/apache2.conf
|
||||
sed -i 's/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
|
||||
$STD a2enmod rewrite
|
||||
systemctl restart apache2
|
||||
rm /var/www/html/index.html
|
||||
msg_ok "Done Setup Apache"
|
||||
|
||||
# Configure ODBC
|
||||
cat <<EOF >/etc/odbcinst.ini
|
||||
[MySQL]
|
||||
Description = ODBC for MySQL (MariaDB)
|
||||
Driver = /usr/lib/x86_64-linux-gnu/odbc/libmaodbc.so
|
||||
FileUsage = 1
|
||||
EOF
|
||||
|
||||
cat <<EOF >/etc/odbc.ini
|
||||
[MySQL-asteriskcdrdb]
|
||||
Description = MySQL connection to 'asteriskcdrdb' database
|
||||
Driver = MySQL
|
||||
Server = localhost
|
||||
Database = asteriskcdrdb
|
||||
Port = 3306
|
||||
Socket = /var/run/mysqld/mysqld.sock
|
||||
Option = 3
|
||||
EOF
|
||||
|
||||
msg_info "Installing FreePBX"
|
||||
cd /usr/local/src
|
||||
curl -fsSL http://mirror.freepbx.org/modules/packages/freepbx/freepbx-17.0-latest-EDGE.tgz -o freepbx-17.0-latest-EDGE.tgz
|
||||
tar zxf freepbx-17.0-latest-EDGE.tgz
|
||||
cd /usr/local/src/freepbx/
|
||||
$STD ./start_asterisk start
|
||||
# Even though the php code completes successfully, it is returning non-zero exit code, so in the next line we return true, needed for successful installation
|
||||
./install -n &>/dev/null || true
|
||||
$STD fwconsole ma installall
|
||||
$STD fwconsole reload
|
||||
$STD fwconsole restart
|
||||
msg_ok "Installed FreePBX"
|
||||
|
||||
msg_info "Setup FreePBX Service"
|
||||
cat <<EOF >/etc/systemd/system/freepbx.service
|
||||
[Unit]
|
||||
Description=FreePBX VoIP Server
|
||||
After=mariadb.service
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
ExecStart=/usr/sbin/fwconsole start -q
|
||||
ExecStop=/usr/sbin/fwconsole stop -q
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl daemon-reload
|
||||
systemctl enable -q --now freepbx
|
||||
msg_ok "Done Setup FreePBX Service"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning up"
|
||||
$STD apt-get -y autoremove
|
||||
$STD apt-get -y autoclean
|
||||
msg_ok "Cleaned"
|
||||
161
install/deferred/funkwhale-install.sh
Normal file
161
install/deferred/funkwhale-install.sh
Normal file
@@ -0,0 +1,161 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2024 tteck
|
||||
# Author: tteck (tteckster)
|
||||
# License: MIT
|
||||
# https://github.com/tteck/Proxmox/raw/main/LICENSE
|
||||
|
||||
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing Python3"
|
||||
$STD apt-get install -y --no-install-recommends \
|
||||
python3 \
|
||||
python3-dev \
|
||||
python3-setuptools \
|
||||
python3-venv
|
||||
msg_ok "Installed Python3"
|
||||
|
||||
msg_info "Installing Dependencies (Patience)"
|
||||
$STD apt-get install -y --no-install-recommends \
|
||||
redis \
|
||||
postgresql \
|
||||
postgresql-contrib \
|
||||
postgresql-client \
|
||||
build-essential \
|
||||
gnupg \
|
||||
ffmpeg \
|
||||
libjpeg-dev \
|
||||
libpq-dev \
|
||||
libmagic-dev \
|
||||
libzbar0 \
|
||||
poppler-utils \
|
||||
automake \
|
||||
libtool \
|
||||
pkg-config \
|
||||
curl \
|
||||
libtiff-dev \
|
||||
libpng-dev \
|
||||
libleptonica-dev \
|
||||
sudo \
|
||||
make \
|
||||
mc
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
msg_info "Setup Funkwhale Dependencies (Patience)"
|
||||
export FUNKWHALE_VERSION=1.4.0
|
||||
$STD sudo apt install -y --no-install-recommends $(curl https://dev.funkwhale.audio/funkwhale/funkwhale/-/raw/$FUNKWHALE_VERSION/deploy/requirements.apt)
|
||||
$STD sudo useradd --system --shell /bin/bash --create-home --home-dir /opt/funkwhale funkwhale
|
||||
cd /opt/funkwhale
|
||||
$STD sudo mkdir -p config api data/static data/media data/music front
|
||||
$STD sudo chown -R funkwhale:funkwhale data
|
||||
msg_ok "Initial Setup complete"
|
||||
|
||||
msg_ok "Download Funkwhale API"
|
||||
$STD sudo curl -L -o "api-$FUNKWHALE_VERSION.zip" "https://dev.funkwhale.audio/funkwhale/funkwhale/-/jobs/artifacts/$FUNKWHALE_VERSION/download?job=build_api"
|
||||
$STD sudo unzip -q "api-$FUNKWHALE_VERSION.zip" -d extracted
|
||||
$STD sudo mv extracted/api/* api/
|
||||
$STD sudo rm -rf extracted api-$FUNKWHALE_VERSION.zip
|
||||
msg_ok "Downloaded and extracted Funkwhale API"
|
||||
|
||||
msg_info "Download Funkwhale Frontend"
|
||||
$STD sudo curl -L -o "front-$FUNKWHALE_VERSION.zip" "https://dev.funkwhale.audio/funkwhale/funkwhale/-/jobs/artifacts/$FUNKWHALE_VERSION/download?job=build_front"
|
||||
$STD sudo unzip -q "front-$FUNKWHALE_VERSION.zip" -d extracted
|
||||
$STD sudo mv extracted/front .
|
||||
$STD sudo rm -rf extracted front-$FUNKWHALE_VERSION.zip
|
||||
msg_ok "Downloaded and extracted Funkwhale Frontend"
|
||||
|
||||
msg_info "Install Funkwhale API and DJANGO"
|
||||
cd /opt/funkwhale
|
||||
$STD sudo python3 -m venv venv
|
||||
$STD sudo venv/bin/pip install --upgrade pip wheel
|
||||
$STD sudo venv/bin/pip install --editable ./api
|
||||
$STD sudo curl -L -o /opt/funkwhale/config/.env "https://dev.funkwhale.audio/funkwhale/funkwhale/raw/$FUNKWHALE_VERSION/deploy/env.prod.sample"
|
||||
secret_key=$(openssl rand -base64 45 | sed 's/\//\\\//g')
|
||||
sudo sed -i "s/DJANGO_SECRET_KEY=.*/DJANGO_SECRET_KEY=$secret_key/" /opt/funkwhale/config/.env
|
||||
sudo sed -i 's/# CACHE_URL=redis:\/\/127.0.0.1:6379\/0/CACHE_URL=redis:\/\/127.0.0.1:6379\/0/' /opt/funkwhale/config/.env #Remove #Hashtag From Config for Debian
|
||||
sudo sed -i 's/# DATABASE_URL=postgresql:\/\/funkwhale@:5432\/funkwhale/DATABASE_URL=postgresql:\/\/funkwhale@:5432\/funkwhale/' /opt/funkwhale/config/.env #Remove #Hashtag From Config for Debian
|
||||
# set the paths to /opt instead of /srv
|
||||
sudo sed -i 's/MEDIA_ROOT=\/srv\/funkwhale\/data\/media/MEDIA_ROOT=\/opt\/funkwhale\/data\/media/' /opt/funkwhale/config/.env
|
||||
sudo sed -i 's/STATIC_ROOT=\/srv\/funkwhale\/data\/static/STATIC_ROOT=\/opt\/funkwhale\/data\/static/' /opt/funkwhale/config/.env
|
||||
sudo sed -i 's/MUSIC_DIRECTORY_PATH=\/srv\/funkwhale\/data\/music/MUSIC_DIRECTORY_PATH=\/opt\/funkwhale\/data\/music/' /opt/funkwhale/config/.env
|
||||
sudo sed -i 's/MUSIC_DIRECTORY_SERVE_PATH=\/srv\/funkwhale\/data\/music/MUSIC_DIRECTORY_SERVE_PATH=\/opt\/funkwhale\/data\/music/' /opt/funkwhale/config/.env
|
||||
sudo sed -i 's/FUNKWHALE_FRONTEND_PATH=\/srv\/funkwhale\/front\/dist/FUNKWHALE_FRONTEND_PATH=\/opt\/funkwhale\/front\/dist/' /opt/funkwhale/config/.env
|
||||
sudo chown funkwhale:funkwhale /opt/funkwhale/config/.env
|
||||
sudo chmod 600 /opt/funkwhale/config/.env
|
||||
msg_ok "Environment successfully set up"
|
||||
|
||||
msg_info "Setting up Database"
|
||||
DB_NAME=funkwhale
|
||||
DB_USER=funkwhale
|
||||
DB_EXTENSION_UNACCENT=unaccent
|
||||
DB_EXTENSION_CITEXT=citext
|
||||
DB_PASS="$(openssl rand -base64 18 | cut -c1-13)"
|
||||
SECRET_KEY="$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 32)"
|
||||
$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';"
|
||||
$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER TEMPLATE template0;"
|
||||
$STD sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE $DB_NAME TO $DB_USER;"
|
||||
echo "" >>~/funkwhale.creds
|
||||
echo -e "Funkwhale Database User: \e[32m$DB_USER\e[0m" >>~/funkwhale.creds
|
||||
echo -e "Funkwhale Database Password: \e[32m$DB_PASS\e[0m" >>~/funkwhale.creds
|
||||
echo -e "Funkwhale Database Name: \e[32m$DB_NAME\e[0m" >>~/funkwhale.creds
|
||||
$STD sudo -u postgres psql -c "CREATE EXTENSION $DB_EXTENSION_UNACCENT;"
|
||||
$STD sudo -u postgres psql -c "CREATE EXTENSION $DB_EXTENSION_CITEXT;"
|
||||
cd /opt/funkwhale
|
||||
$STD sudo -u funkwhale venv/bin/funkwhale-manage migrate
|
||||
msg_ok "Set up PostgreSQL database"
|
||||
|
||||
msg_info "Setting up Funkwhale and systemd"
|
||||
FUNKWHALE_USER=funkwhale_su
|
||||
FUNKWHALE_MAIL=mail@example.com
|
||||
FUNKWHALE_PASS="$(openssl rand -base64 18 | cut -c1-13)"
|
||||
echo -e "Funkwhale Superuser: \e[32m$FUNKWHALE_USER\e[0m" >>~/funkwhale.creds
|
||||
echo -e "Funkwhale Mail: \e[32m$FUNKWHALE_MAIL\e[0m" >>~/funkwhale.creds
|
||||
echo -e "Funkwhale Superuser Password: \e[32m$FUNKWHALE_PASS\e[0m" >>~/funkwhale.creds
|
||||
$STD sudo -u funkwhale venv/bin/funkwhale-manage fw users create --superuser --username $FUNKWHALE_USER --email $FUNKWHALE_MAIL --password $FUNKWHALE_PASS
|
||||
$STD sudo venv/bin/funkwhale-manage collectstatic
|
||||
$STD sudo curl -L -o "/etc/systemd/system/funkwhale.target" "https://dev.funkwhale.audio/funkwhale/funkwhale/raw/$FUNKWHALE_VERSION/deploy/funkwhale.target"
|
||||
$STD sudo curl -L -o "/etc/systemd/system/funkwhale-server.service" "https://dev.funkwhale.audio/funkwhale/funkwhale/raw/$FUNKWHALE_VERSION/deploy/funkwhale-server.service"
|
||||
$STD sudo curl -L -o "/etc/systemd/system/funkwhale-worker.service" "https://dev.funkwhale.audio/funkwhale/funkwhale/raw/$FUNKWHALE_VERSION/deploy/funkwhale-worker.service"
|
||||
$STD sudo curl -L -o "/etc/systemd/system/funkwhale-beat.service" "https://dev.funkwhale.audio/funkwhale/funkwhale/raw/$FUNKWHALE_VERSION/deploy/funkwhale-beat.service"
|
||||
$STD sudo systemctl daemon-reload
|
||||
$STD sudo systemctl start funkwhale.target
|
||||
$STD sudo systemctl enable --now funkwhale.target
|
||||
msg_ok "Funkwhale successfully set up"
|
||||
|
||||
read -r -p "Would you like to Setup Reverse Proxy (Nginx)? <y/N> " prompt
|
||||
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
|
||||
msg_info "Installing NGINX"
|
||||
$STD apt install -y nginx
|
||||
sudo su
|
||||
$STD curl -L -o /etc/nginx/funkwhale_proxy.conf "https://dev.funkwhale.audio/funkwhale/funkwhale/raw/$FUNKWHALE_VERSION/deploy/funkwhale_proxy.conf"
|
||||
$STD curl -L -o /etc/nginx/sites-available/funkwhale.template "https://dev.funkwhale.audio/funkwhale/funkwhale/raw/$FUNKWHALE_VERSION/deploy/nginx.template"
|
||||
$STD set -a && source /opt/funkwhale/config/.env && set +a envsubst "`env | awk -F = '{printf \" $%s\", $$1}'`" \
|
||||
< /etc/nginx/sites-available/funkwhale.template \
|
||||
> /etc/nginx/sites-available/funkwhale.conf
|
||||
$STD grep '${' /etc/nginx/sites-available/funkwhale.conf
|
||||
$STD ln -s /etc/nginx/sites-available/funkwhale.conf /etc/nginx/sites-enabled/
|
||||
$STD systemctl reload nginx
|
||||
msg_ok "Installed Nginx"
|
||||
fi
|
||||
|
||||
read -r -p "Would you like to Setup TLS (Certbot)? <y/N> " prompt
|
||||
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
|
||||
msg_info "Installing Certbot"
|
||||
$STD apt install -y certbot python3-certbot-nginx
|
||||
$STD sudo certbot --nginx -d $FUNKWHALE_HOSTNAME
|
||||
msg_ok "Installed Certbot"
|
||||
fi
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning up"
|
||||
$STD apt-get autoremove
|
||||
$STD apt-get autoclean
|
||||
msg_ok "Cleaned"
|
||||
179
install/deferred/ghostfolio-install.sh
Normal file
179
install/deferred/ghostfolio-install.sh
Normal file
@@ -0,0 +1,179 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2024 tteck
|
||||
# Author: tteck (tteckster)
|
||||
# Co-Author: jcantosz
|
||||
# License: MIT
|
||||
# https://github.com/tteck/Proxmox/raw/main/LICENSE
|
||||
|
||||
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apt-get update
|
||||
$STD apt-get install -y \
|
||||
curl \
|
||||
lsb-release \
|
||||
gpg \
|
||||
g++ \
|
||||
git \
|
||||
make \
|
||||
openssl \
|
||||
python3 \
|
||||
postgresql-15 \
|
||||
redis
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
msg_info "Setting up Node.js Repository"
|
||||
mkdir -p /etc/apt/keyrings
|
||||
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
|
||||
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list
|
||||
msg_ok "Set up Node.js Repository"
|
||||
|
||||
msg_info "Installing Node.js"
|
||||
$STD apt-get update
|
||||
$STD apt-get install -y --no-install-suggests nodejs
|
||||
msg_info "Installed Node.js"
|
||||
|
||||
msg_info "Installing Postgresql"
|
||||
POSTGRES_HOST=localhost
|
||||
POSTGRES_PORT=5432
|
||||
POSTGRES_DB=ghostfolio-db
|
||||
POSTGRES_USER='postgres'
|
||||
POSTGRES_PASSWORD="$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 32)"
|
||||
ACCESS_TOKEN_SALT="$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 32)"
|
||||
DATABASE_URL="postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}?connect_timeout=300&sslmode=prefer"
|
||||
JWT_SECRET_KEY="$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 32)"
|
||||
|
||||
$STD su postgres <<EOSU
|
||||
psql -c "create database \"$POSTGRES_DB\";"
|
||||
psql -c "ALTER DATABASE \"$POSTGRES_DB\" OWNER TO \"$POSTGRES_USER\";"
|
||||
psql -c "GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO \"$POSTGRES_USER\";"
|
||||
psql -c "ALTER USER \"$POSTGRES_USER\" WITH PASSWORD '$POSTGRES_PASSWORD';"
|
||||
EOSU
|
||||
|
||||
echo "" >~/ghostfolio.creds
|
||||
echo "Ghostfolio Database Credentials" >>~/ghostfolio.creds
|
||||
echo "" >>~/ghostfolio.creds
|
||||
echo -e "Ghostfolio Database User: \e[32m$POSTGRES_USER\e[0m" >>~/ghostfolio.creds
|
||||
echo -e "Ghostfolio Database Password: \e[32m$POSTGRES_PASSWORD\e[0m" >>~/ghostfolio.creds
|
||||
echo -e "Ghostfolio Database Name: \e[32m$POSTGRES_DB\e[0m" >>~/ghostfolio.creds
|
||||
msg_ok "Installed Postgresql"
|
||||
|
||||
msg_info "Installing Redis"
|
||||
REDIS_HOST=localhost
|
||||
REDIS_PORT=6379
|
||||
REDIS_PASSWORD="$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 32)"
|
||||
|
||||
$STD redis-cli CONFIG SET requirepass "$REDIS_PASSWORD"
|
||||
$STD redis-cli -a "$REDIS_PASSWORD" CONFIG REWRITE
|
||||
$STD systemctl restart redis
|
||||
echo "" >>~/ghostfolio.creds
|
||||
echo "Ghostfolio Redis Credentials" >>~/ghostfolio.creds
|
||||
echo "" >>~/ghostfolio.creds
|
||||
echo -e "Ghostfolio Redis Password: \e[32m$REDIS_PASSWORD\e[0m" >>~/ghostfolio.creds
|
||||
msg_ok "Installed Redis"
|
||||
|
||||
msg_info "Installing Ghostfolio (Patience)"
|
||||
RELEASE=$(curl -sL https://api.github.com/repos/ghostfolio/ghostfolio/releases/latest | grep '"tag_name":' | cut -d'"' -f4)
|
||||
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
|
||||
|
||||
cd /opt/
|
||||
$STD curl -Ls -o ghostfolio-$RELEASE.tgz https://github.com/ghostfolio/ghostfolio/archive/refs/tags/$RELEASE.tar.gz
|
||||
$STD tar xzf ghostfolio-$RELEASE.tgz
|
||||
$STD rm ghostfolio-$RELEASE.tgz
|
||||
|
||||
cp /opt/ghostfolio-$RELEASE/package.json /opt/package.json
|
||||
cp /opt/ghostfolio-$RELEASE/package-lock.json /opt/package-lock.json
|
||||
|
||||
cd /opt/ghostfolio-$RELEASE
|
||||
$STD npm install
|
||||
$STD npm run build:production
|
||||
mv /opt/package-lock.json /opt/ghostfolio-$RELEASE/package-lock.json
|
||||
|
||||
cd /opt/ghostfolio-$RELEASE/dist/apps/api/
|
||||
$STD npm install
|
||||
cp -r /opt/ghostfolio-$RELEASE/prisma .
|
||||
mv /opt/package.json /opt/ghostfolio-$RELEASE/dist/apps/api/package.json
|
||||
$STD npm run database:generate-typings
|
||||
|
||||
cd /opt
|
||||
mv /opt/ghostfolio-$RELEASE/dist/apps /opt/ghostfolio
|
||||
mv /opt/ghostfolio-$RELEASE/docker/entrypoint.sh /opt/ghostfolio/
|
||||
|
||||
rm -rf /opt/ghostfolio-$RELEASE
|
||||
msg_ok "Installed Ghostfolio"
|
||||
|
||||
msg_info "Creating Service"
|
||||
cat <<EOF >/opt/ghostfolio/api/.env
|
||||
# CACHE
|
||||
REDIS_HOST=$REDIS_HOST
|
||||
REDIS_PORT=$REDIS_PORT
|
||||
REDIS_PASSWORD=$REDIS_PASSWORD
|
||||
|
||||
# POSTGRES
|
||||
POSTGRES_DB=$POSTGRES_DB
|
||||
POSTGRES_USER=$POSTGRES_USER
|
||||
POSTGRES_PASSWORD=$POSTGRES_PASSWORD
|
||||
|
||||
# VARIOUS
|
||||
ACCESS_TOKEN_SALT=$ACCESS_TOKEN_SALT
|
||||
DATABASE_URL="$DATABASE_URL"
|
||||
JWT_SECRET_KEY=$JWT_SECRET_KEY
|
||||
EOF
|
||||
|
||||
cat <<EOF >/opt/ghostfolio/start.sh
|
||||
#!/bin/bash
|
||||
# Source the environment vars and export them otherwise it wont get them properly
|
||||
set -a
|
||||
. /opt/ghostfolio/api/.env
|
||||
set +a
|
||||
|
||||
# Run the docker entrypoint
|
||||
/opt/ghostfolio/entrypoint.sh
|
||||
EOF
|
||||
|
||||
chmod +x /opt/ghostfolio/start.sh
|
||||
|
||||
msg_info "Setup Service"
|
||||
cat <<EOF >/etc/systemd/system/ghostfolio.service
|
||||
[Unit]
|
||||
Description=ghostfolio
|
||||
|
||||
[Service]
|
||||
After=postgresql.service redis.service
|
||||
Require=postgresql.service redis.service
|
||||
|
||||
# Start Service
|
||||
ExecStart=/opt/ghostfolio/start.sh
|
||||
WorkingDirectory=/opt/ghostfolio/api/
|
||||
|
||||
# Restart service after 10 seconds if node service crashes
|
||||
RestartSec=10
|
||||
Restart=always
|
||||
|
||||
# Output to syslog
|
||||
StandardOutput=syslog
|
||||
StandardError=syslog
|
||||
SyslogIdentifier=ghostfolio
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
systemctl enable ghostfolio
|
||||
systemctl start ghostfolio
|
||||
msg_ok "Created Service"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning up"
|
||||
$STD apt-get -y autoremove
|
||||
$STD apt-get -y autoclean
|
||||
msg_ok "Cleaned"
|
||||
130
install/deferred/healthchecks-install.sh
Normal file
130
install/deferred/healthchecks-install.sh
Normal file
@@ -0,0 +1,130 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2025 community-scripts ORG
|
||||
# Author: MickLesk (Canbiz)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/getmaxun/maxun
|
||||
|
||||
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apt-get install -y \
|
||||
gpg \
|
||||
curl \
|
||||
sudo \
|
||||
mc \
|
||||
gcc \
|
||||
libpq-dev \
|
||||
libcurl4-openssl-dev \
|
||||
libssl-dev
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
msg_info "Setup Python3"
|
||||
$STD apt-get install -y \
|
||||
python3 python3-dev python3-venv python3-pip
|
||||
$STD pip install --upgrade pip
|
||||
msg_ok "Setup Python3"
|
||||
msg_info "Setting up PostgreSQL Repository"
|
||||
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg
|
||||
echo "deb https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main" >/etc/apt/sources.list.d/pgdg.list
|
||||
$STD apt-get update
|
||||
$STD apt-get install -y postgresql-17
|
||||
msg_ok "Set up PostgreSQL Repository"
|
||||
|
||||
|
||||
msg_info "Setup Database"
|
||||
DB_NAME=healthchecks_db
|
||||
DB_USER=hc_user
|
||||
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)
|
||||
SECRET_KEY="$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | cut -c1-32)"
|
||||
|
||||
$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';"
|
||||
$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;"
|
||||
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';"
|
||||
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET default_transaction_isolation TO 'read committed';"
|
||||
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC'"
|
||||
{
|
||||
echo "healthchecks-Credentials"
|
||||
echo "healthchecks Database User: $DB_USER"
|
||||
echo "healthchecks Database Password: $DB_PASS"
|
||||
echo "healthchecks Database Name: $DB_NAME"
|
||||
} >> ~/healthchecks.creds
|
||||
msg_ok "Set up Database"
|
||||
|
||||
msg_info "Setup healthchecks"
|
||||
cd /opt
|
||||
RELEASE=$(curl -s https://api.github.com/repos/healthchecks/healthchecks/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||
curl -fsSL "https://github.com/healthchecks/healthchecks/archive/refs/tags/v${RELEASE}.zip"
|
||||
unzip -q v${RELEASE}.zip
|
||||
mv healthchecks-${RELEASE} /opt/healthchecks
|
||||
cd /opt/healthchecks
|
||||
pip install --upgrade pip
|
||||
pip install wheel
|
||||
pip install -r requirements.txt
|
||||
CAT EOF
|
||||
python3 -m venv hc-venv
|
||||
source hc-venv/bin/activate
|
||||
pip3 install wheel
|
||||
pip install -r requirements.txt
|
||||
cat <<EOF >/opt/healthchecks/.env
|
||||
DB=postgres
|
||||
DB_HOST=localhost
|
||||
DB_PORT=5432
|
||||
DB_NAME=${DB_NAME}
|
||||
DB_USER=${DB_USER}
|
||||
DB_PASSWORD=${DB_PASS}
|
||||
|
||||
# Django & Healthchecks Konfiguration
|
||||
SECRET_KEY=${SECRET_KEY}
|
||||
DEBUG=False
|
||||
ALLOWED_HOSTS=your.domain.com
|
||||
SITE_ROOT=https://your.domain.com
|
||||
EOF
|
||||
|
||||
source /opt/healthchecks/venv/bin/activate
|
||||
python3 manage.py migrate
|
||||
cat <<EOF | python3 /opt/healthchecks/manage.py shell
|
||||
from django.contrib.auth import get_user_model
|
||||
UserModel = get_user_model()
|
||||
user = UserModel.objects.create_user('admin', password='$DB_PASS')
|
||||
user.is_superuser = True
|
||||
user.is_staff = True
|
||||
user.save()
|
||||
EOF
|
||||
./manage.py createsuperuser
|
||||
|
||||
|
||||
msg_ok "Installed healthchecks"
|
||||
|
||||
msg_info "Creating Service"
|
||||
cat <<EOF >/etc/systemd/system/healthchecks.service
|
||||
[Unit]
|
||||
Description=Healthchecks Service
|
||||
After=network.target postgresql.service
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=/opt/healthchecks/
|
||||
ExecStart=python3 manage.py runserver 0.0.0.0:8000
|
||||
Restart=always
|
||||
EnvironmentFile=/opt/healthchecks/.env
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q --now healthchecks
|
||||
msg_ok "Created Service"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning up"
|
||||
rm -rf /opt/v${RELEASE}.zip
|
||||
$STD apt-get -y autoremove
|
||||
$STD apt-get -y autoclean
|
||||
msg_ok "Cleaned"
|
||||
72
install/deferred/hoodik-install.sh
Normal file
72
install/deferred/hoodik-install.sh
Normal file
@@ -0,0 +1,72 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2024 community-scripts ORG
|
||||
# Author: MickLesk (Canbiz)
|
||||
# License: MIT
|
||||
# https://github.com/tteck/Proxmox/raw/main/LICENSE
|
||||
# Source: https://github.com/hudikhq/hoodik
|
||||
|
||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing Dependencies (Patience)"
|
||||
$STD apt-get install -y \
|
||||
pkg-config \
|
||||
libssl-dev \
|
||||
libc6-dev \
|
||||
libpq-dev \
|
||||
clang \
|
||||
llvm \
|
||||
nettle-dev \
|
||||
build-essential \
|
||||
curl \
|
||||
sudo \
|
||||
make \
|
||||
mc
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
msg_info "Installing Rust (Patience)"
|
||||
$STD bash <(curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs) -y
|
||||
source ~/.cargo/env
|
||||
msg_ok "Installed Rust"
|
||||
|
||||
msg_info "Installing Hoodik (Patience)"
|
||||
cd /opt
|
||||
RELEASE=$(curl -s https://api.github.com/repos/hudikhq/hoodik/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||
wget -q "https://github.com/hudikhq/hoodik/archive/refs/tags/${RELEASE}.zip"
|
||||
unzip -q ${RELEASE}.zip
|
||||
mv "hoodik-${RELEASE:1}" hoodik
|
||||
cd hoodik
|
||||
cargo build -q --release
|
||||
msg_ok "Installed hoodik"
|
||||
|
||||
msg_info "Creating Service"
|
||||
cat <<EOF >/etc/systemd/system/hoodik.service
|
||||
[Unit]
|
||||
Description=Start Hoodik Service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=root
|
||||
WorkingDirectory=/opt/hoodik
|
||||
ExecStart=/root/.cargo/bin/cargo run -q --release
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q --now hoodik.service
|
||||
msg_ok "Created Service"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning up"
|
||||
rm -rf /opt/${RELEASE}.zip
|
||||
$STD apt-get autoremove
|
||||
$STD apt-get autoclean
|
||||
msg_ok "Cleaned"
|
||||
147
install/deferred/koel-install.sh
Normal file
147
install/deferred/koel-install.sh
Normal file
@@ -0,0 +1,147 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2024 communtiy-scripts ORG
|
||||
# Author: MickLesk (Canbiz)
|
||||
# License: MIT
|
||||
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
|
||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
PG_VERSION="16" install_postgresql
|
||||
PHP_VERSION=8.3 PHP_MODULE="bcmath,bz2,cli,exif,common,curl,fpm,gd,imagick,intl,mbstring,pgsql,sqlite3,xml,xmlrpc,zip" install_php
|
||||
NODE_VERSION=22 NODE_MODULE="yarn,npm@latest" install_node_and_modules
|
||||
install_composer
|
||||
|
||||
msg_info "Installing Dependencies (Patience)"
|
||||
$STD apt-get install -y \
|
||||
nginx \
|
||||
apt-transport-https \
|
||||
lsb-release \
|
||||
ffmpeg \
|
||||
cron \
|
||||
libapache2-mod-xsendfile \
|
||||
libzip-dev \
|
||||
locales \
|
||||
libpng-dev \
|
||||
libjpeg62-turbo-dev \
|
||||
libpq-dev \
|
||||
libwebp-dev
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
# PG_VERSION="16" install_postgresql
|
||||
# PHP_VERSION=8.3 PHP_MODULE="bcmath,bz2,cli,exif,common,curl,fpm,gd,imagick,intl,mbstring,pgsql,sqlite3,xml,xmlrpc,zip" install_php
|
||||
# NODE_VERSION=22 NODE_MODULE="yarn,npm@latest" install_node_and_modules
|
||||
# install_composer
|
||||
|
||||
msg_info "Setting up PostgreSQL Database"
|
||||
DB_NAME=koel_db
|
||||
DB_USER=koel
|
||||
DB_PASS="$(openssl rand -base64 18 | cut -c1-13)"
|
||||
APP_SECRET=$(openssl rand -base64 32)
|
||||
$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';"
|
||||
$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;"
|
||||
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';"
|
||||
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET default_transaction_isolation TO 'read committed';"
|
||||
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC'"
|
||||
{
|
||||
echo "Koel-Credentials"
|
||||
echo "Koel Database User: $DB_USER"
|
||||
echo "Koel Database Password: $DB_PASS"
|
||||
echo "Koel Database Name: $DB_NAME"
|
||||
} >>~/koel.creds
|
||||
msg_ok "Set up PostgreSQL Database"
|
||||
|
||||
msg_info "Installing Koel(Patience)"
|
||||
RELEASE=$(curl -fsSL https://github.com/koel/koel/releases/latest | grep "title>Release" | cut -d " " -f 4)
|
||||
mkdir -p /opt/koel_{media,sync}
|
||||
curl -fsSL https://github.com/koel/koel/releases/download/${RELEASE}/koel-${RELEASE}.zip -o /opt/koel.zip
|
||||
cd /opt
|
||||
unzip koel.zip
|
||||
cd /opt/koel
|
||||
mv .env.example .env
|
||||
$STD composer install --no-interaction
|
||||
sed -i -e "s/DB_CONNECTION=.*/DB_CONNECTION=pgsql/" \
|
||||
-e "s/DB_HOST=.*/DB_HOST=localhost/" \
|
||||
-e "s/DB_DATABASE=.*/DB_DATABASE=$DB_NAME/" \
|
||||
-e "s/DB_PORT=.*/DB_PORT=5432/" \
|
||||
-e "s|APP_KEY=.*|APP_KEY=$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | cut -c1-32)|" \
|
||||
-e "s/DB_USERNAME=.*/DB_USERNAME=$DB_USER/" \
|
||||
-e "s|DB_PASSWORD=.*|DB_PASSWORD=$DB_PASS|" \
|
||||
-e "s|MEDIA_PATH=.*|MEDIA_PATH=/opt/koel_media|" \
|
||||
-e "s|FFMPEG_PATH=/usr/local/bin/ffmpeg|FFMPEG_PATH=/usr/bin/ffmpeg|" /opt/koel/.env
|
||||
php artisan koel:init --no-assets
|
||||
chown -R :www-data /opt/*
|
||||
chmod -R g+r /opt/*
|
||||
chmod -R g+rw /opt/*
|
||||
chown -R www-data:www-data /opt/*
|
||||
chmod -R 755 /opt/*
|
||||
msg_ok "Installed Koel"
|
||||
|
||||
msg_info "Set up web services"
|
||||
cat <<EOF >/etc/nginx/sites-available/koel
|
||||
server {
|
||||
listen *:80;
|
||||
server_name koel.local;
|
||||
root /opt/koel/public;
|
||||
index index.php;
|
||||
|
||||
gzip on;
|
||||
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript application/json;
|
||||
gzip_comp_level 9;
|
||||
|
||||
send_timeout 3600;
|
||||
client_max_body_size 200M;
|
||||
|
||||
location / {
|
||||
try_files \$uri \$uri/ /index.php?\$args;
|
||||
}
|
||||
|
||||
location /media/ {
|
||||
alias /opt/koel_media;
|
||||
autoindex on;
|
||||
access_log /var/log/nginx/koel.access.log;
|
||||
error_log /var/log/nginx/koel.error.log;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
try_files \$uri \$uri/ /index.php?\$args;
|
||||
|
||||
fastcgi_param PATH_INFO \$fastcgi_path_info;
|
||||
fastcgi_param PATH_TRANSLATED \$document_root\$fastcgi_path_info;
|
||||
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
|
||||
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
|
||||
fastcgi_index index.php;
|
||||
include fastcgi_params;
|
||||
|
||||
}
|
||||
}
|
||||
EOF
|
||||
ln -s /etc/nginx/sites-available/koel /etc/nginx/sites-enabled/koel
|
||||
systemctl restart php8.3-fpm
|
||||
systemctl reload nginx
|
||||
msg_ok "Created Services"
|
||||
|
||||
msg_info "Adding Cronjob (Daily Midnight)"
|
||||
cat <<EOF >/opt/koel_sync/koel_sync.cron
|
||||
0 0 * * * cd /opt/koel/ && /usr/bin/php artisan koel:sync >/opt/koel_sync/koel_sync.log 2>&1
|
||||
EOF
|
||||
crontab /opt/koel_sync/koel_sync.cron
|
||||
|
||||
msg_ok "Cronjob successfully added"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning up"
|
||||
rm -rf /opt/koel.zip
|
||||
$STD apt-get autoremove
|
||||
$STD apt-get autoclean
|
||||
msg_ok "Cleaned"
|
||||
265
install/deferred/maxun-install.sh
Normal file
265
install/deferred/maxun-install.sh
Normal file
@@ -0,0 +1,265 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2025 community-scripts ORG
|
||||
# Author: MickLesk (Canbiz)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/getmaxun/maxun
|
||||
|
||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apt-get install -y \
|
||||
gpg \
|
||||
openssl \
|
||||
redis \
|
||||
libgbm1 \
|
||||
libnss3 \
|
||||
libatk1.0-0 \
|
||||
libatk-bridge2.0-0 \
|
||||
libdrm2 \
|
||||
libxkbcommon0 \
|
||||
libglib2.0-0 \
|
||||
libdbus-1-3 \
|
||||
libx11-xcb1 \
|
||||
libxcb1 \
|
||||
libxcomposite1 \
|
||||
libxcursor1 \
|
||||
libxdamage1 \
|
||||
libxext6 \
|
||||
libxi6 \
|
||||
libxtst6 \
|
||||
ca-certificates \
|
||||
libxrandr2 \
|
||||
libasound2 \
|
||||
libxss1 \
|
||||
libxinerama1 \
|
||||
nginx
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
#configure_lxc "Semantic Search requires a dedicated GPU and at least 16GB RAM. Would you like to install it?" 100 "memory" "16000"
|
||||
|
||||
msg_info "Setting up Node.js Repository"
|
||||
mkdir -p /etc/apt/keyrings
|
||||
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
|
||||
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" >/etc/apt/sources.list.d/nodesource.list
|
||||
msg_ok "Set up Node.js Repository"
|
||||
|
||||
msg_info "Setting up PostgreSQL Repository"
|
||||
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg
|
||||
echo "deb https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main" >/etc/apt/sources.list.d/pgdg.list
|
||||
$STD apt-get update
|
||||
$STD apt-get install -y postgresql-17
|
||||
msg_ok "Set up PostgreSQL Repository"
|
||||
|
||||
msg_info "Installing Node.js"
|
||||
$STD apt-get update
|
||||
$STD apt-get install -y nodejs
|
||||
msg_ok "Installed Node.js"
|
||||
|
||||
msg_info "Setup Variables"
|
||||
DB_NAME=maxun_db
|
||||
DB_USER=maxun_user
|
||||
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)
|
||||
MINIO_USER=minio_usr
|
||||
MINIO_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)
|
||||
JWT_SECRET=$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | cut -c1-32)
|
||||
ENCRYPTION_KEY=$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | cut -c1-32)
|
||||
LOCAL_IP=$(hostname -I | awk '{print $1}')
|
||||
msg_ok "Set up Variables"
|
||||
|
||||
msg_info "Setup Database"
|
||||
$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';"
|
||||
$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;"
|
||||
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';"
|
||||
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET default_transaction_isolation TO 'read committed';"
|
||||
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC'"
|
||||
{
|
||||
echo "Maxun-Credentials"
|
||||
echo "Maxun Database User: $DB_USER"
|
||||
echo "Maxun Database Password: $DB_PASS"
|
||||
echo "Maxun Database Name: $DB_NAME"
|
||||
echo "Maxun JWT Secret: $JWT_SECRET"
|
||||
echo "Maxun Encryption Key: $ENCRYPTION_KEY"
|
||||
} >>~/maxun.creds
|
||||
msg_ok "Set up Database"
|
||||
|
||||
msg_info "Setup MinIO"
|
||||
cd /tmp
|
||||
wget -q https://dl.min.io/server/minio/release/linux-amd64/minio
|
||||
mv minio /usr/local/bin/
|
||||
chmod +x /usr/local/bin/minio
|
||||
mkdir -p /data
|
||||
cat <<EOF >/etc/systemd/system/minio.service
|
||||
[Unit]
|
||||
Description=MinIO
|
||||
Documentation=https://docs.min.io
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
User=root
|
||||
EnvironmentFile=-/etc/default/minio
|
||||
ExecStart=/usr/local/bin/minio server /data
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
LimitNOFILE=65536
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
{
|
||||
echo "__________________"
|
||||
echo "MinIO Admin User: $MINIO_USER"
|
||||
echo "MinIO Admin Password: $MINIO_PASS"
|
||||
} >>~/maxun.creds
|
||||
cat <<EOF >/etc/default/minio
|
||||
MINIO_ROOT_USER=${MINIO_USER}
|
||||
MINIO_ROOT_PASSWORD=${MINIO_PASS}
|
||||
EOF
|
||||
systemctl enable -q --now minio
|
||||
msg_ok "Setup MinIO"
|
||||
|
||||
msg_info "Installing Maxun (Patience)"
|
||||
cd /opt
|
||||
RELEASE=$(curl -s https://api.github.com/repos/getmaxun/maxun/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||
wget -q "https://github.com/getmaxun/maxun/archive/refs/tags/v${RELEASE}.zip"
|
||||
unzip -q v${RELEASE}.zip
|
||||
mv maxun-${RELEASE} /opt/maxun
|
||||
cat <<EOF >/opt/maxun/.env
|
||||
NODE_ENV=development
|
||||
JWT_SECRET=${JWT_SECRET}
|
||||
DB_NAME=${DB_NAME}
|
||||
DB_USER=${DB_USER}
|
||||
DB_PASSWORD=${DB_PASS}
|
||||
DB_HOST=localhost
|
||||
DB_PORT=5432
|
||||
ENCRYPTION_KEY=${ENCRYPTION_KEY}
|
||||
MINIO_ENDPOINT=localhost
|
||||
MINIO_PORT=9000
|
||||
MINIO_CONSOLE_PORT=9001
|
||||
MINIO_ACCESS_KEY=${MINIO_USER}
|
||||
MINIO_SECRET_KEY=${MINIO_PASS}
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PORT=6379
|
||||
|
||||
BACKEND_PORT=8080
|
||||
FRONTEND_PORT=5173
|
||||
BACKEND_URL=http://${LOCAL_IP}:8080
|
||||
PUBLIC_URL=http://${LOCAL_IP}:5173
|
||||
VITE_BACKEND_URL=http://${LOCAL_IP}:8080
|
||||
VITE_PUBLIC_URL=http://${LOCAL_IP}:5173
|
||||
|
||||
MAXUN_TELEMETRY=false
|
||||
EOF
|
||||
|
||||
cat <<'EOF' >/usr/local/bin/update-env-ip.sh
|
||||
env_file="/opt/maxun/.env"
|
||||
|
||||
sed -i "s|^BACKEND_URL=.*|BACKEND_URL=http://${LOCAL_IP}:8080|" "$env_file"
|
||||
sed -i "s|^PUBLIC_URL=.*|PUBLIC_URL=http://${LOCAL_IP}:5173|" "$env_file"
|
||||
sed -i "s|^VITE_BACKEND_URL=.*|VITE_BACKEND_URL=http://${LOCAL_IP}:8080|" "$env_file"
|
||||
sed -i "s|^VITE_PUBLIC_URL=.*|VITE_PUBLIC_URL=http://${LOCAL_IP}:5173|" "$env_file"
|
||||
EOF
|
||||
chmod +x /usr/local/bin/update-env-ip.sh
|
||||
cd /opt/maxun
|
||||
$STD npm install --legacy-peer-deps
|
||||
cd /opt/maxun/maxun-core
|
||||
$STD npm install --legacy-peer-deps
|
||||
$STD npm run build
|
||||
cd /opt/maxun
|
||||
$STD npx playwright install --with-deps chromium
|
||||
$STD npx playwright install-deps
|
||||
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
|
||||
msg_ok "Installed Maxun"
|
||||
|
||||
#msg_info "Running DB Migrations"
|
||||
#cd /opt/maxun
|
||||
#node -e "require('./server/src/db/migrate')().then(() => { console.log('Migrations completed'); })"
|
||||
#msg_ok "DB Migrations completed"
|
||||
|
||||
msg_info "Setting up nginx with CORS Proxy"
|
||||
cat <<'EOF' >/etc/nginx/sites-available/maxun
|
||||
server {
|
||||
listen 80;
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
location ~ ^/(api|record|workflow|storage|auth|integration|proxy|api-docs) {
|
||||
proxy_pass http://localhost:8080;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection 'upgrade';
|
||||
proxy_http_version 1.1;
|
||||
|
||||
add_header Access-Control-Allow-Origin "$http_origin" always;
|
||||
add_header Access-Control-Allow-Credentials true always;
|
||||
add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,OPTIONS always;
|
||||
add_header Access-Control-Allow-Headers Authorization,Content-Type,X-Requested-With always;
|
||||
|
||||
if ($request_method = OPTIONS) {
|
||||
return 204;
|
||||
}
|
||||
|
||||
proxy_connect_timeout 60s;
|
||||
proxy_read_timeout 60s;
|
||||
proxy_send_timeout 60s;
|
||||
|
||||
proxy_intercept_errors on;
|
||||
error_page 502 503 504 /50x.html;
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
ln -sf /etc/nginx/sites-available/maxun /etc/nginx/sites-enabled/maxun
|
||||
rm -f /etc/nginx/sites-enabled/default
|
||||
msg_ok "nginx with CORS Proxy set up"
|
||||
|
||||
msg_info "Creating Services"
|
||||
cat <<EOF >/etc/systemd/system/maxun-update-env.service
|
||||
[Unit]
|
||||
Description=Update .env with dynamic LXC IP
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/local/bin/update-env-ip.sh
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
cat <<EOF >/etc/systemd/system/maxun.service
|
||||
[Unit]
|
||||
Description=Maxun Service
|
||||
After=network.target postgresql.service redis.service minio.service maxun-update-env.service
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=/opt/maxun
|
||||
ExecStart=/usr/bin/npm run start
|
||||
Restart=always
|
||||
EnvironmentFile=/opt/maxun/.env
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q --now maxun-update-env
|
||||
systemctl enable -q --now maxun
|
||||
systemctl enable -q --now nginx
|
||||
msg_ok "Created Service"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning up"
|
||||
rm -rf /opt/v${RELEASE}.zip
|
||||
$STD apt-get -y autoremove
|
||||
$STD apt-get -y autoclean
|
||||
msg_ok "Cleaned"
|
||||
57
install/deferred/netbootxyz-install.sh
Normal file
57
install/deferred/netbootxyz-install.sh
Normal file
@@ -0,0 +1,57 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2023 tteck
|
||||
# Author: tteck (tteckster)
|
||||
# License: MIT
|
||||
# https://github.com/tteck/Proxmox/raw/main/LICENSE
|
||||
|
||||
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apt-get install -y ansible git apache2
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
RELEASE=$(curl -sX GET "https://api.github.com/repos/netbootxyz/netboot.xyz/releases/latest" | awk '/tag_name/{print $4;exit}' FS='[""]')
|
||||
msg_info "Installing netboot.xyz ${RELEASE}"
|
||||
$STD curl --silent -o ${RELEASE}.tar.gz -L "https://github.com/netbootxyz/netboot.xyz/archive/${RELEASE}.tar.gz"
|
||||
$STD tar xvzf ${RELEASE}.tar.gz
|
||||
VER=$(curl -s https://api.github.com/repos/netbootxyz/netboot.xyz/releases/latest |
|
||||
grep "tag_name" |
|
||||
awk '{print substr($2, 2, length($2)-3) }')
|
||||
rm -rf ${RELEASE}.tar.gz
|
||||
mv netboot.xyz-${VER} /opt/netboot.xyz
|
||||
msg_ok "Installed netboot.xyz ${RELEASE}"
|
||||
|
||||
msg_info "Creating Service"
|
||||
service_path="/etc/systemd/system/netbootxyz.service"
|
||||
echo "[Unit]
|
||||
Description=netboot.xyz
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
Type=simple
|
||||
User=root
|
||||
WorkingDirectory=/opt/netboot.xyz
|
||||
ExecStart="ansible-playbook" -i inventory site.yml
|
||||
TimeoutStopSec=30
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target" >$service_path
|
||||
$STD sudo systemctl enable --now netbootxyz.service
|
||||
msg_ok "Created Service"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning up"
|
||||
$STD apt-get autoremove
|
||||
$STD apt-get autoclean
|
||||
msg_ok "Cleaned"
|
||||
191
install/deferred/pixelfed-install.sh
Normal file
191
install/deferred/pixelfed-install.sh
Normal file
@@ -0,0 +1,191 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2024 tteck
|
||||
# Author: tteck
|
||||
# Co-Author: MickLesk (Canbiz)
|
||||
# License: MIT
|
||||
# https://github.com/tteck/Proxmox/raw/main/LICENSE
|
||||
|
||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing Dependencies (Patience)"
|
||||
$STD apt-get install -y \
|
||||
build-essential \
|
||||
gpg \
|
||||
curl \
|
||||
sudo \
|
||||
git \
|
||||
gnupg2 \
|
||||
ca-certificates \
|
||||
lsb-release \
|
||||
php8.3-{fpm,bcmath,ctype,curl,exif,gd,iconv,intl,mbstring,redis,tokenizer,xml,zip,pgsql,pdo-pgsql,bz2,sqlite3} \
|
||||
composer \
|
||||
redis \
|
||||
ffmpeg \
|
||||
jpegoptim \
|
||||
optipng \
|
||||
pngquant \
|
||||
make \
|
||||
mc
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
msg_info "Configure Redis Socket"
|
||||
REDIS_PASS="$(openssl rand -base64 18 | cut -c1-13)"
|
||||
sed -i 's/^port .*/port 0/' /etc/redis/redis.conf
|
||||
sed -i "s/^# requirepass foobared/requirepass $REDIS_PASS/" /etc/redis/redis.conf
|
||||
sed -i 's|^# unixsocket .*|unixsocket /run/redis/redis.sock|' /etc/redis/redis.conf
|
||||
sed -i 's/^# unixsocketperm .*/unixsocketperm 770/' /etc/redis/redis.conf
|
||||
systemctl restart redis
|
||||
msg_ok "Redis Socket configured"
|
||||
|
||||
msg_info "Add pixelfed user"
|
||||
useradd -rU -s /bin/bash pixelfed
|
||||
msg_ok "Pixelfed User Added"
|
||||
|
||||
msg_info "Configure PHP-FPM for Pixelfed"
|
||||
cp /etc/php/8.3/fpm/pool.d/www.conf /etc/php/8.3/fpm/pool.d/pixelfed.conf
|
||||
sed -i 's/\[www\]/\[pixelfed\]/' /etc/php/8.3/fpm/pool.d/pixelfed.conf
|
||||
sed -i 's/^user = www-data/user = pixelfed/' /etc/php/8.3/fpm/pool.d/pixelfed.conf
|
||||
sed -i 's/^group = www-data/group = pixelfed/' /etc/php/8.3/fpm/pool.d/pixelfed.conf
|
||||
sed -i 's|^listen = .*|listen = /run/php-fpm/pixelfed.sock|' /etc/php/8.3/fpm/pool.d/pixelfed.conf
|
||||
systemctl restart php8.3-fpm
|
||||
msg_ok "successfully configured PHP-FPM"
|
||||
|
||||
msg_info "Setup Postgres Database"
|
||||
DB_NAME=pixelfed_db
|
||||
DB_USER=pixelfed_user
|
||||
DB_PASS="$(openssl rand -base64 18 | cut -c1-13)"
|
||||
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg
|
||||
echo "deb https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main" >/etc/apt/sources.list.d/pgdg.list
|
||||
apt-get update
|
||||
apt-get install -y postgresql-17
|
||||
sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';"
|
||||
sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER TEMPLATE template0;"
|
||||
sudo -u postgres psql -c "ALTER DATABASE $DB_NAME OWNER TO $DB_USER;"
|
||||
sudo -u postgres psql -c "GRANT CREATE ON SCHEMA public TO $DB_USER;"
|
||||
echo "" >>~/pixelfed.creds
|
||||
echo -e "Pixelfed Database Name: $DB_NAME" >>~/pixelfed.creds
|
||||
echo -e "Pixelfed Database User: $DB_USER" >>~/pixelfed.creds
|
||||
echo -e "Pixelfed Database Password: $DB_PASS" >>~/pixelfed.creds
|
||||
#export $(cat /opt/pixelfed/.env |grep "^[^#]" | xargs)
|
||||
msg_ok "Set up PostgreSQL Database successfully"
|
||||
|
||||
msg_info "Installing Pixelfed (Patience)"
|
||||
RELEASE=$(curl -s https://api.github.com/repos/pixelfed/pixelfed/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||
wget -q "https://github.com/pixelfed/pixelfed/archive/refs/tags/${RELEASE}.zip"
|
||||
unzip -q ${RELEASE}.zip
|
||||
mv pixelfed-${RELEASE:1} /opt/pixelfed
|
||||
rm -R ${RELEASE}.zip
|
||||
cd /opt/pixelfed
|
||||
chown -R www-data:www-data /opt/pixelfed/storage
|
||||
chmod -R 775 /opt/pixelfed/storage
|
||||
chown -R pixelfed:pixelfed /opt/pixelfed/storage
|
||||
chmod -R 775 /opt/pixelfed/storage
|
||||
chown -R www-data:www-data /opt/pixelfed
|
||||
chmod -R 755 /opt/pixelfed
|
||||
COMPOSER_ALLOW_SUPERUSER=1 composer install --no-dev --no-ansi --no-interaction --optimize-autoloader
|
||||
|
||||
msg_info "Setup envoirement & PHP Database Migration"
|
||||
cp .env.example .env
|
||||
sed -i "s/DB_CONNECTION=.*/DB_CONNECTION=pgsql/" .env
|
||||
sed -i "s/DB_PORT=.*/DB_PORT=5432/" .env
|
||||
sed -i "s/DB_DATABASE=.*/DB_DATABASE=$DB_NAME/" .env
|
||||
sed -i "s/DB_USERNAME=.*/DB_USERNAME=$DB_USER/" .env
|
||||
sed -i "s/DB_PASSWORD=.*/DB_PASSWORD=$DB_PASS/" .env
|
||||
sed -i "s/REDIS_HOST=.*/REDIS_HOST=127.0.0.1/" .env
|
||||
sed -i "s/REDIS_PASSWORD=.*/REDIS_PASSWORD=$REDIS_PASS/" .env
|
||||
sed -i "s/APP_URL=.*/APP_URL=http:\/\/localhost/" .env # localhost URL
|
||||
|
||||
php artisan key:generate
|
||||
php artisan storage:link
|
||||
php artisan migrate --force
|
||||
php artisan import:cities
|
||||
php artisan instance:actor
|
||||
php artisan passport:keys
|
||||
php artisan route:cache
|
||||
php artisan view:cache
|
||||
sed -i 's/^post_max_size = .*/post_max_size = 100M/' /etc/php/8.3/fpm/php.ini
|
||||
sed -i 's/^upload_max_filesize = .*/upload_max_filesize = 100M/' /etc/php/8.3/fpm/php.ini
|
||||
sed -i 's/^max_execution_time = .*/max_execution_time = 600/' /etc/php/8.3/fpm/php.ini
|
||||
systemctl restart php8.3-fpm
|
||||
|
||||
msg_ok "Pixelfed successfully set up"
|
||||
|
||||
msg_info "Creating Services"
|
||||
cat <<EOF >/etc/nginx/sites-available/pixelfed.conf
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost; # Nutzung von localhost
|
||||
root /opt/pixelfed/public;
|
||||
|
||||
index index.php;
|
||||
|
||||
location / {
|
||||
try_files \$uri \$uri/ /index.php?\$query_string;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
include snippets/fastcgi-php.conf;
|
||||
fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
|
||||
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
}
|
||||
|
||||
location ~ /\.(?!well-known).* {
|
||||
deny all;
|
||||
}
|
||||
|
||||
client_max_body_size 20M;
|
||||
}
|
||||
EOF
|
||||
|
||||
ln -s /etc/nginx/sites-available/pixelfed.conf /etc/nginx/sites-enabled/
|
||||
nginx -t && systemctl reload nginx
|
||||
|
||||
cat <<EOF >/etc/systemd/system/pixelfed-horizon.service
|
||||
[Unit]
|
||||
Description=Pixelfed Horizon
|
||||
After=network.target
|
||||
Requires=php8.3-fpm
|
||||
Requires=redis
|
||||
|
||||
[Service]
|
||||
User=www-data
|
||||
WorkingDirectory=/opt/pixelfed
|
||||
ExecStart=/usr/bin/php /opt/pixelfed/artisan horizon
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
cat <<EOF >/etc/systemd/system/pixelfed-scheduler.service
|
||||
[Unit]
|
||||
Description=Pixelfed Scheduler
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=www-data
|
||||
ExecStart=/usr/bin/php /opt/pixelfed/artisan schedule:run
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
systemctl enable --now pixelfed-scheduler
|
||||
systemctl enable --now pixelfed-horizon
|
||||
msg_ok "Created Services"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning up"
|
||||
$STD apt-get -y autoremove
|
||||
$STD apt-get -y autoclean
|
||||
msg_ok "Cleaned"
|
||||
88
install/deferred/roundcubemail-install.sh
Normal file
88
install/deferred/roundcubemail-install.sh
Normal file
@@ -0,0 +1,88 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2024 tteck
|
||||
# Author: tteck
|
||||
# Co-Author: MickLesk (Canbiz)
|
||||
# License: MIT
|
||||
# https://github.com/tteck/Proxmox/raw/main/LICENSE
|
||||
# Source: https://github.com/roundcube/roundcubemail
|
||||
|
||||
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apt-get install -y \
|
||||
curl \
|
||||
sudo \
|
||||
mc \
|
||||
postgresql \
|
||||
apache2 \
|
||||
libapache2-mod-php \
|
||||
composer \
|
||||
php8.2-{mbstring,gd,imap,mysql,ldap,curl,intl,imagick,bz2,sqlite3,zip,xml}
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
msg_info "Setting up PostgreSQL"
|
||||
DB_NAME=roundcube_db
|
||||
DB_USER=roundcube_user
|
||||
DB_PASS="$(openssl rand -base64 18 | cut -c1-13)"
|
||||
$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH ENCODING 'UTF8';"
|
||||
$STD sudo -u postgres psql -c "CREATE USER $DB_USER WITH PASSWORD '$DB_PASS';"
|
||||
$STD sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE $DB_NAME TO $DB_USER;"
|
||||
$STD sudo -u postgres psql -c "ALTER DATABASE $DB_NAME OWNER TO $DB_USER;"
|
||||
$STD sudo -u postgres psql -c "ALTER USER $DB_USER WITH SUPERUSER;"
|
||||
echo "" >>~/roundcubemail.creds
|
||||
echo -e "Roundcubemail Database User: $DB_USER" >>~/roundcubemail.creds
|
||||
echo -e "Roundcubemail Database Password: $DB_PASS" >>~/roundcubemail.creds
|
||||
echo -e "Roundcubemail Database Name: $DB_NAME" >>~/roundcubemail.creds
|
||||
msg_ok "Set up PostgreSQL"
|
||||
|
||||
msg_info "Installing Roundcubemail (Patience)"
|
||||
cd /opt
|
||||
RELEASE=$(curl -s https://api.github.com/repos/roundcube/roundcubemail/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||
wget -q "https://github.com/roundcube/roundcubemail/releases/download/${RELEASE}/roundcubemail-${RELEASE}-complete.tar.gz"
|
||||
tar -xf roundcubemail-${RELEASE}-complete.tar.gz
|
||||
mv roundcubemail-${RELEASE} /opt/roundcubemail
|
||||
cd /opt/roundcubemail
|
||||
COMPOSER_ALLOW_SUPERUSER=1 composer install --no-dev
|
||||
cp /opt/roundcubemail/config/config.inc.php.sample /opt/roundcubemail/config/config.inc.php
|
||||
sed -i "s|^\\\$config\\['db_dsnw'\\] = 'mysql://.*';|\\\$config\\['db_dsnw'\\] = 'pgsql://$DB_USER:$DB_PASS@localhost/$DB_NAME';|" /opt/roundcubemail/config/config.inc.php
|
||||
chown -R www-data:www-data temp/ logs/
|
||||
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
|
||||
|
||||
cat <<EOF >/etc/apache2/sites-available/roundcubemail.conf
|
||||
<VirtualHost *:80>
|
||||
ServerAdmin webmaster@localhost
|
||||
DocumentRoot /opt/roundcubemail/public_html
|
||||
|
||||
<Directory /opt/roundcubemail/public_html>
|
||||
Options -Indexes +FollowSymLinks
|
||||
AllowOverride All
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
ErrorLog \${APACHE_LOG_DIR}/wallos_error.log
|
||||
CustomLog \${APACHE_LOG_DIR}/wallos_access.log combined
|
||||
</VirtualHost>
|
||||
EOF
|
||||
$STD sudo a2enmod deflate
|
||||
$STD sudo a2enmod expires
|
||||
$STD sudo a2enmod headers
|
||||
$STD a2ensite roundcubemail.conf
|
||||
$STD a2dissite 000-default.conf
|
||||
$STD systemctl reload apache2
|
||||
msg_ok "Installed Wallos"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning up"
|
||||
rm -rf /opt/roundcubemail-${RELEASE}-complete.tar.gz
|
||||
$STD apt-get -y autoremove
|
||||
$STD apt-get -y autoclean
|
||||
msg_ok "Cleaned"
|
||||
163
install/deferred/squirrelserversmanager-install.sh
Normal file
163
install/deferred/squirrelserversmanager-install.sh
Normal file
@@ -0,0 +1,163 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2024 tteck
|
||||
# Author: tteck (tteckster)
|
||||
# License: MIT
|
||||
# https://github.com/tteck/Proxmox/raw/main/LICENSE
|
||||
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
|
||||
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
# Generate a random string
|
||||
generate_random_string() {
|
||||
local LENGTH=$1
|
||||
tr -dc A-Za-z0-9 </dev/urandom | head -c ${LENGTH} 2>/dev/null || true
|
||||
}
|
||||
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apk add git
|
||||
$STD apk add nodejs
|
||||
$STD apk add npm
|
||||
$STD apk add ansible
|
||||
$STD apk add nmap
|
||||
$STD apk add sudo
|
||||
$STD apk add openssh
|
||||
$STD apk add sshpass
|
||||
$STD apk add py3-pip
|
||||
$STD apk add expect
|
||||
$STD apk add libcurl
|
||||
$STD apk add gcompat
|
||||
$STD apk add curl
|
||||
$STD apk add newt
|
||||
$STD git --version
|
||||
$STD node --version
|
||||
$STD npm --version
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
msg_info "Installing Redis"
|
||||
$STD apk add redis
|
||||
msg_ok "Installed Redis"
|
||||
|
||||
msg_info "Installing Nginx"
|
||||
$STD apk add nginx
|
||||
rm -rf /etc/nginx/http.d/default.conf
|
||||
cat <<'EOF'> /etc/nginx/http.d/default.conf
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
access_log off;
|
||||
error_log off;
|
||||
|
||||
location /api/socket.io/ {
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $host;
|
||||
|
||||
proxy_pass http://127.0.0.1:3000/socket.io/;
|
||||
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
}
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://127.0.0.1:3000/;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8000/;
|
||||
|
||||
# WebSocket support
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
||||
error_page 501 502 503 404 /custom.html;
|
||||
location = /custom.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EOF
|
||||
msg_ok "Installed Nginx"
|
||||
|
||||
msg_info "Installing MongoDB Database"
|
||||
DB_NAME=ssm
|
||||
DB_PORT=27017
|
||||
echo 'http://dl-cdn.alpinelinux.org/alpine/v3.9/main' >> /etc/apk/repositories
|
||||
echo 'http://dl-cdn.alpinelinux.org/alpine/v3.9/community' >> /etc/apk/repositories
|
||||
$STD apk update
|
||||
$STD apk add mongodb mongodb-tools
|
||||
msg_ok "Installed MongoDB Database"
|
||||
|
||||
msg_info "Starting Services"
|
||||
$STD rc-service redis start
|
||||
$STD rc-update add redis default
|
||||
$STD rc-service mongodb start
|
||||
$STD rc-update add mongodb default
|
||||
msg_ok "Started Services"
|
||||
|
||||
msg_info "Setting Up Squirrel Servers Manager"
|
||||
$STD git clone https://github.com/SquirrelCorporation/SquirrelServersManager.git /opt/squirrelserversmanager
|
||||
SECRET=$(generate_random_string 32)
|
||||
SALT=$(generate_random_string 16)
|
||||
VAULT_PWD=$(generate_random_string 32)
|
||||
cat <<EOF > /opt/squirrelserversmanager/.env
|
||||
# SECRETS
|
||||
SECRET=$SECRET
|
||||
SALT=$SALT
|
||||
VAULT_PWD=$VAULT_PWD
|
||||
# MONGO
|
||||
DB_HOST=127.0.0.1
|
||||
DB_NAME=ssm
|
||||
DB_PORT=27017
|
||||
# REDIS
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PORT=6379
|
||||
EOF
|
||||
export NODE_ENV=production
|
||||
export $(grep -v '^#' /opt/squirrelserversmanager/.env | xargs)
|
||||
$STD npm install -g npm@latest
|
||||
$STD npm install -g @umijs/max
|
||||
$STD npm install -g typescript
|
||||
$STD npm install pm2 -g
|
||||
msg_ok "Squirrel Servers Manager Has Been Setup"
|
||||
|
||||
msg_info "Building Squirrel Servers Manager Lib"
|
||||
cd /opt/squirrelserversmanager/shared-lib
|
||||
$STD npm ci
|
||||
$STD npm run build
|
||||
msg_ok "Squirrel Servers Manager Lib built"
|
||||
|
||||
msg_info "Building & Running Squirrel Servers Manager Client"
|
||||
cd /opt/squirrelserversmanager/client
|
||||
$STD npm ci
|
||||
$STD npm run build
|
||||
$STD pm2 start --name="squirrelserversmanager-frontend" npm -- run serve
|
||||
msg_ok "Squirrel Servers Manager Client Built & Ran"
|
||||
|
||||
msg_info "Building & Running Squirrel Servers Manager Server"
|
||||
cd /opt/squirrelserversmanager/server
|
||||
$STD npm ci
|
||||
$STD npm run build
|
||||
$STD pm2 start --name="squirrelserversmanager-backend" node -- ./dist/src/index.js
|
||||
msg_ok "Squirrel Servers Manager Server Built & Ran"
|
||||
|
||||
msg_info "Starting Squirrel Servers Manager"
|
||||
$STD pm2 startup
|
||||
$STD pm2 save
|
||||
mkdir -p /usr/share/nginx/html/
|
||||
cp /opt/squirrelserversmanager/proxy/www/index.html /usr/share/nginx/html/custom.html
|
||||
|
||||
$STD rc-service nginx start
|
||||
$STD rc-update add nginx default
|
||||
msg_ok "Squirrel Servers Manager Started"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
163
install/deferred/timescaledb-install.sh
Normal file
163
install/deferred/timescaledb-install.sh
Normal file
@@ -0,0 +1,163 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2025 community-scripts ORG
|
||||
# Author: MickLesk (CanbiZ)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
|
||||
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apt-get install -y \
|
||||
curl \
|
||||
sudo \
|
||||
mc \
|
||||
gnupg \
|
||||
apt-transport-https \
|
||||
lsb-release
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
msg_info "Setting up PostgreSQL Repository"
|
||||
VERSION="$(awk -F'=' '/^VERSION_CODENAME=/{ print $NF }' /etc/os-release)"
|
||||
echo "deb http://apt.postgresql.org/pub/repos/apt ${VERSION}-pgdg main" >/etc/apt/sources.list.d/pgdg.list
|
||||
curl -sSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor --output /etc/apt/trusted.gpg.d/postgresql.gpg
|
||||
msg_ok "Setup PostgreSQL Repository"
|
||||
|
||||
msg_info "Installing PostgreSQL"
|
||||
$STD apt-get update
|
||||
$STD apt-get install -y postgresql postgresql-common
|
||||
|
||||
cat <<EOF >/etc/postgresql/17/main/pg_hba.conf
|
||||
# PostgreSQL Client Authentication Configuration File
|
||||
local all postgres peer
|
||||
# TYPE DATABASE USER ADDRESS METHOD
|
||||
# "local" is for Unix domain socket connections only
|
||||
local all all md5
|
||||
# IPv4 local connections:
|
||||
host all all 127.0.0.1/32 scram-sha-256
|
||||
host all all 0.0.0.0/24 md5
|
||||
# IPv6 local connections:
|
||||
host all all ::1/128 scram-sha-256
|
||||
host all all 0.0.0.0/0 md5
|
||||
# Allow replication connections from localhost, by a user with the
|
||||
# replication privilege.
|
||||
local replication all peer
|
||||
host replication all 127.0.0.1/32 scram-sha-256
|
||||
host replication all ::1/128 scram-sha-256
|
||||
EOF
|
||||
|
||||
cat <<EOF >/etc/postgresql/17/main/postgresql.conf
|
||||
# -----------------------------
|
||||
# PostgreSQL configuration file
|
||||
# -----------------------------
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# FILE LOCATIONS
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
data_directory = '/var/lib/postgresql/17/main'
|
||||
hba_file = '/etc/postgresql/17/main/pg_hba.conf'
|
||||
ident_file = '/etc/postgresql/17/main/pg_ident.conf'
|
||||
external_pid_file = '/var/run/postgresql/17-main.pid'
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# CONNECTIONS AND AUTHENTICATION
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# - Connection Settings -
|
||||
|
||||
listen_addresses = '*'
|
||||
port = 5432
|
||||
max_connections = 100
|
||||
unix_socket_directories = '/var/run/postgresql'
|
||||
|
||||
# - SSL -
|
||||
|
||||
ssl = on
|
||||
ssl_cert_file = '/etc/ssl/certs/ssl-cert-snakeoil.pem'
|
||||
ssl_key_file = '/etc/ssl/private/ssl-cert-snakeoil.key'
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# RESOURCE USAGE (except WAL)
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
shared_buffers = 128MB
|
||||
dynamic_shared_memory_type = posix
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# WRITE-AHEAD LOG
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
max_wal_size = 1GB
|
||||
min_wal_size = 80MB
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# REPORTING AND LOGGING
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# - What to Log -
|
||||
|
||||
log_line_prefix = '%m [%p] %q%u@%d '
|
||||
log_timezone = 'Etc/UTC'
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# PROCESS TITLE
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
cluster_name = '17/main'
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# CLIENT CONNECTION DEFAULTS
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# - Locale and Formatting -
|
||||
|
||||
datestyle = 'iso, mdy'
|
||||
timezone = 'Etc/UTC'
|
||||
lc_messages = 'C'
|
||||
lc_monetary = 'C'
|
||||
lc_numeric = 'C'
|
||||
lc_time = 'C'
|
||||
default_text_search_config = 'pg_catalog.english'
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# CONFIG FILE INCLUDES
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
include_dir = 'conf.d'
|
||||
EOF
|
||||
|
||||
systemctl restart postgresql
|
||||
msg_ok "Installed PostgreSQL"
|
||||
|
||||
|
||||
msg_info "Setup TimescaleDB"
|
||||
echo "deb https://packagecloud.io/timescale/timescaledb/debian/ $(lsb_release -c -s) main" | sudo tee /etc/apt/sources.list.d/timescaledb.list
|
||||
wget --quiet -O - https://packagecloud.io/timescale/timescaledb/gpgkey | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/timescaledb.gpg
|
||||
$STD apt-get update
|
||||
$STD apt-get install timescaledb-2-postgresql-17 postgresql-client-17
|
||||
$STD timescaledb-tune --quiet --yes
|
||||
$STD systemctl restart postgresql
|
||||
msg_ok "Setup TimescaleDB"
|
||||
|
||||
read -r -p "Would you like to add Adminer? <y/N> " prompt
|
||||
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
|
||||
msg_info "Installing Adminer"
|
||||
$STD apt install -y adminer
|
||||
$STD a2enconf adminer
|
||||
systemctl reload apache2
|
||||
msg_ok "Installed Adminer"
|
||||
fi
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning up"
|
||||
$STD apt-get -y autoremove
|
||||
$STD apt-get -y autoclean
|
||||
msg_ok "Cleaned"
|
||||
Reference in New Issue
Block a user