Files
ProxmoxVE/install/alpine-tinyauth-install.sh
T

74 lines
1.9 KiB
Bash
Raw Normal View History

2025-05-06 11:07:45 +02:00
#!/usr/bin/env bash
# Copyright (c) 2021-2026 community-scripts ORG
# Author: Slaviša Arežina (tremor021) | Co-Author: Stavros (steveiliop56)
2025-05-06 11:07:45 +02:00
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/tinyauthapp/tinyauth
2025-05-06 11:07:45 +02:00
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Dependencies"
2025-10-12 20:00:29 +02:00
$STD apk add --no-cache openssl apache2-utils
2025-05-06 11:07:45 +02:00
msg_ok "Installed Dependencies"
msg_info "Installing Tinyauth"
2025-05-06 11:07:45 +02:00
mkdir -p /opt/tinyauth
RELEASE=$(curl -s https://api.github.com/repos/tinyauthapp/tinyauth/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
curl -fsSL "https://github.com/tinyauthapp/tinyauth/releases/download/v${RELEASE}/tinyauth-amd64" -o /opt/tinyauth/tinyauth
chmod +x /opt/tinyauth/tinyauth
2025-07-07 20:47:14 +02:00
PASS=$(openssl rand -base64 8 | tr -dc 'a-zA-Z0-9' | head -c 8)
USER=$(htpasswd -Bbn "tinyauth" "${PASS}")
2025-07-07 20:47:14 +02:00
cat <<EOF >/opt/tinyauth/credentials.txt
Tinyauth Credentials
Username: tinyauth
2025-07-07 20:47:14 +02:00
Password: ${PASS}
EOF
2025-10-12 20:00:29 +02:00
echo "${RELEASE}" >~/.tinyauth
msg_ok "Installed Tinyauth"
2025-10-12 20:00:29 +02:00
read -r -p "${TAB3}Enter your Tinyauth subdomain (e.g. https://tinyauth.example.com): " app_url
cat <<EOF >/opt/tinyauth/.env
TINYAUTH_DATABASE_PATH=/opt/tinyauth/database.db
TINYAUTH_AUTH_USERS='${USER}'
TINYAUTH_APPURL=${app_url}
EOF
2025-05-06 11:07:45 +02:00
2025-10-12 20:00:29 +02:00
msg_info "Creating Service"
2025-06-10 19:36:33 +02:00
cat <<'EOF' >/etc/init.d/tinyauth
2025-05-06 11:07:45 +02:00
#!/sbin/openrc-run
description="Tinyauth Service"
2025-05-06 11:07:45 +02:00
2025-10-09 19:19:03 +02:00
set -a
ENV_FILE="/opt/tinyauth/.env"
[ -f "$ENV_FILE" ] && . "$ENV_FILE"
set +a
2025-05-06 11:07:45 +02:00
command="/opt/tinyauth/tinyauth"
directory="/opt/tinyauth"
command_user="root"
command_background="true"
pidfile="/var/run/tinyauth.pid"
depend() {
use net
}
EOF
chmod +x /etc/init.d/tinyauth
$STD rc-update add tinyauth default
msg_ok "Enabled Tinyauth Service"
2025-05-06 11:07:45 +02:00
msg_info "Starting Tinyauth"
2025-05-06 11:07:45 +02:00
$STD service tinyauth start
msg_ok "Started Tinyauth"
2025-07-07 20:52:42 +02:00
motd_ssh
customize