mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-11-05 19:02:50 +00:00
Compare commits
3 Commits
remove_mys
...
CrazyWolf1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7bce8fe55b | ||
|
|
3f08fa9435 | ||
|
|
7170563271 |
@@ -24,9 +24,12 @@ function update_script() {
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
|
||||
if ! dpkg-query -W -f='${Status}' mariadb-server 2>/dev/null | grep -q "install ok installed"; then
|
||||
setup_mysql
|
||||
fi
|
||||
NODE_VERSION="22" setup_nodejs
|
||||
|
||||
msg_info "Updating Ghost"
|
||||
msg_info "Updating ${APP} LXC"
|
||||
if command -v ghost &>/dev/null; then
|
||||
current_version=$(ghost version | grep 'Ghost-CLI version' | awk '{print $3}')
|
||||
latest_version=$(npm show ghost-cli version)
|
||||
|
||||
41
ct/kimai.sh
41
ct/kimai.sh
@@ -23,21 +23,32 @@ function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
if ! command -v lsb_release; then
|
||||
apt install -y lsb-release
|
||||
fi
|
||||
if [[ ! -d /opt/kimai ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
|
||||
CURRENT_PHP=$(php -v 2>/dev/null | awk '/^PHP/{print $2}' | cut -d. -f1,2)
|
||||
if [[ "$CURRENT_PHP" != "8.4" ]]; then
|
||||
msg_info "Migrating PHP $CURRENT_PHP to 8.4"
|
||||
PHP_VERSION="8.4" PHP_MODULE="gd,mysql,mbstring,bcmath,xml,curl,zip,intl,fpm" PHP_APACHE="YES" setup_php
|
||||
$STD curl -fsSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb
|
||||
$STD dpkg -i /tmp/debsuryorg-archive-keyring.deb
|
||||
$STD sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
|
||||
$STD apt-get update
|
||||
$STD apt-get remove -y php"${CURRENT_PHP//./}"*
|
||||
$STD apt-get install -y \
|
||||
php8.4 composer \
|
||||
php8.4-{gd,mysql,mbstring,bcmath,xml,curl,zip,intl,fpm} \
|
||||
libapache2-mod-php8.4
|
||||
msg_ok "Migrated PHP $CURRENT_PHP to 8.4"
|
||||
fi
|
||||
|
||||
if check_for_gh_release "Kimai" "kimai/kimai"; then
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/kimai/kimai/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||
BACKUP_DIR="/opt/kimai_backup"
|
||||
|
||||
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
|
||||
msg_info "Stopping Apache2"
|
||||
systemctl stop apache2
|
||||
msg_ok "Stopped Apache2"
|
||||
@@ -49,9 +60,15 @@ function update_script() {
|
||||
[ -f /opt/kimai/config/packages/local.yaml ] && cp /opt/kimai/config/packages/local.yaml "$BACKUP_DIR/"
|
||||
msg_ok "Backup completed"
|
||||
|
||||
fetch_and_deploy_gh_release "Kimai" "kimai/kimai" "prebuild" "latest" "/opt/kimai" "kimai-release-*.zip"
|
||||
|
||||
msg_info "Updating Kimai"
|
||||
msg_info "Updating ${APP} to ${RELEASE}"
|
||||
trap "echo Unable to download release file for version ${RELEASE}; try again later" ERR
|
||||
set -e
|
||||
curl -fsSL "https://github.com/kimai/kimai/archive/refs/tags/${RELEASE}.zip" -o $(basename "https://github.com/kimai/kimai/archive/refs/tags/${RELEASE}.zip")
|
||||
$STD unzip "${RELEASE}".zip
|
||||
set +e
|
||||
trap - ERR
|
||||
rm -rf /opt/kimai
|
||||
mv kimai-"${RELEASE}" /opt/kimai
|
||||
[ -d "$BACKUP_DIR/var" ] && cp -r "$BACKUP_DIR/var" /opt/kimai/
|
||||
[ -f "$BACKUP_DIR/.env" ] && cp "$BACKUP_DIR/.env" /opt/kimai/
|
||||
[ -f "$BACKUP_DIR/local.yaml" ] && cp "$BACKUP_DIR/local.yaml" /opt/kimai/config/packages/
|
||||
@@ -59,7 +76,8 @@ function update_script() {
|
||||
cd /opt/kimai
|
||||
$STD composer install --no-dev --optimize-autoloader
|
||||
$STD bin/console kimai:update
|
||||
msg_ok "Updated Kimai"
|
||||
echo "${RELEASE}" >/opt/${APP}_version.txt
|
||||
msg_ok "Updated ${APP} to ${RELEASE}"
|
||||
|
||||
msg_info "Starting Apache2"
|
||||
systemctl start apache2
|
||||
@@ -72,7 +90,14 @@ function update_script() {
|
||||
chown -R www-data:www-data /opt/*
|
||||
chmod -R 777 /opt/*
|
||||
msg_ok "Setup Permissions"
|
||||
msg_ok "Updated Successfully!"
|
||||
|
||||
msg_info "Cleaning Up"
|
||||
rm -rf "${RELEASE}".zip
|
||||
rm -rf "$BACKUP_DIR"
|
||||
msg_ok "Cleaned"
|
||||
msg_ok "Updated Successfully"
|
||||
else
|
||||
msg_ok "No update required. ${APP} is already at ${RELEASE}"
|
||||
fi
|
||||
exit
|
||||
}
|
||||
|
||||
@@ -40,6 +40,29 @@ function update_script() {
|
||||
sed -i 's|^EnvironmentFile=.*|EnvironmentFile=/opt/tracktor.env|' /etc/systemd/system/tracktor.service
|
||||
systemctl daemon-reload
|
||||
fi
|
||||
if [ ! -d "/opt/tracktor-data/uploads" ]; then
|
||||
mkdir -p /opt/tracktor-data/{uploads,logs}
|
||||
EXISTING_AUTH_PIN=$(grep '^AUTH_PIN=' /opt/tracktor.env 2>/dev/null | cut -d'=' -f2)
|
||||
AUTH_PIN=${EXISTING_AUTH_PIN:-123456}
|
||||
cat <<EOF >/opt/tracktor.env
|
||||
NODE_ENV=production
|
||||
DB_PATH=/opt/tracktor-data/tracktor.db
|
||||
UPLOADS_DIR="/opt/tracktor-data/uploads"
|
||||
LOG_DIR="/opt/tracktor-data/logs"
|
||||
# If server host is not set by default it will run on all interfaces - 0.0.0.0
|
||||
# SERVER_HOST=""
|
||||
SERVER_PORT=3000
|
||||
# Set this if you want to secure your endpoints otherwise default will be "*"
|
||||
CORS_ORIGINS="*"
|
||||
# Set this if you are using backend and frontend separately.
|
||||
# PUBLIC_API_BASE_URL=""
|
||||
LOG_REQUESTS=true
|
||||
LOG_LEVEL="info"
|
||||
AUTH_PIN=${AUTH_PIN}
|
||||
# PUBLIC_DEMO_MODE=false
|
||||
# FORCE_DATA_SEED=false
|
||||
EOF
|
||||
fi
|
||||
msg_ok "Corrected Services"
|
||||
|
||||
setup_nodejs
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
"updateable": true,
|
||||
"privileged": false,
|
||||
"interface_port": 3000,
|
||||
"documentation": "https://tracktor.bytedge.in/introduction.html",
|
||||
"documentation": "https://github.com/javedh-dev/tracktor/tree/main/docs",
|
||||
"config_path": "/opt/tracktor.env",
|
||||
"website": "https://tracktor.bytedge.in/",
|
||||
"website": "https://github.com/javedh-dev/tracktor",
|
||||
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/tracktor.webp",
|
||||
"description": "Tracktor is an open-source web application for comprehensive vehicle management.\nEasily track fuel consumption, maintenance, insurance, and regulatory documents for all your vehicles in one place.",
|
||||
"install_methods": [
|
||||
|
||||
@@ -20,22 +20,22 @@ $STD apt-get install -y \
|
||||
libjemalloc2
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
setup_mariadb
|
||||
setup_mysql
|
||||
|
||||
msg_info "Configuring Database"
|
||||
DB_NAME=ghost
|
||||
DB_USER=ghostuser
|
||||
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
|
||||
$STD mariadb -u root -e "CREATE DATABASE $DB_NAME;"
|
||||
$STD mariadb -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PASS';"
|
||||
$STD mariadb -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;"
|
||||
$STD mysql -u root -e "CREATE DATABASE $DB_NAME;"
|
||||
$STD mysql -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PASS';"
|
||||
$STD mysql -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;"
|
||||
{
|
||||
echo "Ghost-Credentials"
|
||||
echo "Ghost Database User: $DB_USER"
|
||||
echo "Ghost Database Password: $DB_PASS"
|
||||
echo "Ghost Database Name: $DB_NAME"
|
||||
} >>~/ghost.creds
|
||||
msg_ok "Configured MariaDB"
|
||||
msg_ok "Configured MySQL"
|
||||
|
||||
NODE_VERSION="22" setup_nodejs
|
||||
|
||||
@@ -60,5 +60,4 @@ customize
|
||||
msg_info "Cleaning up"
|
||||
$STD apt-get -y autoremove
|
||||
$STD apt-get -y autoclean
|
||||
$STD apt-get -y clean
|
||||
msg_ok "Cleaned"
|
||||
|
||||
@@ -18,21 +18,36 @@ $STD apt-get install -y \
|
||||
apt-transport-https \
|
||||
apache2 \
|
||||
git \
|
||||
expect
|
||||
expect \
|
||||
composer \
|
||||
lsb-release
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
setup_mariadb
|
||||
PHP_VERSION="8.4" PHP_MODULE="gd,mysql,mbstring,bcmath,xml,curl,zip,intl" PHP_APACHE="YES" setup_php
|
||||
setup_composer
|
||||
setup_mysql
|
||||
|
||||
msg_info "Adding PHP8.4 Repository"
|
||||
$STD curl -sSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb
|
||||
$STD dpkg -i /tmp/debsuryorg-archive-keyring.deb
|
||||
$STD sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
|
||||
$STD apt-get update
|
||||
msg_ok "Added PHP8.4 Repository"
|
||||
|
||||
msg_info "Installing PHP"
|
||||
$STD apt-get remove -y php8.2*
|
||||
$STD apt-get install -y \
|
||||
php8.4 \
|
||||
php8.4-{gd,mysql,mbstring,bcmath,xml,curl,zip,intl} \
|
||||
libapache2-mod-php8.4
|
||||
msg_ok "Installed PHP"
|
||||
|
||||
msg_info "Setting up database"
|
||||
DB_NAME=kimai_db
|
||||
DB_USER=kimai
|
||||
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
|
||||
MYSQL_VERSION=$(mariadb --version | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
|
||||
$STD mariadb -u root -e "CREATE DATABASE $DB_NAME;"
|
||||
$STD mariadb -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PASS';"
|
||||
$STD mariadb -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;"
|
||||
MYSQL_VERSION=$(mysql --version | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
|
||||
$STD mysql -u root -e "CREATE DATABASE $DB_NAME;"
|
||||
$STD mysql -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PASS';"
|
||||
$STD mysql -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;"
|
||||
{
|
||||
echo "Kimai-Credentials"
|
||||
echo "Kimai Database User: $DB_USER"
|
||||
@@ -41,9 +56,11 @@ $STD mariadb -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUS
|
||||
} >>~/kimai.creds
|
||||
msg_ok "Set up database"
|
||||
|
||||
fetch_and_deploy_gh_release "Kimai" "kimai/kimai" "prebuild" "latest" "/opt/kimai" "kimai-release-*.zip"
|
||||
|
||||
msg_info "Installing Kimai"
|
||||
msg_info "Installing Kimai (Patience)"
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/kimai/kimai/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||
curl -fsSL "https://github.com/kimai/kimai/archive/refs/tags/${RELEASE}.zip" -o "${RELEASE}".zip
|
||||
$STD unzip "${RELEASE}".zip
|
||||
mv kimai-"${RELEASE}" /opt/kimai
|
||||
cd /opt/kimai
|
||||
echo "export COMPOSER_ALLOW_SUPERUSER=1" >>~/.bashrc
|
||||
source ~/.bashrc
|
||||
@@ -75,6 +92,8 @@ admin_lte:
|
||||
options:
|
||||
default_avatar: build/apple-touch-icon.png
|
||||
EOF
|
||||
|
||||
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
|
||||
msg_ok "Installed Kimai"
|
||||
|
||||
msg_info "Creating Service"
|
||||
@@ -111,7 +130,7 @@ motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning up"
|
||||
$STD apt -y autoremove
|
||||
$STD apt -y autoclean
|
||||
$STD apt -y clean
|
||||
rm -rf "${RELEASE}".zip
|
||||
$STD apt-get -y autoremove
|
||||
$STD apt-get -y autoclean
|
||||
msg_ok "Cleaned"
|
||||
|
||||
@@ -14,19 +14,19 @@ network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing dependencies"
|
||||
$STD apt install -y build-essential
|
||||
$STD apt install --no-install-recommends -y build-essential
|
||||
msg_ok "Installed dependencies"
|
||||
|
||||
NODE_VERSION="22" setup_nodejs
|
||||
setup_mariadb
|
||||
MYSQL_VERSION="8.0" setup_mysql
|
||||
|
||||
msg_info "Setting up Database"
|
||||
DB_NAME="mmdl"
|
||||
DB_USER="mmdl"
|
||||
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
|
||||
$STD mariadb -u root -e "CREATE DATABASE $DB_NAME;"
|
||||
$STD mariadb -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED by '$DB_PASS';"
|
||||
$STD mariadb -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;"
|
||||
$STD mysql -u root -e "CREATE DATABASE $DB_NAME;"
|
||||
$STD mysql -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED by '$DB_PASS';"
|
||||
$STD mysql -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;"
|
||||
{
|
||||
echo "Manage My Damn Life Credentials"
|
||||
echo "Database User: $DB_USER"
|
||||
@@ -59,7 +59,7 @@ msg_info "Creating Service"
|
||||
cat <<EOF >/etc/systemd/system/mmdl.service
|
||||
[Unit]
|
||||
Description=${APPLICATION} Service
|
||||
After=network.target mariadb.service
|
||||
After=network.target mysql.service
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=/opt/mmdl
|
||||
|
||||
@@ -20,18 +20,26 @@ msg_info "Configuring Tracktor"
|
||||
cd /opt/tracktor
|
||||
$STD npm install
|
||||
$STD npm run build
|
||||
mkdir /opt/tracktor-data
|
||||
mkdir -p /opt/tracktor-data/{uploads,logs}
|
||||
HOST_IP=$(hostname -I | awk '{print $1}')
|
||||
cat <<EOF >/opt/tracktor.env
|
||||
NODE_ENV=production
|
||||
PUBLIC_DEMO_MODE=false
|
||||
DB_PATH=/opt/tracktor-data/tracktor.db
|
||||
# Replace this URL if using behind reverse proxy for https traffic. Though it is optional and should work without changing
|
||||
PUBLIC_API_BASE_URL=http://$HOST_IP:3000
|
||||
# Here add the reverse proxy url as well to avoid cross errors from the app.
|
||||
CORS_ORIGINS=http://$HOST_IP:3000
|
||||
UPLOADS_DIR="/opt/tracktor-data/uploads"
|
||||
LOG_DIR="/opt/tracktor-data/logs"
|
||||
# If server host is not set by default it will run on all interfaces - 0.0.0.0
|
||||
# SERVER_HOST=""
|
||||
SERVER_PORT=3000
|
||||
PORT=3000
|
||||
# Set this if you want to secure your endpoints otherwise default will be "*"
|
||||
# CORS_ORIGINS="*"
|
||||
# Set this if you are using backend and frontend separately. For lxc installation this is not needed
|
||||
# PUBLIC_API_BASE_URL=""
|
||||
LOG_REQUESTS=true
|
||||
LOG_LEVEL="info"
|
||||
AUTH_PIN=123456
|
||||
# PUBLIC_DEMO_MODE=false
|
||||
# FORCE_DATA_SEED=false
|
||||
EOF
|
||||
msg_ok "Configured Tracktor"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user