Add Mail-Archiver script
This commit is contained in:
parent
4a41cfd06a
commit
58f0b23ba6
44
ct/mail-archiver.sh
Normal file
44
ct/mail-archiver.sh
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func)
|
||||||
|
# Copyright (c) 2021-2025 community-scripts ORG
|
||||||
|
# Author: Slaviša Arežina (tremor021)
|
||||||
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||||
|
# Source: https://github.com/s1t5/mail-archiver
|
||||||
|
|
||||||
|
APP="Mail-Archiver"
|
||||||
|
var_tags="${var_tags:-mail-archiver}"
|
||||||
|
var_cpu="${var_cpu:-1}"
|
||||||
|
var_ram="${var_ram:-2048}"
|
||||||
|
var_disk="${var_disk:-8}"
|
||||||
|
var_os="${var_os:-debian}"
|
||||||
|
var_version="${var_version:-13}"
|
||||||
|
var_unprivileged="${var_unprivileged:-1}"
|
||||||
|
|
||||||
|
header_info "$APP"
|
||||||
|
variables
|
||||||
|
color
|
||||||
|
catch_errors
|
||||||
|
|
||||||
|
function update_script() {
|
||||||
|
header_info
|
||||||
|
check_container_storage
|
||||||
|
check_container_resources
|
||||||
|
if [[ ! -d /opt/mail-archiver ]]; then
|
||||||
|
msg_error "No ${APP} Installation Found!"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
if check_for_gh_release "mail-archiver-build" "s1t5/mail-archiver"; then
|
||||||
|
msg_ok "Updated successfully!"
|
||||||
|
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}:5380${CL}"
|
||||||
68
install/mail-archiver-install.sh
Normal file
68
install/mail-archiver-install.sh
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Copyright (c) 2021-2025 community-scripts ORG
|
||||||
|
# Author: Slaviša Arežina (tremor021)
|
||||||
|
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
|
||||||
|
# Source: https://github.com/s1t5/mail-archiver
|
||||||
|
|
||||||
|
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||||
|
color
|
||||||
|
verb_ip6
|
||||||
|
catch_errors
|
||||||
|
setting_up_container
|
||||||
|
network_check
|
||||||
|
update_os
|
||||||
|
|
||||||
|
msg_info "Installing Dependencies"
|
||||||
|
setup_deb822_repo \
|
||||||
|
"microsoft" \
|
||||||
|
"https://packages.microsoft.com/keys/microsoft-2025.asc" \
|
||||||
|
"https://packages.microsoft.com/debian/13/prod/" \
|
||||||
|
"trixie" \
|
||||||
|
"main"
|
||||||
|
$STD apt install -y \
|
||||||
|
dotnet-sdk-10.0 \
|
||||||
|
aspnetcore-runtime-8.0
|
||||||
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
|
PG_VERSION="17" setup_postgresql
|
||||||
|
PG_DB_NAME="mailarchiver_db" PG_DB_USER="mailarchiver" setup_postgresql_db
|
||||||
|
fetch_and_deploy_gh_release "mail-archiver-build" "s1t5/mail-archiver" "tarball"
|
||||||
|
|
||||||
|
msg_info "Setting up Mail-Archiver"
|
||||||
|
mkdir -p /opt/mail-archiver
|
||||||
|
cd /opt/mail-archiver-build
|
||||||
|
$STD dotnet restore
|
||||||
|
$STD dotnet publish -c Release -o /opt/mail-archiver
|
||||||
|
cp /opt/mail-archiver-build/appsettings.json /opt/mail-archiver/appsettings.json
|
||||||
|
sed -i "s|\"DefaultConnection\": \"[^\"]*\"|\"DefaultConnection\": \"Host=localhost;Database=mailarchiver_db;Username=mailarchiver;Password=$PG_DB_PASS\"|" /opt/mail-archiver/appsettings.json
|
||||||
|
rm -rf /opt/mail-archiver-build
|
||||||
|
|
||||||
|
cat <<EOF >/opt/mail-archiver/.env
|
||||||
|
ASPNETCORE_URLS=http://+:5000
|
||||||
|
ASPNETCORE_ENVIRONMENT=Production
|
||||||
|
TZ=UTC
|
||||||
|
EOF
|
||||||
|
msg_ok "Setup Mail-Archiver"
|
||||||
|
|
||||||
|
msg_info "Creating Service"
|
||||||
|
cat <<EOF >/etc/systemd/system/mail-archiver.service
|
||||||
|
[Unit]
|
||||||
|
Description=Mail-Archiver Service
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
EnvironmentFile=/opt/mail-archiver/.env
|
||||||
|
WorkingDirectory=/opt/mail-archiver
|
||||||
|
ExecStart=/usr/bin/dotnet MailArchiver.dll
|
||||||
|
Restart=always
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOF
|
||||||
|
systemctl enable -q --now mail-archiver
|
||||||
|
msg_info "Created Service"
|
||||||
|
|
||||||
|
motd_ssh
|
||||||
|
customize
|
||||||
|
cleanup_lxc
|
||||||
Loading…
x
Reference in New Issue
Block a user