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"
|
APP="Blinko"
|
||||||
var_tags="${var_tags:-notes;ai;knowledge}"
|
var_tags="${var_tags:-notes;ai;knowledge}"
|
||||||
var_cpu="${var_cpu:-2}"
|
var_cpu="${var_cpu:-2}"
|
||||||
var_ram="${var_ram:-2048}"
|
var_ram="${var_ram:-4096}"
|
||||||
var_disk="${var_disk:-8}"
|
var_disk="${var_disk:-8}"
|
||||||
var_os="${var_os:-debian}"
|
var_os="${var_os:-debian}"
|
||||||
var_version="${var_version:-13}"
|
var_version="${var_version:-13}"
|
||||||
@@ -47,15 +47,35 @@ function update_script() {
|
|||||||
|
|
||||||
msg_info "Updating Application"
|
msg_info "Updating Application"
|
||||||
cd /opt/blinko
|
cd /opt/blinko
|
||||||
$STD bun install --unsafe-perm
|
$STD bun install
|
||||||
$STD bun run build:web
|
$STD bun run build:web
|
||||||
$STD bun run build:seed
|
$STD bun run build:seed
|
||||||
mkdir -p /opt/blinko/server/public
|
$STD bun run prisma:generate
|
||||||
cp -r /opt/blinko/dist/public/. /opt/blinko/server/public/ 2>/dev/null || true
|
$STD bun run prisma:migrate:deploy
|
||||||
$STD bunx prisma migrate deploy
|
$STD bun run seed
|
||||||
$STD bun /opt/blinko/dist/seed.js
|
|
||||||
msg_ok "Updated Application"
|
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"
|
msg_info "Starting Service"
|
||||||
systemctl start blinko
|
systemctl start blinko
|
||||||
msg_ok "Started Service"
|
msg_ok "Started Service"
|
||||||
|
|||||||
42
ct/matomo.sh
42
ct/matomo.sh
@@ -19,6 +19,18 @@ variables
|
|||||||
color
|
color
|
||||||
catch_errors
|
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() {
|
function update_script() {
|
||||||
header_info
|
header_info
|
||||||
check_container_storage
|
check_container_storage
|
||||||
@@ -34,19 +46,43 @@ function update_script() {
|
|||||||
systemctl stop caddy
|
systemctl stop caddy
|
||||||
msg_ok "Stopped Services"
|
msg_ok "Stopped Services"
|
||||||
|
|
||||||
|
flatten_matomo_layout
|
||||||
|
|
||||||
msg_info "Backing up Data"
|
msg_info "Backing up Data"
|
||||||
cp /opt/matomo/config/config.ini.php /opt/matomo_config.bak
|
[[ -f /opt/matomo/config/config.ini.php ]] && cp /opt/matomo/config/config.ini.php /opt/matomo_config.bak
|
||||||
cp -r /opt/matomo/misc/user /opt/matomo_user_backup 2>/dev/null
|
[[ -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"
|
msg_ok "Backed up Data"
|
||||||
|
|
||||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "matomo" "matomo-org/matomo" "prebuild" "latest" "/opt/matomo" "matomo-*.zip"
|
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"
|
msg_info "Restoring Data"
|
||||||
|
if [[ -f /opt/matomo_config.bak ]]; then
|
||||||
|
mkdir -p /opt/matomo/config
|
||||||
cp /opt/matomo_config.bak /opt/matomo/config/config.ini.php
|
cp /opt/matomo_config.bak /opt/matomo/config/config.ini.php
|
||||||
cp -r /opt/matomo_user_backup/. /opt/matomo/misc/user 2>/dev/null
|
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_config.bak
|
||||||
|
rm -f /opt/matomo_db_creds.bak
|
||||||
rm -rf /opt/matomo_user_backup
|
rm -rf /opt/matomo_user_backup
|
||||||
chown -R www-data:www-data /opt/matomo
|
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_ok "Restored Data"
|
||||||
|
|
||||||
msg_info "Starting Services"
|
msg_info "Starting Services"
|
||||||
|
|||||||
@@ -36,13 +36,12 @@ NEXTAUTH_URL=http://${LOCAL_IP}:1111
|
|||||||
NEXTAUTH_SECRET=$(openssl rand -base64 32)
|
NEXTAUTH_SECRET=$(openssl rand -base64 32)
|
||||||
NEXT_PUBLIC_BASE_URL=http://${LOCAL_IP}:1111
|
NEXT_PUBLIC_BASE_URL=http://${LOCAL_IP}:1111
|
||||||
EOF
|
EOF
|
||||||
$STD bun install --unsafe-perm
|
$STD bun install
|
||||||
$STD bun run build:web
|
$STD bun run build:web
|
||||||
$STD bun run build:seed
|
$STD bun run build:seed
|
||||||
mkdir -p /opt/blinko/server/public
|
$STD bun run prisma:generate
|
||||||
cp -r /opt/blinko/dist/public/. /opt/blinko/server/public/ 2>/dev/null || true
|
$STD bun run prisma:migrate:deploy
|
||||||
$STD bunx prisma migrate deploy
|
$STD bun run seed
|
||||||
$STD bun /opt/blinko/dist/seed.js
|
|
||||||
msg_ok "Set up Blinko"
|
msg_ok "Set up Blinko"
|
||||||
|
|
||||||
msg_info "Creating Service"
|
msg_info "Creating Service"
|
||||||
@@ -54,7 +53,8 @@ After=network.target postgresql.service
|
|||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
User=root
|
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
|
ExecStart=/usr/local/bin/bun --env-file /opt/blinko/.env /opt/blinko/dist/index.js
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
RestartSec=5
|
RestartSec=5
|
||||||
|
|||||||
@@ -204,8 +204,8 @@ EOF
|
|||||||
|
|
||||||
msg_info "Enabling Corepack"
|
msg_info "Enabling Corepack"
|
||||||
$STD corepack enable
|
$STD corepack enable
|
||||||
|
$STD corepack prepare yarn@stable --activate
|
||||||
cd /opt/clickstack
|
cd /opt/clickstack
|
||||||
$STD corepack prepare --activate
|
|
||||||
msg_ok "Enabled Corepack"
|
msg_ok "Enabled Corepack"
|
||||||
|
|
||||||
msg_info "Building HyperDX"
|
msg_info "Building HyperDX"
|
||||||
|
|||||||
@@ -104,8 +104,8 @@ RestartSec=5
|
|||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
systemctl enable -q --now minio
|
systemctl enable -q --now minio
|
||||||
sleep 3
|
sleep 5
|
||||||
$STD mc alias set local http://localhost:3200 minioadmin "${MINIO_PASS}"
|
$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/b2-eu-cen
|
||||||
$STD mc mb --ignore-existing local/wasabi-eu-central-2-v3
|
$STD mc mb --ignore-existing local/wasabi-eu-central-2-v3
|
||||||
$STD mc mb --ignore-existing local/scw-eu-fr-v3
|
$STD mc mb --ignore-existing local/scw-eu-fr-v3
|
||||||
|
|||||||
@@ -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
|
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
|
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
|
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
|
chmod -R 775 storage bootstrap/cache public/dist public/uploads public/sym
|
||||||
msg_ok "Configured Application"
|
msg_ok "Configured Application"
|
||||||
|
|
||||||
@@ -56,6 +55,8 @@ cd /opt/lychee
|
|||||||
$STD php artisan migrate --force
|
$STD php artisan migrate --force
|
||||||
msg_ok "Ran Database Migrations"
|
msg_ok "Ran Database Migrations"
|
||||||
|
|
||||||
|
chown -R www-data:www-data /opt/lychee
|
||||||
|
|
||||||
msg_info "Configuring Caddy"
|
msg_info "Configuring Caddy"
|
||||||
PHP_VER=$(php -r 'echo PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION;')
|
PHP_VER=$(php -r 'echo PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION;')
|
||||||
cat <<EOF >/etc/caddy/Caddyfile
|
cat <<EOF >/etc/caddy/Caddyfile
|
||||||
|
|||||||
@@ -17,16 +17,35 @@ msg_info "Installing Dependencies"
|
|||||||
$STD apt install -y caddy
|
$STD apt install -y caddy
|
||||||
msg_ok "Installed Dependencies"
|
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
|
PHP_VERSION="8.3" PHP_FPM="YES" PHP_MODULES="pdo_mysql,gd,mbstring,xml,curl,intl,zip,ldap" setup_php
|
||||||
setup_mariadb
|
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"
|
fetch_and_deploy_gh_release "matomo" "matomo-org/matomo" "prebuild" "latest" "/opt/matomo" "matomo-*.zip"
|
||||||
|
|
||||||
msg_info "Setting up Matomo"
|
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
|
mkdir -p /opt/matomo/tmp
|
||||||
chown -R www-data:www-data /opt/matomo
|
chown -R www-data:www-data /opt/matomo
|
||||||
chmod -R 755 /opt/matomo/tmp
|
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_ok "Set up Matomo"
|
||||||
|
|
||||||
msg_info "Configuring Caddy"
|
msg_info "Configuring Caddy"
|
||||||
@@ -34,6 +53,8 @@ PHP_VER=$(php -r 'echo PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION;')
|
|||||||
cat <<EOF >/etc/caddy/Caddyfile
|
cat <<EOF >/etc/caddy/Caddyfile
|
||||||
:80 {
|
:80 {
|
||||||
root * /opt/matomo
|
root * /opt/matomo
|
||||||
|
@blocked path /config /config/* /tmp /tmp/*
|
||||||
|
respond @blocked 403
|
||||||
php_fastcgi unix//run/php/php${PHP_VER}-fpm.sock
|
php_fastcgi unix//run/php/php${PHP_VER}-fpm.sock
|
||||||
file_server
|
file_server
|
||||||
encode gzip
|
encode gzip
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ $STD apt install -y \
|
|||||||
fonts-noto-color-emoji \
|
fonts-noto-color-emoji \
|
||||||
fonts-wqy-zenhei
|
fonts-wqy-zenhei
|
||||||
msg_ok "Installed Dependencies"
|
msg_ok "Installed Dependencies"
|
||||||
|
systemctl disable -q --now supervisor
|
||||||
|
|
||||||
msg_info "Installing Build Dependencies"
|
msg_info "Installing Build Dependencies"
|
||||||
$STD apt install -y \
|
$STD apt install -y \
|
||||||
|
|||||||
Reference in New Issue
Block a user