Compare commits

..
Author SHA1 Message Date
push-app-to-main[bot] 22a1b71683 Add 8mblocal (ct) 2026-11-23 07:46:24 +00:00
4 changed files with 186 additions and 153 deletions

No files matched your search

+75
View File
@@ -0,0 +1,75 @@
#!/usr/bin/env bash
_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func"
source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func")
# Copyright (c) 2021-2026 community-scripts ORG
# Author: MickLesk (CanbiZ)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/JMS1717/8mb.local
APP="8mbLocal"
var_tags="${var_tags:-media;video;compression}"
var_cpu="${var_cpu:-2}"
var_ram="${var_ram:-2048}"
var_disk="${var_disk:-10}"
var_os="${var_os:-debian}"
var_version="${var_version:-13}"
var_arm64="${var_arm64:-no}" # psutil 5.9.8 (pinned upstream) has no aarch64 wheel and would need a compiler
var_unprivileged="${var_unprivileged:-1}"
var_gpu="${var_gpu:-yes}"
header_info "$APP"
variables
color
catch_errors
function update_script() {
header_info
check_container_storage
check_container_resources
if [[ ! -d /opt/8mblocal ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
if check_for_gh_release "8mblocal" "JMS1717/8mb.local"; then
msg_info "Stopping 8mb.local"
systemctl stop 8mblocal 8mblocal-worker
msg_ok "Stopped 8mb.local"
NODE_VERSION="22" setup_nodejs
PYTHON_VERSION="3.12" setup_uv
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "8mblocal" "JMS1717/8mb.local" "tarball"
msg_info "Building 8mb.local"
mv /opt/8mblocal /opt/8mblocal-build
cd /opt/8mblocal-build/frontend
$STD npm ci
$STD npm run build
mkdir -p /opt/8mblocal
mv /opt/8mblocal-build/backend-api/app /opt/8mblocal/backend
mv /opt/8mblocal-build/worker/app /opt/8mblocal/worker
mv /opt/8mblocal-build/shared /opt/8mblocal-build/requirements.txt /opt/8mblocal/
mv /opt/8mblocal-build/frontend/build /opt/8mblocal/frontend-build
rm -rf /opt/8mblocal-build
cd /opt/8mblocal
$STD uv venv --python 3.12 .venv
$STD uv pip install --python .venv/bin/python -r requirements.txt packaging
msg_ok "Built 8mb.local"
msg_info "Starting 8mb.local"
systemctl start 8mblocal-worker 8mblocal
msg_ok "Started 8mb.local"
msg_ok "Updated successfully!"
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 "${GATEWAY}${BGN}http://${IP}:8001${CL}"
-70
View File
@@ -1,70 +0,0 @@
#!/usr/bin/env bash
_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func"
source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func")
# Copyright (c) 2021-2026 community-scripts ORG
# Author: MickLesk (CanbiZ)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/typecho/typecho
APP="Typecho"
var_tags="${var_tags:-blog;cms}"
var_cpu="${var_cpu:-1}"
var_ram="${var_ram:-512}"
var_disk="${var_disk:-4}"
var_os="${var_os:-debian}"
var_version="${var_version:-13}"
var_arm64="${var_arm64:-yes}"
var_unprivileged="${var_unprivileged:-1}"
export var_admin_user="${var_admin_user:-admin}"
export var_admin_pass="${var_admin_pass:-$(random_password)}"
header_info "$APP"
variables
color
catch_errors
function update_script() {
header_info
check_container_storage
check_container_resources
if [[ ! -d /opt/typecho ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
if check_for_gh_release "typecho" "typecho/typecho"; then
msg_info "Stopping Typecho"
systemctl stop nginx
msg_ok "Stopped Typecho"
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "typecho" "typecho/typecho" "prebuild" "latest" "/opt/typecho" "typecho.zip"
fetch_and_deploy_from_url "https://github.com/typecho/languages/releases/download/ci/langs.zip" "/opt/typecho_data/usr/langs"
msg_info "Linking Typecho Data"
rm -rf /opt/typecho/usr /opt/typecho/install.php
ln -s /opt/typecho_data/usr /opt/typecho/usr
ln -s /opt/typecho_data/config.inc.php /opt/typecho/config.inc.php
msg_ok "Linked Typecho Data"
msg_info "Starting Typecho"
systemctl start nginx
msg_ok "Started Typecho"
msg_ok "Updated successfully!"
echo -e "${INFO}${YW}Open http://${LOCAL_IP}/admin/ and confirm the database upgrade if Typecho asks for one${CL}"
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 "${GATEWAY}${BGN}http://${IP}${CL}"
echo -e "${INFO}${YW}Admin panel: http://${IP}/admin/${CL}"
echo -e "${INFO}${YW}Admin Username: ${var_admin_user}${CL}"
echo -e "${INFO}${YW}Admin Password: ${var_admin_pass}${CL}"
+111
View File
@@ -0,0 +1,111 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2026 community-scripts ORG
# Author: MickLesk (CanbiZ)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/JMS1717/8mb.local
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
setup_hwaccel
msg_info "Installing Dependencies"
$STD apt install -y redis-server
msg_ok "Installed Dependencies"
setup_ffmpeg
NODE_VERSION="22" setup_nodejs
PYTHON_VERSION="3.12" setup_uv
fetch_and_deploy_gh_release "8mblocal" "JMS1717/8mb.local" "tarball"
msg_info "Building 8mb.local"
mv /opt/8mblocal /opt/8mblocal-build
cd /opt/8mblocal-build/frontend
$STD npm ci
$STD npm run build
# Same layout as the official image: the worker imports backend.history_manager and Celery includes worker.worker
mkdir -p /opt/8mblocal
mv /opt/8mblocal-build/backend-api/app /opt/8mblocal/backend
mv /opt/8mblocal-build/worker/app /opt/8mblocal/worker
mv /opt/8mblocal-build/shared /opt/8mblocal-build/requirements.txt /opt/8mblocal/
mv /opt/8mblocal-build/frontend/build /opt/8mblocal/frontend-build
rm -rf /opt/8mblocal-build
cd /opt/8mblocal
$STD uv venv --python 3.12 .venv
$STD uv pip install --python .venv/bin/python -r requirements.txt packaging
msg_ok "Built 8mb.local"
msg_info "Configuring 8mb.local"
mkdir -p /opt/8mblocal_data/{uploads/.tmp,outputs,state}
cat <<EOF >/opt/8mblocal_data/.env
AUTH_ENABLED=true
AUTH_USER=admin
AUTH_PASS=$(random_password)
FILE_RETENTION_HOURS=1
MEDIA_STORAGE=disk
WORKER_CONCURRENCY=auto
HISTORY_ENABLED=true
REDIS_URL=redis://127.0.0.1:6379/0
APP_DATA_DIR=/opt/8mblocal_data
ENV_FILE=/opt/8mblocal_data/.env
SETTINGS_FILE=/opt/8mblocal_data/state/settings.json
HISTORY_FILE=/opt/8mblocal_data/state/history.json
TMPDIR=/opt/8mblocal_data/uploads/.tmp
FRONTEND_BUILD_DIR=/opt/8mblocal/frontend-build
BACKEND_APP_ROOT=/opt/8mblocal
EOF
chmod 600 /opt/8mblocal_data/.env
msg_ok "Configured 8mb.local"
msg_info "Creating Services"
cat <<EOF >/etc/systemd/system/8mblocal-worker.service
[Unit]
Description=8mb.local Worker
After=network.target redis-server.service
Requires=redis-server.service
[Service]
Type=simple
User=root
WorkingDirectory=/opt/8mblocal
EnvironmentFile=/opt/8mblocal_data/.env
Environment=PYTHONPATH=/opt/8mblocal
ExecStart=/opt/8mblocal/.venv/bin/celery -A worker.celery_app worker --loglevel=info
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
EOF
cat <<EOF >/etc/systemd/system/8mblocal.service
[Unit]
Description=8mb.local
After=network.target redis-server.service 8mblocal-worker.service
Requires=redis-server.service
Wants=8mblocal-worker.service
[Service]
Type=simple
User=root
WorkingDirectory=/opt/8mblocal
EnvironmentFile=/opt/8mblocal_data/.env
Environment=PYTHONPATH=/opt/8mblocal
ExecStart=/opt/8mblocal/.venv/bin/uvicorn backend.main:app --host 0.0.0.0 --port 8001
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now 8mblocal-worker 8mblocal
msg_ok "Created Services"
motd_ssh
customize
cleanup_lxc
-83
View File
@@ -1,83 +0,0 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2026 community-scripts ORG
# Author: MickLesk (CanbiZ)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/typecho/typecho
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 \
nginx \
sqlite3
msg_ok "Installed Dependencies"
PHP_FPM="YES" setup_php
fetch_and_deploy_gh_release "typecho" "typecho/typecho" "prebuild" "latest" "/opt/typecho" "typecho.zip"
fetch_and_deploy_from_url "https://github.com/typecho/languages/releases/download/ci/langs.zip" "/opt/typecho/usr/langs"
var_admin_user="${var_admin_user:-admin}"
var_admin_pass="${var_admin_pass:-$(random_password 16)}"
msg_info "Installing Typecho"
mkdir -p /opt/typecho_data
mv /opt/typecho/usr /opt/typecho_data/usr
ln -s /opt/typecho_data/usr /opt/typecho/usr
cd /opt/typecho
TYPECHO_SITE_URL="http://${LOCAL_IP}" \
TYPECHO_LANG="en_US" \
TYPECHO_DB_ADAPTER="Pdo_SQLite" \
TYPECHO_DB_FILE="/opt/typecho_data/typecho.db" \
TYPECHO_USER_NAME="${var_admin_user}" \
TYPECHO_USER_PASSWORD="${var_admin_pass}" \
$STD php install.php
# PHP resolves symlinks in __FILE__, so a linked config has to name the root itself
sed -i "s|dirname(__FILE__)|'/opt/typecho'|" config.inc.php
mv config.inc.php /opt/typecho_data/config.inc.php
ln -s /opt/typecho_data/config.inc.php /opt/typecho/config.inc.php
rm -f install.php
# upstream defaults to UTC+8 and index.php URLs; the vhost below handles rewritten ones
sqlite3 /opt/typecho_data/typecho.db "UPDATE typecho_options SET value = '1' WHERE name = 'rewrite'; UPDATE typecho_options SET value = '0' WHERE name = 'timezone';"
chown -R www-data:www-data /opt/typecho_data
cat <<EOF >~/typecho.creds
Typecho Admin
URL: http://${LOCAL_IP}/admin/
Username: ${var_admin_user}
Password: ${var_admin_pass}
EOF
chmod 600 ~/typecho.creds
msg_ok "Installed Typecho"
msg_info "Configuring Nginx"
PHP_SOCK=$(get_php_fpm_socket)
cat <<EOF >/etc/nginx/sites-available/typecho
server {
listen 80 default_server;
server_name _;
root /opt/typecho;
index index.php;
client_max_body_size 128M;
location / {
try_files \$uri \$uri/ /index.php\$is_args\$args;
}
location ~ [^/]\.php(/|\$) {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:${PHP_SOCK};
}
}
EOF
nginx_enable_site "typecho"
msg_ok "Configured Nginx"
motd_ssh
customize
cleanup_lxc