Skip to content

Commit 214d21f

Browse files
push-app-to-main[bot]MickLeskbvdberg01tremor021
authored
meilisearch (#3638)
* 'Add new script' * change license * change license * Update install/meilisearch-install.sh Co-authored-by: Bas van den Berg <[email protected]> * Update frontend/public/json/meilisearch.json --------- Co-authored-by: push-app-to-main[bot] <203845782+push-app-to-main[bot]@users.noreply.github.com> Co-authored-by: CanbiZ <[email protected]> Co-authored-by: Bas van den Berg <[email protected]> Co-authored-by: Slaviša Arežina <[email protected]>
1 parent 8b1cdd1 commit 214d21f

File tree

3 files changed

+260
-0
lines changed

3 files changed

+260
-0
lines changed

ct/meilisearch.sh

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
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: MickLesk (CanbiZ)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://www.meilisearch.com/
7+
8+
APP="Meilisearch"
9+
var_tags="${var_tags:-full-text-search}"
10+
var_cpu="${var_cpu:-2}"
11+
var_ram="${var_ram:-4096}"
12+
var_disk="${var_disk:-7}"
13+
var_os="${var_os:-debian}"
14+
var_version="${var_version:-12}"
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+
27+
if [[ ! -f /opt/Meilisearch_version.txt ]]; then
28+
msg_error "No Meilisearch Installation Found!"
29+
exit
30+
fi
31+
UPD=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Meilisearch Update" --radiolist --cancel-button Exit-Script "Spacebar = Select" 10 58 2 \
32+
"1" "Update Meilisearch" ON \
33+
"2" "Update Meilisearch-UI" OFF \
34+
3>&1 1>&2 2>&3)
35+
36+
if [ "$UPD" == "1" ]; then
37+
msg_info "Stopping Meilisearch"
38+
systemctl stop meilisearch
39+
msg_ok "Stopped Meilisearch"
40+
41+
msg_info "Updating Meilisearch"
42+
tmp_file=$(mktemp)
43+
RELEASE=$(curl -s https://api.github.com/repos/meilisearch/meilisearch/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
44+
curl -fsSL https://github.com/meilisearch/meilisearch/releases/latest/download/meilisearch.deb -o $tmp_file
45+
$STD dpkg -i $tmp_file
46+
echo "$RELEASE" >/opt/meilisearch_version.txt
47+
msg_ok "Updated Meilisearch"
48+
49+
msg_info "Starting Meilisearch"
50+
systemctl start meilisearch
51+
msg_ok "Started Meilisearch"
52+
exit
53+
fi
54+
55+
if [ "$UPD" == "2" ]; then
56+
if [[ ! -f /opt/Meilisearch-ui_version.txt ]]; then
57+
msg_error "No Meilisearch-UI Installation Found!"
58+
exit
59+
fi
60+
msg_info "Stopping Meilisearch-UI"
61+
systemctl stop meilisearch-ui
62+
msg_ok "Stopped Meilisearch-UI"
63+
64+
msg_info "Updating Meilisearch-UI"
65+
tmp_file=$(mktemp)
66+
tmp_dir=$(mktemp -d)
67+
RELEASE_UI=$(curl -s https://api.github.com/repos/riccox/meilisearch-ui/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
68+
cp /opt/meilisearch-ui/.env.local /tmp/.env.local.bak
69+
rm -rf /opt/meilisearch-ui
70+
mkdir -p /opt/meilisearch-ui
71+
curl -fsSL "https://github.com/riccox/meilisearch-ui/archive/refs/tags/${RELEASE_UI}.zip" -o $tmp_file
72+
unzip -q "$tmp_file" -d "$tmp_dir"
73+
mv "$tmp_dir"/*/* /opt/meilisearch-ui/
74+
cd /opt/meilisearch-ui
75+
sed -i 's|const hash = execSync("git rev-parse HEAD").toString().trim();|const hash = "unknown";|' /opt/meilisearch-ui/vite.config.ts
76+
mv /tmp/.env.local.bak /opt/meilisearch-ui/.env.local
77+
$STD pnpm install
78+
echo "$RELEASE_UI" >/opt/meilisearch-ui_version.txt
79+
msg_ok "Updated Meilisearch-UI"
80+
81+
msg_info "Starting Meilisearch-UI"
82+
systemctl start meilisearch-ui
83+
msg_ok "Started Meilisearch-UI"
84+
exit
85+
fi
86+
}
87+
88+
start
89+
build_container
90+
description
91+
92+
msg_ok "Completed Successfully!\n"
93+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
94+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
95+
echo -e "${TAB}${GATEWAY}${BGN}meilisearch: http://${IP}:7700$ | meilisearch-ui: http://${IP}:24900${CL}"
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"name": "Meilisearch",
3+
"slug": "meilisearch",
4+
"categories": [
5+
8
6+
],
7+
"date_created": "2025-04-03",
8+
"type": "ct",
9+
"updateable": true,
10+
"privileged": false,
11+
"interface_port": 7700,
12+
"documentation": "https://www.meilisearch.com/docs",
13+
"website": "https://www.meilisearch.com/",
14+
"logo": "https://raw.githubusercontent.com/selfhst/icons/refs/heads/main/svg/meilisearch.svg",
15+
"description": "Meilisearch is a fast, open-source search engine designed for instant, full-text search with typo tolerance. It provides an API that allows developers to integrate powerful search features into applications. Meilisearch-UI is an optional web-based interface that provides a simple way to interact with Meilisearch, visualize indexed data, and test queries without needing to use the API directly.",
16+
"install_methods": [
17+
{
18+
"type": "default",
19+
"script": "ct/meilisearch.sh",
20+
"resources": {
21+
"cpu": 2,
22+
"ram": 4096,
23+
"hdd": 7,
24+
"os": "debian",
25+
"version": "12"
26+
}
27+
}
28+
],
29+
"default_credentials": {
30+
"username": null,
31+
"password": null
32+
},
33+
"notes": [
34+
{
35+
"text": "Meilisearch-UI can optionally be installed for a web-based search interface",
36+
"type": "info"
37+
},
38+
{
39+
"text": "Meilisearch-UI has early development status and can caused performance issues",
40+
"type": "warn"
41+
}
42+
]
43+
}

install/meilisearch-install.sh

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: MickLesk (CanbiZ)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://www.meilisearch.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 Dependencies"
17+
$STD apt-get install -y \
18+
gnupg
19+
msg_ok "Installed Dependencies"
20+
21+
msg_info "Setup ${APPLICATION}"
22+
tmp_file=$(mktemp)
23+
RELEASE=$(curl -s https://api.github.com/repos/meilisearch/meilisearch/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
24+
curl -fsSL https://github.com/meilisearch/meilisearch/releases/latest/download/meilisearch.deb -o $tmp_file
25+
$STD dpkg -i $tmp_file
26+
curl -fsSL https://raw.githubusercontent.com/meilisearch/meilisearch/latest/config.toml -o /etc/meilisearch.toml
27+
MASTER_KEY=$(openssl rand -base64 12)
28+
LOCAL_IP="$(hostname -I | awk '{print $1}')"
29+
sed -i \
30+
-e 's|^env =.*|env = "production"|' \
31+
-e "s|^# master_key =.*|master_key = \"$MASTER_KEY\"|" \
32+
-e 's|^db_path =.*|db_path = "/var/lib/meilisearch/data"|' \
33+
-e 's|^dump_dir =.*|dump_dir = "/var/lib/meilisearch/dumps"|' \
34+
-e 's|^snapshot_dir =.*|snapshot_dir = "/var/lib/meilisearch/snapshots"|' \
35+
-e 's|^# no_analytics = true|no_analytics = true|' \
36+
-e 's|^http_addr =.*|http_addr = "0.0.0.0:7700"|' \
37+
/etc/meilisearch.toml
38+
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
39+
msg_ok "Setup ${APPLICATION}"
40+
41+
read -r -p "Do you want add meilisearch-ui? [y/n]: " prompt
42+
if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then
43+
msg_info "Setting up Node.js Repository"
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_22.x nodistro main" >/etc/apt/sources.list.d/nodesource.list
47+
msg_ok "Set up Node.js Repository"
48+
49+
msg_info "Installing Node.js"
50+
$STD apt-get update
51+
$STD apt-get install -y nodejs
52+
$STD npm install -g pnpm
53+
msg_ok "Installed Node.js"
54+
55+
msg_info "Setup ${APPLICATION}-ui"
56+
tmp_file=$(mktemp)
57+
tmp_dir=$(mktemp -d)
58+
mkdir -p /opt/meilisearch-ui
59+
RELEASE_UI=$(curl -s https://api.github.com/repos/riccox/meilisearch-ui/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
60+
curl -fsSL "https://github.com/riccox/meilisearch-ui/archive/refs/tags/${RELEASE_UI}.zip" -o $tmp_file
61+
unzip -q "$tmp_file" -d "$tmp_dir"
62+
mv "$tmp_dir"/*/* /opt/meilisearch-ui/
63+
cd /opt/meilisearch-ui
64+
sed -i 's|const hash = execSync("git rev-parse HEAD").toString().trim();|const hash = "unknown";|' /opt/meilisearch-ui/vite.config.ts
65+
$STD pnpm install
66+
cat <<EOF > /opt/meilisearch-ui/.env.local
67+
VITE_SINGLETON_MODE=true
68+
VITE_SINGLETON_HOST=http://${LOCAL_IP}:7700
69+
VITE_SINGLETON_API_KEY=${MASTER_KEY}
70+
EOF
71+
echo "${RELEASE_UI}" >/opt/${APPLICATION}-ui_version.txt
72+
msg_ok "Setup ${APPLICATION}-ui"
73+
fi
74+
75+
msg_info "Setting up Services"
76+
cat <<EOF >/etc/systemd/system/meilisearch.service
77+
[Unit]
78+
Description=Meilisearch
79+
After=network.target
80+
81+
[Service]
82+
ExecStart=/usr/bin/meilisearch --config-file-path /etc/meilisearch.toml
83+
Restart=always
84+
85+
[Install]
86+
WantedBy=multi-user.target
87+
EOF
88+
systemctl enable -q --now meilisearch
89+
90+
if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then
91+
cat <<EOF > /etc/systemd/system/meilisearch-ui.service
92+
[Unit]
93+
Description=Meilisearch UI Service
94+
After=network.target meilisearch.service
95+
Requires=meilisearch.service
96+
97+
[Service]
98+
User=root
99+
WorkingDirectory=/opt/meilisearch-ui
100+
ExecStart=/usr/bin/pnpm start
101+
Restart=always
102+
RestartSec=5
103+
StandardOutput=syslog
104+
StandardError=syslog
105+
SyslogIdentifier=meilisearch-ui
106+
107+
[Install]
108+
WantedBy=multi-user.target
109+
EOF
110+
systemctl enable -q --now meilisearch-ui
111+
fi
112+
113+
msg_ok "Set up Services"
114+
115+
116+
motd_ssh
117+
customize
118+
119+
msg_info "Cleaning up"
120+
$STD apt-get -y autoremove
121+
$STD apt-get -y autoclean
122+
msg_ok "Cleaned"

0 commit comments

Comments
 (0)