mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-05-20 10:40:26 +00:00
Updated contributor docs (#4518)
This commit is contained in:
parent
1fdda378ac
commit
ce69a571bc
14
.github/CONTRIBUTOR_AND_GUIDES/ct/AppName.md
vendored
14
.github/CONTRIBUTOR_AND_GUIDES/ct/AppName.md
vendored
@ -108,13 +108,13 @@ Example:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
APP="SnipeIT"
|
APP="SnipeIT"
|
||||||
var_tags="asset-management;foss"
|
var_tags="${var_tags:-asset-management;foss}"
|
||||||
var_cpu="2"
|
var_cpu="${var_cpu:-2}"
|
||||||
var_ram="2048"
|
var_ram="${var_ram:-2048}"
|
||||||
var_disk="4"
|
var_disk="${var_disk:-4}"
|
||||||
var_os="debian"
|
var_os="${var_os:-debian}"
|
||||||
var_version="12"
|
var_version="${var_version:-12}"
|
||||||
var_unprivileged="1"
|
var_unprivileged="${var_unprivileged:-1}"
|
||||||
```
|
```
|
||||||
|
|
||||||
## 2.2 **📋 App output & base settings**
|
## 2.2 **📋 App output & base settings**
|
||||||
|
102
.github/CONTRIBUTOR_AND_GUIDES/ct/AppName.sh
vendored
102
.github/CONTRIBUTOR_AND_GUIDES/ct/AppName.sh
vendored
@ -6,22 +6,22 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV
|
|||||||
# Source: [SOURCE_URL]
|
# Source: [SOURCE_URL]
|
||||||
|
|
||||||
# App Default Values
|
# App Default Values
|
||||||
APP="[APP_NAME]"
|
|
||||||
# Name of the app (e.g. Google, Adventurelog, Apache-Guacamole"
|
# Name of the app (e.g. Google, Adventurelog, Apache-Guacamole"
|
||||||
var_tags="[TAGS]"
|
APP="[APP_NAME]"
|
||||||
# Tags for Proxmox VE, maximum 2 pcs., no spaces allowed, separated by a semicolon ; (e.g. database | adblock;dhcp)
|
# Tags for Proxmox VE, maximum 2 pcs., no spaces allowed, separated by a semicolon ; (e.g. database | adblock;dhcp)
|
||||||
var_cpu="[CPU]"
|
var_tags="${var_tags:-[TAGS]}"
|
||||||
# Number of cores (1-X) (e.g. 4) - default are 2
|
# Number of cores (1-X) (e.g. 4) - default are 2
|
||||||
var_ram="[RAM]"
|
var_cpu="${var_cpu:-[CPU]}"
|
||||||
# Amount of used RAM in MB (e.g. 2048 or 4096)
|
# Amount of used RAM in MB (e.g. 2048 or 4096)
|
||||||
var_disk="[DISK]"
|
var_ram="${var_ram:-[RAM]}"
|
||||||
# Amount of used disk space in GB (e.g. 4 or 10)
|
# Amount of used disk space in GB (e.g. 4 or 10)
|
||||||
var_os="[OS]"
|
var_disk="${var_disk:-[DISK]}"
|
||||||
# Default OS (e.g. debian, ubuntu, alpine)
|
# Default OS (e.g. debian, ubuntu, alpine)
|
||||||
var_version="[VERSION]"
|
var_os="${var_os:-[OS]}"
|
||||||
# Default OS version (e.g. 12 for debian, 24.04 for ubuntu, 3.20 for alpine)
|
# Default OS version (e.g. 12 for debian, 24.04 for ubuntu, 3.20 for alpine)
|
||||||
var_unprivileged="[UNPRIVILEGED]"
|
var_version="${var_version:-[VERSION]}"
|
||||||
# 1 = unprivileged container, 0 = privileged container
|
# 1 = unprivileged container, 0 = privileged container
|
||||||
|
var_unprivileged="${var_unprivileged:-[UNPRIVILEGED]}"
|
||||||
|
|
||||||
header_info "$APP"
|
header_info "$APP"
|
||||||
variables
|
variables
|
||||||
@ -29,51 +29,51 @@ color
|
|||||||
catch_errors
|
catch_errors
|
||||||
|
|
||||||
function update_script() {
|
function update_script() {
|
||||||
header_info
|
header_info
|
||||||
check_container_storage
|
check_container_storage
|
||||||
check_container_resources
|
check_container_resources
|
||||||
|
|
||||||
# Check if installation is present | -f for file, -d for folder
|
# Check if installation is present | -f for file, -d for folder
|
||||||
if [[ ! -f [INSTALLATION_CHECK_PATH] ]]; then
|
if [[ ! -f [INSTALLATION_CHECK_PATH] ]]; then
|
||||||
msg_error "No ${APP} Installation Found!"
|
msg_error "No ${APP} Installation Found!"
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Crawling the new version and checking whether an update is required
|
|
||||||
RELEASE=$(curl -fsSL [RELEASE_URL] | [PARSE_RELEASE_COMMAND])
|
|
||||||
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
|
|
||||||
# Stopping Services
|
|
||||||
msg_info "Stopping $APP"
|
|
||||||
systemctl stop [SERVICE_NAME]
|
|
||||||
msg_ok "Stopped $APP"
|
|
||||||
|
|
||||||
# Creating Backup
|
|
||||||
msg_info "Creating Backup"
|
|
||||||
tar -czf "/opt/${APP}_backup_$(date +%F).tar.gz" [IMPORTANT_PATHS]
|
|
||||||
msg_ok "Backup Created"
|
|
||||||
|
|
||||||
# Execute Update
|
|
||||||
msg_info "Updating $APP to v${RELEASE}"
|
|
||||||
[UPDATE_COMMANDS]
|
|
||||||
msg_ok "Updated $APP to v${RELEASE}"
|
|
||||||
|
|
||||||
# Starting Services
|
|
||||||
msg_info "Starting $APP"
|
|
||||||
systemctl start [SERVICE_NAME]
|
|
||||||
msg_ok "Started $APP"
|
|
||||||
|
|
||||||
# Cleaning up
|
|
||||||
msg_info "Cleaning Up"
|
|
||||||
rm -rf [TEMP_FILES]
|
|
||||||
msg_ok "Cleanup Completed"
|
|
||||||
|
|
||||||
# Last Action
|
|
||||||
echo "${RELEASE}" >/opt/${APP}_version.txt
|
|
||||||
msg_ok "Update Successful"
|
|
||||||
else
|
|
||||||
msg_ok "No update required. ${APP} is already at v${RELEASE}"
|
|
||||||
fi
|
|
||||||
exit
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Crawling the new version and checking whether an update is required
|
||||||
|
RELEASE=$(curl -fsSL [RELEASE_URL] | [PARSE_RELEASE_COMMAND])
|
||||||
|
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
|
||||||
|
# Stopping Services
|
||||||
|
msg_info "Stopping $APP"
|
||||||
|
systemctl stop [SERVICE_NAME]
|
||||||
|
msg_ok "Stopped $APP"
|
||||||
|
|
||||||
|
# Creating Backup
|
||||||
|
msg_info "Creating Backup"
|
||||||
|
tar -czf "/opt/${APP}_backup_$(date +%F).tar.gz" [IMPORTANT_PATHS]
|
||||||
|
msg_ok "Backup Created"
|
||||||
|
|
||||||
|
# Execute Update
|
||||||
|
msg_info "Updating $APP to v${RELEASE}"
|
||||||
|
[UPDATE_COMMANDS]
|
||||||
|
msg_ok "Updated $APP to v${RELEASE}"
|
||||||
|
|
||||||
|
# Starting Services
|
||||||
|
msg_info "Starting $APP"
|
||||||
|
systemctl start [SERVICE_NAME]
|
||||||
|
msg_ok "Started $APP"
|
||||||
|
|
||||||
|
# Cleaning up
|
||||||
|
msg_info "Cleaning Up"
|
||||||
|
rm -rf [TEMP_FILES]
|
||||||
|
msg_ok "Cleanup Completed"
|
||||||
|
|
||||||
|
# Last Action
|
||||||
|
echo "${RELEASE}" >/opt/${APP}_version.txt
|
||||||
|
msg_ok "Update Successful"
|
||||||
|
else
|
||||||
|
msg_ok "No update required. ${APP} is already at v${RELEASE}"
|
||||||
|
fi
|
||||||
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
start
|
start
|
||||||
|
@ -152,7 +152,7 @@ Example for a git release:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
RELEASE=$(curl -fsSL https://api.github.com/repos/snipe/snipe-it/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
RELEASE=$(curl -fsSL https://api.github.com/repos/snipe/snipe-it/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||||
wget -q "https://github.com/snipe/snipe-it/archive/refs/tags/v${RELEASE}.zip"
|
curl -fsSL "https://github.com/snipe/snipe-it/archive/refs/tags/v${RELEASE}.zip" -o "v${RELEASE}.zip"
|
||||||
```
|
```
|
||||||
|
|
||||||
### 5.2 **Save the version for update checks**
|
### 5.2 **Save the version for update checks**
|
||||||
@ -163,7 +163,7 @@ wget -q "https://github.com/snipe/snipe-it/archive/refs/tags/v${RELEASE}.zip"
|
|||||||
Example:
|
Example:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
echo "${RELEASE}" >"/opt/AppName_version.txt"
|
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
# Source: [SOURCE_URL]
|
# Source: [SOURCE_URL]
|
||||||
|
|
||||||
# Import Functions und Setup
|
# Import Functions und Setup
|
||||||
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
|
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||||
color
|
color
|
||||||
verb_ip6
|
verb_ip6
|
||||||
catch_errors
|
catch_errors
|
||||||
@ -31,15 +31,13 @@ $STD mysql -u root -e "CREATE DATABASE $DB_NAME;"
|
|||||||
$STD mysql -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED WITH mysql_native_password AS PASSWORD('$DB_PASS');"
|
$STD mysql -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED WITH mysql_native_password AS PASSWORD('$DB_PASS');"
|
||||||
$STD mysql -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;"
|
$STD mysql -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;"
|
||||||
{
|
{
|
||||||
echo "${APPLICATION} Credentials"
|
echo "${APPLICATION} Credentials"
|
||||||
echo "Database User: $DB_USER"
|
echo "Database User: $DB_USER"
|
||||||
echo "Database Password: $DB_PASS"
|
echo "Database Password: $DB_PASS"
|
||||||
echo "Database Name: $DB_NAME"
|
echo "Database Name: $DB_NAME"
|
||||||
} >> ~/$APP_NAME.creds
|
} >>~/"$APP_NAME".creds
|
||||||
msg_ok "Set up Database"
|
msg_ok "Set up Database"
|
||||||
|
|
||||||
# Temp
|
|
||||||
|
|
||||||
# Setup App
|
# Setup App
|
||||||
msg_info "Setup ${APPLICATION}"
|
msg_info "Setup ${APPLICATION}"
|
||||||
RELEASE=$(curl -fsSL https://api.github.com/repos/[REPO]/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
RELEASE=$(curl -fsSL https://api.github.com/repos/[REPO]/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||||
@ -49,12 +47,12 @@ mv "${APPLICATION}-${RELEASE}/" "/opt/${APPLICATION}"
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
|
echo "${RELEASE}" >/opt/"${APPLICATION}"_version.txt
|
||||||
msg_ok "Setup ${APPLICATION}"
|
msg_ok "Setup ${APPLICATION}"
|
||||||
|
|
||||||
# Creating Service (if needed)
|
# Creating Service (if needed)
|
||||||
msg_info "Creating Service"
|
msg_info "Creating Service"
|
||||||
cat <<EOF >/etc/systemd/system/${APPLICATION}.service
|
cat <<EOF >/etc/systemd/system/"${APPLICATION}".service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=${APPLICATION} Service
|
Description=${APPLICATION} Service
|
||||||
After=network.target
|
After=network.target
|
||||||
@ -66,7 +64,7 @@ Restart=always
|
|||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
systemctl enable -q --now ${APPLICATION}
|
systemctl enable -q --now "${APPLICATION}"
|
||||||
msg_ok "Created Service"
|
msg_ok "Created Service"
|
||||||
|
|
||||||
motd_ssh
|
motd_ssh
|
||||||
@ -74,7 +72,7 @@ customize
|
|||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
msg_info "Cleaning up"
|
msg_info "Cleaning up"
|
||||||
rm -f ${RELEASE}.zip
|
rm -f "${RELEASE}".zip
|
||||||
$STD apt-get -y autoremove
|
$STD apt-get -y autoremove
|
||||||
$STD apt-get -y autoclean
|
$STD apt-get -y autoclean
|
||||||
msg_ok "Cleaned"
|
msg_ok "Cleaned"
|
Loading…
x
Reference in New Issue
Block a user