mirror of
https://github.com/community-scripts/ProxmoxVE
synced 2025-02-04 15:00:16 +00:00
New script: Baikal (#1913)
This commit is contained in:
parent
f9b84bf5ee
commit
baef2a0cb9
75
ct/baikal.sh
Normal file
75
ct/baikal.sh
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
|
||||||
|
# Copyright (c) 2021-2025 community-scripts ORG
|
||||||
|
# Author: bvdberg01
|
||||||
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||||
|
# Source: https://sabre.io/baikal/
|
||||||
|
|
||||||
|
# App Default Values
|
||||||
|
APP="Baikal"
|
||||||
|
var_tags="Dav"
|
||||||
|
var_cpu="1"
|
||||||
|
var_ram="512"
|
||||||
|
var_disk="4"
|
||||||
|
var_os="debian"
|
||||||
|
var_version="12"
|
||||||
|
var_unprivileged="1"
|
||||||
|
|
||||||
|
# App Output & Base Settings
|
||||||
|
header_info "$APP"
|
||||||
|
base_settings
|
||||||
|
|
||||||
|
# Core
|
||||||
|
variables
|
||||||
|
color
|
||||||
|
catch_errors
|
||||||
|
|
||||||
|
function update_script() {
|
||||||
|
header_info
|
||||||
|
check_container_storage
|
||||||
|
check_container_resources
|
||||||
|
if [[ ! -d /opt/baikal ]]; then
|
||||||
|
msg_error "No ${APP} Installation Found!"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
RELEASE=$(curl -s https://api.github.com/repos/sabre-io/Baikal/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||||
|
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
|
||||||
|
msg_info "Stopping Service"
|
||||||
|
systemctl stop apache2
|
||||||
|
msg_ok "Stopped Service"
|
||||||
|
|
||||||
|
msg_info "Updating ${APP} to v${RELEASE}"
|
||||||
|
cd /opt
|
||||||
|
wget -q "https://github.com/sabre-io/baikal/releases/download/${RELEASE}/baikal-${RELEASE}.zip"
|
||||||
|
mv /opt/baikal /opt/baikal-backup
|
||||||
|
unzip -o -q "baikal-${RELEASE}.zip"
|
||||||
|
cp -r /opt/baikal-backup/config/baikal.yaml /opt/baikal/config/
|
||||||
|
cp -r /opt/baikal-backup/Specific/ /opt/baikal/
|
||||||
|
chown -R www-data:www-data /opt/baikal/
|
||||||
|
chmod -R 755 /opt/baikal/
|
||||||
|
echo "${RELEASE}" >/opt/${APP}_version.txt
|
||||||
|
msg_ok "Updated $APP to v${RELEASE}"
|
||||||
|
|
||||||
|
msg_info "Starting Service"
|
||||||
|
systemctl start apache2
|
||||||
|
msg_ok "Started Service"
|
||||||
|
|
||||||
|
msg_info "Cleaning up"
|
||||||
|
rm -rf "/opt/baikal-${RELEASE}.zip"
|
||||||
|
rm -rf /opt/baikal-backup
|
||||||
|
msg_ok "Cleaned"
|
||||||
|
msg_ok "Updated Successfully"
|
||||||
|
else
|
||||||
|
msg_ok "No update required. ${APP} is already at v${RELEASE}"
|
||||||
|
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 "${TAB}${GATEWAY}${BGN}http://${IP}${CL}"
|
97
install/baikal-install.sh
Normal file
97
install/baikal-install.sh
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Copyright (c) 2021-2025 community-scripts ORG
|
||||||
|
# Author: bvdberg01
|
||||||
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||||
|
|
||||||
|
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
|
||||||
|
color
|
||||||
|
verb_ip6
|
||||||
|
catch_errors
|
||||||
|
setting_up_container
|
||||||
|
network_check
|
||||||
|
update_os
|
||||||
|
|
||||||
|
msg_info "Installing Dependencies"
|
||||||
|
$STD apt-get install -y \
|
||||||
|
curl \
|
||||||
|
sudo \
|
||||||
|
mc \
|
||||||
|
postgresql \
|
||||||
|
apache2 \
|
||||||
|
libapache2-mod-php \
|
||||||
|
php-{pgsql,dom}
|
||||||
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
|
msg_info "Setting up PostgreSQL"
|
||||||
|
DB_NAME=baikal
|
||||||
|
DB_USER=baikal
|
||||||
|
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)
|
||||||
|
$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';"
|
||||||
|
$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER TEMPLATE template0;"
|
||||||
|
{
|
||||||
|
echo "Baikal Credentials"
|
||||||
|
echo "Baikal Database User: $DB_USER"
|
||||||
|
echo "Baikal Database Password: $DB_PASS"
|
||||||
|
echo "Baikal Database Name: $DB_NAME"
|
||||||
|
} >> ~/baikal.creds
|
||||||
|
msg_ok "Set up PostgreSQL"
|
||||||
|
|
||||||
|
msg_info "Installing Baikal"
|
||||||
|
RELEASE=$(curl -s https://api.github.com/repos/sabre-io/Baikal/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||||
|
cd /opt
|
||||||
|
wget -q "https://github.com/sabre-io/baikal/releases/download/${RELEASE}/baikal-${RELEASE}.zip"
|
||||||
|
unzip -q "baikal-${RELEASE}.zip"
|
||||||
|
cat <<EOF >/opt/baikal/config/baikal.yaml
|
||||||
|
database:
|
||||||
|
backend: pgsql
|
||||||
|
pgsql_host: localhost
|
||||||
|
pgsql_dbname: $DB_NAME
|
||||||
|
pgsql_username: $DB_USER
|
||||||
|
pgsql_password: $DB_PASS
|
||||||
|
EOF
|
||||||
|
chown -R www-data:www-data /opt/baikal/
|
||||||
|
chmod -R 755 /opt/baikal/
|
||||||
|
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
|
||||||
|
msg_ok "Installed Baikal"
|
||||||
|
|
||||||
|
msg_info "Creating Service"
|
||||||
|
cat <<EOF > /etc/apache2/sites-available/baikal.conf
|
||||||
|
<VirtualHost *:80>
|
||||||
|
ServerName baikal
|
||||||
|
DocumentRoot /opt/baikal/html
|
||||||
|
|
||||||
|
RewriteEngine on
|
||||||
|
RewriteRule /.well-known/carddav /dav.php [R=308,L]
|
||||||
|
RewriteRule /.well-known/caldav /dav.php [R=308,L]
|
||||||
|
RewriteCond %{REQUEST_URI} ^/dav.php$ [NC]
|
||||||
|
RewriteRule ^(.*)$ /dav.php/ [R=301,L]
|
||||||
|
|
||||||
|
<Directory /opt/baikal/html>
|
||||||
|
Options FollowSymLinks
|
||||||
|
AllowOverride All
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
<IfModule mod_expires.c>
|
||||||
|
ExpiresActive Off
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
ErrorLog /var/log/apache2/baikal_error.log
|
||||||
|
CustomLog /var/log/apache2/baikal_access.log combined
|
||||||
|
</VirtualHost>
|
||||||
|
EOF
|
||||||
|
$STD a2ensite baikal
|
||||||
|
$STD a2enmod rewrite
|
||||||
|
$STD a2dissite 000-default.conf
|
||||||
|
$STD systemctl reload apache2
|
||||||
|
msg_ok "Created Service"
|
||||||
|
|
||||||
|
motd_ssh
|
||||||
|
customize
|
||||||
|
|
||||||
|
msg_info "Cleaning up"
|
||||||
|
rm -rf "/opt/baikal-${RELEASE}.zip"
|
||||||
|
$STD apt-get -y autoremove
|
||||||
|
$STD apt-get -y autoclean
|
||||||
|
msg_ok "Cleaned"
|
34
json/baikal.json
Normal file
34
json/baikal.json
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
"name": "Baïkal",
|
||||||
|
"slug": "baikal",
|
||||||
|
"categories": [
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"date_created": "2025-01-31",
|
||||||
|
"type": "ct",
|
||||||
|
"updateable": true,
|
||||||
|
"privileged": false,
|
||||||
|
"interface_port": 80,
|
||||||
|
"documentation": null,
|
||||||
|
"website": "https://sabre.io/baikal/",
|
||||||
|
"logo": "https://sabre.io/img/logo.png",
|
||||||
|
"description": "Baïkal is a lightweight CalDAV+CardDAV server. It offers an extensive web interface with easy management of users, address books and calendars.",
|
||||||
|
"install_methods": [
|
||||||
|
{
|
||||||
|
"type": "default",
|
||||||
|
"script": "ct/baikal.sh",
|
||||||
|
"resources": {
|
||||||
|
"cpu": 1,
|
||||||
|
"ram": 512,
|
||||||
|
"hdd": 4,
|
||||||
|
"os": "Debian",
|
||||||
|
"version": "12"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"default_credentials": {
|
||||||
|
"username": "Admin",
|
||||||
|
"password": null
|
||||||
|
},
|
||||||
|
"notes": []
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user