Skip to content

Commit da552dc

Browse files
'Add new script' (#8452)
Co-authored-by: push-app-to-main[bot] <203845782+push-app-to-main[bot]@users.noreply.github.com>
1 parent 77aba17 commit da552dc

File tree

4 files changed

+231
-0
lines changed

4 files changed

+231
-0
lines changed

ct/headers/open-archiver

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
____ ___ __ _
2+
/ __ \____ ___ ____ / | __________/ /_ (_) _____ _____
3+
/ / / / __ \/ _ \/ __ \______/ /| | / ___/ ___/ __ \/ / | / / _ \/ ___/
4+
/ /_/ / /_/ / __/ / / /_____/ ___ |/ / / /__/ / / / /| |/ / __/ /
5+
\____/ .___/\___/_/ /_/ /_/ |_/_/ \___/_/ /_/_/ |___/\___/_/
6+
/_/

ct/open-archiver.sh

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/usr/bin/env bash
2+
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: Slaviša Arežina (tremor021)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://openarchiver.com/
7+
8+
APP="Open-Archiver"
9+
var_tags="${var_tags:-os}"
10+
var_cpu="${var_cpu:-2}"
11+
var_ram="${var_ram:-3072}"
12+
var_disk="${var_disk:-8}"
13+
var_os="${var_os:-debian}"
14+
var_version="${var_version:-13}"
15+
var_unprivileged="${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+
if [[ ! -d /opt/openarchiver ]]; then
27+
msg_error "No Open Archiver Installation Found!"
28+
exit
29+
fi
30+
31+
if check_for_gh_release "openarchiver" "LogicLabs-OU/OpenArchiver"; then
32+
msg_info "Stopping Services"
33+
systemctl stop openarchiver
34+
msg_ok "Stopped Services"
35+
36+
cp /opt/openarchiver/.env /opt/openarchiver.env
37+
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "openarchiver" "LogicLabs-OU/OpenArchiver" "tarball" "latest" "/opt/openarchiver"
38+
mv /opt/openarchiver.env /opt/openarchiver/.env
39+
40+
msg_info "Updating Open Archiver"
41+
$STD pnpm install --shamefully-hoist --frozen-lockfile --prod=false
42+
$STD pnpm build
43+
$STD pnpm db:migrate
44+
msg_ok "Updated Open Archiver"
45+
46+
msg_info "Starting Services"
47+
systemctl start openarchiver
48+
msg_ok "Started Services"
49+
msg_ok "Updated Successfully"
50+
fi
51+
exit
52+
}
53+
54+
start
55+
build_container
56+
description
57+
58+
msg_ok "Completed Successfully!\n"
59+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
60+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
61+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}"
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"name": "Open-Archiver",
3+
"slug": "open-archiver",
4+
"categories": [
5+
7
6+
],
7+
"date_created": "2025-09-30",
8+
"type": "ct",
9+
"updateable": true,
10+
"privileged": false,
11+
"interface_port": 3000,
12+
"documentation": "https://docs.openarchiver.com/",
13+
"config_path": "/opt/openarchiver/.env",
14+
"website": "https://openarchiver.com/",
15+
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/OpenArchiver.webp",
16+
"description": "Open Archiver is a secure, self-hosted email archiving solution, and it's completely open source. Get an email archiver that enables full-text search across email and attachments. Create a permanent, searchable, and compliant mail archive from Google Workspace, Microsoft 35, and any IMAP server.",
17+
"install_methods": [
18+
{
19+
"type": "default",
20+
"script": "ct/open-archiver.sh",
21+
"resources": {
22+
"cpu": 2,
23+
"ram": 3072,
24+
"hdd": 8,
25+
"os": "debian",
26+
"version": "13"
27+
}
28+
}
29+
],
30+
"default_credentials": {
31+
"username": null,
32+
"password": null
33+
},
34+
"notes": [
35+
{
36+
"text": "Data directory is: `/opt/openarchiver-data`. If you have a lot of email, you might consider mounting external storage to this directory.",
37+
"type": "info"
38+
}
39+
]
40+
}

