mirror of
https://github.com/YunoHost-Apps/etherpad_mypads_ynh.git
synced 2024-09-03 18:36:09 +02:00
Simplify plugin install
This commit is contained in:
parent
1621ca2528
commit
3b0842e03d
5 changed files with 81 additions and 64 deletions
|
@ -23,10 +23,10 @@
|
|||
/* An Example of MySQL Configuration */
|
||||
"dbType" : "mysql",
|
||||
"dbSettings" : {
|
||||
"user" : "__DB_USER__",
|
||||
"user" : "__DB_NAME__",
|
||||
"host" : "localhost",
|
||||
"password": "__DB_PWD__",
|
||||
"database": "__DB_USER__",
|
||||
"database": "__DB_NAME__",
|
||||
"charset" : "utf8mb4"
|
||||
},
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
||||
#sub_path_only rewrite ^__PATH__/admin$ __PATH__/admin/ permanent;
|
||||
location __PATH__/ {
|
||||
|
||||
# Force usage of https
|
||||
|
@ -5,17 +7,21 @@ location __PATH__/ {
|
|||
rewrite ^ https://$server_name$request_uri? permanent;
|
||||
}
|
||||
|
||||
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
||||
#sub_path_only rewrite ^__PATH__/admin$ __PATH__/admin/ permanent;
|
||||
proxy_pass http://127.0.0.1:__PORT__/;
|
||||
proxy_set_header Host $host;
|
||||
proxy_buffering off;
|
||||
proxy_pass http://127.0.0.1:__PORT__/;
|
||||
proxy_set_header Host $host;
|
||||
proxy_buffering off;
|
||||
more_set_headers "X-Frame-Options : ALLOWALL";
|
||||
|
||||
# Recommended proxy_http version for keepalive connections
|
||||
# https://github.com/ether/etherpad-lite/wiki/How-to-put-Etherpad-Lite-behind-a-reverse-Proxy#nginx
|
||||
proxy_http_version 1.1;
|
||||
proxy_buffering off;
|
||||
proxy_set_header X-Real-IP $remote_addr; # http://wiki.nginx.org/HttpProxyModule
|
||||
proxy_set_header X-Forwarded-For $remote_addr; # EP logs to show the actual remote IP
|
||||
proxy_set_header X-Forwarded-Proto $scheme; # for EP to set secure cookie flag when https is used
|
||||
proxy_set_header Host $host; # pass the host header
|
||||
proxy_http_version 1.1; # recommended with keepalive connections
|
||||
|
||||
# WebSocket proxying - from http://nginx.org/en/docs/http/websocket.html
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
|
||||
# Include SSOWAT user panel.
|
||||
include conf.d/yunohost_panel.conf.inc;
|
||||
|
|
|
@ -85,11 +85,11 @@ pad_config_automatic_logout="${YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_AUTO
|
|||
# Etherpad skin
|
||||
old_pad_config_skinname="$(get_config_value skinName)"
|
||||
if [ "$old_pad_config_skinname" = "no-skin" ]; then
|
||||
old_pad_config_skinname=noskin
|
||||
old_pad_config_skinname=colibris
|
||||
fi
|
||||
pad_config_skinname="${YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_SKINNAME:-$old_pad_config_skinname}"
|
||||
if [ "$pad_config_skinname" = "no-skin" ]; then
|
||||
pad_config_skinname=noskin
|
||||
pad_config_skinname=colibris
|
||||
fi
|
||||
|
||||
# MyPads
|
||||
|
|
100
scripts/install
100
scripts/install
|
@ -165,6 +165,12 @@ chown -R $app: $final_path
|
|||
pushd $final_path
|
||||
ynh_use_nodejs
|
||||
ynh_exec_as $app env "$ynh_node_load_PATH" bin/installDeps.sh
|
||||
ynh_exec_as $app env "$ynh_node_load_PATH" npm install ep_spellcheck ep_countable ep_delete_empty_pads ep_subscript_and_superscript ep_headings2 ep_author_hover ep_markdown ep_comments_page ep_align ep_font_color ep_embedded_hyperlinks2 >> $install_log 2>&1
|
||||
if [ $mypads -eq 1 ]; then
|
||||
# Framapad - Groups and private pads for Etherpad
|
||||
ynh_exec_as $app env "$ynh_node_load_PATH" npm install ep_mypads >> $install_log 2>&1
|
||||
fi
|
||||
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
|
@ -172,12 +178,16 @@ popd
|
|||
#=================================================
|
||||
ynh_script_progression --message="Configuring Etherpad..." --weight=6
|
||||
|
||||
ynh_add_config --template="../conf/credentials.json" --destination="$final_path/credentials.json"
|
||||
|
||||
#cp ../conf/credentials.json "$final_path/credentials.json"
|
||||
#ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/credentials.json"
|
||||
#ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/credentials.json"
|
||||
#ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file="$final_path/credentials.json"
|
||||
#ynh_print_OFF; ynh_replace_special_string --match_string="__PASSWORD__" --replace_string="$password" --target_file="$final_path/credentials.json"; ynh_print_ON
|
||||
|
||||
cp ../conf/settings.json "$final_path/settings.json"
|
||||
cp ../conf/credentials.json "$final_path/credentials.json"
|
||||
ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_name" --target_file="$final_path/credentials.json"
|
||||
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/credentials.json"
|
||||
ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file="$final_path/credentials.json"
|
||||
ynh_print_OFF; ynh_replace_special_string --match_string="__PASSWORD__" --replace_string="$password" --target_file="$final_path/credentials.json"; ynh_print_ON
|
||||
|
||||
if [ "$export" = "abiword" ]
|
||||
then
|
||||
# Get abiword binary path
|
||||
|
@ -227,47 +237,47 @@ ynh_add_systemd_config --others_var="ynh_node_load_PATH"
|
|||
|
||||
yunohost service add $app --description="Collaborative editor" --log="/var/log/$app/etherpad.log"
|
||||
|
||||
#=================================================
|
||||
# INSTALL FRAMAPAD'S PLUGINS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing Etherpad plugins..." --weight=90
|
||||
# #=================================================
|
||||
# # INSTALL FRAMAPAD'S PLUGINS
|
||||
# #=================================================
|
||||
# ynh_script_progression --message="Installing Etherpad plugins..." --weight=90
|
||||
|
||||
pushd "$final_path"
|
||||
# Add Left/Center/Right/Justify to lines of text in a pad
|
||||
npm install ep_align@${ep_align_version} >> $install_log 2>&1
|
||||
# Framapad - Adds author names to span titles
|
||||
npm install ep_author_hover@${ep_author_hover_version} >> $install_log 2>&1
|
||||
# Automatically disconnects user after some period of time (Prevent server overload)
|
||||
npm install ep_automatic_logut@${ep_automatic_logut_version} >> $install_log 2>&1
|
||||
# Framapad - Adds comments on sidebar and link it to the text.
|
||||
npm install ep_comments_page@${ep_comments_page_version} >> $install_log 2>&1
|
||||
# Framapad - Displays paragraphs, sentences, words and characters counts.
|
||||
npm install ep_countable@${ep_countable_version} >> $install_log 2>&1
|
||||
# Framapad - Delete pads which were never edited
|
||||
npm install ep_delete_empty_pads@${ep_delete_empty_pads_version} >> $install_log 2>&1
|
||||
# Framapad - Apply colors to fonts
|
||||
npm install ep_font_color@${ep_font_color_version} >> $install_log 2>&1
|
||||
# Framapad - User Pad Contents font size can be set in settings, this does not effect other peoples views
|
||||
npm install ep_font_size@${ep_font_size_version} >> $install_log 2>&1
|
||||
# Framapad - Adds heading support to Etherpad Lite.
|
||||
npm install ep_headings2@${ep_headings2_version} >> $install_log 2>&1
|
||||
# Framapad - Edit and Export as Markdown in Etherpad
|
||||
npm install ep_markdown@${ep_markdown_version} >> $install_log 2>&1
|
||||
if [ $mypads -eq 1 ]; then
|
||||
# Framapad - Groups and private pads for Etherpad
|
||||
npm install ep_mypads@${mypads_version} >> $install_log 2>&1
|
||||
fi
|
||||
# Framapad - Add support to do 'page view', with a toggle on/off option in Settings, also Page Breaks with Control Enter
|
||||
npm install ep_page_view@${ep_page_view_version} >> $install_log 2>&1
|
||||
# Framapad - Add support to do 'Spell checking'
|
||||
npm install ep_spellcheck@${ep_spellcheck_version} >> $install_log 2>&1
|
||||
# Framapad - Add support for Subscript and Superscript
|
||||
npm install ep_subscript_and_superscript@${ep_subscript_and_superscript_version} >> $install_log 2>&1
|
||||
# Framapad - View a table of contents for your pad
|
||||
npm install ep_table_of_contents@${ep_table_of_contents_version} >> $install_log 2>&1
|
||||
popd
|
||||
# pushd "$final_path"
|
||||
# # Add Left/Center/Right/Justify to lines of text in a pad
|
||||
# npm install ep_align@${ep_align_version} >> $install_log 2>&1
|
||||
# # Framapad - Adds author names to span titles
|
||||
# npm install ep_author_hover@${ep_author_hover_version} >> $install_log 2>&1
|
||||
# # Automatically disconnects user after some period of time (Prevent server overload)
|
||||
# npm install ep_automatic_logut@${ep_automatic_logut_version} >> $install_log 2>&1
|
||||
# # Framapad - Adds comments on sidebar and link it to the text.
|
||||
# npm install ep_comments_page@${ep_comments_page_version} >> $install_log 2>&1
|
||||
# # Framapad - Displays paragraphs, sentences, words and characters counts.
|
||||
# npm install ep_countable@${ep_countable_version} >> $install_log 2>&1
|
||||
# # Framapad - Delete pads which were never edited
|
||||
# npm install ep_delete_empty_pads@${ep_delete_empty_pads_version} >> $install_log 2>&1
|
||||
# # Framapad - Apply colors to fonts
|
||||
# npm install ep_font_color@${ep_font_color_version} >> $install_log 2>&1
|
||||
# # Framapad - User Pad Contents font size can be set in settings, this does not effect other peoples views
|
||||
# npm install ep_font_size@${ep_font_size_version} >> $install_log 2>&1
|
||||
# # Framapad - Adds heading support to Etherpad Lite.
|
||||
# npm install ep_headings2@${ep_headings2_version} >> $install_log 2>&1
|
||||
# # Framapad - Edit and Export as Markdown in Etherpad
|
||||
# npm install ep_markdown@${ep_markdown_version} >> $install_log 2>&1
|
||||
# if [ $mypads -eq 1 ]; then
|
||||
# # Framapad - Groups and private pads for Etherpad
|
||||
# npm install ep_mypads@${mypads_version} >> $install_log 2>&1
|
||||
# fi
|
||||
# # Framapad - Add support to do 'page view', with a toggle on/off option in Settings, also Page Breaks with Control Enter
|
||||
# npm install ep_page_view@${ep_page_view_version} >> $install_log 2>&1
|
||||
# # Framapad - Add support to do 'Spell checking'
|
||||
# npm install ep_spellcheck@${ep_spellcheck_version} >> $install_log 2>&1
|
||||
# # Framapad - Add support for Subscript and Superscript
|
||||
# npm install ep_subscript_and_superscript@${ep_subscript_and_superscript_version} >> $install_log 2>&1
|
||||
# # Framapad - View a table of contents for your pad
|
||||
# npm install ep_table_of_contents@${ep_table_of_contents_version} >> $install_log 2>&1
|
||||
# popd
|
||||
|
||||
chown -R $app: $final_path/node_modules
|
||||
# chown -R $app: $final_path/node_modules
|
||||
|
||||
#=================================================
|
||||
# SOME HACKS
|
||||
|
@ -291,7 +301,7 @@ fi
|
|||
#=================================================
|
||||
# SETUP FAIL2BAN
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring Fail2Ban..." --weight=13
|
||||
ynh_script_progression --message="Configuring Fail2Ban..." --weight=60
|
||||
|
||||
# Create a dedicated Fail2Ban config
|
||||
ynh_add_fail2ban_config --logpath="/var/log/nginx/$domain-access.log" --failregex="<HOST> .* .POST /mypads/api/auth/login HTTP/1.1. 400" --max_retry=5
|
||||
|
|
|
@ -28,6 +28,7 @@ port=$(ynh_app_setting_get --app=$app --key=port)
|
|||
export=$(ynh_app_setting_get --app=$app --key=export)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
ynh_print_OFF; password=$(ynh_app_setting_get --app=$app --key=password); ynh_print_ON
|
||||
mypads=$(ynh_app_setting_get --app=$app --key=mypads)
|
||||
useldap=$(ynh_app_setting_get --app=$app --key=useldap)
|
||||
overwrite_settings=$(ynh_app_setting_get --app=$app --key=overwrite_settings)
|
||||
|
@ -309,13 +310,13 @@ then
|
|||
then
|
||||
# Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
|
||||
ynh_backup_if_checksum_is_different --file="$final_path/credentials.json"
|
||||
cp ../conf/credentials.json "$final_path/credentials.json"
|
||||
ynh_add_config --template="../conf/credentials.json" --destination="$final_path/credentials.json"
|
||||
|
||||
ynh_replace_string --match_string="__DB_USER__" --replace_string="$app" --target_file="$final_path/credentials.json"
|
||||
ynh_print_OFF; password=$(ynh_app_setting_get --app=$app --key=password); ynh_print_ON
|
||||
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/credentials.json"
|
||||
ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file="$final_path/credentials.json"
|
||||
ynh_print_OFF; ynh_replace_special_string --match_string="__PASSWORD__" --replace_string="$password" --target_file="$final_path/credentials.json"; ynh_print_ON
|
||||
#cp ../conf/credentials.json "$final_path/credentials.json"
|
||||
#ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/credentials.json"
|
||||
#ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/credentials.json"
|
||||
#ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file="$final_path/credentials.json"
|
||||
#ynh_print_OFF; ynh_replace_special_string --match_string="__PASSWORD__" --replace_string="$password" --target_file="$final_path/credentials.json"; ynh_print_ON
|
||||
|
||||
# Recalculate and store the checksum of the file for the next upgrade.
|
||||
ynh_store_file_checksum --file="$final_path/credentials.json"
|
||||
|
@ -349,7 +350,7 @@ yunohost service add $app --description="Collaborative editor" --log="/var/log/$
|
|||
#=================================================
|
||||
# UPGRADE FAIL2BAN
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reconfiguring Fail2ban..." --weight=8
|
||||
ynh_script_progression --message="Reconfiguring Fail2Ban..." --weight=8
|
||||
|
||||
# Create a dedicated fail2ban config
|
||||
ynh_add_fail2ban_config --logpath="/var/log/nginx/$domain-access.log" --failregex="<HOST> .* .POST /mypads/api/auth/login HTTP/1.1. 400" --max_retry=5
|
||||
|
|
Loading…
Add table
Reference in a new issue