mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-02-03 20:03:25 +01:00
various scripts: use setup_meilisearch function (#11259)
This commit is contained in:
committed by
GitHub
parent
ebb48f697c
commit
3a04923479
@@ -88,18 +88,8 @@ function update_script() {
|
||||
msg_ok "Started nginx"
|
||||
fi
|
||||
|
||||
if check_for_gh_release "meilisearch" "meilisearch/meilisearch"; then
|
||||
msg_info "Stopping Meilisearch"
|
||||
systemctl stop meilisearch
|
||||
msg_ok "Stopped Meilisearch"
|
||||
setup_meilisearch
|
||||
|
||||
fetch_and_deploy_gh_release "meilisearch" "meilisearch/meilisearch" "binary"
|
||||
|
||||
msg_info "Starting Meilisearch"
|
||||
systemctl start meilisearch
|
||||
msg_ok "Started Meilisearch"
|
||||
msg_ok "Updated successfully!"
|
||||
fi
|
||||
exit
|
||||
}
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ function update_script() {
|
||||
fi
|
||||
MODULE_VERSION="$(jq -r '.packageManager | split("@")[1]' /opt/karakeep/package.json)"
|
||||
NODE_VERSION="22" NODE_MODULE="pnpm@${MODULE_VERSION}" setup_nodejs
|
||||
setup_meilisearch
|
||||
|
||||
msg_info "Updating Karakeep"
|
||||
corepack enable
|
||||
@@ -90,6 +91,7 @@ function update_script() {
|
||||
msg_ok "Started Services"
|
||||
msg_ok "Updated successfully!"
|
||||
fi
|
||||
|
||||
exit
|
||||
}
|
||||
|
||||
|
||||
@@ -30,18 +30,7 @@ function update_script() {
|
||||
3>&1 1>&2 2>&3)
|
||||
|
||||
if [ "$UPD" == "1" ]; then
|
||||
if check_for_gh_release "meilisearch" "meilisearch/meilisearch"; then
|
||||
msg_info "Stopping Meilisearch"
|
||||
systemctl stop meilisearch
|
||||
msg_ok "Stopped Meilisearch"
|
||||
|
||||
fetch_and_deploy_gh_release "meilisearch" "meilisearch/meilisearch" "binary"
|
||||
|
||||
msg_info "Starting Meilisearch"
|
||||
systemctl start meilisearch
|
||||
msg_ok "Started Meilisearch"
|
||||
msg_ok "Updated successfully!"
|
||||
fi
|
||||
setup_meilisearch
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
@@ -28,6 +28,8 @@ function update_script() {
|
||||
exit
|
||||
fi
|
||||
|
||||
setup_meilisearch
|
||||
|
||||
if check_for_gh_release "openarchiver" "LogicLabs-OU/OpenArchiver"; then
|
||||
msg_info "Stopping Services"
|
||||
systemctl stop openarchiver
|
||||
@@ -54,6 +56,7 @@ function update_script() {
|
||||
msg_ok "Started Services"
|
||||
msg_ok "Updated successfully!"
|
||||
fi
|
||||
|
||||
exit
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ msg_ok "Installed Dependencies"
|
||||
PHP_VERSION="8.4" PHP_FPM=YES PHP_MODULE="ffi,opcache,redis,zip,pdo-sqlite,bcmath,pdo,curl,dom,fpm" setup_php
|
||||
setup_composer
|
||||
NODE_VERSION="22" setup_nodejs
|
||||
fetch_and_deploy_gh_release "meilisearch" "meilisearch/meilisearch" "binary"
|
||||
setup_meilisearch
|
||||
fetch_and_deploy_gh_release "bar-assistant" "karlomikus/bar-assistant" "tarball" "latest" "/opt/bar-assistant"
|
||||
fetch_and_deploy_gh_release "vue-salt-rim" "karlomikus/vue-salt-rim" "tarball" "latest" "/opt/vue-salt-rim"
|
||||
|
||||
@@ -36,49 +36,16 @@ sed -i.bak -E 's/^\s*;?\s*ffi\.enable\s*=.*/ffi.enable=true/' /etc/php/${PHPVER}
|
||||
$STD systemctl reload php${PHPVER}-fpm
|
||||
msg_info "configured PHP"
|
||||
|
||||
msg_info "Configure MeiliSearch"
|
||||
curl -fsSL https://raw.githubusercontent.com/meilisearch/meilisearch/latest/config.toml -o /etc/meilisearch.toml
|
||||
MASTER_KEY=$(openssl rand -base64 12)
|
||||
sed -i \
|
||||
-e 's|^env =.*|env = "production"|' \
|
||||
-e "s|^# master_key =.*|master_key = \"$MASTER_KEY\"|" \
|
||||
-e 's|^db_path =.*|db_path = "/var/lib/meilisearch/data"|' \
|
||||
-e 's|^dump_dir =.*|dump_dir = "/var/lib/meilisearch/dumps"|' \
|
||||
-e 's|^snapshot_dir =.*|snapshot_dir = "/var/lib/meilisearch/snapshots"|' \
|
||||
-e 's|^# no_analytics = true|no_analytics = true|' \
|
||||
-e 's|^http_addr =.*|http_addr = "127.0.0.1:7700"|' \
|
||||
/etc/meilisearch.toml
|
||||
msg_ok "Configured MeiliSearch"
|
||||
|
||||
msg_info "Creating MeiliSearch service"
|
||||
cat <<EOF >/etc/systemd/system/meilisearch.service
|
||||
[Unit]
|
||||
Description=Meilisearch
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/meilisearch --config-file-path /etc/meilisearch.toml
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q --now meilisearch
|
||||
sleep 5
|
||||
msg_ok "Created Service MeiliSearch"
|
||||
|
||||
msg_info "Installing Bar Assistant"
|
||||
cd /opt/bar-assistant
|
||||
cp /opt/bar-assistant/.env.dist /opt/bar-assistant/.env
|
||||
mkdir -p /opt/bar-assistant/resources/data
|
||||
curl -fsSL https://github.com/bar-assistant/data/archive/refs/heads/v5.tar.gz | tar -xz --strip-components=1 -C /opt/bar-assistant/resources/data
|
||||
MeiliSearch_API_KEY=$(curl -s -X GET 'http://127.0.0.1:7700/keys' -H "Authorization: Bearer $MASTER_KEY" | grep -o '"key":"[^"]*"' | head -n 1 | sed 's/"key":"//;s/"//')
|
||||
MeiliSearch_API_KEY_UID=$(curl -s -X GET 'http://127.0.0.1:7700/keys' -H "Authorization: Bearer $MASTER_KEY" | grep -o '"uid":"[^"]*"' | head -n 1 | sed 's/"uid":"//;s/"//')
|
||||
sed -i -e "s|^APP_URL=|APP_URL=http://${LOCAL_IP}/bar/|" \
|
||||
-e "s|^MEILISEARCH_HOST=|MEILISEARCH_HOST=http://127.0.0.1:7700|" \
|
||||
-e "s|^MEILISEARCH_KEY=|MEILISEARCH_KEY=${MASTER_KEY}|" \
|
||||
-e "s|^MEILISEARCH_API_KEY=|MEILISEARCH_API_KEY=${MeiliSearch_API_KEY}|" \
|
||||
-e "s|^MEILISEARCH_API_KEY_UID=|MEILISEARCH_API_KEY_UID=${MeiliSearch_API_KEY_UID}|" \
|
||||
-e "s|^MEILISEARCH_KEY=|MEILISEARCH_KEY=${MEILISEARCH_MASTER_KEY}|" \
|
||||
-e "s|^MEILISEARCH_API_KEY=|MEILISEARCH_API_KEY=${MEILISEARCH_API_KEY}|" \
|
||||
-e "s|^MEILISEARCH_API_KEY_UID=|MEILISEARCH_API_KEY_UID=${MEILISEARCH_API_KEY_UID}|" \
|
||||
/opt/bar-assistant/.env
|
||||
$STD composer install --no-interaction
|
||||
$STD php artisan key:generate
|
||||
|
||||
@@ -25,20 +25,7 @@ msg_ok "Installed Dependencies"
|
||||
|
||||
fetch_and_deploy_gh_release "monolith" "Y2Z/monolith" "singlefile" "latest" "/usr/bin" "monolith-gnu-linux-x86_64"
|
||||
fetch_and_deploy_gh_release "yt-dlp" "yt-dlp/yt-dlp-nightly-builds" "singlefile" "latest" "/usr/bin" "yt-dlp_linux"
|
||||
fetch_and_deploy_gh_release "meilisearch" "meilisearch/meilisearch" "binary"
|
||||
|
||||
msg_info "Configuring Meilisearch"
|
||||
curl -fsSL "https://raw.githubusercontent.com/meilisearch/meilisearch/latest/config.toml" -o "/etc/meilisearch.toml"
|
||||
MASTER_KEY=$(openssl rand -base64 12)
|
||||
sed -i \
|
||||
-e 's|^env =.*|env = "production"|' \
|
||||
-e "s|^# master_key =.*|master_key = \"$MASTER_KEY\"|" \
|
||||
-e 's|^db_path =.*|db_path = "/var/lib/meilisearch/data"|' \
|
||||
-e 's|^dump_dir =.*|dump_dir = "/var/lib/meilisearch/dumps"|' \
|
||||
-e 's|^snapshot_dir =.*|snapshot_dir = "/var/lib/meilisearch/snapshots"|' \
|
||||
-e 's|^# no_analytics = true|no_analytics = true|' \
|
||||
/etc/meilisearch.toml
|
||||
msg_ok "Configured Meilisearch"
|
||||
setup_meilisearch
|
||||
|
||||
fetch_and_deploy_gh_release "karakeep" "karakeep-app/karakeep" "tarball"
|
||||
cd /opt/karakeep
|
||||
@@ -70,7 +57,7 @@ NEXTAUTH_SECRET="$karakeep_SECRET"
|
||||
NEXTAUTH_URL="http://localhost:3000"
|
||||
DATA_DIR=${DATA_DIR}
|
||||
MEILI_ADDR="http://127.0.0.1:7700"
|
||||
MEILI_MASTER_KEY="$MASTER_KEY"
|
||||
MEILI_MASTER_KEY="$MEILISEARCH_MASTER_KEY"
|
||||
BROWSER_WEB_URL="http://127.0.0.1:9222"
|
||||
DB_WAL_MODE=true
|
||||
|
||||
@@ -109,19 +96,6 @@ $STD pnpm migrate
|
||||
msg_ok "Database Migration Completed"
|
||||
|
||||
msg_info "Creating Services"
|
||||
cat <<EOF >/etc/systemd/system/meilisearch.service
|
||||
[Unit]
|
||||
Description=Meilisearch
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/meilisearch --config-file-path /etc/meilisearch.toml
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
cat <<EOF >/etc/systemd/system/karakeep-web.service
|
||||
[Unit]
|
||||
Description=karakeep Web
|
||||
@@ -169,7 +143,7 @@ TimeoutStopSec=5
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
systemctl enable -q --now meilisearch karakeep-browser karakeep-workers karakeep-web
|
||||
systemctl enable -q --now karakeep-browser karakeep-workers karakeep-web
|
||||
msg_ok "Created Services"
|
||||
|
||||
motd_ssh
|
||||
|
||||
@@ -13,21 +13,7 @@ setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
fetch_and_deploy_gh_release "meilisearch" "meilisearch/meilisearch" "binary"
|
||||
|
||||
msg_info "Configuring ${APPLICATION}"
|
||||
curl -fsSL https://raw.githubusercontent.com/meilisearch/meilisearch/latest/config.toml -o /etc/meilisearch.toml
|
||||
MASTER_KEY=$(openssl rand -base64 12)
|
||||
sed -i \
|
||||
-e 's|^env =.*|env = "production"|' \
|
||||
-e "s|^# master_key =.*|master_key = \"$MASTER_KEY\"|" \
|
||||
-e 's|^db_path =.*|db_path = "/var/lib/meilisearch/data"|' \
|
||||
-e 's|^dump_dir =.*|dump_dir = "/var/lib/meilisearch/dumps"|' \
|
||||
-e 's|^snapshot_dir =.*|snapshot_dir = "/var/lib/meilisearch/snapshots"|' \
|
||||
-e 's|^# no_analytics = true|no_analytics = true|' \
|
||||
-e 's|^http_addr =.*|http_addr = "0.0.0.0:7700"|' \
|
||||
/etc/meilisearch.toml
|
||||
msg_ok "Configured ${APPLICATION}"
|
||||
MEILISEARCH_BIND="0.0.0.0:7700" setup_meilisearch
|
||||
|
||||
read -r -p "${TAB3}Do you want add meilisearch-ui? [y/n]: " prompt
|
||||
if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then
|
||||
@@ -41,27 +27,11 @@ if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then
|
||||
cat <<EOF >/opt/meilisearch-ui/.env.local
|
||||
VITE_SINGLETON_MODE=true
|
||||
VITE_SINGLETON_HOST=http://${LOCAL_IP}:7700
|
||||
VITE_SINGLETON_API_KEY=${MASTER_KEY}
|
||||
VITE_SINGLETON_API_KEY=${MEILISEARCH_MASTER_KEY}
|
||||
EOF
|
||||
msg_ok "Configured ${APPLICATION}-ui"
|
||||
fi
|
||||
|
||||
msg_info "Creating service"
|
||||
cat <<EOF >/etc/systemd/system/meilisearch.service
|
||||
[Unit]
|
||||
Description=Meilisearch
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/meilisearch --config-file-path /etc/meilisearch.toml
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q --now meilisearch
|
||||
|
||||
if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then
|
||||
msg_info "Creating Meilisearch-UI service"
|
||||
cat <<EOF >/etc/systemd/system/meilisearch-ui.service
|
||||
[Unit]
|
||||
Description=Meilisearch UI Service
|
||||
@@ -82,8 +52,8 @@ SyslogIdentifier=meilisearch-ui
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q --now meilisearch-ui
|
||||
msg_ok "Created Meilisearch-UI service"
|
||||
fi
|
||||
msg_ok "Service created"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
|
||||
@@ -21,40 +21,11 @@ NODE_VERSION="22" NODE_MODULE="pnpm" setup_nodejs
|
||||
PG_VERSION="17" setup_postgresql
|
||||
PG_DB_NAME="openarchiver_db" PG_DB_USER="openarchiver" setup_postgresql_db
|
||||
|
||||
fetch_and_deploy_gh_release "meilisearch" "meilisearch/meilisearch" "binary"
|
||||
setup_meilisearch
|
||||
fetch_and_deploy_gh_release "openarchiver" "LogicLabs-OU/OpenArchiver" "tarball"
|
||||
JWT_KEY="$(openssl rand -hex 32)"
|
||||
SECRET_KEY="$(openssl rand -hex 32)"
|
||||
|
||||
msg_info "Configuring MeiliSearch"
|
||||
curl -fsSL https://raw.githubusercontent.com/meilisearch/meilisearch/latest/config.toml -o /etc/meilisearch.toml
|
||||
MASTER_KEY=$(openssl rand -base64 12)
|
||||
sed -i \
|
||||
-e 's|^env =.*|env = "production"|' \
|
||||
-e "s|^# master_key =.*|master_key = \"$MASTER_KEY\"|" \
|
||||
-e 's|^db_path =.*|db_path = "/var/lib/meilisearch/data"|' \
|
||||
-e 's|^dump_dir =.*|dump_dir = "/var/lib/meilisearch/dumps"|' \
|
||||
-e 's|^snapshot_dir =.*|snapshot_dir = "/var/lib/meilisearch/snapshots"|' \
|
||||
-e 's|^# no_analytics = true|no_analytics = true|' \
|
||||
-e 's|^http_addr =.*|http_addr = "127.0.0.1:7700"|' \
|
||||
/etc/meilisearch.toml
|
||||
|
||||
cat <<EOF >/etc/systemd/system/meilisearch.service
|
||||
[Unit]
|
||||
Description=Meilisearch
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/meilisearch --config-file-path /etc/meilisearch.toml
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q --now meilisearch
|
||||
sleep 5
|
||||
msg_ok "Configured MeiliSearch"
|
||||
|
||||
msg_info "Setting up Open Archiver"
|
||||
mkdir -p /opt/openarchiver-data
|
||||
cd /opt/openarchiver
|
||||
@@ -65,7 +36,7 @@ sed -i "s|^POSTGRES_USER=.*|POSTGRES_USER=$PG_DB_USER|g" /opt/openarchiver/.env
|
||||
sed -i "s|^POSTGRES_PASSWORD=.*|POSTGRES_PASSWORD=$PG_DB_PASS|g" /opt/openarchiver/.env
|
||||
sed -i "s|^DATABASE_URL=.*|DATABASE_URL=\"postgresql://$PG_DB_USER:$PG_DB_PASS@localhost:5432/$PG_DB_NAME\"|g" /opt/openarchiver/.env
|
||||
sed -i "s|^MEILI_HOST=.*|MEILI_HOST=http://localhost:7700|g" /opt/openarchiver/.env
|
||||
sed -i "s|^MEILI_MASTER_KEY=.*|MEILI_MASTER_KEY=$MASTER_KEY|g" /opt/openarchiver/.env
|
||||
sed -i "s|^MEILI_MASTER_KEY=.*|MEILI_MASTER_KEY=$MEILISEARCH_MASTER_KEY|g" /opt/openarchiver/.env
|
||||
sed -i "s|^REDIS_HOST=.*|REDIS_HOST=localhost|g" /opt/openarchiver/.env
|
||||
sed -i "s|^REDIS_PASSWORD=.*|REDIS_PASSWORD=|g" /opt/openarchiver/.env
|
||||
sed -i "s|^STORAGE_LOCAL_ROOT_PATH=.*|STORAGE_LOCAL_ROOT_PATH=/opt/openarchiver-data|g" /opt/openarchiver/.env
|
||||
|
||||
Reference in New Issue
Block a user