Add Maxun container install and metadata scripts
Introduces scripts for installing and managing the Maxun web scraping platform in a containerized environment, including ct/maxun.sh for container setup, install/maxun-install.sh for full installation and service configuration, and frontend/public/json/maxun.json for application metadata and integration.
This commit is contained in:
parent
5422640848
commit
4e0efe4242
82
ct/maxun.sh
Normal file
82
ct/maxun.sh
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
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/ProxmoxVED/raw/main/LICENSE
|
||||||
|
# Source: https://github.com/getmaxun/maxun
|
||||||
|
|
||||||
|
APP="Maxun"
|
||||||
|
var_tags="${var_tags:-automation;scraper}"
|
||||||
|
var_cpu="${var_cpu:-2}"
|
||||||
|
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}"
|
||||||
|
|
||||||
|
header_info "$APP"
|
||||||
|
variables
|
||||||
|
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
|
||||||
|
|
||||||
|
if check_for_gh_release "maxun" "getmaxun/maxun"; then
|
||||||
|
msg_info "Stopping Services"
|
||||||
|
systemctl stop maxun
|
||||||
|
msg_ok "Services stopped"
|
||||||
|
|
||||||
|
msg_info "Backing up Configuration"
|
||||||
|
cp /opt/maxun/.env /tmp/maxun.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/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
|
||||||
|
|
||||||
|
cp -r /opt/maxun/dist/* /var/www/maxun/
|
||||||
|
echo "${RELEASE}" >/opt/maxun_version.txt
|
||||||
|
msg_ok "Updated ${APP}"
|
||||||
|
|
||||||
|
msg_info "Starting Services"
|
||||||
|
systemctl start maxun
|
||||||
|
msg_ok "Services started"
|
||||||
|
|
||||||
|
msg_ok "Updated Successfully"
|
||||||
|
else
|
||||||
|
msg_ok "No update required. ${APP} is already at the latest version."
|
||||||
|
fi
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
start
|
||||||
|
build_container
|
||||||
|
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}${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"
|
||||||
52
frontend/public/json/maxun.json
Normal file
52
frontend/public/json/maxun.json
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
{
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
203
install/maxun-install.sh
Normal file
203
install/maxun-install.sh
Normal file
@ -0,0 +1,203 @@
|
|||||||
|
#!/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 /usr/local/bin /opt/minio_data
|
||||||
|
curl -fsSL "https://dl.min.io/server/minio/release/linux-amd64/minio" -o /usr/local/bin/minio
|
||||||
|
chmod +x /usr/local/bin/minio
|
||||||
|
|
||||||
|
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/local/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 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
|
||||||
Loading…
x
Reference in New Issue
Block a user