mirror of
https://github.com/YunoHost-Apps/meilisearch_ynh.git
synced 2024-09-03 19:45:59 +02:00
Fix
This commit is contained in:
parent
b5dcfc41ef
commit
ae1b55b7a8
6 changed files with 41 additions and 67 deletions
|
@ -4,11 +4,11 @@
|
||||||
echo -n "Here your commands to execute in the container"
|
echo -n "Here your commands to execute in the container"
|
||||||
echo ", before each installation of the app."
|
echo ", before each installation of the app."
|
||||||
; Manifest
|
; Manifest
|
||||||
domain="domain.tld" (DOMAIN)
|
domain="domain.tld"
|
||||||
path="/path" (PATH)
|
path="/path"
|
||||||
master_key="YUNOHOST-API-KEY-202020201456452135"
|
master_key="YUNOHOST-API-KEY-202020201456452135"
|
||||||
is_public=1 (PUBLIC|public=1|private=0)
|
is_public=1
|
||||||
port="3500" (PORT)
|
port="3500"
|
||||||
data_path=""
|
data_path=""
|
||||||
; Actions
|
; Actions
|
||||||
action_argument=arg1|arg2
|
action_argument=arg1|arg2
|
||||||
|
|
|
@ -7,7 +7,7 @@ Type=simple
|
||||||
User=__APP__
|
User=__APP__
|
||||||
Group=__APP__
|
Group=__APP__
|
||||||
WorkingDirectory=__FINALPATH__/
|
WorkingDirectory=__FINALPATH__/
|
||||||
ExecStart=/usr/bin/meilisearch --http-addr 127.0.0.1:__PORT__ --env production --master-key __API_KEY__ --no-analytics __ANALYTICS__
|
ExecStart=/usr/bin/meilisearch --http-addr 127.0.0.1:__PORT__ --env production --master-key __MASTER_KEY__ --no-analytics __ANALYTICS__
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
"url": "https://julien.gomes-dias.dev"
|
"url": "https://julien.gomes-dias.dev"
|
||||||
},
|
},
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 4.1.7"
|
"yunohost": ">= 4.2.0"
|
||||||
},
|
},
|
||||||
"multi_instance": true,
|
"multi_instance": true,
|
||||||
"services": [
|
"services": [
|
||||||
|
|
|
@ -70,6 +70,14 @@ ynh_script_progression --message="Finding an available port..." --weight=2
|
||||||
port=$(ynh_find_port --port=8095)
|
port=$(ynh_find_port --port=8095)
|
||||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CREATE DEDICATED USER
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configuring system user..." --weight=1
|
||||||
|
|
||||||
|
# Create a system user
|
||||||
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD AND INSTALL MEILISEARCH
|
# DOWNLOAD AND INSTALL MEILISEARCH
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -86,6 +94,10 @@ curl -OL https://github.com/meilisearch/MeiliSearch/releases/download/$latest/me
|
||||||
chmod +x "$release_file"
|
chmod +x "$release_file"
|
||||||
mv "$release_file" /usr/bin/meilisearch
|
mv "$release_file" /usr/bin/meilisearch
|
||||||
|
|
||||||
|
chmod 750 "$final_path"
|
||||||
|
chmod -R o-rwx "$final_path"
|
||||||
|
chown -R $app:www-data "$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -94,14 +106,6 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=8
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated nginx config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CREATE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configuring system user..." --weight=1
|
|
||||||
|
|
||||||
# Create a system user
|
|
||||||
ynh_system_user_create --username=$app
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -112,21 +116,10 @@ if [ $allow_analyse ]; then
|
||||||
else
|
else
|
||||||
ynh_replace_string "__ANALYTICS__" "true" "../conf/systemd.service"
|
ynh_replace_string "__ANALYTICS__" "true" "../conf/systemd.service"
|
||||||
fi
|
fi
|
||||||
ynh_replace_string "__PORT__" "$port" "../conf/systemd.service"
|
|
||||||
ynh_replace_string "__API_KEY__" "$master_key" "../conf/systemd.service"
|
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
# Create a dedicated systemd config
|
||||||
ynh_add_systemd_config
|
ynh_add_systemd_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
|
||||||
# SECURE FILES AND DIRECTORIES
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Set permissions to app files
|
|
||||||
chown -R $app:$app $final_path
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -149,14 +142,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||||
# Start a systemd service
|
# Start a systemd service
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SETUP FAIL2BAN
|
|
||||||
#=================================================
|
|
||||||
#ynh_script_progression --message="Configuring fail2ban..." --time --weight=1
|
|
||||||
#
|
|
||||||
## Create a dedicated fail2ban config
|
|
||||||
#ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -50,6 +50,14 @@ test ! -d $final_path \
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RECREATE THE DEDICATED USER
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
||||||
|
|
||||||
|
# Create the dedicated user (if not existing)
|
||||||
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# RESTORE THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -57,6 +65,10 @@ ynh_script_progression --message="Restoring Meilisearch main directory..." --wei
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$final_path"
|
ynh_restore_file --origin_path="$final_path"
|
||||||
|
|
||||||
|
chmod 750 "$final_path"
|
||||||
|
chmod -R o-rwx "$final_path"
|
||||||
|
chown -R $app:www-data "$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE Meilisearch
|
# RESTORE Meilisearch
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -75,14 +87,6 @@ curl -OL https://github.com/meilisearch/MeiliSearch/releases/download/$latest/me
|
||||||
chmod +x "$release_file"
|
chmod +x "$release_file"
|
||||||
mv "$release_file" /usr/bin/meilisearch
|
mv "$release_file" /usr/bin/meilisearch
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RECREATE THE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
|
||||||
|
|
||||||
# Create the dedicated user (if not existing)
|
|
||||||
ynh_system_user_create --username=$app
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE FAIL2BAN CONFIGURATION
|
# RESTORE FAIL2BAN CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -89,6 +89,14 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
|
||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CREATE DEDICATED USER
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
||||||
|
|
||||||
|
# Create a dedicated user (if not existing)
|
||||||
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPGRADING MEILISEARCH
|
# UPGRADING MEILISEARCH
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -105,13 +113,9 @@ curl -OL https://github.com/meilisearch/MeiliSearch/releases/download/$latest/me
|
||||||
chmod +x "$release_file"
|
chmod +x "$release_file"
|
||||||
mv "$release_file" /usr/bin/meilisearch
|
mv "$release_file" /usr/bin/meilisearch
|
||||||
|
|
||||||
#=================================================
|
chmod 750 "$final_path"
|
||||||
# CREATE DEDICATED USER
|
chmod -R o-rwx "$final_path"
|
||||||
#=================================================
|
chown -R $app:www-data "$final_path"
|
||||||
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
|
||||||
|
|
||||||
# Create a dedicated user (if not existing)
|
|
||||||
ynh_system_user_create --username=$app
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE THE CONFIG FILE CHECKSUM
|
# STORE THE CONFIG FILE CHECKSUM
|
||||||
|
@ -139,29 +143,10 @@ if [ $allow_analyse ]; then
|
||||||
else
|
else
|
||||||
ynh_replace_string "__ANALYTICS__" "true" "../conf/systemd.service"
|
ynh_replace_string "__ANALYTICS__" "true" "../conf/systemd.service"
|
||||||
fi
|
fi
|
||||||
ynh_replace_string "__PORT__" "$port" "../conf/systemd.service"
|
|
||||||
ynh_replace_string "__API_KEY__" "$master_key" "../conf/systemd.service"
|
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
# Create a dedicated systemd config
|
||||||
ynh_add_systemd_config
|
ynh_add_systemd_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
|
||||||
# UPGRADE FAIL2BAN
|
|
||||||
#=================================================
|
|
||||||
#ynh_script_progression --message="Reconfiguring fail2ban..." --weight=1
|
|
||||||
|
|
||||||
# Create a dedicated fail2ban config
|
|
||||||
#ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SECURE FILES AND DIRECTORIES
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Set permissions on app files
|
|
||||||
chown -R $app:$app $final_path
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Reference in a new issue