Compare commits

...
Author SHA1 Message Date
push-app-to-main[bot] 3e5d639a23 Add typecho (ct) 2026-11-23 07:44:08 +00:00
2 changed files with 153 additions and 0 deletions

No files matched your search

+70
View File
@@ -0,0 +1,70 @@
#!/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}"
+83
View File
@@ -0,0 +1,83 @@
#!/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