1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/vaultwarden_ynh.git synced 2024-09-03 18:26:31 +02:00

Apply last example_ynh

This commit is contained in:
yalh76 2021-04-10 23:52:18 +02:00
parent 7eb1ed5383
commit 81e072f426
3 changed files with 23 additions and 18 deletions

View file

@ -98,6 +98,10 @@ ynh_setup_source --dest_dir="$final_path/build/" --source_id="app"
# Download, check integrity, uncompress and patch the source from web.src # Download, check integrity, uncompress and patch the source from web.src
ynh_setup_source --dest_dir="$final_path/live/web-vault/" --source_id="web" ynh_setup_source --dest_dir="$final_path/live/web-vault/" --source_id="web"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R root:$app "$final_path"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
@ -139,14 +143,6 @@ ynh_secure_remove --file="$final_path/.rustup"
# Create datadir # Create datadir
mkdir -p "$final_path"/live/data mkdir -p "$final_path"/live/data
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Configuring a systemd service..."
# Create a dedicated systemd config
ynh_add_systemd_config
#================================================= #=================================================
# ADD A CONFIGURATION # ADD A CONFIGURATION
#================================================= #=================================================
@ -157,6 +153,14 @@ ynh_add_config --template="../conf/bitwarden_rs.env" --destination="$final_path/
chmod 400 "$final_path/live/bitwarden_rs.env" chmod 400 "$final_path/live/bitwarden_rs.env"
chown $app:$app "$final_path/live/bitwarden_rs.env" chown $app:$app "$final_path/live/bitwarden_rs.env"
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Configuring a systemd service..."
# Create a dedicated systemd config
ynh_add_systemd_config
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================
@ -165,8 +169,6 @@ chown $app:$app "$final_path/live/bitwarden_rs.env"
ynh_script_progression --message="Configuring log rotation..." ynh_script_progression --message="Configuring log rotation..."
# Use logrotate to manage application logfile(s) # Use logrotate to manage application logfile(s)
chown -R "$app":"$app" "$final_path"
mkdir -p "/var/log/$app"
ynh_use_logrotate ynh_use_logrotate
#================================================= #=================================================
@ -190,6 +192,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --l
ynh_script_progression --message="Configuring Fail2Ban..." ynh_script_progression --message="Configuring Fail2Ban..."
# Create a dedicated Fail2Ban config # Create a dedicated Fail2Ban config
mkdir -p "/var/log/$app"
touch /var/log/"$app"/"$app".log touch /var/log/"$app"/"$app".log
ynh_add_fail2ban_config --logpath="/var/log/$app/$app.log" --failregex="^.*Username or password is incorrect\. Try again\. IP: <HOST>\. Username:.*$" ynh_add_fail2ban_config --logpath="/var/log/$app/$app.log" --failregex="^.*Username or password is incorrect\. Try again\. IP: <HOST>\. Username:.*$"

View file

@ -76,7 +76,6 @@ ynh_script_progression --message="Restoring the Fail2Ban configuration..."
# Create a dedicated Fail2Ban config # Create a dedicated Fail2Ban config
mkdir -p "/var/log/$app" mkdir -p "/var/log/$app"
chown -R "$app":"$app" "/var/log/$app"
touch /var/log/"$app"/"$app".log touch /var/log/"$app"/"$app".log
ynh_restore_file "/etc/fail2ban/jail.d/$app.conf" ynh_restore_file "/etc/fail2ban/jail.d/$app.conf"

View file

@ -162,6 +162,16 @@ then
ynh_secure_remove --file="$final_path/.rustup" ynh_secure_remove --file="$final_path/.rustup"
fi fi
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Updating a config file..."
ynh_add_config --template="../conf/bitwarden_rs.env" --destination="$final_path/live/bitwarden_rs.env"
chmod 400 "$final_path/live/bitwarden_rs.env"
chown $app:$app "$final_path/live/bitwarden_rs.env"
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
#================================================= #=================================================
@ -170,13 +180,6 @@ ynh_script_progression --message="Upgrading systemd configuration..."
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config ynh_add_systemd_config
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Updating a config file..."
ynh_add_config --template="../conf/bitwarden_rs.env" --destination="$final_path/live/bitwarden_rs.env"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================