added ct minthcm
This commit is contained in:
parent
c84485d5f4
commit
a827025d1e
44
ct/minthcm.sh
Normal file
44
ct/minthcm.sh
Normal file
@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env bash
|
||||
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
|
||||
# Copyright (c) 2021-2025 minthcm
|
||||
# Author: MintHCM
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/minthcm/minthcm
|
||||
|
||||
APP="MintHCM"
|
||||
var_tags="${var_tags:-hcm}"
|
||||
var_disk="${var_disk:-20}"
|
||||
var_cpu="${var_cpu:-4}"
|
||||
var_ram="${var_ram:-4096}"
|
||||
var_os="${var_os:-debian}"
|
||||
var_version="${var_version:-13}"
|
||||
var_unprivileged="${var_unprivileged:-1}"
|
||||
|
||||
header_info "$APP"
|
||||
variables
|
||||
color
|
||||
catch_errors
|
||||
|
||||
function update_script() {
|
||||
header_info "$APP"
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
|
||||
INSTALL_DIR="/var/www/MintHCM"
|
||||
|
||||
if [[ ! -d "${INSTALL_DIR}" ]] || [[ ! -d "${INSTALL_DIR}/.git" ]]; then
|
||||
msg_error "No ${APP} installation found in ${INSTALL_DIR}!"
|
||||
exit
|
||||
fi
|
||||
msg_error "Currently we don't provide an update function for this ${APP}."
|
||||
exit
|
||||
}
|
||||
|
||||
start
|
||||
build_container
|
||||
description
|
||||
|
||||
msg_ok "Completed Successfully!\n"
|
||||
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
||||
echo -e "${INFO}${YW} Access it using the following URL (after DB & installer are completed):${CL}"
|
||||
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}"
|
||||
35
frontend/public/json/minthcm.json
Normal file
35
frontend/public/json/minthcm.json
Normal file
@ -0,0 +1,35 @@
|
||||
{
|
||||
"name": "MintHCM",
|
||||
"slug": "minthcm",
|
||||
"categories": [
|
||||
25
|
||||
],
|
||||
"date_created": "2025-12-12",
|
||||
"type": "ct",
|
||||
"updateable": false,
|
||||
"privileged": false,
|
||||
"interface_port": 80,
|
||||
"documentation": "https://wiki.minthcm.org/",
|
||||
"config_path": "/var/www/MintHCM",
|
||||
"website": "https://minthcm.org/",
|
||||
"logo": "https://minthcm.org/wp-content/uploads/2021/03/minthcm-logo.svg",
|
||||
"description": "MintCHM is a free and open-source tool for Human Capital Management.\n\nMain features:\nrecruitment\ntime management\nonboarding & offboarding\ncalendar\nleave management\nresources booking\ntravel & expenses\nworkplace management\nanalytics\nroles & permissions management\njob descriptions\nemployer branding\nemployee profiles\ncompetences & skills\nemployment history\nemployee evaluations\niOS & Android mobile apps\nMint based on two popular, well-known business applications: SugarCRM Community Edition and SuiteCRM. This is why we often say that MintHCM is CRM reinvented.",
|
||||
"install_methods": [
|
||||
{
|
||||
"type": "default",
|
||||
"script": "ct/minthcm.sh",
|
||||
"resources": {
|
||||
"cpu": 4,
|
||||
"ram": 4096,
|
||||
"hdd": 20,
|
||||
"os": "debian",
|
||||
"version": "13"
|
||||
}
|
||||
}
|
||||
],
|
||||
"default_credentials": {
|
||||
"username": "admin",
|
||||
"password": "minthcm"
|
||||
},
|
||||
"notes": []
|
||||
}
|
||||
190
install/minthcm-install.sh
Normal file
190
install/minthcm-install.sh
Normal file
@ -0,0 +1,190 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2025 minthcm
|
||||
# Author: MintHCM
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/minthcm/minthcm
|
||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
APP_NAME="MintHCM"
|
||||
MINT_REPO="https://github.com/minthcm/minthcm.git"
|
||||
MINT_DIR="/var/www/MintHCM"
|
||||
PHP_VERSION="8.2"
|
||||
|
||||
# Install base packages required for MintHCM and system management
|
||||
msg_info "Installing base packages"
|
||||
$STD apt-get install -y git curl cron
|
||||
msg_ok "Base packages installed"
|
||||
|
||||
# PHP + Apache
|
||||
msg_info "Setting up PHP ${PHP_VERSION}"
|
||||
PHP_APACHE="YES" PHP_VERSION="${PHP_VERSION}" PHP_MODULE="mysql,cli,redis" PHP_FPM="YES" setup_php
|
||||
msg_ok "PHP ${PHP_VERSION} and required extensions installed"
|
||||
|
||||
msg_info "Setting up Composer"
|
||||
setup_composer || msg_error "Failed to setup Composer"
|
||||
msg_ok "Composer setup completed"
|
||||
|
||||
msg_info "Enabling Apache modules (rewrite, headers)"
|
||||
$STD a2enmod rewrite
|
||||
$STD a2enmod headers
|
||||
msg_ok "Apache2 with rewrite and headers modules configured"
|
||||
|
||||
# MintHCM configuration files
|
||||
msg_info "Downloading PHP configuration for MintHCM"
|
||||
PHP_MODS_DIR="/etc/php/${PHP_VERSION}/mods-available"
|
||||
PHP_MINTHCM_INI="${PHP_MODS_DIR}/php-minthcm.ini"
|
||||
|
||||
mkdir -p "${PHP_MODS_DIR}"
|
||||
|
||||
curl -fsSL \
|
||||
"https://raw.githubusercontent.com/minthcm/minthcm/master/docker/config/php-minthcm.ini" \
|
||||
-o "${PHP_MINTHCM_INI}" \
|
||||
|| msg_error "Failed to download php-minthcm.ini"
|
||||
|
||||
mkdir -p "/etc/php/${PHP_VERSION}/cli/conf.d" "/etc/php/${PHP_VERSION}/apache2/conf.d"
|
||||
|
||||
if [[ ! -e "/etc/php/${PHP_VERSION}/cli/conf.d/20-minthcm.ini" ]]; then
|
||||
ln -s "${PHP_MINTHCM_INI}" "/etc/php/${PHP_VERSION}/cli/conf.d/20-minthcm.ini" \
|
||||
|| msg_error "Failed to create CLI symlink for php-minthcm.ini"
|
||||
fi
|
||||
|
||||
if [[ ! -e "/etc/php/${PHP_VERSION}/apache2/conf.d/20-minthcm.ini" ]]; then
|
||||
ln -s "${PHP_MINTHCM_INI}" "/etc/php/${PHP_VERSION}/apache2/conf.d/20-minthcm.ini" \
|
||||
|| msg_error "Failed to create Apache symlink for php-minthcm.ini"
|
||||
fi
|
||||
|
||||
msg_ok "PHP configuration for MintHCM applied"
|
||||
|
||||
# Apache VirtualHost configuration for MintHCM
|
||||
msg_info "Downloading Apache VirtualHost configuration for MintHCM"
|
||||
curl -fsSL \
|
||||
"https://raw.githubusercontent.com/minthcm/minthcm/master/docker/config/000-default.conf" \
|
||||
-o "/etc/apache2/sites-available/000-default.conf" \
|
||||
|| msg_error "Failed to download 000-default.conf"
|
||||
msg_ok "Apache VirtualHost configuration updated for MintHCM"
|
||||
|
||||
# Clone MintHCM repository into the target directory
|
||||
msg_info "Cloning MintHCM repository"
|
||||
if [[ -d "${MINT_DIR}" ]]; then
|
||||
msg_warn "Directory ${MINT_DIR} already exists, skipping clone"
|
||||
else
|
||||
mkdir -p "$(dirname "${MINT_DIR}")"
|
||||
$STD git clone --depth=1 "${MINT_REPO}" "${MINT_DIR}" || msg_error "Failed to clone MintHCM repository"
|
||||
fi
|
||||
msg_ok "MintHCM repository available at ${MINT_DIR}"
|
||||
|
||||
# Set ownership and permissions for MintHCM directory
|
||||
msg_info "Setting ownership and permissions for MintHCM directory"
|
||||
git config --global --add safe.directory "${MINT_DIR}"
|
||||
chown -R www-data:www-data "${MINT_DIR}"
|
||||
find "${MINT_DIR}" -type d -exec chmod 755 {} \;
|
||||
find "${MINT_DIR}" -type f -exec chmod 644 {} \;
|
||||
msg_ok "Ownership and permissions for MintHCM directory set"
|
||||
|
||||
# Restart Apache2 to apply all new configuration
|
||||
msg_info "Restarting Apache2 with new configuration"
|
||||
$STD systemctl restart apache2 || msg_error "Failed to restart Apache2"
|
||||
msg_ok "Apache2 restarted"
|
||||
|
||||
# Elasticsearch
|
||||
msg_info "Setting up Elasticsearch"
|
||||
setup_deb822_repo \
|
||||
"elasticsearch" \
|
||||
"https://artifacts.elastic.co/GPG-KEY-elasticsearch" \
|
||||
"https://artifacts.elastic.co/packages/7.x/apt" \
|
||||
"stable" \
|
||||
"main"
|
||||
|
||||
$STD apt install -y elasticsearch || msg_error "Failed to install Elasticsearch"
|
||||
|
||||
echo "-Xms2g" >>/etc/elasticsearch/jvm.options
|
||||
echo "-Xmx2g" >>/etc/elasticsearch/jvm.options
|
||||
|
||||
$STD /usr/share/elasticsearch/bin/elasticsearch-plugin install ingest-attachment -b \
|
||||
|| msg_error "Failed to install Elasticsearch ingest-attachment plugin"
|
||||
|
||||
systemctl enable -q elasticsearch
|
||||
systemctl restart -q elasticsearch
|
||||
msg_ok "Elasticsearch setup completed"
|
||||
|
||||
# MariaDB
|
||||
msg_info "Setting up MariaDB"
|
||||
setup_mariadb || msg_error "Failed to setup MariaDB"
|
||||
$STD mariadb -u root -e "SET GLOBAL sql_mode=''";
|
||||
msg_ok "MariaDB setup completed"
|
||||
|
||||
msg_info "Configuring database for MintHCM"
|
||||
DB_USER="minthcm"
|
||||
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
|
||||
|
||||
$STD mariadb -u root -e "CREATE USER '${DB_USER}'@'localhost' IDENTIFIED BY '${DB_PASS}';"
|
||||
|
||||
$STD mariadb -u root -e "GRANT ALL ON *.* TO '${DB_USER}'@'localhost'; FLUSH PRIVILEGES;"
|
||||
|
||||
msg_ok "Configured MariaDB for MintHCM"
|
||||
|
||||
#MintHCM config generate
|
||||
msg_info "Downloading generate_config.php script"
|
||||
mkdir -p /var/www/script
|
||||
|
||||
curl -fsSL \
|
||||
"https://raw.githubusercontent.com/minthcm/minthcm/master/docker/script/generate_config.php" \
|
||||
-o "/var/www/script/generate_config.php" \
|
||||
|| msg_error "Failed to download generate_config.php"
|
||||
|
||||
chown -R www-data:www-data /var/www/script
|
||||
msg_ok "generate_config.php script downloaded"
|
||||
|
||||
export DB_HOST=localhost
|
||||
export DB_NAME=minthcm
|
||||
export DB_PORT=3306
|
||||
export DB_USER=minthcm
|
||||
export DB_PASS=$DB_PASS
|
||||
export MINT_URL=localhost
|
||||
export MINT_USER=admin
|
||||
export MINT_PASS=minthcm
|
||||
export ELASTICSEARCH_HOST=localhost
|
||||
|
||||
{
|
||||
echo "MintHCM DB Credentials"
|
||||
echo "MariaDB User: $DB_USER"
|
||||
echo "MariaDB Password: $DB_PASS"
|
||||
} >>~/minthcm.creds
|
||||
|
||||
msg_info "Generating MintHCM configuration file (configMint4)"
|
||||
php /var/www/script/generate_config.php || msg_error "Failed to execute generate_config.php"
|
||||
|
||||
if [[ ! -f /var/www/MintHCM/configMint4 ]]; then
|
||||
msg_error "Error: Failed to generate configMint4 - please check the configuration"
|
||||
exit 1
|
||||
fi
|
||||
msg_ok "configMint4 generated"
|
||||
#MintHCM installation
|
||||
msg_info "Starting MintHCM installation..."
|
||||
cd /var/www/MintHCM && su -s /bin/bash -c 'php /var/www/MintHCM/MintCLI install < /var/www/MintHCM/configMint4' www-data
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
msg_error "Error: MintHCM installation failed - please check logs"
|
||||
else
|
||||
msg_ok "MintHCM installation completed!"
|
||||
msg_info "Configuring cron for MintHCM"
|
||||
printf "* * * * * cd /var/www/MintHCM/legacy; php -f cron.php > /dev/null 2>&1\n" > /var/spool/cron/crontabs/www-data \
|
||||
|| msg_error "Failed to configure cron for www-data"
|
||||
service cron start || msg_error "Failed to start cron service"
|
||||
rm -f /var/www/MintHCM/configMint4
|
||||
fi
|
||||
|
||||
|
||||
msg_ok "${APP_NAME} has been installed. Make sure to configure the database and other parameters according to the MintHCM documentation."
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
cleanup_lxc
|
||||
Loading…
x
Reference in New Issue
Block a user