Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions ct/frappe-hrms.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#!/usr/bin/env bash
_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/DevScripts/main"
_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func"
source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func")

# Copyright (c) 2021-2026 community-scripts ORG
# Author: Davor Ornik (davorornik)
# License: MIT | https://github.com/community-scripts/DevScripts/raw/main/LICENSE
# Source: https://github.com/frappe/hrms

APP="Frappe-HRMS"
var_tags="${var_tags:-hr;business;erp;frappe}"
var_cpu="${var_cpu:-4}"
var_ram="${var_ram:-8192}"
var_disk="${var_disk:-20}"
var_os="${var_os:-debian}"
var_version="${var_version:-13}"
var_arm64="${var_arm64:-yes}"
var_unprivileged="${var_unprivileged:-1}"

export var_hrms_site="${var_hrms_site:-}"

header_info "$APP"
variables
color
catch_errors

function update_script() {
header_info
check_container_storage
check_container_resources

if [[ ! -d /opt/frappe-bench ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi

if check_for_gh_release "pdfkiln" "pdfkiln/pdfkiln"; then
fetch_and_deploy_gh_release "pdfkiln" "pdfkiln/pdfkiln" "binary" "latest" "" "pdfkiln_*_$(arch_resolve).deb"
fi

if check_for_gh_release "hrms" "frappe/hrms" "" "" "v16."; then
NODE_VERSION="24" NODE_MODULE="yarn" setup_nodejs

msg_info "Stopping Frappe HRMS"
$STD supervisorctl stop frappe-bench-web: frappe-bench-workers:
msg_ok "Stopped Frappe HRMS"

msg_info "Updating Frappe HRMS"
$STD sudo -u frappe bash -c 'export PATH="$HOME/.local/bin:$PATH"; cd /opt/frappe-bench && bench update --reset'
echo "${CHECK_UPDATE_RELEASE#v}" >~/.hrms
msg_ok "Updated Frappe HRMS"

msg_info "Starting Frappe HRMS"
$STD supervisorctl start all
msg_ok "Started Frappe HRMS"
msg_ok "Updated successfully!"
fi
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:${CL}"
echo -e "${GATEWAY}${BGN}http://${IP}${CL}"
echo -e "${INFO}${YW}Login: Administrator / ADMIN_PASSWORD in /opt/frappe-bench/.env (inside the container)${CL}"
112 changes: 112 additions & 0 deletions install/frappe-hrms-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
#!/usr/bin/env bash

# Copyright (c) 2021-2026 community-scripts ORG
# Author: Davor Ornik (davorornik)
# License: MIT | https://github.com/community-scripts/DevScripts/raw/main/LICENSE
# Source: https://github.com/frappe/hrms

source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os

SITE_NAME="${var_hrms_site:-site1.local}"

msg_info "Installing Dependencies"
$STD apt install -y \
git \
build-essential \
python3-dev \
libffi-dev \
libssl-dev \
redis-server \
nginx \
supervisor \
fail2ban \
xvfb \
libfontconfig1 \
libxrender1 \
fontconfig \
libjpeg-dev \
libmariadb-dev \
pkg-config \
cron
msg_ok "Installed Dependencies"

NODE_VERSION="24" NODE_MODULE="yarn" setup_nodejs
PYTHON_VERSION="3.14" setup_uv
setup_mariadb

msg_info "Configuring MariaDB for Frappe"
cat <<EOF >/etc/mysql/mariadb.conf.d/50-erpnext.cnf
[mysqld]
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci

[client]
default-character-set=utf8mb4
EOF
$STD systemctl restart mariadb
msg_ok "Configured MariaDB for Frappe"

fetch_and_deploy_gh_release "pdfkiln" "pdfkiln/pdfkiln" "binary" "latest" "" "pdfkiln_*_$(arch_resolve).deb"

msg_info "Installing Frappe Bench"
useradd -m -s /bin/bash frappe
chown frappe:frappe /opt
echo "frappe ALL=(ALL) NOPASSWD:ALL" >/etc/sudoers.d/frappe
$STD sudo -u frappe bash -c 'export PATH="$HOME/.local/bin:$PATH"; uv tool install frappe-bench --with pip'
msg_ok "Installed Frappe Bench"

msg_info "Initializing Frappe Bench"
ADMIN_PASS=$(random_password 13)
DB_ROOT_PASS=$(random_password 13)
mysql -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '${DB_ROOT_PASS}'; FLUSH PRIVILEGES;"
$STD sudo -u frappe bash -c 'export PATH="$HOME/.local/bin:$PATH"; uv python install 3.14'
$STD sudo -u frappe bash -c 'export PATH="$HOME/.local/bin:$PATH"; cd /opt && bench init --frappe-branch version-16 --python "$(uv python find 3.14)" frappe-bench'
$STD sudo -u frappe bash -c 'export PATH="$HOME/.local/bin:$PATH"; cd /opt/frappe-bench && bench get-app erpnext --branch version-16'
$STD sudo -u frappe bash -c 'export PATH="$HOME/.local/bin:$PATH"; cd /opt/frappe-bench && bench get-app hrms --branch version-16'
msg_ok "Initialized Frappe Bench"

msg_info "Starting Redis Services for Site Setup"
$STD sudo -u frappe bash -c 'redis-server /opt/frappe-bench/config/redis_queue.conf --daemonize yes'
$STD sudo -u frappe bash -c 'redis-server /opt/frappe-bench/config/redis_cache.conf --daemonize yes'
sleep 3
msg_ok "Started Redis Services for Site Setup"

msg_info "Creating Site ${SITE_NAME}"
$STD sudo -u frappe bash -c "export PATH=\"\$HOME/.local/bin:\$PATH\"; cd /opt/frappe-bench && bench new-site ${SITE_NAME} --db-root-username root --db-root-password \"$DB_ROOT_PASS\" --admin-password \"$ADMIN_PASS\" --install-app erpnext --set-default"
$STD sudo -u frappe bash -c "export PATH=\"\$HOME/.local/bin:\$PATH\"; cd /opt/frappe-bench && bench --site ${SITE_NAME} install-app hrms"
msg_ok "Created Site ${SITE_NAME}"

msg_info "Configuring Frappe HRMS"
cat <<EOF >/opt/frappe-bench/.env
ADMIN_PASSWORD=${ADMIN_PASS}
DB_ROOT_PASSWORD=${DB_ROOT_PASS}
SITE_NAME=${SITE_NAME}
EOF
chown frappe:frappe /opt/frappe-bench/.env
chmod 600 /opt/frappe-bench/.env
$STD systemctl enable --now redis-server
pkill -u frappe redis-server || true
msg_ok "Configured Frappe HRMS"

msg_info "Setting up Production"
$STD sudo -u frappe bash -c 'export PATH="$HOME/.local/bin:$PATH"; uv tool install ansible'
ln -sf /home/frappe/.local/bin/ansible* /usr/local/bin/
$STD bash -c 'export PATH="/home/frappe/.local/bin:$PATH"; cd /opt/frappe-bench && bench setup production frappe --yes'
ln -sf /opt/frappe-bench/config/supervisor.conf /etc/supervisor/conf.d/frappe-bench.conf
$STD supervisorctl reread
$STD supervisorctl update
$STD systemctl enable --now supervisor
msg_ok "Set up Production"

# record the installed release so the first update has something to compare against
check_for_gh_release "hrms" "frappe/hrms" "" "" "v16." && echo "${CHECK_UPDATE_RELEASE#v}" >~/.hrms

motd_ssh
customize
cleanup_lxc
60 changes: 60 additions & 0 deletions json/frappe-hrms.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"name": "Frappe HRMS",
"slug": "frappe-hrms",
"categories": [
25
],
"date_created": "2026-12-01",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": 80,
"documentation": "https://docs.frappe.io/hr/introduction",
"website": "https://frappe.io/hr",
"repository": "https://github.com/frappe/hrms",
"architectures": [
"amd64",
"arm64"
],
"platforms": [
"pve"
],
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/frappe.webp",
"description": "Frappe HRMS is an open source HR and payroll system built on the Frappe framework. It covers employee management, onboarding, leave, attendance, recruitment, payroll, taxation and expense claims, with a mobile app.",
"install_methods": [
{
"type": "default",
"script": "ct/frappe-hrms.sh",
"config_path": "/opt/frappe-bench/.env",
"resources": {
"cpu": 4,
"ram": 8192,
"hdd": 20,
"os": "Debian",
"version": "13"
}
}
],
"default_credentials": {
"username": "Administrator",
"password": null
},
"notes": [
{
"text": "The site name defaults to site1.local; set var_hrms_site (e.g. the public hostname) before running the script to change it. The site answers on any host, so the container IP works too.",
"type": "info"
},
{
"text": "The admin password is in /opt/frappe-bench/.env inside the container.",
"type": "info"
}
],
"app_vars": [
{
"name": "var_hrms_site",
"label": "Site name",
"type": "text",
"default": ""
}
]
}
Loading