11#! /usr/bin/env bash
22source <( curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
33# Copyright (c) 2021-2024 tteck
4- # Author: tteck
5- # Co-Author: MickLesk (Canbiz)
6- # License: MIT
7- # https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
4+ # Author: MickLesk (Canbiz)
5+ # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+ # Source: https://adventurelog.app/
87
9- function header_info {
10- clear
11- cat << "EOF "
12- ___ __ __ __
13- / | ____/ / _____ ____ / /___ __________ / / ____ ____ _
14- / /| |/ __ / | / / _ \/ __ \/ __/ / / / ___/ _ \/ / / __ \/ __ `/
15- / ___ / /_/ /| |/ / __/ / / / /_/ /_/ / / / __/ /___/ /_/ / /_/ /
16- /_/ |_\__,_/ |___/\___/_/ /_/\__/\__,_/_/ \___/_____/\____/\__, /
17- /____/
18- EOF
19- }
20- header_info
21- echo -e " Loading..."
8+ # App Default Values
229APP=" AdventureLog"
10+ TAGS=" traveling"
2311var_disk=" 7"
2412var_cpu=" 2"
2513var_ram=" 2048"
2614var_os=" debian"
2715var_version=" 12"
16+ var_unprivileged=" 1"
17+
18+ # App Output & Base Settings
19+ header_info " $APP "
20+ base_settings
21+
22+ # Core
2823variables
2924color
3025catch_errors
3126
32- function default_settings() {
33- CT_TYPE=" 1"
34- PW=" "
35- CT_ID=$NEXTID
36- HN=$NSAPP
37- DISK_SIZE=" $var_disk "
38- CORE_COUNT=" $var_cpu "
39- RAM_SIZE=" $var_ram "
40- BRG=" vmbr0"
41- NET=" dhcp"
42- GATE=" "
43- APT_CACHER=" "
44- APT_CACHER_IP=" "
45- DISABLEIP6=" no"
46- MTU=" "
47- SD=" "
48- NS=" "
49- MAC=" "
50- VLAN=" "
51- SSH=" no"
52- VERB=" no"
53- echo_default
54- }
5527function update_script() {
56- header_info
57- check_container_storage
58- check_container_resources
59- if [[ ! -d /opt/adventurelog ]]; then msg_error " No ${APP} Installation Found!" ; exit ; fi
60- RELEASE=$( curl -s https://api.github.com/repos/seanmorley15/AdventureLog/releases/latest | grep " tag_name" | awk ' {print substr($2, 3, length($2)-4) }' )
61- if [[ ! -f /opt/${APP} _version.txt ]] || [[ " ${RELEASE} " != " $( cat /opt/${APP} _version.txt) " ]]; then
62- msg_info " Stopping Services"
63- systemctl stop adventurelog-backend
64- systemctl stop adventurelog-frontend
65- msg_ok " Services Stopped"
28+ header_info
29+ check_container_storage
30+ check_container_resources
31+ if [[ ! -d /opt/adventurelog ]]; then
32+ msg_error " No ${APP} Installation Found!"
33+ exit
34+ fi
35+ RELEASE=$( curl -s https://api.github.com/repos/seanmorley15/AdventureLog/releases/latest | grep " tag_name" | awk ' {print substr($2, 3, length($2)-4) }' )
36+ if [[ ! -f /opt/${APP} _version.txt ]] || [[ " ${RELEASE} " != " $( cat /opt/${APP} _version.txt) " ]]; then
37+ msg_info " Stopping Services"
38+ systemctl stop adventurelog-backend
39+ systemctl stop adventurelog-frontend
40+ msg_ok " Services Stopped"
41+
42+ msg_info " Updating ${APP} to ${RELEASE} "
43+ cp /opt/adventurelog/backend/server/.env /opt/server.env
44+ cp /opt/adventurelog/frontend/.env /opt/frontend.env
45+ wget -q " https://github.com/seanmorley15/AdventureLog/archive/refs/tags/v${RELEASE} .zip"
46+ unzip -q v${RELEASE} .zip
47+ mv AdventureLog-${RELEASE} /opt/adventurelog
48+ mv /opt/server.env /opt/adventurelog/backend/server/.env
49+ cd /opt/adventurelog/backend/server
50+ pip install --upgrade pip & > /dev/null
51+ pip install -r requirements.txt & > /dev/null
52+ python3 manage.py collectstatic --noinput & > /dev/null
53+ python3 manage.py migrate & > /dev/null
6654
67- msg_info " Updating ${APP} to ${RELEASE} "
68- cp /opt/adventurelog/backend/server/.env /opt/server.env
69- cp /opt/adventurelog/frontend/.env /opt/frontend.env
70- wget -q " https://github.com/seanmorley15/AdventureLog/archive/refs/tags/v${RELEASE} .zip"
71- unzip -q v${RELEASE} .zip
72- mv AdventureLog-${RELEASE} /opt/adventurelog
73- mv /opt/server.env /opt/adventurelog/backend/server/.env
74- cd /opt/adventurelog/backend/server
75- pip install --upgrade pip & > /dev/null
76- pip install -r requirements.txt & > /dev/null
77- python3 manage.py collectstatic --noinput & > /dev/null
78- python3 manage.py migrate & > /dev/null
79-
80- mv /opt/frontend.env /opt/adventurelog/frontend/.env
81- cd /opt/adventurelog/frontend
82- pnpm install & > /dev/null
83- pnpm run build & > /dev/null
84- echo " ${RELEASE} " > /opt/${APP} _version.txt
85- msg_ok " Updated ${APP} "
55+ mv /opt/frontend.env /opt/adventurelog/frontend/.env
56+ cd /opt/adventurelog/frontend
57+ pnpm install & > /dev/null
58+ pnpm run build & > /dev/null
59+ echo " ${RELEASE} " > /opt/${APP} _version.txt
60+ msg_ok " Updated ${APP} "
8661
87- msg_info " Starting Services"
88- systemctl start adventurelog-backend
89- systemctl start adventurelog-frontend
90- msg_ok " Started Services"
62+ msg_info " Starting Services"
63+ systemctl start adventurelog-backend
64+ systemctl start adventurelog-frontend
65+ msg_ok " Started Services"
9166
92- msg_info " Cleaning Up"
93- rm -rf v${RELEASE} .zip
94- msg_ok " Cleaned"
95- msg_ok " Updated Successfully"
96- else
97- msg_ok " No update required. ${APP} is already at ${RELEASE} "
98- fi
99- exit
67+ msg_info " Cleaning Up"
68+ rm -rf v${RELEASE} .zip
69+ msg_ok " Cleaned"
70+ msg_ok " Updated Successfully"
71+ else
72+ msg_ok " No update required. ${APP} is already at ${RELEASE} "
73+ fi
74+ exit
10075}
10176
10277start
10378build_container
10479description
10580
10681msg_ok " Completed Successfully!\n"
107- echo -e " ${APP} Setup should be reachable by going to the following URL.
108- ${BL} http://${IP} :3000${CL} \n"
82+ echo -e " ${CREATING}${GN}${APP} setup has been successfully initialized!${CL} "
83+ echo -e " ${INFO}${YW} Access it using the following URL:${CL} "
84+ echo -e " ${TAB}${GATEWAY}${BGN} http://${IP} :3000${CL} "
0 commit comments