Skip to content

Commit 7f6ff40

Browse files
authored
Merge pull request #637 from Stroopwafe1/leantime
Feat: Add script to install leantime
2 parents 133f088 + 9989b15 commit 7f6ff40

3 files changed

Lines changed: 186 additions & 0 deletions

File tree

ct/leantime.sh

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/usr/bin/env bash
2+
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func)
3+
4+
# Copyright (c) 2021-2025 community-scripts ORG
5+
# Author: Stroopwafe1
6+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
7+
# Source: https://leantime.io
8+
9+
APP="Leantime"
10+
var_tags="${var_tags:-productivity}"
11+
var_cpu="${var_cpu:-2}"
12+
var_ram="${var_ram:-2048}"
13+
var_disk="${var_disk:-20}"
14+
var_os="${var_os:-debian}"
15+
var_version="${var_version:-12}"
16+
var_unprivileged="${var_unprivileged:-1}"
17+
18+
header_info "$APP"
19+
variables
20+
color
21+
catch_errors
22+
23+
function update_script() {
24+
header_info
25+
check_container_storage
26+
check_container_resources
27+
28+
if [[ ! -d /opt/${APP} ]]; then
29+
msg_error "No ${APP} Installation Found!"
30+
exit
31+
fi
32+
33+
msg_info "Creating Backup"
34+
mariadb-dump leantime >"/opt/${APP}_db_backup_$(date +%F).sql"
35+
tar -czf "/opt/${APP}_backup_$(date +%F).tar.gz" "/opt/${APP}"
36+
msg_ok "Backup Created"
37+
fetch_and_deploy_gh_release "$APP" "Leantime/leantime" "prebuild" "latest" "/opt/${APP}" Leantime-v[0-9].[0-9].[0-9].tar.gz
38+
exit
39+
}
40+
41+
start
42+
build_container
43+
description
44+
45+
msg_ok "Completed Successfully!\n"
46+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
47+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
48+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}/install${CL}"

frontend/public/json/leantime.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "Leantime",
3+
"slug": "leantime",
4+
"categories": [
5+
12
6+
],
7+
"date_created": "2025-06-27",
8+
"type": "ct",
9+
"updateable": true,
10+
"privileged": false,
11+
"interface_port": 80,
12+
"documentation": "https://docs.leantime.io/",
13+
"config_path": "/opt/Leantime/config/.env",
14+
"website": "https://leantime.io",
15+
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/leantime.webp",
16+
"description": "Leantime is a goals focused project management system for non-project managers. Building with ADHD, Autism, and dyslexia in mind. ",
17+
"install_methods": [
18+
{
19+
"type": "default",
20+
"script": "ct/leantime.sh",
21+
"resources": {
22+
"cpu": 2,
23+
"ram": 2048,
24+
"hdd": 20,
25+
"os": "Debian",
26+
"version": "12"
27+
}
28+
}
29+
],
30+
"default_credentials": {
31+
"username": null,
32+
"password": null
33+
},
34+
"notes": []
35+
}

install/leantime-install.sh

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: Stroopwafe1
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://leantime.io
7+
8+
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
9+
color
10+
verb_ip6
11+
catch_errors
12+
setting_up_container
13+
network_check
14+
update_os
15+
16+
PHP_VERSION=8.4
17+
PHP_MODULE=mysql
18+
PHP_APACHE=YES
19+
PHP_FPM=YES
20+
21+
msg_info "Installing Apache2"
22+
$STD apt-get install -y \
23+
apache2
24+
msg_ok "Installed Apache2"
25+
26+
setup_php
27+
28+
msg_info "Installing Apache2 mod for PHP"
29+
$STD apt-get install -y \
30+
"libapache2-mod-php${PHP_VERSION}"
31+
msg_ok "Installed Apache2 mod"
32+
33+
setup_mariadb
34+
35+
msg_ok "Installed Dependencies"
36+
37+
msg_info "Setting up Database"
38+
systemctl enable -q --now mariadb
39+
DB_NAME=leantime
40+
DB_USER=leantime
41+
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
42+
$STD mysql -u root -e "CREATE DATABASE $DB_NAME;"
43+
$STD mysql -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED WITH mysql_native_password AS PASSWORD('$DB_PASS');"
44+
$STD mysql -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;"
45+
{
46+
echo "${APPLICATION} Credentials"
47+
echo "Database User: $DB_USER"
48+
echo "Database Password: $DB_PASS"
49+
echo "Database Name: $DB_NAME"
50+
} >>~/"$APPLICATION".creds
51+
msg_ok "Set up Database"
52+
53+
msg_info "Setup ${APPLICATION}"
54+
APACHE_LOG_DIR=/var/log/apache2
55+
fetch_and_deploy_gh_release "$APPLICATION" "Leantime/leantime" "prebuild" "latest" "/opt/${APPLICATION}" Leantime-v[0-9].[0-9].[0-9].tar.gz
56+
chown -R www-data:www-data "/opt/${APPLICATION}"
57+
chmod -R 750 "/opt/${APPLICATION}"
58+
59+
cat <<EOF >/etc/apache2/sites-enabled/000-default.conf
60+
<VirtualHost *:80>
61+
ServerAdmin webmaster@localhost
62+
DocumentRoot /opt/${APPLICATION}/public
63+
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml
64+
Options +ExecCGI
65+
66+
<Directory /opt/${APPLICATION}/>
67+
Options FollowSymLinks
68+
Require all granted
69+
AllowOverride All
70+
</Directory>
71+
72+
<Location />
73+
Require all granted
74+
</Location>
75+
76+
ErrorLog ${APACHE_LOG_DIR}/error.log
77+
CustomLog ${APACHE_LOG_DIR}/access.log combined
78+
</VirtualHost>
79+
EOF
80+
81+
mv "/opt/${APPLICATION}/config/sample.env" "/opt/${APPLICATION}/config/.env"
82+
sed -i -e "s|^LEAN_DB_DATABASE.*|LEAN_DB_DATABASE = '$DB_NAME'|" \
83+
-e "s|^LEAN_DB_USER.*|LEAN_DB_USER = '$DB_USER'|" \
84+
-e "s|^LEAN_DB_PASSWORD.*|LEAN_DB_PASSWORD = '$DB_PASS'|" \
85+
-e "s|^LEAN_SESSION_PASSWORD.*|LEAN_SESSION_PASSWORD = '$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)'|" \
86+
"/opt/${APPLICATION}/config/.env"
87+
88+
a2enmod -q proxy_fcgi setenvif rewrite
89+
a2enconf -q "php${PHP_VERSION}-fpm"
90+
91+
sed -i -e "s/^;extension.\(curl\|fileinfo\|gd\|intl\|ldap\|mbstring\|exif\|mysqli\|odbc\|openssl\|pdo_mysql\)/extension=\1/g" "/etc/php/${PHP_VERSION}/apache2/php.ini"
92+
93+
systemctl restart apache2
94+
95+
msg_ok "Setup ${APPLICATION}"
96+
97+
motd_ssh
98+
customize
99+
100+
msg_info "Cleaning up"
101+
$STD apt-get -y autoremove
102+
$STD apt-get -y autoclean
103+
msg_ok "Cleaned"

0 commit comments

Comments
 (0)