minor fixes overall
This commit is contained in:
32
ct/blinko.sh
32
ct/blinko.sh
@@ -8,7 +8,7 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV
|
||||
APP="Blinko"
|
||||
var_tags="${var_tags:-notes;ai;knowledge}"
|
||||
var_cpu="${var_cpu:-2}"
|
||||
var_ram="${var_ram:-2048}"
|
||||
var_ram="${var_ram:-4096}"
|
||||
var_disk="${var_disk:-8}"
|
||||
var_os="${var_os:-debian}"
|
||||
var_version="${var_version:-13}"
|
||||
@@ -47,15 +47,35 @@ function update_script() {
|
||||
|
||||
msg_info "Updating Application"
|
||||
cd /opt/blinko
|
||||
$STD bun install --unsafe-perm
|
||||
$STD bun install
|
||||
$STD bun run build:web
|
||||
$STD bun run build:seed
|
||||
mkdir -p /opt/blinko/server/public
|
||||
cp -r /opt/blinko/dist/public/. /opt/blinko/server/public/ 2>/dev/null || true
|
||||
$STD bunx prisma migrate deploy
|
||||
$STD bun /opt/blinko/dist/seed.js
|
||||
$STD bun run prisma:generate
|
||||
$STD bun run prisma:migrate:deploy
|
||||
$STD bun run seed
|
||||
msg_ok "Updated Application"
|
||||
|
||||
msg_info "Updating Service"
|
||||
cat <<EOF >/etc/systemd/system/blinko.service
|
||||
[Unit]
|
||||
Description=Blinko Note-Taking App
|
||||
After=network.target postgresql.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
WorkingDirectory=/opt/blinko
|
||||
ExecStartPre=/bin/bash -c "mkdir -p /opt/blinko/server/public && cp -r /opt/blinko/dist/public/. /opt/blinko/server/public/"
|
||||
ExecStart=/usr/local/bin/bun --env-file /opt/blinko/.env /opt/blinko/dist/index.js
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl daemon-reload
|
||||
msg_ok "Updated Service"
|
||||
|
||||
msg_info "Starting Service"
|
||||
systemctl start blinko
|
||||
msg_ok "Started Service"
|
||||
|
||||
44
ct/matomo.sh
44
ct/matomo.sh
@@ -19,6 +19,18 @@ variables
|
||||
color
|
||||
catch_errors
|
||||
|
||||
function flatten_matomo_layout() {
|
||||
if [[ -d /opt/matomo/matomo ]]; then
|
||||
msg_info "Migrating Legacy Layout"
|
||||
rm -rf /opt/matomo/tmp "/opt/matomo/How to install Matomo.html"
|
||||
find /opt/matomo/matomo -mindepth 1 -maxdepth 1 -exec mv -t /opt/matomo {} +
|
||||
rm -rf /opt/matomo/matomo
|
||||
msg_ok "Migrated Legacy Layout"
|
||||
fi
|
||||
|
||||
rm -rf /opt/matomo/node_modules /opt/matomo/tests
|
||||
}
|
||||
|
||||
function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
@@ -34,19 +46,43 @@ function update_script() {
|
||||
systemctl stop caddy
|
||||
msg_ok "Stopped Services"
|
||||
|
||||
flatten_matomo_layout
|
||||
|
||||
msg_info "Backing up Data"
|
||||
cp /opt/matomo/config/config.ini.php /opt/matomo_config.bak
|
||||
cp -r /opt/matomo/misc/user /opt/matomo_user_backup 2>/dev/null
|
||||
[[ -f /opt/matomo/config/config.ini.php ]] && cp /opt/matomo/config/config.ini.php /opt/matomo_config.bak
|
||||
[[ -d /opt/matomo/misc/user ]] && cp -r /opt/matomo/misc/user /opt/matomo_user_backup
|
||||
if [[ -f /opt/matomo/.mariadb-creds ]]; then
|
||||
cp /opt/matomo/.mariadb-creds /opt/matomo_db_creds.bak
|
||||
elif [[ -f /root/matomo.creds ]]; then
|
||||
cp /root/matomo.creds /opt/matomo_db_creds.bak
|
||||
fi
|
||||
msg_ok "Backed up Data"
|
||||
|
||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "matomo" "matomo-org/matomo" "prebuild" "latest" "/opt/matomo" "matomo-*.zip"
|
||||
|
||||
flatten_matomo_layout
|
||||
|
||||
msg_info "Restoring Data"
|
||||
cp /opt/matomo_config.bak /opt/matomo/config/config.ini.php
|
||||
cp -r /opt/matomo_user_backup/. /opt/matomo/misc/user 2>/dev/null
|
||||
if [[ -f /opt/matomo_config.bak ]]; then
|
||||
mkdir -p /opt/matomo/config
|
||||
cp /opt/matomo_config.bak /opt/matomo/config/config.ini.php
|
||||
fi
|
||||
if [[ -d /opt/matomo_user_backup ]]; then
|
||||
mkdir -p /opt/matomo/misc/user
|
||||
cp -r /opt/matomo_user_backup/. /opt/matomo/misc/user
|
||||
fi
|
||||
if [[ -f /opt/matomo_db_creds.bak ]]; then
|
||||
cp /opt/matomo_db_creds.bak /opt/matomo/.mariadb-creds
|
||||
fi
|
||||
rm -f /opt/matomo_config.bak
|
||||
rm -f /opt/matomo_db_creds.bak
|
||||
rm -rf /opt/matomo_user_backup
|
||||
chown -R www-data:www-data /opt/matomo
|
||||
if [[ -f /opt/matomo/.mariadb-creds ]]; then
|
||||
chown root:root /opt/matomo/.mariadb-creds
|
||||
chmod 600 /opt/matomo/.mariadb-creds
|
||||
fi
|
||||
rm -f /root/matomo.creds
|
||||
msg_ok "Restored Data"
|
||||
|
||||
msg_info "Starting Services"
|
||||
|
||||
@@ -36,13 +36,12 @@ NEXTAUTH_URL=http://${LOCAL_IP}:1111
|
||||
NEXTAUTH_SECRET=$(openssl rand -base64 32)
|
||||
NEXT_PUBLIC_BASE_URL=http://${LOCAL_IP}:1111
|
||||
EOF
|
||||
$STD bun install --unsafe-perm
|
||||
$STD bun install
|
||||
$STD bun run build:web
|
||||
$STD bun run build:seed
|
||||
mkdir -p /opt/blinko/server/public
|
||||
cp -r /opt/blinko/dist/public/. /opt/blinko/server/public/ 2>/dev/null || true
|
||||
$STD bunx prisma migrate deploy
|
||||
$STD bun /opt/blinko/dist/seed.js
|
||||
$STD bun run prisma:generate
|
||||
$STD bun run prisma:migrate:deploy
|
||||
$STD bun run seed
|
||||
msg_ok "Set up Blinko"
|
||||
|
||||
msg_info "Creating Service"
|
||||
@@ -54,7 +53,8 @@ After=network.target postgresql.service
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
WorkingDirectory=/opt/blinko/server
|
||||
WorkingDirectory=/opt/blinko
|
||||
ExecStartPre=/bin/bash -c "mkdir -p /opt/blinko/server/public && cp -r /opt/blinko/dist/public/. /opt/blinko/server/public/"
|
||||
ExecStart=/usr/local/bin/bun --env-file /opt/blinko/.env /opt/blinko/dist/index.js
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
@@ -204,8 +204,8 @@ EOF
|
||||
|
||||
msg_info "Enabling Corepack"
|
||||
$STD corepack enable
|
||||
$STD corepack prepare yarn@stable --activate
|
||||
cd /opt/clickstack
|
||||
$STD corepack prepare --activate
|
||||
msg_ok "Enabled Corepack"
|
||||
|
||||
msg_info "Building HyperDX"
|
||||
|
||||
@@ -104,8 +104,8 @@ RestartSec=5
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q --now minio
|
||||
sleep 3
|
||||
$STD mc alias set local http://localhost:3200 minioadmin "${MINIO_PASS}"
|
||||
sleep 5
|
||||
$STD mc alias set local http://127.0.0.1:3200 minioadmin "${MINIO_PASS}"
|
||||
$STD mc mb --ignore-existing local/b2-eu-cen
|
||||
$STD mc mb --ignore-existing local/wasabi-eu-central-2-v3
|
||||
$STD mc mb --ignore-existing local/scw-eu-fr-v3
|
||||
@@ -479,4 +479,4 @@ msg_ok "Created helper scripts"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
cleanup_lxc
|
||||
cleanup_lxc
|
||||
|
||||
@@ -47,7 +47,6 @@ sed -i "s|^DB_USERNAME=.*|DB_USERNAME=${PG_DB_USER}|" .env
|
||||
sed -i "s|^DB_PASSWORD=.*|DB_PASSWORD=${PG_DB_PASS}|" .env
|
||||
mkdir -p storage/framework/{cache,sessions,views} storage/logs bootstrap/cache public/dist public/uploads public/sym
|
||||
touch public/dist/user.css public/dist/custom.js
|
||||
chown -R www-data:www-data /opt/lychee
|
||||
chmod -R 775 storage bootstrap/cache public/dist public/uploads public/sym
|
||||
msg_ok "Configured Application"
|
||||
|
||||
@@ -56,6 +55,8 @@ cd /opt/lychee
|
||||
$STD php artisan migrate --force
|
||||
msg_ok "Ran Database Migrations"
|
||||
|
||||
chown -R www-data:www-data /opt/lychee
|
||||
|
||||
msg_info "Configuring Caddy"
|
||||
PHP_VER=$(php -r 'echo PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION;')
|
||||
cat <<EOF >/etc/caddy/Caddyfile
|
||||
|
||||
@@ -17,16 +17,35 @@ msg_info "Installing Dependencies"
|
||||
$STD apt install -y caddy
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
mkdir -p /opt/matomo
|
||||
|
||||
PHP_VERSION="8.3" PHP_FPM="YES" PHP_MODULES="pdo_mysql,gd,mbstring,xml,curl,intl,zip,ldap" setup_php
|
||||
setup_mariadb
|
||||
MARIADB_DB_NAME="matomo" MARIADB_DB_USER="matomo" setup_mariadb_db
|
||||
MARIADB_DB_CREDS_FILE="/opt/matomo/.mariadb-creds" MARIADB_DB_NAME="matomo" MARIADB_DB_USER="matomo" setup_mariadb_db
|
||||
|
||||
msg_info "Allowing Local TCP Database Access"
|
||||
$STD mariadb -u root -e "CREATE USER IF NOT EXISTS '$MARIADB_DB_USER'@'127.0.0.1' IDENTIFIED BY '$MARIADB_DB_PASS';"
|
||||
$STD mariadb -u root -e "ALTER USER '$MARIADB_DB_USER'@'127.0.0.1' IDENTIFIED BY '$MARIADB_DB_PASS';"
|
||||
$STD mariadb -u root -e "GRANT ALL ON \`$MARIADB_DB_NAME\`.* TO '$MARIADB_DB_USER'@'127.0.0.1';"
|
||||
$STD mariadb -u root -e "FLUSH PRIVILEGES;"
|
||||
msg_ok "Allowed Local TCP Database Access"
|
||||
|
||||
fetch_and_deploy_gh_release "matomo" "matomo-org/matomo" "prebuild" "latest" "/opt/matomo" "matomo-*.zip"
|
||||
|
||||
msg_info "Setting up Matomo"
|
||||
if [[ -d /opt/matomo/matomo ]]; then
|
||||
rm -rf /opt/matomo/tmp "/opt/matomo/How to install Matomo.html"
|
||||
find /opt/matomo/matomo -mindepth 1 -maxdepth 1 -exec mv -t /opt/matomo {} +
|
||||
rm -rf /opt/matomo/matomo
|
||||
fi
|
||||
rm -rf /opt/matomo/node_modules /opt/matomo/tests
|
||||
mkdir -p /opt/matomo/tmp
|
||||
chown -R www-data:www-data /opt/matomo
|
||||
chmod -R 755 /opt/matomo/tmp
|
||||
if [[ -f /opt/matomo/.mariadb-creds ]]; then
|
||||
chown root:root /opt/matomo/.mariadb-creds
|
||||
chmod 600 /opt/matomo/.mariadb-creds
|
||||
fi
|
||||
msg_ok "Set up Matomo"
|
||||
|
||||
msg_info "Configuring Caddy"
|
||||
@@ -34,6 +53,8 @@ PHP_VER=$(php -r 'echo PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION;')
|
||||
cat <<EOF >/etc/caddy/Caddyfile
|
||||
:80 {
|
||||
root * /opt/matomo
|
||||
@blocked path /config /config/* /tmp /tmp/*
|
||||
respond @blocked 403
|
||||
php_fastcgi unix//run/php/php${PHP_VER}-fpm.sock
|
||||
file_server
|
||||
encode gzip
|
||||
|
||||
@@ -32,6 +32,7 @@ $STD apt install -y \
|
||||
fonts-noto-color-emoji \
|
||||
fonts-wqy-zenhei
|
||||
msg_ok "Installed Dependencies"
|
||||
systemctl disable -q --now supervisor
|
||||
|
||||
msg_info "Installing Build Dependencies"
|
||||
$STD apt install -y \
|
||||
|
||||
Reference in New Issue
Block a user