Skip to content

Commit b70cd00

Browse files
authored
New script: Monica LXC (#1813)
* New script: Monica LXC * Update monica.json
1 parent 31473b2 commit b70cd00

File tree

3 files changed

+219
-0
lines changed

3 files changed

+219
-0
lines changed

ct/monica.sh

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
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: bvdberg01
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://www.monicahq.com/
7+
8+
# App Default Values
9+
APP="Monica"
10+
var_tags="network"
11+
var_cpu="2"
12+
var_ram="2048"
13+
var_disk="8"
14+
var_os="debian"
15+
var_version="12"
16+
var_unprivileged="1"
17+
18+
# App Output & Base Settings
19+
header_info "$APP"
20+
base_settings
21+
22+
# Core
23+
variables
24+
color
25+
catch_errors
26+
27+
function update_script() {
28+
header_info
29+
check_container_storage
30+
check_container_resources
31+
if [[ ! -d /opt/monica ]]; then
32+
msg_error "No ${APP} Installation Found!"
33+
exit
34+
fi
35+
RELEASE=$(curl -s https://api.github.com/repos/monicahq/monica/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
36+
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
37+
msg_info "Stopping Service"
38+
systemctl stop apache2
39+
msg_ok "Stopped Service"
40+
41+
msg_info "Updating ${APP} to v${RELEASE}"
42+
cd /opt
43+
mv /opt/monica/ /opt/monica-backup
44+
wget -q "https://github.com/monicahq/monica/releases/download/v${RELEASE}/monica-v${RELEASE}.tar.bz2"
45+
tar -xjf "monica-v${RELEASE}.tar.bz2"
46+
mv "/opt/monica-v${RELEASE}" /opt/monica
47+
cd /opt/monica/
48+
cp -r /opt/monica-backup/.env /opt/monica
49+
cp -r /opt/monica-backup/storage/* /opt/monica/storage/
50+
composer install --no-interaction --no-dev &>/dev/null
51+
yarn install &>/dev/null
52+
yarn run production &>/dev/null
53+
php artisan monica:update --force &>/dev/null
54+
chown -R www-data:www-data /opt/monica
55+
chmod -R 775 /opt/monica/storage
56+
echo "${RELEASE}" >/opt/${APP}_version.txt
57+
msg_ok "Updated $APP to v${RELEASE}"
58+
59+
msg_info "Starting Service"
60+
systemctl start apache2
61+
msg_ok "Started Service"
62+
63+
msg_info "Cleaning up"
64+
rm -r "/opt/monica-v${RELEASE}.tar.bz2"
65+
rm -r /opt/monica-backup
66+
msg_ok "Cleaned"
67+
msg_ok "Updated Successfully"
68+
else
69+
msg_ok "No update required. ${APP} is already at v${RELEASE}"
70+
fi
71+
exit
72+
}
73+
74+
start
75+
build_container
76+
description
77+
78+
msg_ok "Completed Successfully!\n"
79+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
80+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
81+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}"

install/monica-install.sh

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: bvdberg01
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
7+
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
8+
color
9+
verb_ip6
10+
catch_errors
11+
setting_up_container
12+
network_check
13+
update_os
14+
15+
msg_info "Installing Dependencies"
16+
$STD apt-get install -y \
17+
curl \
18+
sudo \
19+
mc \
20+
gnupg2\
21+
mariadb-server \
22+
apache2 \
23+
libapache2-mod-php \
24+
php-{bcmath,curl,dom,gd,gmp,iconv,intl,json,mbstring,mysqli,opcache,pdo-mysql,redis,tokenizer,xml,zip} \
25+
composer
26+
msg_ok "Installed Dependencies"
27+
28+
msg_info "Setting up MariaDB"
29+
DB_NAME=monica
30+
DB_USER=monica
31+
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
32+
$STD mysql -u root -e "CREATE DATABASE $DB_NAME;"
33+
$STD mysql -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED WITH mysql_native_password AS PASSWORD('$DB_PASS');"
34+
$STD mysql -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;"
35+
{
36+
echo "monica-Credentials"
37+
echo "monica Database User: $DB_USER"
38+
echo "monica Database Password: $DB_PASS"
39+
echo "monica Database Name: $DB_NAME"
40+
} >> ~/monica.creds
41+
msg_ok "Set up MariaDB"
42+
43+
msg_info "Setting up Node.js/Yarn"
44+
mkdir -p /etc/apt/keyrings
45+
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
46+
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list
47+
$STD apt-get update
48+
$STD apt-get install -y nodejs
49+
$STD npm install -g npm@latest
50+
$STD npm install -g yarn
51+
msg_ok "Installed Node.js/Yarn"
52+
53+
msg_info "Installing monica"
54+
RELEASE=$(curl -s https://api.github.com/repos/monicahq/monica/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
55+
cd /opt
56+
wget -q "https://github.com/monicahq/monica/releases/download/v${RELEASE}/monica-v${RELEASE}.tar.bz2"
57+
tar -xjf "monica-v${RELEASE}.tar.bz2"
58+
mv "/opt/monica-v${RELEASE}" /opt/monica
59+
cd /opt/monica
60+
cp /opt/monica/.env.example /opt/monica/.env
61+
HASH_SALT=$(openssl rand -base64 32)
62+
sed -i -e "s|^DB_USERNAME=.*|DB_USERNAME=${DB_USER}|" \
63+
-e "s|^DB_PASSWORD=.*|DB_PASSWORD=${DB_PASS}|" \
64+
-e "s|^HASH_SALT=.*|HASH_SALT=${HASH_SALT}|" \
65+
/opt/monica/.env
66+
$STD composer install --no-dev -o --no-interaction
67+
$STD yarn install
68+
$STD yarn run production
69+
$STD php artisan key:generate
70+
$STD php artisan setup:production [email protected] --password=helper-scripts.com --force
71+
chown -R www-data:www-data /opt/monica
72+
chmod -R 775 /opt/monica/storage
73+
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
74+
msg_ok "Installed monica"
75+
76+
msg_info "Creating Service"
77+
cat <<EOF >/etc/apache2/sites-available/monica.conf
78+
<VirtualHost *:80>
79+
ServerName monica
80+
DocumentRoot /opt/monica/public
81+
<Directory /opt/monica/public>
82+
Options Indexes FollowSymLinks
83+
AllowOverride All
84+
Require all granted
85+
</Directory>
86+
87+
ErrorLog /var/log/apache2/monica_error.log
88+
CustomLog /var/log/apache2/monica_access.log combined
89+
</VirtualHost>
90+
EOF
91+
$STD a2ensite monica
92+
$STD a2enmod rewrite
93+
$STD a2dissite 000-default.conf
94+
$STD systemctl reload apache2
95+
msg_ok "Created Service"
96+
97+
motd_ssh
98+
customize
99+
100+
msg_info "Cleaning up"
101+
rm -rf "/opt/monica-v${RELEASE}.tar.bz2"
102+
$STD apt-get -y autoremove
103+
$STD apt-get -y autoclean
104+
msg_ok "Cleaned"

json/monica.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "Monica",
3+
"slug": "monica",
4+
"categories": [
5+
24
6+
],
7+
"date_created": "2025-01-26",
8+
"type": "ct",
9+
"updateable": true,
10+
"privileged": false,
11+
"interface_port": 80,
12+
"documentation": "https://github.com/monicahq/monica/tree/4.x/docs",
13+
"website": "https://www.monicahq.com/",
14+
"logo": "https://www.monicahq.com/img/logo_vertical.png",
15+
"description": "Monica is an open-source personal CRM designed to help you manage and strengthen your relationships. It allows you to store important details about your contacts, track interactions, set reminders for special dates, and log activities—all in one secure, private place. Perfect for busy individuals, Monica helps you stay organized, remember meaningful moments, and nurture your connections without ads or data mining. Install it on your own server for full control!",
16+
"install_methods": [
17+
{
18+
"type": "default",
19+
"script": "ct/monica.sh",
20+
"resources": {
21+
"cpu": 2,
22+
"ram": 2048,
23+
"hdd": 8,
24+
"os": "debian",
25+
"version": "12"
26+
}
27+
}
28+
],
29+
"default_credentials": {
30+
"username": "[email protected]",
31+
"password": "helper-scripts.com"
32+
},
33+
"notes": []
34+
}

0 commit comments

Comments
 (0)