Skip to content

Commit baef2a0

Browse files
authored
New script: Baikal (#1913)
1 parent f9b84bf commit baef2a0

File tree

3 files changed

+206
-0
lines changed

3 files changed

+206
-0
lines changed

ct/baikal.sh

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
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://sabre.io/baikal/
7+
8+
# App Default Values
9+
APP="Baikal"
10+
var_tags="Dav"
11+
var_cpu="1"
12+
var_ram="512"
13+
var_disk="4"
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/baikal ]]; then
32+
msg_error "No ${APP} Installation Found!"
33+
exit
34+
fi
35+
RELEASE=$(curl -s https://api.github.com/repos/sabre-io/Baikal/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
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+
wget -q "https://github.com/sabre-io/baikal/releases/download/${RELEASE}/baikal-${RELEASE}.zip"
44+
mv /opt/baikal /opt/baikal-backup
45+
unzip -o -q "baikal-${RELEASE}.zip"
46+
cp -r /opt/baikal-backup/config/baikal.yaml /opt/baikal/config/
47+
cp -r /opt/baikal-backup/Specific/ /opt/baikal/
48+
chown -R www-data:www-data /opt/baikal/
49+
chmod -R 755 /opt/baikal/
50+
echo "${RELEASE}" >/opt/${APP}_version.txt
51+
msg_ok "Updated $APP to v${RELEASE}"
52+
53+
msg_info "Starting Service"
54+
systemctl start apache2
55+
msg_ok "Started Service"
56+
57+
msg_info "Cleaning up"
58+
rm -rf "/opt/baikal-${RELEASE}.zip"
59+
rm -rf /opt/baikal-backup
60+
msg_ok "Cleaned"
61+
msg_ok "Updated Successfully"
62+
else
63+
msg_ok "No update required. ${APP} is already at v${RELEASE}"
64+
fi
65+
exit
66+
}
67+
68+
start
69+
build_container
70+
description
71+
72+
msg_ok "Completed Successfully!\n"
73+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
74+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
75+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}"

install/baikal-install.sh

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
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+
postgresql \
21+
apache2 \
22+
libapache2-mod-php \
23+
php-{pgsql,dom}
24+
msg_ok "Installed Dependencies"
25+
26+
msg_info "Setting up PostgreSQL"
27+
DB_NAME=baikal
28+
DB_USER=baikal
29+
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)
30+
$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';"
31+
$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER TEMPLATE template0;"
32+
{
33+
echo "Baikal Credentials"
34+
echo "Baikal Database User: $DB_USER"
35+
echo "Baikal Database Password: $DB_PASS"
36+
echo "Baikal Database Name: $DB_NAME"
37+
} >> ~/baikal.creds
38+
msg_ok "Set up PostgreSQL"
39+
40+
msg_info "Installing Baikal"
41+
RELEASE=$(curl -s https://api.github.com/repos/sabre-io/Baikal/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
42+
cd /opt
43+
wget -q "https://github.com/sabre-io/baikal/releases/download/${RELEASE}/baikal-${RELEASE}.zip"
44+
unzip -q "baikal-${RELEASE}.zip"
45+
cat <<EOF >/opt/baikal/config/baikal.yaml
46+
database:
47+
backend: pgsql
48+
pgsql_host: localhost
49+
pgsql_dbname: $DB_NAME
50+
pgsql_username: $DB_USER
51+
pgsql_password: $DB_PASS
52+
EOF
53+
chown -R www-data:www-data /opt/baikal/
54+
chmod -R 755 /opt/baikal/
55+
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
56+
msg_ok "Installed Baikal"
57+
58+
msg_info "Creating Service"
59+
cat <<EOF > /etc/apache2/sites-available/baikal.conf
60+
<VirtualHost *:80>
61+
ServerName baikal
62+
DocumentRoot /opt/baikal/html
63+
64+
RewriteEngine on
65+
RewriteRule /.well-known/carddav /dav.php [R=308,L]
66+
RewriteRule /.well-known/caldav /dav.php [R=308,L]
67+
RewriteCond %{REQUEST_URI} ^/dav.php$ [NC]
68+
RewriteRule ^(.*)$ /dav.php/ [R=301,L]
69+
70+
<Directory /opt/baikal/html>
71+
Options FollowSymLinks
72+
AllowOverride All
73+
Require all granted
74+
</Directory>
75+
76+
<IfModule mod_expires.c>
77+
ExpiresActive Off
78+
</IfModule>
79+
80+
ErrorLog /var/log/apache2/baikal_error.log
81+
CustomLog /var/log/apache2/baikal_access.log combined
82+
</VirtualHost>
83+
EOF
84+
$STD a2ensite baikal
85+
$STD a2enmod rewrite
86+
$STD a2dissite 000-default.conf
87+
$STD systemctl reload apache2
88+
msg_ok "Created Service"
89+
90+
motd_ssh
91+
customize
92+
93+
msg_info "Cleaning up"
94+
rm -rf "/opt/baikal-${RELEASE}.zip"
95+
$STD apt-get -y autoremove
96+
$STD apt-get -y autoclean
97+
msg_ok "Cleaned"

json/baikal.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "Baïkal",
3+
"slug": "baikal",
4+
"categories": [
5+
0
6+
],
7+
"date_created": "2025-01-31",
8+
"type": "ct",
9+
"updateable": true,
10+
"privileged": false,
11+
"interface_port": 80,
12+
"documentation": null,
13+
"website": "https://sabre.io/baikal/",
14+
"logo": "https://sabre.io/img/logo.png",
15+
"description": "Baïkal is a lightweight CalDAV+CardDAV server. It offers an extensive web interface with easy management of users, address books and calendars.",
16+
"install_methods": [
17+
{
18+
"type": "default",
19+
"script": "ct/baikal.sh",
20+
"resources": {
21+
"cpu": 1,
22+
"ram": 512,
23+
"hdd": 4,
24+
"os": "Debian",
25+
"version": "12"
26+
}
27+
}
28+
],
29+
"default_credentials": {
30+
"username": "Admin",
31+
"password": null
32+
},
33+
"notes": []
34+
}

0 commit comments

Comments
 (0)