cleanup
This commit is contained in:
@@ -1,85 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Copyright (c) 2021-2026 community-scripts ORG
|
|
||||||
# Author: MickLesk (CanbiZ)
|
|
||||||
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
|
|
||||||
# Source: https://github.com/Kanba-co/kanba
|
|
||||||
|
|
||||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
|
||||||
color
|
|
||||||
verb_ip6
|
|
||||||
catch_errors
|
|
||||||
setting_up_container
|
|
||||||
network_check
|
|
||||||
update_os
|
|
||||||
|
|
||||||
NODE_VERSION="24" setup_nodejs
|
|
||||||
fetch_and_deploy_gh_release "kanba" "Kanba-co/kanba" "tarball" "latest" "/opt/kanba"
|
|
||||||
fetch_and_deploy_gh_release "supabase" "supabase/cli" "binary" "latest" "/opt/supabase" "supabase-linux-x64"
|
|
||||||
POSTGRES_VERSION="16" setup_postgresql
|
|
||||||
|
|
||||||
msg_info "Set up PostgreSQL Database"
|
|
||||||
DB_NAME=kanba_db
|
|
||||||
DB_USER=kanba_usr
|
|
||||||
DB_PASS="$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)"
|
|
||||||
DB_URL="postgresql://${DB_USER}:${DB_PASS}@localhost:5432/${DB_NAME}"
|
|
||||||
$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 "Kanba-Credentials"
|
|
||||||
echo "Kanba Database Name: $DB_NAME"
|
|
||||||
echo "Kanba Database User: $DB_USER"
|
|
||||||
echo "Kanba Database Password: $DB_PASS"
|
|
||||||
} >>~/kanba.creds
|
|
||||||
msg_ok "Set up PostgreSQL Database"
|
|
||||||
|
|
||||||
msg_info "Preparing .env.local"
|
|
||||||
cd /opt/kanba
|
|
||||||
cp .env.example .env.local
|
|
||||||
sed -i "s|^DATABASE_PROVIDER=.*|DATABASE_PROVIDER=postgresql|" .env.local
|
|
||||||
sed -i "s|^DATABASE_URL=.*|DATABASE_URL=${DB_URL}|" .env.local
|
|
||||||
sed -i "s|^DIRECT_URL=.*|DIRECT_URL=${DB_URL}|" .env.local
|
|
||||||
sed -i "s|^NEXT_PUBLIC_SITE_URL=.*|NEXT_PUBLIC_SITE_URL=http://localhost:3000|" .env.local
|
|
||||||
sed -i "s|^NEXTAUTH_URL=.*|NEXTAUTH_URL=http://localhost:3000|" .env.local
|
|
||||||
sed -i "s|^NEXTAUTH_SECRET=.*|NEXTAUTH_SECRET=$(openssl rand -hex 32)|" .env.local
|
|
||||||
sed -i "s|^NEXT_PUBLIC_SUPABASE_URL=.*|NEXT_PUBLIC_SUPABASE_URL=http://localhost:54321|" .env.local
|
|
||||||
sed -i "s|^NEXT_PUBLIC_SUPABASE_ANON_KEY=.*|NEXT_PUBLIC_SUPABASE_ANON_KEY=dummy-key|" .env.local
|
|
||||||
msg_ok "Prepared .env.local"
|
|
||||||
|
|
||||||
msg_info "Installing Kanba"
|
|
||||||
export $(grep -v '^#' .env.local | xargs)
|
|
||||||
$STD npm install
|
|
||||||
$STD npx prisma generate
|
|
||||||
$STD npx prisma migrate deploy
|
|
||||||
$STD npm run build
|
|
||||||
msg_ok "Installed Kanba"
|
|
||||||
|
|
||||||
msg_info "Creating systemd Service"
|
|
||||||
cat <<EOF >/etc/systemd/system/kanba.service
|
|
||||||
[Unit]
|
|
||||||
Description=Kanba - Lightweight Trello Alternative
|
|
||||||
After=network.target postgresql.service
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=simple
|
|
||||||
WorkingDirectory=/opt/kanba
|
|
||||||
EnvironmentFile=/opt/kanba/.env.local
|
|
||||||
ExecStart=/usr/bin/npx next start -p 3000
|
|
||||||
Restart=always
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
EOF
|
|
||||||
systemctl enable -q --now kanba
|
|
||||||
msg_ok "Created systemd Service"
|
|
||||||
|
|
||||||
motd_ssh
|
|
||||||
customize
|
|
||||||
|
|
||||||
msg_info "Cleaning up"
|
|
||||||
$STD apt-get -y autoremove
|
|
||||||
$STD apt-get -y autoclean
|
|
||||||
msg_ok "Cleaned"
|
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Copyright (c) 2021-2026 tteck
|
|
||||||
# Author: tteck (tteckster)
|
|
||||||
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
|
|
||||||
# Source: https://petio.tv/
|
|
||||||
|
|
||||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
|
||||||
color
|
|
||||||
verb_ip6
|
|
||||||
catch_errors
|
|
||||||
setting_up_container
|
|
||||||
network_check
|
|
||||||
update_os
|
|
||||||
|
|
||||||
msg_info "Installing MongoDB 4.4"
|
|
||||||
curl -fsSL "https://www.mongodb.org/static/pgp/server-4.4.asc" | gpg --dearmor >/usr/share/keyrings/mongodb-server-4.4.gpg
|
|
||||||
# Determine OS ID
|
|
||||||
OS_ID=$(grep '^ID=' /etc/os-release | cut -d'=' -f2)
|
|
||||||
|
|
||||||
if [ "$OS_ID" = "debian" ]; then
|
|
||||||
echo "deb [ signed-by=/usr/share/keyrings/mongodb-server-4.4.gpg ] http://repo.mongodb.org/apt/debian $(grep '^VERSION_CODENAME=' /etc/os-release | cut -d'=' -f2)/mongodb-org/4.4 main" >/etc/apt/sources.list.d/mongodb-org-4.4.list
|
|
||||||
else
|
|
||||||
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-4.4.gpg ] https://repo.mongodb.org/apt/ubuntu $(grep '^VERSION_CODENAME=' /etc/os-release | cut -d'=' -f2)/mongodb-org/4.4 multiverse" >/etc/apt/sources.list.d/mongodb-org-4.4.list
|
|
||||||
fi
|
|
||||||
|
|
||||||
$STD apt-get update
|
|
||||||
$STD apt-get install -y mongodb-org
|
|
||||||
sed -i 's/bindIp: 127.0.0.1/bindIp: 0.0.0.0/' /etc/mongod.conf
|
|
||||||
systemctl enable -q --now mongod
|
|
||||||
msg_ok "MongoDB 4.4 Installed"
|
|
||||||
|
|
||||||
msg_info "Installing Petio"
|
|
||||||
useradd -M --shell=/bin/false petio
|
|
||||||
mkdir /opt/Petio
|
|
||||||
curl -fsSL "https://petio.tv/releases/latest" -o "petio-latest.zip"
|
|
||||||
$STD unzip petio-latest.zip -d /opt/Petio
|
|
||||||
rm -rf petio-latest.zip
|
|
||||||
chown -R petio:petio /opt/Petio
|
|
||||||
msg_ok "Installed Petio"
|
|
||||||
|
|
||||||
msg_info "Creating Service"
|
|
||||||
cat <<EOF >/etc/systemd/system/petio.service
|
|
||||||
[Unit]
|
|
||||||
Description=Petio a content request system
|
|
||||||
After=network.target mongod.service
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=simple
|
|
||||||
User=petio
|
|
||||||
Restart=on-failure
|
|
||||||
RestartSec=1
|
|
||||||
ExecStart=/opt/Petio/bin/petio-linux
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
|
|
||||||
|
|
||||||
EOF
|
|
||||||
systemctl enable -q --now petio
|
|
||||||
msg_ok "Created Service"
|
|
||||||
|
|
||||||
motd_ssh
|
|
||||||
customize
|
|
||||||
|
|
||||||
msg_info "Cleaning up"
|
|
||||||
$STD apt-get -y autoremove
|
|
||||||
$STD apt-get -y autoclean
|
|
||||||
msg_ok "Cleaned"
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
#!/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"
|
|
||||||
@@ -1,187 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Copyright (c) 2021-2026 tteck
|
|
||||||
# Author: tteck (tteckster)
|
|
||||||
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
|
|
||||||
# Source: https://nginxproxymanager.com/
|
|
||||||
|
|
||||||
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 -y install \
|
|
||||||
sudo \
|
|
||||||
mc \
|
|
||||||
curl \
|
|
||||||
gnupg \
|
|
||||||
make \
|
|
||||||
gcc \
|
|
||||||
g++ \
|
|
||||||
ca-certificates \
|
|
||||||
apache2-utils \
|
|
||||||
logrotate \
|
|
||||||
build-essential \
|
|
||||||
git
|
|
||||||
msg_ok "Installed Dependencies"
|
|
||||||
|
|
||||||
msg_info "Installing Python3"
|
|
||||||
$STD apt-get install -y \
|
|
||||||
python3 \
|
|
||||||
python3-dev \
|
|
||||||
python3-pip \
|
|
||||||
python3-venv \
|
|
||||||
python3-cffi \
|
|
||||||
python3-certbot \
|
|
||||||
python3-certbot-dns-cloudflare
|
|
||||||
$STD pip3 install certbot-dns-multi
|
|
||||||
$STD python3 -m venv /opt/certbot/
|
|
||||||
rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED
|
|
||||||
msg_ok "Installed Python3"
|
|
||||||
|
|
||||||
msg_info "Installing Openresty"
|
|
||||||
VERSION="$(awk -F'=' '/^VERSION_CODENAME=/{ print $NF }' /etc/os-release)"
|
|
||||||
wget -qO - https://openresty.org/package/pubkey.gpg | gpg --dearmor -o /etc/apt/trusted.gpg.d/openresty.gpg
|
|
||||||
echo -e "deb http://openresty.org/package/debian $VERSION openresty" >/etc/apt/sources.list.d/openresty.list
|
|
||||||
$STD apt-get update
|
|
||||||
$STD apt-get -y install openresty
|
|
||||||
msg_ok "Installed Openresty"
|
|
||||||
|
|
||||||
msg_info "Installing Node.js"
|
|
||||||
$STD bash <(curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh)
|
|
||||||
source ~/.bashrc
|
|
||||||
$STD nvm install 16.20.2
|
|
||||||
ln -sf /root/.nvm/versions/node/v16.20.2/bin/node /usr/bin/node
|
|
||||||
msg_ok "Installed Node.js"
|
|
||||||
|
|
||||||
msg_info "Installing pnpm"
|
|
||||||
$STD npm install -g pnpm@8.15
|
|
||||||
msg_ok "Installed pnpm"
|
|
||||||
|
|
||||||
msg_info "Setup Nginx Proxy Manager"
|
|
||||||
RELEASE=$(curl -s https://api.github.com/repos/NginxProxyManager/nginx-proxy-manager/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
|
||||||
wget -q https://codeload.github.com/NginxProxyManager/nginx-proxy-manager/tar.gz/v${RELEASE} -O - | tar -xz
|
|
||||||
cd ./nginx-proxy-manager-${RELEASE}
|
|
||||||
ln -sf /usr/bin/python3 /usr/bin/python
|
|
||||||
ln -sf /usr/bin/certbot /opt/certbot/bin/certbot
|
|
||||||
ln -sf /usr/local/openresty/nginx/sbin/nginx /usr/sbin/nginx
|
|
||||||
ln -sf /usr/local/openresty/nginx/ /etc/nginx
|
|
||||||
sed -i "s|\"version\": \"0.0.0\"|\"version\": \"$RELEASE\"|" backend/package.json
|
|
||||||
sed -i "s|\"version\": \"0.0.0\"|\"version\": \"$RELEASE\"|" frontend/package.json
|
|
||||||
sed -i 's+^daemon+#daemon+g' docker/rootfs/etc/nginx/nginx.conf
|
|
||||||
NGINX_CONFS=$(find "$(pwd)" -type f -name "*.conf")
|
|
||||||
for NGINX_CONF in $NGINX_CONFS; do
|
|
||||||
sed -i 's+include conf.d+include /etc/nginx/conf.d+g' "$NGINX_CONF"
|
|
||||||
done
|
|
||||||
|
|
||||||
mkdir -p /var/www/html /etc/nginx/logs
|
|
||||||
cp -r docker/rootfs/var/www/html/* /var/www/html/
|
|
||||||
cp -r docker/rootfs/etc/nginx/* /etc/nginx/
|
|
||||||
cp docker/rootfs/etc/letsencrypt.ini /etc/letsencrypt.ini
|
|
||||||
cp docker/rootfs/etc/logrotate.d/nginx-proxy-manager /etc/logrotate.d/nginx-proxy-manager
|
|
||||||
ln -sf /etc/nginx/nginx.conf /etc/nginx/conf/nginx.conf
|
|
||||||
rm -f /etc/nginx/conf.d/dev.conf
|
|
||||||
|
|
||||||
mkdir -p /tmp/nginx/body \
|
|
||||||
/run/nginx \
|
|
||||||
/data/nginx \
|
|
||||||
/data/custom_ssl \
|
|
||||||
/data/logs \
|
|
||||||
/data/access \
|
|
||||||
/data/nginx/default_host \
|
|
||||||
/data/nginx/default_www \
|
|
||||||
/data/nginx/proxy_host \
|
|
||||||
/data/nginx/redirection_host \
|
|
||||||
/data/nginx/stream \
|
|
||||||
/data/nginx/dead_host \
|
|
||||||
/data/nginx/temp \
|
|
||||||
/var/lib/nginx/cache/public \
|
|
||||||
/var/lib/nginx/cache/private \
|
|
||||||
/var/cache/nginx/proxy_temp
|
|
||||||
|
|
||||||
chmod -R 777 /var/cache/nginx
|
|
||||||
chown root /tmp/nginx
|
|
||||||
|
|
||||||
echo resolver "$(awk 'BEGIN{ORS=" "} $1=="nameserver" {print ($2 ~ ":")? "["$2"]": $2}' /etc/resolv.conf);" >/etc/nginx/conf.d/include/resolvers.conf
|
|
||||||
|
|
||||||
if [ ! -f /data/nginx/dummycert.pem ] || [ ! -f /data/nginx/dummykey.pem ]; then
|
|
||||||
openssl req -new -newkey rsa:2048 -days 3650 -nodes -x509 -subj "/O=Nginx Proxy Manager/OU=Dummy Certificate/CN=localhost" -keyout /data/nginx/dummykey.pem -out /data/nginx/dummycert.pem &>/dev/null
|
|
||||||
fi
|
|
||||||
|
|
||||||
mkdir -p /app/global /app/frontend/images
|
|
||||||
cp -r backend/* /app
|
|
||||||
cp -r global/* /app/global
|
|
||||||
msg_ok "Setup Nginx Proxy Manager"
|
|
||||||
|
|
||||||
msg_info "Building Frontend"
|
|
||||||
cd ./frontend
|
|
||||||
$STD pnpm install
|
|
||||||
$STD pnpm upgrade
|
|
||||||
$STD pnpm run build
|
|
||||||
cp -r dist/* /app/frontend
|
|
||||||
cp -r app-images/* /app/frontend/images
|
|
||||||
msg_ok "Built Frontend"
|
|
||||||
|
|
||||||
msg_info "Initializing Backend"
|
|
||||||
rm -rf /app/config/default.json
|
|
||||||
if [ ! -f /app/config/production.json ]; then
|
|
||||||
cat <<'EOF' >/app/config/production.json
|
|
||||||
{
|
|
||||||
"database": {
|
|
||||||
"engine": "knex-native",
|
|
||||||
"knex": {
|
|
||||||
"client": "sqlite3",
|
|
||||||
"connection": {
|
|
||||||
"filename": "/data/database.sqlite"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
cd /app
|
|
||||||
$STD pnpm install
|
|
||||||
msg_ok "Initialized Backend"
|
|
||||||
|
|
||||||
msg_info "Creating Service"
|
|
||||||
cat <<'EOF' >/lib/systemd/system/npm.service
|
|
||||||
[Unit]
|
|
||||||
Description=Nginx Proxy Manager
|
|
||||||
After=network.target
|
|
||||||
Wants=openresty.service
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=simple
|
|
||||||
Environment=NODE_ENV=production
|
|
||||||
ExecStartPre=-mkdir -p /tmp/nginx/body /data/letsencrypt-acme-challenge
|
|
||||||
ExecStart=/usr/bin/node index.js --abort_on_uncaught_exception --max_old_space_size=250
|
|
||||||
WorkingDirectory=/app
|
|
||||||
Restart=on-failure
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
EOF
|
|
||||||
msg_ok "Created Service"
|
|
||||||
|
|
||||||
motd_ssh
|
|
||||||
customize
|
|
||||||
|
|
||||||
msg_info "Starting Services"
|
|
||||||
sed -i 's/user npm/user root/g; s/^pid/#pid/g' /usr/local/openresty/nginx/conf/nginx.conf
|
|
||||||
sed -r -i 's/^([[:space:]]*)su npm npm/\1#su npm npm/g;' /etc/logrotate.d/nginx-proxy-manager
|
|
||||||
sed -i 's/include-system-site-packages = false/include-system-site-packages = true/g' /opt/certbot/pyvenv.cfg
|
|
||||||
systemctl enable -q --now openresty
|
|
||||||
systemctl enable -q --now npm
|
|
||||||
msg_ok "Started Services"
|
|
||||||
|
|
||||||
msg_info "Cleaning up"
|
|
||||||
rm -rf ../nginx-proxy-manager-*
|
|
||||||
systemctl restart openresty
|
|
||||||
$STD apt-get -y autoremove
|
|
||||||
$STD apt-get -y autoclean
|
|
||||||
msg_ok "Cleaned"
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Copyright (c) 2021-2026 community-scripts ORG
|
|
||||||
# Author: CrazyWolf13
|
|
||||||
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
|
|
||||||
# Source: https://github.com/arunavo4/gitea-mirror
|
|
||||||
|
|
||||||
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 \
|
|
||||||
openssl \
|
|
||||||
git
|
|
||||||
msg_ok "Installed Dependencies"
|
|
||||||
|
|
||||||
msg_info "Installing Bun"
|
|
||||||
export BUN_INSTALL=/opt/bun
|
|
||||||
curl -fsSL https://bun.sh/install | $STD bash
|
|
||||||
ln -sf /opt/bun/bin/bun /usr/local/bin/bun
|
|
||||||
ln -sf /opt/bun/bin/bun /usr/local/bin/bunx
|
|
||||||
msg_ok "Installed Bun"
|
|
||||||
|
|
||||||
msg_info "Setting up PostgreSQL Database"
|
|
||||||
DB_NAME=nimbus
|
|
||||||
DB_USER=nimbus
|
|
||||||
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 "Nimbus-Credentials"
|
|
||||||
echo "Nimbus Database User: $DB_USER"
|
|
||||||
echo "Nimbus Database Password: $DB_PASS"
|
|
||||||
echo "Nimbus Database Name: $DB_NAME"
|
|
||||||
} >>~/nimbus.creds
|
|
||||||
msg_ok "Set up PostgreSQL Database"
|
|
||||||
|
|
||||||
msg_info "Installing nimbus"
|
|
||||||
cd /opt
|
|
||||||
git clone https://github.com/logscore/Nimbus.git
|
|
||||||
cd /opt/Nimbus
|
|
||||||
$STD bun install
|
|
||||||
$STD bun run build
|
|
||||||
$STD bun run manage-db init
|
|
||||||
msg_ok "Installed gitea-mirror"
|
|
||||||
|
|
||||||
msg_info "Creating Services"
|
|
||||||
JWT_SECRET=$(openssl rand -hex 32)
|
|
||||||
cat <<EOF >/etc/systemd/system/gitea-mirror.service
|
|
||||||
[Unit]
|
|
||||||
Description=Gitea Mirror
|
|
||||||
After=network.target
|
|
||||||
[Service]
|
|
||||||
Type=simple
|
|
||||||
WorkingDirectory=/opt/gitea-mirror
|
|
||||||
ExecStart=/usr/local/bin/bun dist/server/entry.mjs
|
|
||||||
Restart=on-failure
|
|
||||||
RestartSec=10
|
|
||||||
Environment=NODE_ENV=production
|
|
||||||
Environment=HOST=0.0.0.0
|
|
||||||
Environment=PORT=4321
|
|
||||||
Environment=DATABASE_URL=file:/opt/gitea-mirror/data/gitea-mirror.db
|
|
||||||
Environment=JWT_SECRET=${JWT_SECRET}
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
EOF
|
|
||||||
systemctl enable -q --now gitea-mirror
|
|
||||||
msg_ok "Created Service"
|
|
||||||
|
|
||||||
motd_ssh
|
|
||||||
customize
|
|
||||||
|
|
||||||
msg_info "Cleaning up"
|
|
||||||
$STD apt-get -y autoremove
|
|
||||||
$STD apt-get -y autoclean
|
|
||||||
msg_ok "Cleaned"
|
|
||||||
@@ -1,191 +0,0 @@
|
|||||||
#!/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"
|
|
||||||
@@ -1,163 +0,0 @@
|
|||||||
#!/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
|
|
||||||
@@ -1,103 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Copyright (c) 2021-2026 tteck
|
|
||||||
# Author: tteck (tteckster)
|
|
||||||
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
|
|
||||||
# Source: https://github.com/dani-garcia/vaultwarden
|
|
||||||
|
|
||||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
|
||||||
color
|
|
||||||
verb_ip6
|
|
||||||
catch_errors
|
|
||||||
setting_up_container
|
|
||||||
network_check
|
|
||||||
update_os
|
|
||||||
|
|
||||||
msg_info "Installing Dependencies"
|
|
||||||
$STD apt install -y \
|
|
||||||
build-essential \
|
|
||||||
pkgconf \
|
|
||||||
libssl-dev \
|
|
||||||
libmariadb-dev-compat \
|
|
||||||
libpq-dev \
|
|
||||||
argon2 \
|
|
||||||
ssl-cert
|
|
||||||
msg_ok "Installed Dependencies"
|
|
||||||
|
|
||||||
setup_rust
|
|
||||||
fetch_and_deploy_gh_release "vaultwarden" "dani-garcia/vaultwarden" "tarball" "latest" "/tmp/vaultwarden-src"
|
|
||||||
|
|
||||||
msg_info "Building Vaultwarden (Patience)"
|
|
||||||
cd /tmp/vaultwarden-src
|
|
||||||
$STD cargo build --features "sqlite,mysql,postgresql" --release
|
|
||||||
msg_ok "Built Vaultwarden"
|
|
||||||
|
|
||||||
msg_info "Setting up Vaultwarden"
|
|
||||||
$STD addgroup --system vaultwarden
|
|
||||||
$STD adduser --system --home /opt/vaultwarden --shell /usr/sbin/nologin --no-create-home --gecos 'vaultwarden' --ingroup vaultwarden --disabled-login --disabled-password vaultwarden
|
|
||||||
mkdir -p /opt/vaultwarden/{bin,data,web-vault}
|
|
||||||
cp target/release/vaultwarden /opt/vaultwarden/bin/
|
|
||||||
cd ~ && rm -rf /tmp/vaultwarden-src
|
|
||||||
msg_ok "Set up Vaultwarden"
|
|
||||||
|
|
||||||
fetch_and_deploy_gh_release "vaultwarden_webvault" "dani-garcia/bw_web_builds" "prebuild" "latest" "/opt/vaultwarden/web-vault" "bw_web_*.tar.gz"
|
|
||||||
|
|
||||||
msg_info "Configuring Vaultwarden"
|
|
||||||
cat <<EOF >/opt/vaultwarden/.env
|
|
||||||
ADMIN_TOKEN=''
|
|
||||||
ROCKET_ADDRESS=0.0.0.0
|
|
||||||
ROCKET_TLS='{certs="/opt/vaultwarden/ssl-cert-snakeoil.pem",key="/opt/vaultwarden/ssl-cert-snakeoil.key"}'
|
|
||||||
DATA_FOLDER=/opt/vaultwarden/data
|
|
||||||
DATABASE_MAX_CONNS=10
|
|
||||||
WEB_VAULT_FOLDER=/opt/vaultwarden/web-vault
|
|
||||||
WEB_VAULT_ENABLED=true
|
|
||||||
EOF
|
|
||||||
mv /etc/ssl/certs/ssl-cert-snakeoil.pem /opt/vaultwarden/
|
|
||||||
mv /etc/ssl/private/ssl-cert-snakeoil.key /opt/vaultwarden/
|
|
||||||
|
|
||||||
chown -R vaultwarden:vaultwarden /opt/vaultwarden/
|
|
||||||
chown root:root /opt/vaultwarden/bin/vaultwarden
|
|
||||||
chmod +x /opt/vaultwarden/bin/vaultwarden
|
|
||||||
chown -R root:root /opt/vaultwarden/web-vault/
|
|
||||||
chmod +r /opt/vaultwarden/.env
|
|
||||||
msg_ok "Configured Vaultwarden"
|
|
||||||
|
|
||||||
msg_info "Creating Service"
|
|
||||||
cat <<'EOF' >/etc/systemd/system/vaultwarden.service
|
|
||||||
[Unit]
|
|
||||||
Description=Bitwarden Server (Powered by Vaultwarden)
|
|
||||||
Documentation=https://github.com/dani-garcia/vaultwarden
|
|
||||||
After=network.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
User=vaultwarden
|
|
||||||
Group=vaultwarden
|
|
||||||
EnvironmentFile=-/opt/vaultwarden/.env
|
|
||||||
ExecStart=/opt/vaultwarden/bin/vaultwarden
|
|
||||||
LimitNOFILE=65535
|
|
||||||
LimitNPROC=4096
|
|
||||||
PrivateTmp=true
|
|
||||||
PrivateDevices=true
|
|
||||||
ProtectHome=true
|
|
||||||
ProtectSystem=strict
|
|
||||||
DevicePolicy=closed
|
|
||||||
ProtectControlGroups=yes
|
|
||||||
ProtectKernelModules=yes
|
|
||||||
ProtectKernelTunables=yes
|
|
||||||
RestrictNamespaces=yes
|
|
||||||
RestrictRealtime=yes
|
|
||||||
MemoryDenyWriteExecute=yes
|
|
||||||
LockPersonality=yes
|
|
||||||
WorkingDirectory=/opt/vaultwarden
|
|
||||||
ReadWriteDirectories=/opt/vaultwarden/data
|
|
||||||
AmbientCapabilities=CAP_NET_BIND_SERVICE
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
EOF
|
|
||||||
systemctl enable -q --now vaultwarden
|
|
||||||
msg_ok "Created Service"
|
|
||||||
|
|
||||||
motd_ssh
|
|
||||||
customize
|
|
||||||
cleanup_lxc
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Copyright (c) 2021-2026 community-scripts ORG
|
|
||||||
# Author: MickLesk (Canbiz)
|
|
||||||
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
|
|
||||||
# Source: https://vikunja.io/
|
|
||||||
|
|
||||||
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 make
|
|
||||||
msg_ok "Installed Dependencies"
|
|
||||||
|
|
||||||
msg_info "Setup Vikunja (Patience)"
|
|
||||||
cd /opt
|
|
||||||
RELEASE=$(curl -fsSL https://dl.vikunja.io/vikunja/ | grep -oP 'href="/vikunja/\K[0-9]+\.[0-9]+\.[0-9]+' | sort -V | tail -n 1)
|
|
||||||
curl -fsSL "https://dl.vikunja.io/vikunja/$RELEASE/vikunja-$RELEASE-amd64.deb" -o vikunja-$RELEASE-amd64.deb
|
|
||||||
$STD dpkg -i vikunja-$RELEASE-amd64.deb
|
|
||||||
sed -i 's|^ timezone: .*| timezone: UTC|' /etc/vikunja/config.yml
|
|
||||||
sed -i 's|"./vikunja.db"|"/etc/vikunja/vikunja.db"|' /etc/vikunja/config.yml
|
|
||||||
sed -i 's|./files|/etc/vikunja/files|' /etc/vikunja/config.yml
|
|
||||||
systemctl start vikunja.service
|
|
||||||
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
|
|
||||||
msg_ok "Installed Vikunja"
|
|
||||||
|
|
||||||
motd_ssh
|
|
||||||
customize
|
|
||||||
|
|
||||||
msg_info "Cleaning up"
|
|
||||||
rm -rf /opt/vikunja-$RELEASE-amd64.deb
|
|
||||||
$STD apt-get autoremove
|
|
||||||
$STD apt-get autoclean
|
|
||||||
msg_ok "Cleaned"
|
|
||||||
Reference in New Issue
Block a user