cleanup
This commit is contained in:
parent
9b01f34bc1
commit
c2cc455629
@ -1,15 +1,15 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
source <(curl -fsSL https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/misc/build.func)
|
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func)
|
||||||
# Copyright (c) 2021-2025 community-scripts ORG
|
# Copyright (c) 2021-2025 community-scripts ORG
|
||||||
# Author: MickLesk (Canbiz)
|
# Author: MickLesk (CanbiZ)
|
||||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
|
||||||
# Source: https://github.com/getmaxun/maxun
|
# Source: https://github.com/getmaxun/maxun
|
||||||
|
|
||||||
APP="Maxun"
|
APP="Maxun"
|
||||||
var_tags="${var_tags:-scraper}"
|
var_tags="${var_tags:-automation;scraper}"
|
||||||
var_disk="${var_disk:-7}"
|
|
||||||
var_cpu="${var_cpu:-2}"
|
var_cpu="${var_cpu:-2}"
|
||||||
var_ram="${var_ram:-3072}"
|
var_ram="${var_ram:-4096}"
|
||||||
|
var_disk="${var_disk:-10}"
|
||||||
var_os="${var_os:-debian}"
|
var_os="${var_os:-debian}"
|
||||||
var_version="${var_version:-12}"
|
var_version="${var_version:-12}"
|
||||||
var_unprivileged="${var_unprivileged:-1}"
|
var_unprivileged="${var_unprivileged:-1}"
|
||||||
@ -20,47 +20,23 @@ color
|
|||||||
catch_errors
|
catch_errors
|
||||||
|
|
||||||
function update_script() {
|
function update_script() {
|
||||||
header_info
|
header_info
|
||||||
check_container_storage
|
check_container_storage
|
||||||
check_container_resources
|
check_container_resources
|
||||||
if [[ ! -d /opt/maxun ]]; then
|
|
||||||
msg_error "No ${APP} Installation Found!"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
RELEASE=$(curl -fsSL https://api.github.com/repos/getmaxun/maxun/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
|
||||||
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
|
|
||||||
msg_info "Stopping Services"
|
|
||||||
systemctl stop maxun minio redis
|
|
||||||
msg_ok "Services Stopped"
|
|
||||||
|
|
||||||
msg_info "Updating ${APP} to v${RELEASE}"
|
if [[ ! -d /opt/maxun ]]; then
|
||||||
mv /opt/maxun /opt/maxun_bak
|
msg_error "No ${APP} Installation Found!"
|
||||||
cd /opt
|
|
||||||
curl -fsSL "https://github.com/getmaxun/maxun/archive/refs/tags/v${RELEASE}.zip"
|
|
||||||
unzip -q v${RELEASE}.zip
|
|
||||||
mv maxun-${RELEASE} /opt/maxun
|
|
||||||
mv /opt/maxun_bak/.env /opt/maxun/
|
|
||||||
cd /opt/maxun
|
|
||||||
npm install --legacy-peer-deps
|
|
||||||
cd /opt/maxun/maxun-core
|
|
||||||
npm install --legacy-peer-deps
|
|
||||||
cd /opt/maxun
|
|
||||||
npx playwright install --with-deps chromium
|
|
||||||
npx playwright install-deps
|
|
||||||
"${RELEASE}" >/opt/${APP}_version.txt
|
|
||||||
|
|
||||||
msg_info "Starting Services"
|
|
||||||
systemctl start minio redis maxun
|
|
||||||
msg_ok "Started Services"
|
|
||||||
|
|
||||||
msg_info "Cleaning Up"
|
|
||||||
rm -rf /opt/v${RELEASE}.zip
|
|
||||||
msg_ok "Cleaned"
|
|
||||||
msg_ok "Updated Successfully"
|
|
||||||
else
|
|
||||||
msg_ok "No update required. ${APP} is already at v${RELEASE}"
|
|
||||||
fi
|
|
||||||
exit
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# NOTE: Updates temporarily disabled due to upstream TypeScript build errors in v0.0.27+
|
||||||
|
# The mcp-worker.ts file has type instantiation issues that prevent compilation
|
||||||
|
# Pinned to v0.0.26 until upstream fixes the issue
|
||||||
|
# See: https://github.com/getmaxun/maxun/releases
|
||||||
|
msg_warn "Updates are temporarily disabled due to upstream build issues"
|
||||||
|
msg_info "Current pinned version: v0.0.26"
|
||||||
|
msg_info "Check https://github.com/getmaxun/maxun/releases for fixes"
|
||||||
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
start
|
start
|
||||||
@ -70,4 +46,8 @@ description
|
|||||||
msg_ok "Completed Successfully!\n"
|
msg_ok "Completed Successfully!\n"
|
||||||
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
||||||
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
|
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
|
||||||
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:5173${CL}"
|
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}"
|
||||||
|
echo -e "${INFO}${YW} MinIO Console:${CL}"
|
||||||
|
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:9001${CL}"
|
||||||
|
echo -e "${INFO}${YW} Credentials saved in:${CL}"
|
||||||
|
echo -e "${TAB}/root/maxun.creds"
|
||||||
|
|||||||
@ -3,15 +3,15 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV
|
|||||||
# Copyright (c) 2021-2025 community-scripts ORG
|
# Copyright (c) 2021-2025 community-scripts ORG
|
||||||
# Author: MickLesk (CanbiZ)
|
# Author: MickLesk (CanbiZ)
|
||||||
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
|
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
|
||||||
# Source: https://github.com/getmaxun/maxun
|
# Source: https://pixelfed.org/
|
||||||
|
|
||||||
APP="Maxun"
|
APP="Pixelfed"
|
||||||
var_tags="${var_tags:-automation;scraper}"
|
var_tags="${var_tags:-fediverse;social}"
|
||||||
var_cpu="${var_cpu:-2}"
|
var_cpu="${var_cpu:-2}"
|
||||||
var_ram="${var_ram:-4096}"
|
var_ram="${var_ram:-2048}"
|
||||||
var_disk="${var_disk:-10}"
|
var_disk="${var_disk:-10}"
|
||||||
var_os="${var_os:-debian}"
|
var_os="${var_os:-debian}"
|
||||||
var_version="${var_version:-12}"
|
var_version="${var_version:-13}"
|
||||||
var_unprivileged="${var_unprivileged:-1}"
|
var_unprivileged="${var_unprivileged:-1}"
|
||||||
|
|
||||||
header_info "$APP"
|
header_info "$APP"
|
||||||
@ -24,41 +24,41 @@ function update_script() {
|
|||||||
check_container_storage
|
check_container_storage
|
||||||
check_container_resources
|
check_container_resources
|
||||||
|
|
||||||
if [[ ! -d /opt/maxun ]]; then
|
if [[ ! -d /opt/pixelfed ]]; then
|
||||||
msg_error "No ${APP} Installation Found!"
|
msg_error "No ${APP} Installation Found!"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if check_for_gh_release "maxun" "getmaxun/maxun"; then
|
if check_for_gh_release "pixelfed" "pixelfed/pixelfed"; then
|
||||||
msg_info "Stopping Services"
|
msg_info "Stopping Services"
|
||||||
systemctl stop maxun
|
systemctl stop pixelfed-horizon pixelfed-scheduler.timer
|
||||||
msg_ok "Services stopped"
|
msg_ok "Services stopped"
|
||||||
|
|
||||||
msg_info "Backing up Configuration"
|
msg_info "Backing up Configuration"
|
||||||
cp /opt/maxun/.env /tmp/maxun.env.bak
|
cp /opt/pixelfed/.env /tmp/pixelfed.env.bak
|
||||||
msg_ok "Configuration backed up"
|
msg_ok "Configuration backed up"
|
||||||
|
|
||||||
msg_info "Updating ${APP}"
|
msg_info "Updating ${APP}"
|
||||||
rm -rf /opt/maxun
|
cd /opt/pixelfed
|
||||||
fetch_and_deploy_gh_release "maxun" "getmaxun/maxun" "source"
|
fetch_and_deploy_gh_release "pixelfed" "pixelfed/pixelfed" "tarball" "latest" "/opt/pixelfed"
|
||||||
cp /tmp/maxun.env.bak /opt/maxun/.env
|
cp /tmp/pixelfed.env.bak /opt/pixelfed/.env
|
||||||
rm -f /tmp/maxun.env.bak
|
rm -f /tmp/pixelfed.env.bak
|
||||||
|
|
||||||
cd /opt/maxun
|
chown -R pixelfed:pixelfed /opt/pixelfed
|
||||||
$STD npm install --legacy-peer-deps
|
chmod -R 755 /opt/pixelfed
|
||||||
cd /opt/maxun/maxun-core
|
chmod -R 775 /opt/pixelfed/storage /opt/pixelfed/bootstrap/cache
|
||||||
$STD npm install --legacy-peer-deps
|
|
||||||
cd /opt/maxun
|
|
||||||
$STD npx playwright install --with-deps chromium
|
|
||||||
$STD npm run build:server
|
|
||||||
$STD npm run build
|
|
||||||
|
|
||||||
cp -r /opt/maxun/dist/* /var/www/maxun/
|
export COMPOSER_ALLOW_SUPERUSER=1
|
||||||
echo "${RELEASE}" >/opt/maxun_version.txt
|
$STD composer install --no-dev --no-ansi --no-interaction --optimize-autoloader
|
||||||
|
$STD sudo -u pixelfed php artisan migrate --force
|
||||||
|
$STD sudo -u pixelfed php artisan route:cache
|
||||||
|
$STD sudo -u pixelfed php artisan view:cache
|
||||||
|
$STD sudo -u pixelfed php artisan config:cache
|
||||||
|
$STD sudo -u pixelfed php artisan horizon:publish
|
||||||
msg_ok "Updated ${APP}"
|
msg_ok "Updated ${APP}"
|
||||||
|
|
||||||
msg_info "Starting Services"
|
msg_info "Starting Services"
|
||||||
systemctl start maxun
|
systemctl start pixelfed-horizon pixelfed-scheduler.timer
|
||||||
msg_ok "Services started"
|
msg_ok "Services started"
|
||||||
|
|
||||||
msg_ok "Updated Successfully"
|
msg_ok "Updated Successfully"
|
||||||
@ -76,7 +76,7 @@ msg_ok "Completed Successfully!\n"
|
|||||||
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
||||||
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
|
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
|
||||||
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}"
|
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}"
|
||||||
echo -e "${INFO}${YW} MinIO Console:${CL}"
|
echo -e "${INFO}${YW} Create an admin account with:${CL}"
|
||||||
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:9001${CL}"
|
echo -e "${TAB}cd /opt/pixelfed && sudo -u pixelfed php artisan user:create"
|
||||||
echo -e "${INFO}${YW} Credentials saved in:${CL}"
|
echo -e "${INFO}${YW} Credentials saved in:${CL}"
|
||||||
echo -e "${TAB}/root/maxun.creds"
|
echo -e "${TAB}/root/pixelfed.creds"
|
||||||
@ -1,52 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "Maxun",
|
|
||||||
"slug": "maxun",
|
|
||||||
"categories": [
|
|
||||||
11
|
|
||||||
],
|
|
||||||
"date_created": "2024-10-15",
|
|
||||||
"type": "ct",
|
|
||||||
"updateable": true,
|
|
||||||
"privileged": false,
|
|
||||||
"interface_port": 80,
|
|
||||||
"documentation": "https://docs.maxun.dev/",
|
|
||||||
"config_path": "/opt/maxun/.env",
|
|
||||||
"website": "https://www.maxun.dev/",
|
|
||||||
"logo": "https://raw.githubusercontent.com/getmaxun/maxun/master/public/maxun-logo.png",
|
|
||||||
"description": "Maxun is an open-source, no-code web scraping platform that allows you to turn websites into APIs and spreadsheets in minutes. It features visual workflow building, scheduled robots, and AI-powered data extraction without writing code.",
|
|
||||||
"install_methods": [
|
|
||||||
{
|
|
||||||
"type": "default",
|
|
||||||
"script": "ct/maxun.sh",
|
|
||||||
"resources": {
|
|
||||||
"cpu": 2,
|
|
||||||
"ram": 4096,
|
|
||||||
"hdd": 10,
|
|
||||||
"os": "Debian",
|
|
||||||
"version": "12"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"default_credentials": {
|
|
||||||
"username": null,
|
|
||||||
"password": null
|
|
||||||
},
|
|
||||||
"notes": [
|
|
||||||
{
|
|
||||||
"text": "First visit will prompt you to create an account",
|
|
||||||
"type": "info"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "MinIO Console available at port 9001",
|
|
||||||
"type": "info"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Credentials saved in /root/maxun.creds",
|
|
||||||
"type": "info"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Uses PostgreSQL, Redis, and MinIO as backend services",
|
|
||||||
"type": "info"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
52
frontend/public/json/pixelfed.json
Normal file
52
frontend/public/json/pixelfed.json
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
{
|
||||||
|
"name": "Pixelfed",
|
||||||
|
"slug": "pixelfed",
|
||||||
|
"categories": [
|
||||||
|
17
|
||||||
|
],
|
||||||
|
"date_created": "2024-06-15",
|
||||||
|
"type": "ct",
|
||||||
|
"updateable": true,
|
||||||
|
"privileged": false,
|
||||||
|
"interface_port": 80,
|
||||||
|
"documentation": "https://docs.pixelfed.org/",
|
||||||
|
"config_path": "/opt/pixelfed/.env",
|
||||||
|
"website": "https://pixelfed.org/",
|
||||||
|
"logo": "https://raw.githubusercontent.com/pixelfed/pixelfed/dev/public/img/pixelfed-icon-color.svg",
|
||||||
|
"description": "Pixelfed is a free, ethical, and decentralized photo sharing platform powered by ActivityPub federation. It offers an ad-free, privacy-focused alternative to Instagram with features like Stories, Collections, and photo filters.",
|
||||||
|
"install_methods": [
|
||||||
|
{
|
||||||
|
"type": "default",
|
||||||
|
"script": "ct/pixelfed.sh",
|
||||||
|
"resources": {
|
||||||
|
"cpu": 2,
|
||||||
|
"ram": 2048,
|
||||||
|
"hdd": 10,
|
||||||
|
"os": "Debian",
|
||||||
|
"version": "12"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"default_credentials": {
|
||||||
|
"username": null,
|
||||||
|
"password": null
|
||||||
|
},
|
||||||
|
"notes": [
|
||||||
|
{
|
||||||
|
"text": "Create admin account with: cd /opt/pixelfed && sudo -u pixelfed php artisan user:create",
|
||||||
|
"type": "warning"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "Credentials saved in /root/pixelfed.creds",
|
||||||
|
"type": "info"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "ActivityPub federation is enabled by default",
|
||||||
|
"type": "info"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "Uses PostgreSQL, Redis (socket), and PHP-FPM",
|
||||||
|
"type": "info"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@ -1,8 +1,8 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Copyright (c) 2021-2025 community-scripts ORG
|
# Copyright (c) 2021-2025 community-scripts ORG
|
||||||
# Author: MickLesk (Canbiz)
|
# Author: MickLesk (CanbiZ)
|
||||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
|
||||||
# Source: https://github.com/getmaxun/maxun
|
# Source: https://github.com/getmaxun/maxun
|
||||||
|
|
||||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||||
@ -15,81 +15,70 @@ update_os
|
|||||||
|
|
||||||
msg_info "Installing Dependencies"
|
msg_info "Installing Dependencies"
|
||||||
$STD apt-get install -y \
|
$STD apt-get install -y \
|
||||||
openssl \
|
redis-server \
|
||||||
redis \
|
nginx \
|
||||||
libgbm1 \
|
libgbm1 \
|
||||||
libnss3 \
|
libnss3 \
|
||||||
libatk1.0-0 \
|
libatk1.0-0 \
|
||||||
libatk-bridge2.0-0 \
|
libatk-bridge2.0-0 \
|
||||||
libdrm2 \
|
libdrm2 \
|
||||||
libxkbcommon0 \
|
libxkbcommon0 \
|
||||||
libglib2.0-0 \
|
libglib2.0-0 \
|
||||||
libdbus-1-3 \
|
libdbus-1-3 \
|
||||||
libx11-xcb1 \
|
libx11-xcb1 \
|
||||||
libxcb1 \
|
libxcb1 \
|
||||||
libxcomposite1 \
|
libxcomposite1 \
|
||||||
libxcursor1 \
|
libxcursor1 \
|
||||||
libxdamage1 \
|
libxdamage1 \
|
||||||
libxext6 \
|
libxext6 \
|
||||||
libxi6 \
|
libxi6 \
|
||||||
libxtst6 \
|
libxtst6 \
|
||||||
ca-certificates \
|
libxrandr2 \
|
||||||
libxrandr2 \
|
libasound2 \
|
||||||
libasound2 \
|
libxss1 \
|
||||||
libxss1 \
|
libxinerama1
|
||||||
libxinerama1 \
|
|
||||||
nginx
|
|
||||||
msg_ok "Installed Dependencies"
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
PG_VERSION=17 setup_postgresql
|
PG_VERSION="17" setup_postgresql
|
||||||
NODE_VERSION="18" setup_nodejs
|
NODE_VERSION="20" setup_nodejs
|
||||||
|
PG_DB_NAME="maxun_db" PG_DB_USER="maxun" setup_postgresql_db
|
||||||
|
fetch_and_deploy_gh_release "maxun" "getmaxun/maxun" "tarball" "latest" "/opt/maxun"
|
||||||
|
|
||||||
msg_info "Setup Variables"
|
msg_info "Setting up Variables"
|
||||||
DB_NAME=maxun_db
|
MINIO_USER="minio_admin"
|
||||||
DB_USER=maxun_user
|
MINIO_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
|
||||||
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)
|
JWT_SECRET=$(openssl rand -base64 48 | tr -dc 'a-zA-Z0-9' | head -c48)
|
||||||
MINIO_USER=minio_usr
|
ENCRYPTION_KEY=$(openssl rand -hex 32)
|
||||||
MINIO_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)
|
SESSION_SECRET=$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | head -c32)
|
||||||
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}')
|
LOCAL_IP=$(hostname -I | awk '{print $1}')
|
||||||
SESSION_SECRET=$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | cut -c1-32)
|
msg_ok "Variables configured"
|
||||||
msg_ok "Set up Variables"
|
|
||||||
|
|
||||||
msg_info "Setup Database"
|
msg_info "Setting up MinIO"
|
||||||
$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';"
|
mkdir -p /opt/minio_data
|
||||||
$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"
|
|
||||||
echo "Maxun Session Secret: $SESSION_SECRET"
|
|
||||||
} >>~/maxun.creds
|
|
||||||
msg_ok "Set up Database"
|
|
||||||
|
|
||||||
msg_info "Setup MinIO"
|
|
||||||
cd /tmp
|
cd /tmp
|
||||||
wget -q https://dl.min.io/server/minio/release/linux-amd64/minio
|
curl -fsSL https://dl.min.io/server/minio/release/linux-amd64/minio.deb -o minio.deb
|
||||||
mv minio /usr/local/bin/
|
$STD dpkg -i minio.deb
|
||||||
chmod +x /usr/local/bin/minio
|
rm -f /tmp/minio.deb
|
||||||
mkdir -p /data
|
|
||||||
|
cat <<EOF >/etc/default/minio
|
||||||
|
MINIO_ROOT_USER=${MINIO_USER}
|
||||||
|
MINIO_ROOT_PASSWORD=${MINIO_PASS}
|
||||||
|
MINIO_VOLUMES="/opt/minio_data"
|
||||||
|
MINIO_OPTS="--console-address :9001"
|
||||||
|
EOF
|
||||||
|
|
||||||
cat <<EOF >/etc/systemd/system/minio.service
|
cat <<EOF >/etc/systemd/system/minio.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=MinIO
|
Description=MinIO Object Storage
|
||||||
Documentation=https://docs.min.io
|
Documentation=https://docs.min.io
|
||||||
Wants=network-online.target
|
|
||||||
After=network-online.target
|
After=network-online.target
|
||||||
|
Wants=network-online.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
|
Type=simple
|
||||||
User=root
|
User=root
|
||||||
EnvironmentFile=-/etc/default/minio
|
EnvironmentFile=/etc/default/minio
|
||||||
ExecStart=/usr/local/bin/minio server /data
|
ExecStart=/usr/bin/minio server \$MINIO_VOLUMES \$MINIO_OPTS
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=5
|
RestartSec=5
|
||||||
LimitNOFILE=65536
|
LimitNOFILE=65536
|
||||||
@ -97,82 +86,78 @@ LimitNOFILE=65536
|
|||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
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
|
systemctl enable -q --now minio
|
||||||
msg_ok "Setup MinIO"
|
msg_ok "MinIO configured"
|
||||||
|
|
||||||
fetch_and_deploy_gh_release "maxun" "getmaxun/maxun" "source"
|
msg_info "Setting up Redis"
|
||||||
|
systemctl enable -q --now redis-server
|
||||||
|
msg_ok "Redis configured"
|
||||||
|
|
||||||
msg_info "Installing Maxun (Patience)"
|
msg_info "Installing Maxun (Patience)"
|
||||||
|
cd /opt/maxun
|
||||||
cat <<EOF >/opt/maxun/.env
|
cat <<EOF >/opt/maxun/.env
|
||||||
NODE_ENV=development
|
NODE_ENV=production
|
||||||
JWT_SECRET=${JWT_SECRET}
|
JWT_SECRET=${JWT_SECRET}
|
||||||
DB_NAME=${DB_NAME}
|
DB_NAME=${PG_DB_NAME}
|
||||||
DB_USER=${DB_USER}
|
DB_USER=${PG_DB_USER}
|
||||||
DB_PASSWORD=${DB_PASS}
|
DB_PASSWORD=${PG_DB_PASS}
|
||||||
DB_HOST=localhost
|
DB_HOST=localhost
|
||||||
DB_PORT=5432
|
DB_PORT=5432
|
||||||
ENCRYPTION_KEY=${ENCRYPTION_KEY}
|
ENCRYPTION_KEY=${ENCRYPTION_KEY}
|
||||||
|
SESSION_SECRET=${SESSION_SECRET}
|
||||||
|
|
||||||
MINIO_ENDPOINT=localhost
|
MINIO_ENDPOINT=localhost
|
||||||
MINIO_PORT=9000
|
MINIO_PORT=9000
|
||||||
MINIO_CONSOLE_PORT=9001
|
MINIO_CONSOLE_PORT=9001
|
||||||
MINIO_ACCESS_KEY=${MINIO_USER}
|
MINIO_ACCESS_KEY=${MINIO_USER}
|
||||||
MINIO_SECRET_KEY=${MINIO_PASS}
|
MINIO_SECRET_KEY=${MINIO_PASS}
|
||||||
|
|
||||||
REDIS_HOST=127.0.0.1
|
REDIS_HOST=127.0.0.1
|
||||||
REDIS_PORT=6379
|
REDIS_PORT=6379
|
||||||
|
|
||||||
BACKEND_PORT=8080
|
BACKEND_PORT=8080
|
||||||
FRONTEND_PORT=5173
|
FRONTEND_PORT=5173
|
||||||
BACKEND_URL=http://${LOCAL_IP}:8080
|
BACKEND_URL=http://${LOCAL_IP}:8080
|
||||||
PUBLIC_URL=http://${LOCAL_IP}:5173
|
PUBLIC_URL=http://${LOCAL_IP}
|
||||||
VITE_BACKEND_URL=http://${LOCAL_IP}:8080
|
VITE_BACKEND_URL=http://${LOCAL_IP}:8080
|
||||||
VITE_PUBLIC_URL=http://${LOCAL_IP}:5173
|
VITE_PUBLIC_URL=http://${LOCAL_IP}
|
||||||
|
|
||||||
MAXUN_TELEMETRY=false
|
MAXUN_TELEMETRY=false
|
||||||
SESSION_SECRET=${SESSION_SECRET}
|
|
||||||
EOF
|
EOF
|
||||||
|
$STD npm install --legacy-peer-deps
|
||||||
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
|
|
||||||
cd /opt/maxun/maxun-core
|
cd /opt/maxun/maxun-core
|
||||||
$STD npm install
|
$STD npm install --legacy-peer-deps
|
||||||
cd /opt/maxun
|
cd /opt/maxun
|
||||||
$STD npx playwright install --with-deps chromium
|
msg_ok "Maxun dependencies installed"
|
||||||
$STD npx playwright install-deps
|
|
||||||
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
|
msg_info "Installing Playwright/Chromium"
|
||||||
msg_ok "Installed Maxun"
|
$STD npm install playwright
|
||||||
|
$STD npx playwright install --with-deps chromium
|
||||||
|
msg_ok "Playwright/Chromium installed"
|
||||||
|
|
||||||
|
msg_info "Building Maxun"
|
||||||
|
$STD npm run build:server
|
||||||
|
$STD npm run build
|
||||||
|
msg_ok "Maxun built"
|
||||||
|
|
||||||
|
msg_info "Setting up nginx"
|
||||||
|
mkdir -p /var/www/maxun
|
||||||
|
cp -r /opt/maxun/dist/* /var/www/maxun/
|
||||||
|
|
||||||
msg_info "Setting up nginx with CORS Proxy"
|
|
||||||
cat <<'EOF' >/etc/nginx/sites-available/maxun
|
cat <<'EOF' >/etc/nginx/sites-available/maxun
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
server_name _;
|
server_name _;
|
||||||
|
|
||||||
# Frontend ausliefern
|
root /var/www/maxun;
|
||||||
root /usr/share/nginx/html;
|
|
||||||
index index.html;
|
index index.html;
|
||||||
|
|
||||||
|
# Frontend
|
||||||
location / {
|
location / {
|
||||||
try_files $uri $uri/ /index.html;
|
try_files $uri $uri/ /index.html;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Backend Proxy
|
# Backend API Proxy
|
||||||
location ~ ^/(auth|storage|record|workflow|robot|proxy|api-docs|api|webhook)(/|$) {
|
location ~ ^/(auth|storage|record|workflow|robot|proxy|api-docs|api|webhook)(/|$) {
|
||||||
proxy_pass http://127.0.0.1:8080;
|
proxy_pass http://127.0.0.1:8080;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
@ -182,67 +167,40 @@ server {
|
|||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
|
||||||
# CORS
|
|
||||||
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_connect_timeout 60s;
|
||||||
proxy_read_timeout 60s;
|
proxy_read_timeout 120s;
|
||||||
proxy_send_timeout 60s;
|
proxy_send_timeout 60s;
|
||||||
|
|
||||||
proxy_intercept_errors on;
|
|
||||||
error_page 502 503 504 /50x.html;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
ln -sf /etc/nginx/sites-available/maxun /etc/nginx/sites-enabled/maxun
|
ln -sf /etc/nginx/sites-available/maxun /etc/nginx/sites-enabled/maxun
|
||||||
rm -f /etc/nginx/sites-enabled/default
|
rm -f /etc/nginx/sites-enabled/default
|
||||||
msg_ok "nginx with CORS Proxy set up"
|
$STD nginx -t
|
||||||
|
systemctl enable -q --now nginx
|
||||||
|
msg_ok "nginx configured"
|
||||||
|
|
||||||
msg_info "Creating Services"
|
msg_info "Creating Service"
|
||||||
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
|
cat <<EOF >/etc/systemd/system/maxun.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Maxun Service
|
Description=Maxun Web Scraping Service
|
||||||
After=network.target postgresql.service redis.service minio.service maxun-update-env.service
|
After=network.target postgresql.service redis-server.service minio.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
User=root
|
||||||
WorkingDirectory=/opt/maxun
|
WorkingDirectory=/opt/maxun
|
||||||
ExecStart=/usr/bin/npm run start
|
|
||||||
Restart=always
|
|
||||||
EnvironmentFile=/opt/maxun/.env
|
EnvironmentFile=/opt/maxun/.env
|
||||||
|
ExecStart=/usr/bin/node server/dist/server/src/server.js
|
||||||
|
Restart=always
|
||||||
|
RestartSec=5
|
||||||
|
Environment=NODE_OPTIONS=--max-old-space-size=512
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
systemctl enable -q --now maxun-update-env
|
|
||||||
systemctl enable -q --now maxun
|
systemctl enable -q --now maxun
|
||||||
systemctl enable -q --now nginx
|
msg_ok "Service created"
|
||||||
msg_ok "Created Service"
|
|
||||||
|
|
||||||
motd_ssh
|
motd_ssh
|
||||||
customize
|
customize
|
||||||
|
cleanup_lxc
|
||||||
msg_info "Cleaning up"
|
|
||||||
rm -rf /opt/v${RELEASE}.zip
|
|
||||||
$STD apt-get -y autoremove
|
|
||||||
$STD apt-get -y autoclean
|
|
||||||
msg_ok "Cleaned"
|
|
||||||
|
|||||||
@ -1,206 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Copyright (c) 2021-2025 community-scripts ORG
|
|
||||||
# Author: MickLesk (CanbiZ)
|
|
||||||
# License: MIT | https://github.com/community-scripts/ProxmoxVED/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 \
|
|
||||||
redis-server \
|
|
||||||
nginx \
|
|
||||||
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 \
|
|
||||||
libxrandr2 \
|
|
||||||
libasound2 \
|
|
||||||
libxss1 \
|
|
||||||
libxinerama1
|
|
||||||
msg_ok "Installed Dependencies"
|
|
||||||
|
|
||||||
PG_VERSION="17" setup_postgresql
|
|
||||||
NODE_VERSION="20" setup_nodejs
|
|
||||||
PG_DB_NAME="maxun_db" PG_DB_USER="maxun" setup_postgresql_db
|
|
||||||
fetch_and_deploy_gh_release "maxun" "getmaxun/maxun" "tarball" "latest" "/opt/maxun"
|
|
||||||
|
|
||||||
msg_info "Setting up Variables"
|
|
||||||
MINIO_USER="minio_admin"
|
|
||||||
MINIO_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
|
|
||||||
JWT_SECRET=$(openssl rand -base64 48 | tr -dc 'a-zA-Z0-9' | head -c48)
|
|
||||||
ENCRYPTION_KEY=$(openssl rand -hex 32)
|
|
||||||
SESSION_SECRET=$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | head -c32)
|
|
||||||
LOCAL_IP=$(hostname -I | awk '{print $1}')
|
|
||||||
msg_ok "Variables configured"
|
|
||||||
|
|
||||||
msg_info "Setting up MinIO"
|
|
||||||
mkdir -p /opt/minio_data
|
|
||||||
cd /tmp
|
|
||||||
curl -fsSL https://dl.min.io/server/minio/release/linux-amd64/minio.deb -o minio.deb
|
|
||||||
$STD dpkg -i minio.deb
|
|
||||||
rm -f /tmp/minio.deb
|
|
||||||
|
|
||||||
cat <<EOF >/etc/default/minio
|
|
||||||
MINIO_ROOT_USER=${MINIO_USER}
|
|
||||||
MINIO_ROOT_PASSWORD=${MINIO_PASS}
|
|
||||||
MINIO_VOLUMES="/opt/minio_data"
|
|
||||||
MINIO_OPTS="--console-address :9001"
|
|
||||||
EOF
|
|
||||||
|
|
||||||
cat <<EOF >/etc/systemd/system/minio.service
|
|
||||||
[Unit]
|
|
||||||
Description=MinIO Object Storage
|
|
||||||
Documentation=https://docs.min.io
|
|
||||||
After=network-online.target
|
|
||||||
Wants=network-online.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=simple
|
|
||||||
User=root
|
|
||||||
EnvironmentFile=/etc/default/minio
|
|
||||||
ExecStart=/usr/bin/minio server \$MINIO_VOLUMES \$MINIO_OPTS
|
|
||||||
Restart=always
|
|
||||||
RestartSec=5
|
|
||||||
LimitNOFILE=65536
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
EOF
|
|
||||||
systemctl enable -q --now minio
|
|
||||||
msg_ok "MinIO configured"
|
|
||||||
|
|
||||||
msg_info "Setting up Redis"
|
|
||||||
systemctl enable -q --now redis-server
|
|
||||||
msg_ok "Redis configured"
|
|
||||||
|
|
||||||
msg_info "Installing Maxun (Patience)"
|
|
||||||
cd /opt/maxun
|
|
||||||
cat <<EOF >/opt/maxun/.env
|
|
||||||
NODE_ENV=production
|
|
||||||
JWT_SECRET=${JWT_SECRET}
|
|
||||||
DB_NAME=${PG_DB_NAME}
|
|
||||||
DB_USER=${PG_DB_USER}
|
|
||||||
DB_PASSWORD=${PG_DB_PASS}
|
|
||||||
DB_HOST=localhost
|
|
||||||
DB_PORT=5432
|
|
||||||
ENCRYPTION_KEY=${ENCRYPTION_KEY}
|
|
||||||
SESSION_SECRET=${SESSION_SECRET}
|
|
||||||
|
|
||||||
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}
|
|
||||||
VITE_BACKEND_URL=http://${LOCAL_IP}:8080
|
|
||||||
VITE_PUBLIC_URL=http://${LOCAL_IP}
|
|
||||||
|
|
||||||
MAXUN_TELEMETRY=false
|
|
||||||
EOF
|
|
||||||
$STD npm install --legacy-peer-deps
|
|
||||||
cd /opt/maxun/maxun-core
|
|
||||||
$STD npm install --legacy-peer-deps
|
|
||||||
cd /opt/maxun
|
|
||||||
msg_ok "Maxun dependencies installed"
|
|
||||||
|
|
||||||
msg_info "Installing Playwright/Chromium"
|
|
||||||
$STD npm install playwright
|
|
||||||
$STD npx playwright install --with-deps chromium
|
|
||||||
msg_ok "Playwright/Chromium installed"
|
|
||||||
|
|
||||||
msg_info "Building Maxun"
|
|
||||||
$STD npm run build:server
|
|
||||||
$STD npm run build
|
|
||||||
msg_ok "Maxun built"
|
|
||||||
|
|
||||||
msg_info "Setting up nginx"
|
|
||||||
mkdir -p /var/www/maxun
|
|
||||||
cp -r /opt/maxun/dist/* /var/www/maxun/
|
|
||||||
|
|
||||||
cat <<'EOF' >/etc/nginx/sites-available/maxun
|
|
||||||
server {
|
|
||||||
listen 80;
|
|
||||||
server_name _;
|
|
||||||
|
|
||||||
root /var/www/maxun;
|
|
||||||
index index.html;
|
|
||||||
|
|
||||||
# Frontend
|
|
||||||
location / {
|
|
||||||
try_files $uri $uri/ /index.html;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Backend API Proxy
|
|
||||||
location ~ ^/(auth|storage|record|workflow|robot|proxy|api-docs|api|webhook)(/|$) {
|
|
||||||
proxy_pass http://127.0.0.1:8080;
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
|
||||||
proxy_set_header Connection 'upgrade';
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
|
||||||
proxy_connect_timeout 60s;
|
|
||||||
proxy_read_timeout 120s;
|
|
||||||
proxy_send_timeout 60s;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
ln -sf /etc/nginx/sites-available/maxun /etc/nginx/sites-enabled/maxun
|
|
||||||
rm -f /etc/nginx/sites-enabled/default
|
|
||||||
$STD nginx -t
|
|
||||||
systemctl enable -q --now nginx
|
|
||||||
msg_ok "nginx configured"
|
|
||||||
|
|
||||||
msg_info "Creating Service"
|
|
||||||
cat <<EOF >/etc/systemd/system/maxun.service
|
|
||||||
[Unit]
|
|
||||||
Description=Maxun Web Scraping Service
|
|
||||||
After=network.target postgresql.service redis-server.service minio.service
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=simple
|
|
||||||
User=root
|
|
||||||
WorkingDirectory=/opt/maxun
|
|
||||||
EnvironmentFile=/opt/maxun/.env
|
|
||||||
ExecStart=/usr/bin/node server/dist/server/src/server.js
|
|
||||||
Restart=always
|
|
||||||
RestartSec=5
|
|
||||||
Environment=NODE_OPTIONS=--max-old-space-size=512
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
EOF
|
|
||||||
systemctl enable -q --now maxun
|
|
||||||
msg_ok "Service created"
|
|
||||||
|
|
||||||
motd_ssh
|
|
||||||
customize
|
|
||||||
cleanup_lxc
|
|
||||||
196
install/pixelfed-install.sh
Normal file
196
install/pixelfed-install.sh
Normal file
@ -0,0 +1,196 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Copyright (c) 2021-2025 community-scripts ORG
|
||||||
|
# Author: MickLesk (CanbiZ)
|
||||||
|
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
|
||||||
|
# Source: https://pixelfed.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 \
|
||||||
|
nginx \
|
||||||
|
redis-server \
|
||||||
|
ffmpeg \
|
||||||
|
jpegoptim \
|
||||||
|
optipng \
|
||||||
|
pngquant \
|
||||||
|
gifsicle
|
||||||
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
|
msg_info "Creating Pixelfed User"
|
||||||
|
useradd -rU -s /bin/bash pixelfed
|
||||||
|
usermod -aG redis pixelfed
|
||||||
|
msg_ok "Created Pixelfed User"
|
||||||
|
|
||||||
|
import_local_ip
|
||||||
|
PG_VERSION="17" setup_postgresql
|
||||||
|
PG_DB_NAME="pixelfed" PG_DB_USER="pixelfed" setup_postgresql_db
|
||||||
|
PHP_VERSION="8.4" PHP_FPM="YES" PHP_MODULE="bcmath,ctype,exif,imagick,pgsql,redis,tokenizer" PHP_UPLOAD_MAX_FILESIZE="500M" PHP_POST_MAX_SIZE="500M" PHP_MAX_EXECUTION_TIME="600" setup_php
|
||||||
|
setup_composer
|
||||||
|
|
||||||
|
msg_info "Configuring Redis Socket"
|
||||||
|
REDIS_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
|
||||||
|
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-server
|
||||||
|
msg_ok "Redis Socket configured"
|
||||||
|
|
||||||
|
msg_info "Configuring PHP-FPM Pool"
|
||||||
|
mkdir -p /run/php-fpm
|
||||||
|
cp /etc/php/8.4/fpm/pool.d/www.conf /etc/php/8.4/fpm/pool.d/pixelfed.conf
|
||||||
|
sed -i 's/\[www\]/[pixelfed]/' /etc/php/8.4/fpm/pool.d/pixelfed.conf
|
||||||
|
sed -i 's/^user = www-data/user = pixelfed/' /etc/php/8.4/fpm/pool.d/pixelfed.conf
|
||||||
|
sed -i 's/^group = www-data/group = pixelfed/' /etc/php/8.4/fpm/pool.d/pixelfed.conf
|
||||||
|
sed -i 's|^listen = .*|listen = /run/php-fpm/pixelfed.sock|' /etc/php/8.4/fpm/pool.d/pixelfed.conf
|
||||||
|
sed -i 's/^listen.owner = .*/listen.owner = pixelfed/' /etc/php/8.4/fpm/pool.d/pixelfed.conf
|
||||||
|
sed -i 's/^listen.group = .*/listen.group = www-data/' /etc/php/8.4/fpm/pool.d/pixelfed.conf
|
||||||
|
systemctl restart php8.4-fpm
|
||||||
|
msg_ok "PHP-FPM Pool configured"
|
||||||
|
|
||||||
|
fetch_and_deploy_gh_release "pixelfed" "pixelfed/pixelfed" "tarball" "latest" "/opt/pixelfed"
|
||||||
|
|
||||||
|
msg_info "Installing Pixelfed (Patience)"
|
||||||
|
cd /opt/pixelfed
|
||||||
|
cp .env.example .env
|
||||||
|
sed -i "s|APP_URL=.*|APP_URL=http://${LOCAL_IP}|" .env
|
||||||
|
sed -i "s|APP_DOMAIN=.*|APP_DOMAIN=${LOCAL_IP}|" .env
|
||||||
|
sed -i "s|ADMIN_DOMAIN=.*|ADMIN_DOMAIN=${LOCAL_IP}|" .env
|
||||||
|
sed -i "s|SESSION_DOMAIN=.*|SESSION_DOMAIN=${LOCAL_IP}|" .env
|
||||||
|
sed -i "s|DB_CONNECTION=.*|DB_CONNECTION=pgsql|" .env
|
||||||
|
sed -i "s|DB_HOST=.*|DB_HOST=127.0.0.1|" .env
|
||||||
|
sed -i "s|DB_PORT=.*|DB_PORT=5432|" .env
|
||||||
|
sed -i "s|DB_DATABASE=.*|DB_DATABASE=${PG_DB_NAME}|" .env
|
||||||
|
sed -i "s|DB_USERNAME=.*|DB_USERNAME=${PG_DB_USER}|" .env
|
||||||
|
sed -i "s|DB_PASSWORD=.*|DB_PASSWORD=${PG_DB_PASS}|" .env
|
||||||
|
sed -i "s|REDIS_SCHEME=.*|REDIS_SCHEME=unix|" .env
|
||||||
|
sed -i "s|REDIS_HOST=.*|REDIS_HOST=/run/redis/redis.sock|" .env
|
||||||
|
sed -i "s|REDIS_PORT=.*|REDIS_PORT=0|" .env
|
||||||
|
sed -i "s|REDIS_PASSWORD=.*|REDIS_PASSWORD=${REDIS_PASS}|" .env
|
||||||
|
sed -i "s|ACTIVITY_PUB=.*|ACTIVITY_PUB=true|" .env
|
||||||
|
sed -i "s|AP_REMOTE_FOLLOW=.*|AP_REMOTE_FOLLOW=true|" .env
|
||||||
|
sed -i "s|OAUTH_ENABLED=.*|OAUTH_ENABLED=true|" .env
|
||||||
|
|
||||||
|
chown -R pixelfed:pixelfed /opt/pixelfed
|
||||||
|
chmod -R 755 /opt/pixelfed
|
||||||
|
chmod -R 775 /opt/pixelfed/storage /opt/pixelfed/bootstrap/cache
|
||||||
|
|
||||||
|
export COMPOSER_ALLOW_SUPERUSER=1
|
||||||
|
cd /opt/pixelfed
|
||||||
|
$STD composer install --no-dev --no-ansi --no-interaction --optimize-autoloader
|
||||||
|
|
||||||
|
sudo -u pixelfed php artisan key:generate
|
||||||
|
sudo -u pixelfed php artisan storage:link
|
||||||
|
$STD sudo -u pixelfed php artisan migrate --force
|
||||||
|
$STD sudo -u pixelfed php artisan import:cities
|
||||||
|
$STD sudo -u pixelfed php artisan instance:actor
|
||||||
|
$STD sudo -u pixelfed php artisan passport:keys
|
||||||
|
$STD sudo -u pixelfed php artisan route:cache
|
||||||
|
$STD sudo -u pixelfed php artisan view:cache
|
||||||
|
$STD sudo -u pixelfed php artisan config:cache
|
||||||
|
$STD sudo -u pixelfed php artisan horizon:install
|
||||||
|
$STD sudo -u pixelfed php artisan horizon:publish
|
||||||
|
msg_ok "Pixelfed installed"
|
||||||
|
|
||||||
|
msg_info "Configuring Nginx"
|
||||||
|
cat <<'EOF' >/etc/nginx/sites-available/pixelfed
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name _;
|
||||||
|
root /opt/pixelfed/public;
|
||||||
|
index index.php;
|
||||||
|
|
||||||
|
charset utf-8;
|
||||||
|
client_max_body_size 100M;
|
||||||
|
|
||||||
|
add_header X-Frame-Options "SAMEORIGIN";
|
||||||
|
add_header X-XSS-Protection "1; mode=block";
|
||||||
|
add_header X-Content-Type-Options "nosniff";
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.php?$query_string;
|
||||||
|
}
|
||||||
|
|
||||||
|
location = /favicon.ico { access_log off; log_not_found off; }
|
||||||
|
location = /robots.txt { access_log off; log_not_found off; }
|
||||||
|
|
||||||
|
error_page 404 /index.php;
|
||||||
|
|
||||||
|
location ~ \.php$ {
|
||||||
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||||
|
fastcgi_pass unix:/run/php-fpm/pixelfed.sock;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
include fastcgi_params;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ /\.(?!well-known).* {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
ln -sf /etc/nginx/sites-available/pixelfed /etc/nginx/sites-enabled/pixelfed
|
||||||
|
rm -f /etc/nginx/sites-enabled/default
|
||||||
|
$STD nginx -t
|
||||||
|
systemctl enable -q --now nginx
|
||||||
|
msg_ok "Nginx configured"
|
||||||
|
|
||||||
|
msg_info "Creating Services"
|
||||||
|
cat <<'EOF' >/etc/systemd/system/pixelfed-horizon.service
|
||||||
|
[Unit]
|
||||||
|
Description=Pixelfed Horizon Queue Worker
|
||||||
|
After=network.target redis-server.service postgresql.service
|
||||||
|
Requires=redis-server.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
User=pixelfed
|
||||||
|
WorkingDirectory=/opt/pixelfed
|
||||||
|
ExecStart=/usr/bin/php /opt/pixelfed/artisan horizon
|
||||||
|
Restart=always
|
||||||
|
RestartSec=5
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat <<'EOF' >/etc/systemd/system/pixelfed-scheduler.service
|
||||||
|
[Unit]
|
||||||
|
Description=Pixelfed Task Scheduler
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
User=pixelfed
|
||||||
|
WorkingDirectory=/opt/pixelfed
|
||||||
|
ExecStart=/usr/bin/php /opt/pixelfed/artisan schedule:run
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat <<'EOF' >/etc/systemd/system/pixelfed-scheduler.timer
|
||||||
|
[Unit]
|
||||||
|
Description=Run Pixelfed Scheduler every minute
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
OnCalendar=*-*-* *:*:00
|
||||||
|
Persistent=true
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
||||||
|
EOF
|
||||||
|
|
||||||
|
systemctl daemon-reload
|
||||||
|
systemctl enable -q --now pixelfed-horizon
|
||||||
|
systemctl enable -q --now pixelfed-scheduler.timer
|
||||||
|
msg_ok "Services created"
|
||||||
|
|
||||||
|
motd_ssh
|
||||||
|
customize
|
||||||
|
cleanup_lxc
|
||||||
Loading…
x
Reference in New Issue
Block a user