install/open-archiver-install.sh

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: Slaviša Arežina (tremor021)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://openarchiver.com/
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 dependendencies"
17+
$STD apt install -y valkey
18+
msg_ok "Installed dependendencies"
19+
20+
NODE_VERSION="22" NODE_MODULE="pnpm" setup_nodejs
21+
PG_VERSION="17" setup_postgresql
22+
fetch_and_deploy_gh_release "meilisearch" "meilisearch/meilisearch" "binary"
23+
fetch_and_deploy_gh_release "openarchiver" "LogicLabs-OU/OpenArchiver" "tarball"
24+
JWT_KEY="$(openssl rand -hex 32)"
25+
SECRET_KEY="$(openssl rand -hex 32)"
26+
IP_ADDR=$(hostname -I | awk '{print $1}')
27+
28+
msg_info "Setting up PostgreSQL"
29+
DB_NAME="openarchiver_db"
30+
DB_USER="openarchiver"
31+
DB_PASS="$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-18)"
32+
$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';"
33+
$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;"
34+
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';"
35+
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET default_transaction_isolation TO 'read committed';"
36+
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC';"
37+
{
38+
echo "Open Archiver DB Credentials"
39+
echo "Database Name: $DB_NAME"
40+
echo "Database User: $DB_USER"
41+
echo "Database Password: $DB_PASS"
42+
} >>~/openarchiver.creds
43+
msg_ok "Set up PostgreSQL"
44+
45+
msg_info "Configuring MeiliSearch"
46+
curl -fsSL https://raw.githubusercontent.com/meilisearch/meilisearch/latest/config.toml -o /etc/meilisearch.toml
47+
MASTER_KEY=$(openssl rand -base64 12)
48+
sed -i \
49+
-e 's|^env =.*|env = "production"|' \
50+
-e "s|^# master_key =.*|master_key = \"$MASTER_KEY\"|" \
51+
-e 's|^db_path =.*|db_path = "/var/lib/meilisearch/data"|' \
52+
-e 's|^dump_dir =.*|dump_dir = "/var/lib/meilisearch/dumps"|' \
53+
-e 's|^snapshot_dir =.*|snapshot_dir = "/var/lib/meilisearch/snapshots"|' \
54+
-e 's|^# no_analytics = true|no_analytics = true|' \
55+
-e 's|^http_addr =.*|http_addr = "127.0.0.1:7700"|' \
56+
/etc/meilisearch.toml
57+
58+
cat <<EOF >/etc/systemd/system/meilisearch.service
59+
[Unit]
60+
Description=Meilisearch
61+
After=network.target
62+
63+
[Service]
64+
ExecStart=/usr/bin/meilisearch --config-file-path /etc/meilisearch.toml
65+
Restart=always
66+
67+
[Install]
68+
WantedBy=multi-user.target
69+
EOF
70+
systemctl enable -q --now meilisearch
71+
sleep 5
72+
msg_ok "Configured MeiliSearch"
73+
74+
msg_info "Setting up Open Archiver"
75+
mkdir -p /opt/openarchiver-data
76+
cd /opt/openarchiver
77+
cp .env.example .env
78+
sed -i "s|^NODE_ENV=.*|NODE_ENV=production|g" /opt/openarchiver/.env
79+
sed -i "s|^POSTGRES_DB=.*|POSTGRES_DB=openarchiver_db|g" /opt/openarchiver/.env
80+
sed -i "s|^POSTGRES_USER=.*|POSTGRES_USER=openarchiver|g" /opt/openarchiver/.env
81+
sed -i "s|^POSTGRES_PASSWORD=.*|POSTGRES_PASSWORD=$DB_PASS|g" /opt/openarchiver/.env
82+
sed -i "s|^DATABASE_URL=.*|DATABASE_URL=\"postgresql://openarchiver:$DB_PASS@localhost:5432/openarchiver_db\"|g" /opt/openarchiver/.env
83+
sed -i "s|^MEILI_HOST=.*|MEILI_HOST=http://localhost:7700|g" /opt/openarchiver/.env
84+
sed -i "s|^MEILI_MASTER_KEY=.*|MEILI_MASTER_KEY=$MASTER_KEY|g" /opt/openarchiver/.env
85+
sed -i "s|^REDIS_HOST=.*|REDIS_HOST=localhost|g" /opt/openarchiver/.env
86+
sed -i "s|^REDIS_PASSWORD=.*|REDIS_PASSWORD=|g" /opt/openarchiver/.env
87+
sed -i "s|^STORAGE_LOCAL_ROOT_PATH=.*|STORAGE_LOCAL_ROOT_PATH=/opt/openarchiver-data|g" /opt/openarchiver/.env
88+
sed -i "s|^JWT_SECRET=.*|JWT_SECRET=$JWT_KEY|g" /opt/openarchiver/.env
89+
sed -i "s|^ENCRYPTION_KEY=.*|ENCRYPTION_KEY=$SECRET_KEY|g" /opt/openarchiver/.env
90+
sed -i "s|^TIKA_URL=.*|TIKA_URL=|g" /opt/openarchiver/.env
91+
echo "ORIGIN=http://$IP_ADDR:3000" >> /opt/openarchiver/.env
92+
$STD pnpm install --shamefully-hoist --frozen-lockfile --prod=false
93+
$STD pnpm build
94+
$STD pnpm db:migrate
95+
msg_ok "Setup Open Archiver"
96+
97+
msg_info "Creating Service"
98+
cat <<EOF >/etc/systemd/system/openarchiver.service
99+
[Unit]
100+
Description=Open Archiver Service
101+
After=network-online.target
102+
103+
[Service]
104+
Type=simple
105+
User=root
106+
EnvironmentFile=/opt/openarchiver/.env
107+
WorkingDirectory=/opt/openarchiver
108+
ExecStart=/usr/bin/pnpm docker-start
109+
Restart=on-failure
110+
111+
[Install]
112+
WantedBy=multi-user.target
113+
EOF
114+
systemctl enable -q --now openarchiver
115+
msg_ok "Created Service"
116+
117+
motd_ssh
118+
customize
119+
120+
msg_info "Cleaning up"
121+
$STD apt -y autoremove
122+
$STD apt -y autoclean
123+
$STD apt -y clean
124+
msg_ok "Cleaned"

0 commit comments

Comments
 (0)