Skip to content

Commit 293a220

Browse files
MickLeskbvdberg01
andauthored
Plant-it (#3000)
* Plant-it * update source * fix header * Update json/plant-it.json Co-authored-by: Bas van den Berg <[email protected]> * Update plant-it.sh --------- Co-authored-by: Bas van den Berg <[email protected]>
1 parent a0f7643 commit 293a220

File tree

3 files changed

+252
-0
lines changed

3 files changed

+252
-0
lines changed

ct/plant-it.sh

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/usr/bin/env bash
2+
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: MickLesk (CanbiZ)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://plant-it.org/
7+
8+
APP="Plant-it"
9+
var_tags="plants;garden"
10+
var_cpu="2"
11+
var_ram="2048"
12+
var_disk="5"
13+
var_os="debian"
14+
var_version="12"
15+
var_unprivileged="1"
16+
17+
header_info "$APP"
18+
variables
19+
color
20+
catch_errors
21+
22+
function update_script() {
23+
header_info
24+
check_container_storage
25+
check_container_resources
26+
27+
if [[ ! -d /opt/plant-it ]]; then
28+
msg_error "No ${APP} Installation Found!"
29+
exit
30+
fi
31+
32+
RELEASE=$(curl -s https://api.github.com/repos/MDeLuise/plant-it/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
33+
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
34+
msg_info "Stopping $APP"
35+
systemctl stop plant-it
36+
msg_ok "Stopped $APP"
37+
38+
msg_info "Updating $APP to v${RELEASE}"
39+
wget -q -O /opt/plant-it/server.jar "https://github.com/MDeLuise/plant-it/releases/download/${RELEASE}/server.jar"
40+
cd /opt/plant-it/frontend
41+
wget -q https://github.com/MDeLuise/plant-it/releases/download/${RELEASE}/client.tar.gz
42+
tar -xzf client.tar.gz
43+
rm -f client.tar.gz
44+
echo "${RELEASE}" >/opt/${APP}_version.txt
45+
msg_ok "Updated $APP to v${RELEASE}"
46+
47+
msg_info "Starting $APP"
48+
systemctl start plant-it
49+
msg_ok "Started $APP"
50+
msg_ok "Update Successful"
51+
else
52+
msg_ok "No update required. ${APP} is already at v${RELEASE}"
53+
fi
54+
exit
55+
}
56+
57+
start
58+
build_container
59+
description
60+
61+
msg_ok "Completed Successfully!\n"
62+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
63+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
64+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}"

install/plant-it-install.sh

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: MickLesk (CanbiZ)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://plant-it.org/
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+
msg_info "Installing Dependencies"
17+
$STD apt-get install -y \
18+
curl \
19+
mc \
20+
sudo \
21+
gnupg2 \
22+
mariadb-server \
23+
redis \
24+
nginx
25+
msg_ok "Installed Dependencies"
26+
27+
msg_info "Setting up Adoptium Repository"
28+
mkdir -p /etc/apt/keyrings
29+
wget -qO - https://packages.adoptium.net/artifactory/api/gpg/key/public | gpg --dearmor >/etc/apt/trusted.gpg.d/adoptium.gpg
30+
echo "deb https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" >/etc/apt/sources.list.d/adoptium.list
31+
$STD apt-get update
32+
msg_ok "Set up Adoptium Repository"
33+
34+
msg_info "Installing Temurin JDK 21 (LTS)"
35+
$STD apt-get install -y temurin-21-jdk
36+
msg_ok "Setup Temurin JDK 21 (LTS)"
37+
38+
msg_info "Setting up MariaDB"
39+
JWT_SECRET=$(openssl rand -base64 24 | tr -d '/+=')
40+
DB_NAME=plantit
41+
DB_USER=plantit_usr
42+
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
43+
$STD mysql -u root -e "CREATE DATABASE $DB_NAME;"
44+
$STD mysql -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED WITH mysql_native_password AS PASSWORD('$DB_PASS');"
45+
$STD mysql -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;"
46+
{
47+
echo "Plant-it Credentials"
48+
echo "Plant-it Database User: $DB_USER"
49+
echo "Plant-it Database Password: $DB_PASS"
50+
echo "Plant-it Database Name: $DB_NAME"
51+
} >>~/plant-it.creds
52+
msg_ok "Set up MariaDB"
53+
54+
msg_info "Setup Plant-it"
55+
RELEASE=$(curl -s https://api.github.com/repos/MDeLuise/plant-it/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
56+
wget -q https://github.com/MDeLuise/plant-it/releases/download/${RELEASE}/server.jar
57+
mkdir -p /opt/plant-it/{backend,frontend}
58+
mkdir -p /opt/plant-it-data
59+
mv -f server.jar /opt/plant-it/backend/server.jar
60+
61+
cat <<EOF >/opt/plant-it/backend/server.env
62+
MYSQL_HOST=localhost
63+
MYSQL_PORT=3306
64+
MYSQL_USERNAME=$DB_USER
65+
MYSQL_PSW=$DB_PASS
66+
MYSQL_DATABASE=$DB_NAME
67+
MYSQL_ROOT_PASSWORD=$DB_PASS
68+
69+
JWT_SECRET=$JWT_SECRET
70+
JWT_EXP=1
71+
72+
USERS_LIMIT=-1
73+
UPLOAD_DIR=/opt/plant-it-data
74+
API_PORT=8080
75+
FLORACODEX_KEY=
76+
LOG_LEVEL=DEBUG
77+
ALLOWED_ORIGINS=*
78+
79+
CACHE_TYPE=redis
80+
CACHE_TTL=86400
81+
CACHE_HOST=localhost
82+
CACHE_PORT=6379
83+
EOF
84+
85+
cd /opt/plant-it/frontend
86+
wget -q https://github.com/MDeLuise/plant-it/releases/download/${RELEASE}/client.tar.gz
87+
tar -xzf client.tar.gz
88+
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
89+
msg_ok "Setup Plant-it"
90+
91+
msg_info "Creating Service"
92+
cat <<EOF >/etc/systemd/system/plant-it.service
93+
[Unit]
94+
Description=Plant-it Backend Service
95+
After=syslog.target network.target
96+
97+
[Service]
98+
Type=simple
99+
WorkingDirectory=/opt/plant-it/backend
100+
EnvironmentFile=/opt/plant-it/backend/server.env
101+
ExecStart=/usr/bin/java -jar -Xmx2g server.jar
102+
TimeoutStopSec=20
103+
KillMode=process
104+
Restart=on-failure
105+
106+
[Install]
107+
WantedBy=multi-user.target
108+
EOF
109+
systemctl enable --now -q plant-it
110+
111+
cat <<EOF >/etc/nginx/nginx.conf
112+
events {
113+
worker_connections 1024;
114+
}
115+
116+
http {
117+
server {
118+
listen 3000;
119+
server_name localhost;
120+
121+
root /opt/plant-it/frontend;
122+
index index.html;
123+
124+
location / {
125+
try_files \$uri \$uri/ /index.html;
126+
}
127+
128+
error_page 404 /404.html;
129+
location = /404.html {
130+
internal;
131+
}
132+
}
133+
}
134+
EOF
135+
systemctl restart nginx
136+
msg_ok "Created Service"
137+
138+
motd_ssh
139+
customize
140+
141+
msg_info "Cleaning up"
142+
rm -rf /opt/plant-it/frontend/client.tar.gz
143+
$STD apt-get -y autoremove
144+
$STD apt-get -y autoclean
145+
msg_ok "Cleaned"

json/plant-it.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"name": "Plant-it",
3+
"slug": "plant-it",
4+
"categories": [
5+
24
6+
],
7+
"date_created": "2025-03-11",
8+
"type": "ct",
9+
"updateable": true,
10+
"privileged": false,
11+
"interface_port": 3000,
12+
"documentation": "https://docs.plant-it.org/latest/",
13+
"website": "https://plant-it.org/",
14+
"logo": "https://raw.githubusercontent.com/MDeLuise/plant-it/refs/heads/main/images/plant-it-logo.png",
15+
"description": "Plant-it is a self-hosted, open-source app designed to help users manage and track plant care. It allows users to add plants, log activities like watering, fertilizing, and pruning, set reminders, and upload photos for visual tracking. The app includes a database of over 400,000 plant species, offering detailed care information such as optimal growing conditions and maintenance tips.\n\nUsers can organize their plant collection, monitor growth, and share data with others. The app is free to use and works on Android, iOS, and the web.",
16+
"install_methods": [
17+
{
18+
"type": "default",
19+
"script": "ct/plant-it.sh",
20+
"resources": {
21+
"cpu": 2,
22+
"ram": 2048,
23+
"hdd": 5,
24+
"os": "debian",
25+
"version": "12"
26+
}
27+
}
28+
],
29+
"default_credentials": {
30+
"username": null,
31+
"password": null
32+
},
33+
"notes": [
34+
{
35+
"text": "This Script use Adoptium JDK 21 - Sometimes the installation of these takes a while",
36+
"type": "info"
37+
},
38+
{
39+
"text": "After the initial start, the backend requires approx. 1-2 minutes boot time",
40+
"type": "info"
41+
}
42+
]
43+
}

0 commit comments

Comments
 (0)