Skip to content

Commit 8e26cd4

Browse files
'Add new script' (#4264)
Co-authored-by: push-app-to-main[bot] <203845782+push-app-to-main[bot]@users.noreply.github.com>
1 parent 237c920 commit 8e26cd4

File tree

3 files changed

+204
-0
lines changed

3 files changed

+204
-0
lines changed

ct/alpine-tinyauth.sh

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#!/usr/bin/env bash
2+
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: Slaviša Arežina (tremor021)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/steveiliop56/tinyauth
7+
8+
APP="Alpine-tinyauth"
9+
var_tags="${var_tags:-alpine;auth}"
10+
var_cpu="${var_cpu:-1}"
11+
var_ram="${var_ram:-512}"
12+
var_disk="${var_disk:-3}"
13+
var_os="${var_os:-alpine}"
14+
var_version="${var_version:-3.21}"
15+
var_unprivileged="${var_unprivileged:-1}"
16+
17+
header_info "$APP"
18+
variables
19+
color
20+
catch_errors
21+
22+
function update_script() {
23+
if [[ ! -d /opt/tinyauth ]]; then
24+
msg_error "No ${APP} Installation Found!"
25+
exit 1
26+
fi
27+
28+
msg_info "Updating Alpine Packages"
29+
$STD apk update
30+
$STD apk upgrade
31+
msg_ok "Updated Alpine Packages"
32+
33+
msg_info "Updating tinyauth"
34+
RELEASE=$(curl -s https://api.github.com/repos/steveiliop56/tinyauth/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
35+
if [ "${RELEASE}" != "$(cat /opt/tinyauth_version.txt)" ] || [ ! -f /opt/tinyauth_version.txt ]; then
36+
$STD service tinyauth stop
37+
temp_file=$(mktemp)
38+
cp /opt/tinyauth/.env /opt
39+
rm -rf /opt/tinyauth
40+
mkdir -p /opt/tinyauth
41+
curl -fsSL "https://github.com/steveiliop56/tinyauth/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file"
42+
tar -xzf "$temp_file" -C /opt/tinyauth --strip-components=1
43+
cd /opt/tinyauth/frontend
44+
$STD bun install
45+
$STD bun run build
46+
mv dist /opt/tinyauth/internal/assets/
47+
cd /opt/tinyauth
48+
$STD go mod download
49+
CGO_ENABLED=0 go build -ldflags "-s -w"
50+
cp /opt/.env /opt/tinyauth
51+
echo "${RELEASE}" >/opt/tinyauth_version.txt
52+
rm -f "$temp_file"
53+
msg_info "Restarting tinyauth"
54+
$STD service tinyauth start
55+
msg_ok "Restarted tinyauth"
56+
msg_ok "Updated tinyauth"
57+
else
58+
msg_ok "No update required. ${APP} is already at ${RELEASE}"
59+
fi
60+
exit 0
61+
}
62+
63+
start
64+
build_container
65+
description
66+
67+
msg_ok "Completed Successfully!\n"
68+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
69+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
70+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}"
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"name": "Alpine-tinyauth",
3+
"slug": "alpine-tinyauth",
4+
"categories": [
5+
6
6+
],
7+
"date_created": "2025-04-28",
8+
"type": "ct",
9+
"updateable": true,
10+
"privileged": false,
11+
"interface_port": 3000,
12+
"documentation": "https://tinyauth.app/docs/getting-started.html",
13+
"website": "https://tinyauth.app/",
14+
"logo": "https://raw.githubusercontent.com/steveiliop56/tinyauth/refs/heads/main/frontend/public/android-chrome-192x192.png",
15+
"config_path": "/opt/tinyauth/.env",
16+
"description": "Tinyauth is a simple authentication middleware that adds simple username/password login or OAuth with Google, Github and any generic provider to all of your docker apps. It is designed for traefik but it can be extended to work with all reverse proxies like caddy and nginx.",
17+
"install_methods": [
18+
{
19+
"type": "default",
20+
"script": "ct/alpine-tinyauth.sh",
21+
"resources": {
22+
"cpu": 1,
23+
"ram": 256,
24+
"hdd": 3,
25+
"os": "alpine",
26+
"version": "3.21"
27+
}
28+
},
29+
{
30+
"type": "alpine",
31+
"script": "ct/alpine-tinyauth.sh",
32+
"resources": {
33+
"cpu": 1,
34+
"ram": 256,
35+
"hdd": 3,
36+
"os": "alpine",
37+
"version": "3.21"
38+
}
39+
}
40+
],
41+
"default_credentials": {
42+
"username": null,
43+
"password": null
44+
},
45+
"notes": [
46+
{
47+
"type": "info",
48+
"text": "`cat ~/tinyauth.creds` to view login credentials"
49+
}
50+
]
51+
}

