From c2cc4556299b8078de6e3d87c39f3c824e361118 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Wed, 10 Dec 2025 09:09:05 +0100 Subject: [PATCH] cleanup --- ct/deferred/maxun.sh | 72 +++------ ct/{maxun.sh => pixelfed.sh} | 54 +++---- frontend/public/json/maxun.json | 52 ------ frontend/public/json/pixelfed.json | 52 ++++++ install/deferred/maxun-install.sh | 248 ++++++++++++----------------- install/maxun-install.sh | 206 ------------------------ install/pixelfed-install.sh | 196 +++++++++++++++++++++++ 7 files changed, 404 insertions(+), 476 deletions(-) rename ct/{maxun.sh => pixelfed.sh} (50%) delete mode 100644 frontend/public/json/maxun.json create mode 100644 frontend/public/json/pixelfed.json delete mode 100644 install/maxun-install.sh create mode 100644 install/pixelfed-install.sh diff --git a/ct/deferred/maxun.sh b/ct/deferred/maxun.sh index a5561dc56..ab303b763 100644 --- a/ct/deferred/maxun.sh +++ b/ct/deferred/maxun.sh @@ -1,15 +1,15 @@ #!/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 -# Author: MickLesk (Canbiz) -# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Author: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE # Source: https://github.com/getmaxun/maxun APP="Maxun" -var_tags="${var_tags:-scraper}" -var_disk="${var_disk:-7}" +var_tags="${var_tags:-automation;scraper}" 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_version="${var_version:-12}" var_unprivileged="${var_unprivileged:-1}" @@ -20,47 +20,23 @@ color catch_errors function update_script() { - header_info - check_container_storage - 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" + header_info + check_container_storage + check_container_resources - msg_info "Updating ${APP} to v${RELEASE}" - mv /opt/maxun /opt/maxun_bak - 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 + if [[ ! -d /opt/maxun ]]; then + msg_error "No ${APP} Installation Found!" 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 @@ -70,4 +46,8 @@ description msg_ok "Completed Successfully!\n" echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${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" diff --git a/ct/maxun.sh b/ct/pixelfed.sh similarity index 50% rename from ct/maxun.sh rename to ct/pixelfed.sh index 3a9803f5c..ef62c0129 100644 --- a/ct/maxun.sh +++ b/ct/pixelfed.sh @@ -3,15 +3,15 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV # 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: https://pixelfed.org/ -APP="Maxun" -var_tags="${var_tags:-automation;scraper}" +APP="Pixelfed" +var_tags="${var_tags:-fediverse;social}" var_cpu="${var_cpu:-2}" -var_ram="${var_ram:-4096}" +var_ram="${var_ram:-2048}" var_disk="${var_disk:-10}" var_os="${var_os:-debian}" -var_version="${var_version:-12}" +var_version="${var_version:-13}" var_unprivileged="${var_unprivileged:-1}" header_info "$APP" @@ -24,41 +24,41 @@ function update_script() { check_container_storage check_container_resources - if [[ ! -d /opt/maxun ]]; then + if [[ ! -d /opt/pixelfed ]]; then msg_error "No ${APP} Installation Found!" exit fi - if check_for_gh_release "maxun" "getmaxun/maxun"; then + if check_for_gh_release "pixelfed" "pixelfed/pixelfed"; then msg_info "Stopping Services" - systemctl stop maxun + systemctl stop pixelfed-horizon pixelfed-scheduler.timer msg_ok "Services stopped" 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_info "Updating ${APP}" - rm -rf /opt/maxun - fetch_and_deploy_gh_release "maxun" "getmaxun/maxun" "source" - cp /tmp/maxun.env.bak /opt/maxun/.env - rm -f /tmp/maxun.env.bak + cd /opt/pixelfed + fetch_and_deploy_gh_release "pixelfed" "pixelfed/pixelfed" "tarball" "latest" "/opt/pixelfed" + cp /tmp/pixelfed.env.bak /opt/pixelfed/.env + rm -f /tmp/pixelfed.env.bak - cd /opt/maxun - $STD npm install --legacy-peer-deps - cd /opt/maxun/maxun-core - $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 + chown -R pixelfed:pixelfed /opt/pixelfed + chmod -R 755 /opt/pixelfed + chmod -R 775 /opt/pixelfed/storage /opt/pixelfed/bootstrap/cache - cp -r /opt/maxun/dist/* /var/www/maxun/ - echo "${RELEASE}" >/opt/maxun_version.txt + export COMPOSER_ALLOW_SUPERUSER=1 + $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_info "Starting Services" - systemctl start maxun + systemctl start pixelfed-horizon pixelfed-scheduler.timer msg_ok "Services started" 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 "${INFO}${YW} Access it using the following URL:${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} Create an admin account with:${CL}" +echo -e "${TAB}cd /opt/pixelfed && sudo -u pixelfed php artisan user:create" echo -e "${INFO}${YW} Credentials saved in:${CL}" -echo -e "${TAB}/root/maxun.creds" +echo -e "${TAB}/root/pixelfed.creds" diff --git a/frontend/public/json/maxun.json b/frontend/public/json/maxun.json deleted file mode 100644 index 8deb4d9b6..000000000 --- a/frontend/public/json/maxun.json +++ /dev/null @@ -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" - } - ] -} diff --git a/frontend/public/json/pixelfed.json b/frontend/public/json/pixelfed.json new file mode 100644 index 000000000..8192468f9 --- /dev/null +++ b/frontend/public/json/pixelfed.json @@ -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" + } + ] +} diff --git a/install/deferred/maxun-install.sh b/install/deferred/maxun-install.sh index 004546bc5..704ff04dd 100644 --- a/install/deferred/maxun-install.sh +++ b/install/deferred/maxun-install.sh @@ -1,8 +1,8 @@ #!/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 +# 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" @@ -15,81 +15,70 @@ update_os msg_info "Installing Dependencies" $STD apt-get install -y \ - 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 + 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="18" setup_nodejs +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 "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) +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}') -SESSION_SECRET=$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | cut -c1-32) -msg_ok "Set up Variables" +msg_ok "Variables configured" -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" - echo "Maxun Session Secret: $SESSION_SECRET" -} >>~/maxun.creds -msg_ok "Set up Database" - -msg_info "Setup MinIO" +msg_info "Setting up MinIO" +mkdir -p /opt/minio_data 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 +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 </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 </etc/systemd/system/minio.service [Unit] -Description=MinIO +Description=MinIO Object Storage Documentation=https://docs.min.io -Wants=network-online.target After=network-online.target +Wants=network-online.target [Service] +Type=simple User=root -EnvironmentFile=-/etc/default/minio -ExecStart=/usr/local/bin/minio server /data +EnvironmentFile=/etc/default/minio +ExecStart=/usr/bin/minio server \$MINIO_VOLUMES \$MINIO_OPTS Restart=always RestartSec=5 LimitNOFILE=65536 @@ -97,82 +86,78 @@ LimitNOFILE=65536 [Install] WantedBy=multi-user.target EOF -{ - echo "__________________" - echo "MinIO Admin User: $MINIO_USER" - echo "MinIO Admin Password: $MINIO_PASS" -} >>~/maxun.creds -cat </etc/default/minio -MINIO_ROOT_USER=${MINIO_USER} -MINIO_ROOT_PASSWORD=${MINIO_PASS} -EOF 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)" +cd /opt/maxun cat </opt/maxun/.env -NODE_ENV=development +NODE_ENV=production JWT_SECRET=${JWT_SECRET} -DB_NAME=${DB_NAME} -DB_USER=${DB_USER} -DB_PASSWORD=${DB_PASS} +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}:5173 +PUBLIC_URL=http://${LOCAL_IP} VITE_BACKEND_URL=http://${LOCAL_IP}:8080 -VITE_PUBLIC_URL=http://${LOCAL_IP}:5173 +VITE_PUBLIC_URL=http://${LOCAL_IP} MAXUN_TELEMETRY=false -SESSION_SECRET=${SESSION_SECRET} 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 +$STD npm install --legacy-peer-deps cd /opt/maxun/maxun-core -$STD npm install +$STD npm install --legacy-peer-deps 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_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/ -msg_info "Setting up nginx with CORS Proxy" cat <<'EOF' >/etc/nginx/sites-available/maxun server { listen 80; server_name _; - # Frontend ausliefern - root /usr/share/nginx/html; + root /var/www/maxun; index index.html; + + # Frontend location / { try_files $uri $uri/ /index.html; } - # Backend Proxy + # 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; @@ -182,67 +167,40 @@ server { 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; - - # 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_read_timeout 60s; + proxy_read_timeout 120s; 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" +$STD nginx -t +systemctl enable -q --now nginx +msg_ok "nginx configured" -msg_info "Creating Services" -cat </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 +msg_info "Creating Service" cat </etc/systemd/system/maxun.service [Unit] -Description=Maxun Service -After=network.target postgresql.service redis.service minio.service maxun-update-env.service +Description=Maxun Web Scraping Service +After=network.target postgresql.service redis-server.service minio.service [Service] +Type=simple +User=root WorkingDirectory=/opt/maxun -ExecStart=/usr/bin/npm run start -Restart=always 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-update-env systemctl enable -q --now maxun -systemctl enable -q --now nginx -msg_ok "Created Service" +msg_ok "Service created" 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" +cleanup_lxc diff --git a/install/maxun-install.sh b/install/maxun-install.sh deleted file mode 100644 index 704ff04dd..000000000 --- a/install/maxun-install.sh +++ /dev/null @@ -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 </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 </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 </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 </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 diff --git a/install/pixelfed-install.sh b/install/pixelfed-install.sh new file mode 100644 index 000000000..416a06180 --- /dev/null +++ b/install/pixelfed-install.sh @@ -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