install/alpine-tinyauth-install.sh

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: Slaviša Arežina (tremor021)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/steveiliop56/tinyauth
7+
8+
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
9+
color
10+
verb_ip6
11+
catch_errors
12+
setting_up_container
13+
network_check
14+
update_os
15+
16+
msg_info "Installing Dependencies"
17+
$STD apk add --no-cache \
18+
npm \
19+
curl \
20+
go
21+
msg_ok "Installed Dependencies"
22+
23+
msg_info "Installing tinyauth"
24+
temp_file=$(mktemp)
25+
$STD npm install -g bun
26+
mkdir -p /opt/tinyauth
27+
RELEASE=$(curl -s https://api.github.com/repos/steveiliop56/tinyauth/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
28+
curl -fsSL "https://github.com/steveiliop56/tinyauth/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file"
29+
tar -xzf "$temp_file" -C /opt/tinyauth --strip-components=1
30+
cd /opt/tinyauth/frontend
31+
$STD bun install
32+
$STD bun run build
33+
mv dist /opt/tinyauth/internal/assets/
34+
cd /opt/tinyauth
35+
$STD go mod download
36+
CGO_ENABLED=0 go build -ldflags "-s -w"
37+
{
38+
echo "tinyauth Credentials"
39+
echo "Username: [email protected]"
40+
echo "Password: admin"
41+
} >>~/tinyauth.creds
42+
echo "${RELEASE}" >/opt/tinyauth_version.txt
43+
msg_ok "Installed tinyauth"
44+
45+
msg_info "Enabling tinyauth Service"
46+
SECRET=$(head -c 16 /dev/urandom | xxd -p -c 16 | tr -d '\n')
47+
{
48+
echo "SECRET=${SECRET}"
49+
echo "[email protected]:\$2a\$10\$CrTK.W7WXSClo3ZY1yJUFupg5UdV8WNcynEhZhJFNjhGQB.Ga0ZDm"
50+
echo "APP_URL=http://localhost:3000"
51+
} >>/opt/tinyauth/.env
52+
53+
cat <<EOF >/etc/init.d/tinyauth
54+
#!/sbin/openrc-run
55+
description="tinyauth Service"
56+
57+
command="/opt/tinyauth/tinyauth"
58+
directory="/opt/tinyauth"
59+
command_user="root"
60+
command_background="true"
61+
pidfile="/var/run/tinyauth.pid"
62+
63+
start_pre() {
64+
if [ -f "/opt/tinyauth/.env" ]; then
65+
export \$(grep -v '^#' /opt/tinyauth/.env | xargs)
66+
fi
67+
}
68+
69+
depend() {
70+
use net
71+
}
72+
EOF
73+
74+
chmod +x /etc/init.d/tinyauth
75+
$STD rc-update add tinyauth default
76+
msg_ok "Enabled tinyauth Service"
77+
78+
msg_info "Starting tinyauth"
79+
$STD service tinyauth start
80+
msg_ok "Started tinyauth"
81+
82+
motd_ssh
83+
customize

0 commit comments

Comments
 (0)