mirror of
https://github.com/YunoHost-Apps/glitchsoc_ynh.git
synced 2024-09-03 19:15:59 +02:00
Merge pull request #18 from YunoHost-Apps/testing
Upgrade to 2022.01.23 Fix systemd sandboxing causing federation issues Fix config_panel
This commit is contained in:
commit
818a73f510
14 changed files with 231 additions and 134 deletions
|
@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
|
||||||
Glitch-Soc, a fork of Mastodon, is a free, open-source microblogging social network. It is a decentralized alternative to commercial platforms like Twitter and avoids the risks of a single company monopolizing your communication for commercial purposes.
|
Glitch-Soc, a fork of Mastodon, is a free, open-source microblogging social network. It is a decentralized alternative to commercial platforms like Twitter and avoids the risks of a single company monopolizing your communication for commercial purposes.
|
||||||
|
|
||||||
|
|
||||||
**Shipped version:** 2022.01.10~ynh2
|
**Shipped version:** 2022.01.23~ynh1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
|
||||||
Glitch-Soc, une scission de Mastodon, est un réseau social de microblog auto-hébergé et open source. C'est une alternative décentralisée aux plates-formes commerciales comme Twitter. Glitch-Soc évite ainsi les risques qu'une seule société monopolise votre communication à des fins commerciales.
|
Glitch-Soc, une scission de Mastodon, est un réseau social de microblog auto-hébergé et open source. C'est une alternative décentralisée aux plates-formes commerciales comme Twitter. Glitch-Soc évite ainsi les risques qu'une seule société monopolise votre communication à des fins commerciales.
|
||||||
|
|
||||||
|
|
||||||
**Version incluse :** 2022.01.10~ynh2
|
**Version incluse :** 2022.01.23~ynh1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,13 +12,13 @@
|
||||||
setup_private=1
|
setup_private=1
|
||||||
setup_public=1
|
setup_public=1
|
||||||
upgrade=1
|
upgrade=1
|
||||||
# 2022.01.10~ynh1
|
# 2022.01.10~ynh2
|
||||||
upgrade=1 from_commit=9fb00be10143ee57685d4c84b21029921b33e159
|
upgrade=1 from_commit=325f6befc0d6da2b5102ad9c4ac64a5235ee470e
|
||||||
backup_restore=1
|
backup_restore=1
|
||||||
multi_instance=0
|
multi_instance=0
|
||||||
port_already_use=0
|
port_already_use=0
|
||||||
change_url=0
|
change_url=0
|
||||||
;;; Options
|
;;; Options
|
||||||
;;; Upgrade options
|
;;; Upgrade options
|
||||||
; commit=efbdbb05350b820c6e59a7bbbf70f57cf679fff8
|
; commit=325f6befc0d6da2b5102ad9c4ac64a5235ee470e
|
||||||
name=2022.01.10~ynh1
|
name=2022.01.10~ynh2
|
||||||
|
|
|
@ -254,31 +254,31 @@ LDAP_TLS_NO_VERIFY=true
|
||||||
# ---------------
|
# ---------------
|
||||||
|
|
||||||
# Maximum allowed character count
|
# Maximum allowed character count
|
||||||
MAX_TOOT_CHARS=500
|
MAX_TOOT_CHARS=__MAX_TOOT_CHARS__
|
||||||
|
|
||||||
# Maximum number of pinned posts
|
# Maximum number of pinned posts
|
||||||
MAX_PINNED_TOOTS=5
|
MAX_PINNED_TOOTS=__MAX_PINNED_TOOTS__
|
||||||
|
|
||||||
# Maximum allowed bio characters
|
# Maximum allowed bio characters
|
||||||
MAX_BIO_CHARS=500
|
MAX_BIO_CHARS=__MAX_BIO_CHARS__
|
||||||
|
|
||||||
# Maximim number of profile fields allowed
|
# Maximim number of profile fields allowed
|
||||||
MAX_PROFILE_FIELDS=4
|
MAX_PROFILE_FIELDS=__MAX_PROFILE_FIELDS__
|
||||||
|
|
||||||
# Maximum allowed display name characters
|
# Maximum allowed display name characters
|
||||||
MAX_DISPLAY_NAME_CHARS=30
|
MAX_DISPLAY_NAME_CHARS=__MAX_DISPLAY_NAME_CHARS__
|
||||||
|
|
||||||
# Maximum allowed poll options
|
# Maximum allowed poll options
|
||||||
MAX_POLL_OPTIONS=5
|
MAX_POLL_OPTIONS=__MAX_POLL_OPTIONS__
|
||||||
|
|
||||||
# Maximum allowed poll option characters
|
# Maximum allowed poll option characters
|
||||||
MAX_POLL_OPTION_CHARS=100
|
MAX_POLL_OPTION_CHARS=__MAX_POLL_OPTION_CHARS__
|
||||||
|
|
||||||
# Maximum image and video/audio upload sizes
|
# Maximum image and video/audio upload sizes
|
||||||
# Units are in bytes
|
# Units are in bytes
|
||||||
# 1048576 bytes equals 1 megabyte
|
# 1048576 bytes equals 1 megabyte
|
||||||
MAX_IMAGE_SIZE=8388608
|
MAX_IMAGE_SIZE=__MAX_IMAGE_SIZE__
|
||||||
MAX_VIDEO_SIZE=41943040
|
MAX_VIDEO_SIZE=__MAX_VIDEO_SIZE__
|
||||||
|
|
||||||
# Maximum search results to display
|
# Maximum search results to display
|
||||||
# Only relevant when elasticsearch is installed
|
# Only relevant when elasticsearch is installed
|
||||||
|
@ -288,5 +288,5 @@ MAX_VIDEO_SIZE=41943040
|
||||||
# If undefined or smaller than MAX_EMOJI_SIZE, the value
|
# If undefined or smaller than MAX_EMOJI_SIZE, the value
|
||||||
# of MAX_EMOJI_SIZE will be used for MAX_REMOTE_EMOJI_SIZE
|
# of MAX_EMOJI_SIZE will be used for MAX_REMOTE_EMOJI_SIZE
|
||||||
# Units are in bytes
|
# Units are in bytes
|
||||||
MAX_EMOJI_SIZE=51200
|
MAX_EMOJI_SIZE=__MAX_EMOJI_SIZE__
|
||||||
MAX_REMOTE_EMOJI_SIZE=204800
|
MAX_REMOTE_EMOJI_SIZE=__MAX_REMOTE_EMOJI_SIZE__
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
SOURCE_URL=https://github.com/glitch-soc/mastodon/archive/07cb948f39464b11959fc506b673a90d9524e519.tar.gz
|
SOURCE_URL=https://github.com/glitch-soc/mastodon/archive/e58e0eb9aa375b1107b207e8229a2142c4edc0b8.tar.gz
|
||||||
SOURCE_SUM=5808362e249689029726b79b799aab7382fc6626a142e54638633b08dee13c76
|
SOURCE_SUM=8ef596033f1278f7a2bfdff76437a2040f494769533b891fa4f83694b0d9f975
|
||||||
SOURCE_SUM_PRG=sha256sum
|
SOURCE_SUM_PRG=sha256sum
|
||||||
SOURCE_FORMAT=tar.gz
|
SOURCE_FORMAT=tar.gz
|
||||||
SOURCE_IN_SUBDIR=true
|
SOURCE_IN_SUBDIR=true
|
||||||
SOURCE_FILENAME=07cb948f39464b11959fc506b673a90d9524e519.tar.gz
|
SOURCE_FILENAME=e58e0eb9aa375b1107b207e8229a2142c4edc0b8.tar.gz
|
||||||
SOURCE_EXTRACT=true
|
SOURCE_EXTRACT=true
|
||||||
|
|
|
@ -21,7 +21,7 @@ StandardError=syslog
|
||||||
NoNewPrivileges=yes
|
NoNewPrivileges=yes
|
||||||
PrivateTmp=yes
|
PrivateTmp=yes
|
||||||
PrivateDevices=yes
|
PrivateDevices=yes
|
||||||
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
|
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 AF_NETLINK
|
||||||
RestrictNamespaces=yes
|
RestrictNamespaces=yes
|
||||||
RestrictRealtime=yes
|
RestrictRealtime=yes
|
||||||
DevicePolicy=closed
|
DevicePolicy=closed
|
||||||
|
|
|
@ -22,7 +22,7 @@ StandardError=syslog
|
||||||
NoNewPrivileges=yes
|
NoNewPrivileges=yes
|
||||||
PrivateTmp=yes
|
PrivateTmp=yes
|
||||||
PrivateDevices=yes
|
PrivateDevices=yes
|
||||||
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
|
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 AF_NETLINK
|
||||||
RestrictNamespaces=yes
|
RestrictNamespaces=yes
|
||||||
RestrictRealtime=yes
|
RestrictRealtime=yes
|
||||||
DevicePolicy=closed
|
DevicePolicy=closed
|
||||||
|
|
|
@ -21,7 +21,7 @@ StandardError=syslog
|
||||||
NoNewPrivileges=yes
|
NoNewPrivileges=yes
|
||||||
PrivateTmp=yes
|
PrivateTmp=yes
|
||||||
PrivateDevices=yes
|
PrivateDevices=yes
|
||||||
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
|
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 AF_NETLINK
|
||||||
RestrictNamespaces=yes
|
RestrictNamespaces=yes
|
||||||
RestrictRealtime=yes
|
RestrictRealtime=yes
|
||||||
DevicePolicy=closed
|
DevicePolicy=closed
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
version = "1.0"
|
version = "1.0"
|
||||||
|
|
||||||
[main]
|
[main]
|
||||||
name = "Main configuration"
|
name = "Glitchsoc configuration"
|
||||||
services = ["__APP__-web", "__APP__-sidekiq", "__APP__-streaming"]
|
services = ["__APP__-web", "__APP__-sidekiq", "__APP__-streaming"]
|
||||||
|
|
||||||
[main.customization]
|
[main.customization]
|
||||||
|
@ -10,65 +10,69 @@ services = ["__APP__-web", "__APP__-sidekiq", "__APP__-streaming"]
|
||||||
[main.customization.max_toot_chars]
|
[main.customization.max_toot_chars]
|
||||||
ask = "Maximum allowed character count in a toot"
|
ask = "Maximum allowed character count in a toot"
|
||||||
type = "number"
|
type = "number"
|
||||||
bind = ":/var/www/__APP__/live/live/.env.production"
|
example = "500"
|
||||||
example = 500
|
bind = ":__FINALPATH__/live/.env.production"
|
||||||
|
|
||||||
[main.customization.max_pinned_toots]
|
[main.customization.max_pinned_toots]
|
||||||
ask = "Maximum number of pinned posts"
|
ask = "Maximum number of pinned posts"
|
||||||
type = "number"
|
type = "number"
|
||||||
example = "5"
|
example = "5"
|
||||||
bind = ":/var/www/__APP__/live/.env.production"
|
bind = ":__FINALPATH__/live/.env.production"
|
||||||
|
|
||||||
[main.customization.max_bio_chars]
|
[main.customization.max_bio_chars]
|
||||||
ask = "Maximum allowed bio characters"
|
ask = "Maximum allowed bio characters"
|
||||||
type = "number"
|
type = "number"
|
||||||
accept = "500"
|
example = "500"
|
||||||
bind = ":/var/www/__APP__/live/.env.production"
|
bind = ":__FINALPATH__/live/.env.production"
|
||||||
|
|
||||||
[main.customization.max_profile_fields]
|
[main.customization.max_profile_fields]
|
||||||
ask = "Maximim number of profile fields allowed"
|
ask = "Maximim number of profile fields allowed"
|
||||||
type = "number"
|
type = "number"
|
||||||
accept = "4"
|
example = "4"
|
||||||
bind = ":/var/www/__APP__/live/.env.production"
|
bind = ":__FINALPATH__/live/.env.production"
|
||||||
|
|
||||||
[main.customization.max_display_name_chars]
|
[main.customization.max_display_name_chars]
|
||||||
ask = "Maximum allowed bio characters"
|
ask = "Maximum allowed bio characters"
|
||||||
type = "number"
|
type = "number"
|
||||||
accept = "30"
|
example = "30"
|
||||||
bind = ":/var/www/__APP__/live/.env.production"
|
bind = ":__FINALPATH__/live/.env.production"
|
||||||
|
|
||||||
[main.customization.max_poll_options]
|
[main.customization.max_poll_options]
|
||||||
ask = "Maximum allowed poll options"
|
ask = "Maximum allowed poll options"
|
||||||
type = "number"
|
type = "number"
|
||||||
accept = "5"
|
example = "5"
|
||||||
bind = ":/var/www/__APP__/live/.env.production"
|
bind = ":__FINALPATH__/live/.env.production"
|
||||||
|
|
||||||
[main.customization.max_poll_option_chars]
|
[main.customization.max_poll_option_chars]
|
||||||
ask = "Maximum allowed poll option characters"
|
ask = "Maximum allowed poll option characters"
|
||||||
type = "number"
|
type = "number"
|
||||||
accept = "100"
|
example = "100"
|
||||||
bind = ":/var/www/__APP__/live/.env.production"
|
bind = ":__FINALPATH__/live/.env.production"
|
||||||
|
|
||||||
[main.customization.max_image_size]
|
[main.customization.max_image_size]
|
||||||
ask = "Maximum image upload size, in bytes"
|
ask = "Maximum image upload size"
|
||||||
|
help = "in bytes"
|
||||||
type = "number"
|
type = "number"
|
||||||
accept = "8388608"
|
example = "8388608"
|
||||||
bind = ":/var/www/__APP__/live/.env.production"
|
bind = ":__FINALPATH__/live/.env.production"
|
||||||
|
|
||||||
[main.customization.max_video_size]
|
[main.customization.max_video_size]
|
||||||
ask = "Maximum video and audio upload sizes, in bytes"
|
ask = "Maximum video and audio upload sizes"
|
||||||
|
help = "in bytes"
|
||||||
type = "number"
|
type = "number"
|
||||||
accept = "41943040"
|
example = "41943040"
|
||||||
bind = ":/var/www/__APP__/live/.env.production"
|
bind = ":__FINALPATH__/live/.env.production"
|
||||||
|
|
||||||
[main.customization.max_emoji_size]
|
[main.customization.max_emoji_size]
|
||||||
ask = "Maximum custom emoji file sizes"
|
ask = "Maximum custom emoji file sizes"
|
||||||
|
help = "in bytes"
|
||||||
type = "number"
|
type = "number"
|
||||||
accept = "51200"
|
example = "51200"
|
||||||
bind = ":/var/www/__APP__/live/.env.production"
|
bind = ":__FINALPATH__/live/.env.production"
|
||||||
|
|
||||||
[main.customization.max_remote_emoji_size]
|
[main.customization.max_remote_emoji_size]
|
||||||
ask = "Maximum remote custom emoji file sizes"
|
ask = "Maximum remote custom emoji file sizes"
|
||||||
|
help = "in bytes"
|
||||||
type = "number"
|
type = "number"
|
||||||
accept = "204800"
|
example = "204800"
|
||||||
bind = ":/var/www/__APP__/live/.env.production"
|
bind = ":__FINALPATH__/live/.env.production"
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"en": "Libre and federated social network, fork of Mastodon",
|
"en": "Libre and federated social network, fork of Mastodon",
|
||||||
"fr": "Réseau social libre et fédéré, scission de Mastodon"
|
"fr": "Réseau social libre et fédéré, scission de Mastodon"
|
||||||
},
|
},
|
||||||
"version": "2022.01.10~ynh2",
|
"version": "2022.01.23~ynh1",
|
||||||
"url": "https://github.com/glitch-soc/mastodon",
|
"url": "https://github.com/glitch-soc/mastodon",
|
||||||
"upstream": {
|
"upstream": {
|
||||||
"license": "free",
|
"license": "free",
|
||||||
|
|
|
@ -32,10 +32,22 @@ admin_mail=$(ynh_user_get_info $admin 'mail')
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
max_toot_chars="500"
|
||||||
|
max_pinned_toots="5"
|
||||||
|
max_bio_chars="500"
|
||||||
|
max_profile_fields="4"
|
||||||
|
max_display_name_chars="30"
|
||||||
|
max_poll_options="5"
|
||||||
|
max_poll_option_chars="100"
|
||||||
|
max_image_size="8388608"
|
||||||
|
max_video_size="41943040"
|
||||||
|
max_emoji_size="51200"
|
||||||
|
max_remote_emoji_size="204800"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Validating installation parameters..."
|
ynh_script_progression --message="Validating installation parameters..." --weight=1
|
||||||
|
|
||||||
final_path=/var/www/$app
|
final_path=/var/www/$app
|
||||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||||
|
@ -46,19 +58,30 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Storing installation settings..."
|
ynh_script_progression --message="Storing installation settings..." --weight=1
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
||||||
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
||||||
ynh_app_setting_set --app=$app --key=admin --value=$admin
|
ynh_app_setting_set --app=$app --key=admin --value=$admin
|
||||||
ynh_app_setting_set --app=$app --key=language --value=$language
|
ynh_app_setting_set --app=$app --key=language --value=$language
|
||||||
|
ynh_app_setting_set --app=$app --key=max_toot_chars --value=$max_toot_chars
|
||||||
|
ynh_app_setting_set --app=$app --key=max_pinned_toots --value=$max_pinned_toots
|
||||||
|
ynh_app_setting_set --app=$app --key=max_bio_chars --value=$max_bio_chars
|
||||||
|
ynh_app_setting_set --app=$app --key=max_profile_fields --value=$max_profile_fields
|
||||||
|
ynh_app_setting_set --app=$app --key=max_display_name_chars--value=$max_display_name_chars
|
||||||
|
ynh_app_setting_set --app=$app --key=max_poll_options --value=$max_poll_options
|
||||||
|
ynh_app_setting_set --app=$app --key=max_poll_option_chars --value=$max_poll_option_chars
|
||||||
|
ynh_app_setting_set --app=$app --key=max_image_size --value=$max_image_size
|
||||||
|
ynh_app_setting_set --app=$app --key=max_video_size --value=$max_video_size
|
||||||
|
ynh_app_setting_set --app=$app --key=max_emoji_size --value=$max_emoji_size
|
||||||
|
ynh_app_setting_set --app=$app --key=max_remote_emoji_size --value=$max_remote_emoji_size
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
# FIND AND OPEN A PORT
|
# FIND AND OPEN A PORT
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Finding an available port..."
|
ynh_script_progression --message="Finding an available port..." --weight=1
|
||||||
|
|
||||||
# Find an available port
|
# Find an available port
|
||||||
port_web=$(ynh_find_port --port=3000)
|
port_web=$(ynh_find_port --port=3000)
|
||||||
|
@ -70,7 +93,7 @@ ynh_app_setting_set --app=$app --key=port_stream --value=$port_stream
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installing dependencies..."
|
ynh_script_progression --message="Installing dependencies..." --weight=60
|
||||||
|
|
||||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
|
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
|
||||||
|
@ -80,7 +103,7 @@ ynh_exec_warn_less ynh_install_ruby --ruby_version=$RUBY_VERSION
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring system user..."
|
ynh_script_progression --message="Configuring system user..." --weight=1
|
||||||
|
|
||||||
# Create a system user
|
# Create a system user
|
||||||
ynh_system_user_create --username=$app --home_dir=$final_path
|
ynh_system_user_create --username=$app --home_dir=$final_path
|
||||||
|
@ -88,7 +111,7 @@ ynh_system_user_create --username=$app --home_dir=$final_path
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE A POSTGRESQL DATABASE
|
# CREATE A POSTGRESQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Creating a PostgreSQL database..."
|
ynh_script_progression --message="Creating a PostgreSQL database..." --weight=14
|
||||||
|
|
||||||
ynh_psql_test_if_first_run
|
ynh_psql_test_if_first_run
|
||||||
# Create PostgreSQL database
|
# Create PostgreSQL database
|
||||||
|
@ -104,7 +127,7 @@ ynh_psql_execute_as_root --sql="ALTER USER $db_user CREATEDB;"
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setting up source files..."
|
ynh_script_progression --message="Setting up source files..." --weight=5
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
|
@ -117,7 +140,7 @@ chown -R $app:www-data "$final_path"
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring NGINX web server..."
|
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
||||||
|
|
||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
@ -127,7 +150,7 @@ ynh_add_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD SWAP IF NEEDED
|
# ADD SWAP IF NEEDED
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding swap if needed..."
|
ynh_script_progression --message="Adding swap if needed..." --weight=1
|
||||||
|
|
||||||
total_memory=$(ynh_get_ram --total)
|
total_memory=$(ynh_get_ram --total)
|
||||||
swap_needed=0
|
swap_needed=0
|
||||||
|
@ -137,24 +160,24 @@ if [ $total_memory -lt $MEMORY_NEEDED ]; then
|
||||||
swap_needed=$(($MEMORY_NEEDED - $total_memory))
|
swap_needed=$(($MEMORY_NEEDED - $total_memory))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_script_progression --message="Adding $swap_needed Mo to swap..."
|
ynh_script_progression --message="Adding $swap_needed Mo to swap..." --weight=1
|
||||||
ynh_add_swap --size=$swap_needed
|
ynh_add_swap --size=$swap_needed
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALLING RUBY AND BUNDLER
|
# INSTALLING RUBY AND BUNDLER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installing Ruby..."
|
ynh_script_progression --message="Installing Ruby dependencies..." --weight=6
|
||||||
|
|
||||||
pushd "$final_path/live"
|
pushd "$final_path/live"
|
||||||
ynh_use_ruby
|
ynh_use_ruby
|
||||||
ynh_gem update --system
|
ynh_gem update --system --no-document
|
||||||
ynh_gem install bundler --no-document
|
ynh_gem install bundler --no-document
|
||||||
popd
|
popd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD A CONFIGURATION
|
# ADD A CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding a configuration file..."
|
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||||
|
|
||||||
config="$final_path/live/.env.production"
|
config="$final_path/live/.env.production"
|
||||||
|
|
||||||
|
@ -188,7 +211,7 @@ chown $app:$app "$final_path/live/config/settings.yml"
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring a systemd service..."
|
ynh_script_progression --message="Configuring a systemd service..." --weight=1
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
# Create a dedicated systemd config
|
||||||
ynh_add_systemd_config --service="$app-web" --template="glitchsoc-web.service"
|
ynh_add_systemd_config --service="$app-web" --template="glitchsoc-web.service"
|
||||||
|
@ -198,7 +221,7 @@ ynh_add_systemd_config --service="$app-streaming" --template="glitchsoc-streamin
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALLING GLITCH-SOC
|
# INSTALLING GLITCH-SOC
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installing Glitch-Soc..."
|
ynh_script_progression --message="Installing Glitch-Soc..." --weight=30
|
||||||
|
|
||||||
pushd "$final_path/live"
|
pushd "$final_path/live"
|
||||||
ynh_exec_as $app $ynh_ruby_load_path bin/bundle config deployment 'true'
|
ynh_exec_as $app $ynh_ruby_load_path bin/bundle config deployment 'true'
|
||||||
|
@ -232,7 +255,7 @@ chown $app:$app "$config"
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP THE CRON FILE
|
# SETUP THE CRON FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setuping the cron file..."
|
ynh_script_progression --message="Setuping the cron file..." --weight=1
|
||||||
|
|
||||||
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
|
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
|
||||||
|
|
||||||
|
@ -241,7 +264,7 @@ ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||||
|
|
||||||
yunohost service add "$app-web" --description="$app web service"
|
yunohost service add "$app-web" --description="$app web service"
|
||||||
yunohost service add "$app-sidekiq" --description="$app sidekiq service"
|
yunohost service add "$app-sidekiq" --description="$app sidekiq service"
|
||||||
|
@ -250,7 +273,7 @@ yunohost service add "$app-streaming" --description="$app streaming service"
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..."
|
ynh_script_progression --message="Starting a systemd service..." --weight=3
|
||||||
|
|
||||||
ynh_systemd_action --service_name=${app}-web --action="start" --log_path=systemd --line_match="Listening on"
|
ynh_systemd_action --service_name=${app}-web --action="start" --log_path=systemd --line_match="Listening on"
|
||||||
ynh_systemd_action --service_name=${app}-sidekiq --action="start" --log_path=systemd --line_match="Schedules Loaded"
|
ynh_systemd_action --service_name=${app}-sidekiq --action="start" --log_path=systemd --line_match="Schedules Loaded"
|
||||||
|
@ -259,7 +282,7 @@ ynh_systemd_action --service_name=${app}-streaming --action="start" --log_path=s
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring permissions..."
|
ynh_script_progression --message="Configuring permissions..." --weight=1
|
||||||
|
|
||||||
# Make app public if necessary
|
# Make app public if necessary
|
||||||
if [ $is_public -eq 1 ]
|
if [ $is_public -eq 1 ]
|
||||||
|
@ -273,7 +296,7 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading NGINX web server..."
|
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
|
@ -281,4 +304,4 @@ ynh_systemd_action --service_name=nginx --action=reload
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Installation of $app completed"
|
ynh_script_progression --message="Installation of $app completed" --weight=1
|
||||||
|
|
|
@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Loading installation settings..."
|
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -30,26 +30,26 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
||||||
if ynh_exec_warn_less yunohost service status "$app-web" >/dev/null
|
if ynh_exec_warn_less yunohost service status "$app-web" >/dev/null
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Removing $app-web service integration..."
|
ynh_script_progression --message="Removing $app-web service integration..." --weight=1
|
||||||
yunohost service remove "$app-web"
|
yunohost service remove "$app-web"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ynh_exec_warn_less yunohost service status "$app-sidekiq" >/dev/null
|
if ynh_exec_warn_less yunohost service status "$app-sidekiq" >/dev/null
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Removing $app-sidekiq service integration..."
|
ynh_script_progression --message="Removing $app-sidekiq service integration..." --weight=1
|
||||||
yunohost service remove "$app-sidekiq"
|
yunohost service remove "$app-sidekiq"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ynh_exec_warn_less yunohost service status "$app-streaming" >/dev/null
|
if ynh_exec_warn_less yunohost service status "$app-streaming" >/dev/null
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Removing $app-streaming service integration..."
|
ynh_script_progression --message="Removing $app-streaming service integration..." --weight=1
|
||||||
yunohost service remove "$app-streaming"
|
yunohost service remove "$app-streaming"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STOP AND REMOVE SERVICE
|
# STOP AND REMOVE SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Stopping and removing the systemd service..."
|
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
|
||||||
|
|
||||||
# Remove the dedicated systemd config
|
# Remove the dedicated systemd config
|
||||||
ynh_remove_systemd_config --service="$app-web"
|
ynh_remove_systemd_config --service="$app-web"
|
||||||
|
@ -59,7 +59,7 @@ ynh_remove_systemd_config --service="$app-streaming"
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE THE POSTGRESQL DATABASE
|
# REMOVE THE POSTGRESQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing the PostgreSQL database..."
|
ynh_script_progression --message="Removing the PostgreSQL database..." --weight=10
|
||||||
|
|
||||||
# Remove a database if it exists, along with the associated user
|
# Remove a database if it exists, along with the associated user
|
||||||
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
|
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
|
||||||
|
@ -67,7 +67,7 @@ ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE APP MAIN DIR
|
# REMOVE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing app main directory..."
|
ynh_script_progression --message="Removing app main directory..." --weight=10
|
||||||
|
|
||||||
# Remove the app directory securely
|
# Remove the app directory securely
|
||||||
ynh_secure_remove --file="$final_path"
|
ynh_secure_remove --file="$final_path"
|
||||||
|
@ -75,7 +75,7 @@ ynh_secure_remove --file="$final_path"
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE NGINX CONFIGURATION
|
# REMOVE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing NGINX web server configuration..."
|
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
|
||||||
|
|
||||||
# Remove the dedicated NGINX config
|
# Remove the dedicated NGINX config
|
||||||
ynh_remove_nginx_config
|
ynh_remove_nginx_config
|
||||||
|
@ -83,7 +83,7 @@ ynh_remove_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEPENDENCIES
|
# REMOVE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing dependencies..."
|
ynh_script_progression --message="Removing dependencies..." --weight=30
|
||||||
|
|
||||||
# Remove metapackage and its dependencies
|
# Remove metapackage and its dependencies
|
||||||
ynh_remove_ruby
|
ynh_remove_ruby
|
||||||
|
@ -96,7 +96,7 @@ ynh_remove_extra_repo
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE VARIOUS FILES
|
# REMOVE VARIOUS FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing various files..."
|
ynh_script_progression --message="Removing various files..." --weight=1
|
||||||
|
|
||||||
# Remove a cron file
|
# Remove a cron file
|
||||||
ynh_secure_remove --file="/etc/cron.d/$app"
|
ynh_secure_remove --file="/etc/cron.d/$app"
|
||||||
|
@ -109,7 +109,7 @@ ynh_del_swap
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEDICATED USER
|
# REMOVE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing the dedicated system user..."
|
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
|
||||||
|
|
||||||
# Delete a system user
|
# Delete a system user
|
||||||
ynh_system_user_delete --username=$app
|
ynh_system_user_delete --username=$app
|
||||||
|
@ -118,4 +118,4 @@ ynh_system_user_delete --username=$app
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Removal of $app completed"
|
ynh_script_progression --message="Removal of $app completed" --weight=1
|
||||||
|
|
|
@ -23,7 +23,7 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Loading installation settings..."
|
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Validating restoration parameters..."
|
ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
||||||
|
|
||||||
test ! -d $final_path \
|
test ! -d $final_path \
|
||||||
|| ynh_die --message="There is already a directory: $final_path "
|
|| ynh_die --message="There is already a directory: $final_path "
|
||||||
|
@ -47,14 +47,14 @@ test ! -d $final_path \
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE NGINX CONFIGURATION
|
# RESTORE THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the NGINX web server configuration..."
|
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
|
||||||
|
|
||||||
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
|
# RECREATE THE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Recreating the dedicated system user..."
|
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
||||||
|
|
||||||
# Create the dedicated user (if not existing)
|
# Create the dedicated user (if not existing)
|
||||||
ynh_system_user_create --username=$app --home_dir=$final_path
|
ynh_system_user_create --username=$app --home_dir=$final_path
|
||||||
|
@ -62,7 +62,7 @@ ynh_system_user_create --username=$app --home_dir=$final_path
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# RESTORE THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the app main directory..."
|
ynh_script_progression --message="Restoring the app main directory..." --weight=10
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$final_path"
|
ynh_restore_file --origin_path="$final_path"
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ chown -R $app:www-data "$final_path"
|
||||||
#=================================================
|
#=================================================
|
||||||
# REINSTALL DEPENDENCIES
|
# REINSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reinstalling dependencies..."
|
ynh_script_progression --message="Reinstalling dependencies..." --weight=60
|
||||||
|
|
||||||
# Define and install dependencies
|
# Define and install dependencies
|
||||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
@ -86,7 +86,7 @@ ynh_install_ruby --ruby_version=$RUBY_VERSION
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE POSTGRESQL DATABASE
|
# RESTORE THE POSTGRESQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the PostgreSQL database..."
|
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=10
|
||||||
|
|
||||||
ynh_psql_test_if_first_run
|
ynh_psql_test_if_first_run
|
||||||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||||
|
@ -96,7 +96,7 @@ ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name"
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD SWAP IF NEEDED
|
# ADD SWAP IF NEEDED
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding swap if needed..."
|
ynh_script_progression --message="Adding swap if needed..." --weight=1
|
||||||
|
|
||||||
total_memory=$(ynh_get_ram --total)
|
total_memory=$(ynh_get_ram --total)
|
||||||
swap_needed=0
|
swap_needed=0
|
||||||
|
@ -106,31 +106,31 @@ if [ $total_memory -lt $MEMORY_NEEDED ]; then
|
||||||
swap_needed=$(($MEMORY_NEEDED - $total_memory))
|
swap_needed=$(($MEMORY_NEEDED - $total_memory))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_script_progression --message="Adding $swap_needed Mo to swap..."
|
ynh_script_progression --message="Adding $swap_needed Mo to swap..." --weight=1
|
||||||
ynh_add_swap --size=$swap_needed
|
ynh_add_swap --size=$swap_needed
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALLING RUBY AND BUNDLER
|
# INSTALLING RUBY AND BUNDLER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installing Ruby..."
|
ynh_script_progression --message="Installing Ruby dependencies..." --weight=30
|
||||||
|
|
||||||
pushd "$final_path/live"
|
pushd "$final_path/live"
|
||||||
ynh_use_ruby
|
ynh_use_ruby
|
||||||
ynh_gem update --system
|
ynh_gem update --system --no-document
|
||||||
ynh_gem install bundler --no-document
|
ynh_gem install bundler --no-document
|
||||||
popd
|
popd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE VARIOUS FILES
|
# RESTORE VARIOUS FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring various files..."
|
ynh_script_progression --message="Restoring various files..." --weight=1
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/cron.d/$app"
|
ynh_restore_file --origin_path="/etc/cron.d/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE SYSTEMD
|
# RESTORE SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the systemd configuration..."
|
ynh_script_progression --message="Restoring the systemd configuration..." --weight=1
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/$app-web.service"
|
ynh_restore_file --origin_path="/etc/systemd/system/$app-web.service"
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/$app-sidekiq.service"
|
ynh_restore_file --origin_path="/etc/systemd/system/$app-sidekiq.service"
|
||||||
|
@ -140,7 +140,7 @@ systemctl enable "$app-web" "$app-sidekiq" "$app-streaming" --quiet
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||||
|
|
||||||
yunohost service add "$app-web" --description="$app web service"
|
yunohost service add "$app-web" --description="$app web service"
|
||||||
yunohost service add "$app-sidekiq" --description="$app sidekiq service"
|
yunohost service add "$app-sidekiq" --description="$app sidekiq service"
|
||||||
|
@ -149,7 +149,7 @@ yunohost service add "$app-streaming" --description="$app streaming service"
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..."
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=${app}-web --action="start" --log_path=systemd --line_match="Listening on"
|
ynh_systemd_action --service_name=${app}-web --action="start" --log_path=systemd --line_match="Listening on"
|
||||||
ynh_systemd_action --service_name=${app}-sidekiq --action="start" --log_path=systemd --line_match="Schedules Loaded"
|
ynh_systemd_action --service_name=${app}-sidekiq --action="start" --log_path=systemd --line_match="Schedules Loaded"
|
||||||
|
@ -160,7 +160,7 @@ ynh_systemd_action --service_name=${app}-streaming --action="start" --log_path=s
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading NGINX web server..."
|
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
|
@ -168,4 +168,4 @@ ynh_systemd_action --service_name=nginx --action=reload
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Restoration completed for $app"
|
ynh_script_progression --message="Restoration completed for $app" --weight=1
|
||||||
|
|
142
scripts/upgrade
142
scripts/upgrade
|
@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Loading installation settings..."
|
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -36,17 +36,29 @@ vapid_public_key=$(ynh_app_setting_get --app=$app --key=vapid_public_key)
|
||||||
|
|
||||||
config="$final_path/live/.env.production"
|
config="$final_path/live/.env.production"
|
||||||
|
|
||||||
|
max_toot_chars=$(ynh_app_setting_get --app=$app --key=max_toot_chars)
|
||||||
|
max_pinned_toots=$(ynh_app_setting_get --app=$app --key=max_pinned_toots)
|
||||||
|
max_bio_chars=$(ynh_app_setting_get --app=$app --key=max_bio_chars)
|
||||||
|
max_profile_fields=$(ynh_app_setting_get --app=$app --key=max_profile_fields)
|
||||||
|
max_display_name_chars=$(ynh_app_setting_get --app=$app --key=max_display_name_chars)
|
||||||
|
max_poll_options=$(ynh_app_setting_get --app=$app --key=max_poll_options)
|
||||||
|
max_poll_option_chars=$(ynh_app_setting_get --app=$app --key=max_poll_option_chars)
|
||||||
|
max_image_size=$(ynh_app_setting_get --app=$app --key=max_image_size)
|
||||||
|
max_video_size=$(ynh_app_setting_get --app=$app --key=max_video_size)
|
||||||
|
max_emoji_size=$(ynh_app_setting_get --app=$app --key=max_emoji_size)
|
||||||
|
max_remote_emoji_size=$(ynh_app_setting_get --app=$app --key=max_remote_emoji_size)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK VERSION
|
# CHECK VERSION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Checking version..."
|
ynh_script_progression --message="Checking version..." --weight=1
|
||||||
|
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
upgrade_type=$(ynh_check_app_version_changed)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
|
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
|
||||||
|
|
||||||
# Backup the current version of the app
|
# Backup the current version of the app
|
||||||
ynh_backup_before_upgrade
|
ynh_backup_before_upgrade
|
||||||
|
@ -63,7 +75,7 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
# STOP SYSTEMD SERVICE
|
# STOP SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Stopping a systemd service..."
|
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=${app}-web --action="stop" --log_path=systemd --line_match="Stopped"
|
ynh_systemd_action --service_name=${app}-web --action="stop" --log_path=systemd --line_match="Stopped"
|
||||||
ynh_systemd_action --service_name=${app}-sidekiq --action="stop" --log_path=systemd --line_match="Stopped"
|
ynh_systemd_action --service_name=${app}-sidekiq --action="stop" --log_path=systemd --line_match="Stopped"
|
||||||
|
@ -72,7 +84,7 @@ ynh_systemd_action --service_name=${app}-streaming --action="stop" --log_path=sy
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Ensuring downward compatibility..."
|
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||||
|
|
||||||
# Cleaning legacy permissions
|
# Cleaning legacy permissions
|
||||||
if ynh_legacy_permissions_exists; then
|
if ynh_legacy_permissions_exists; then
|
||||||
|
@ -148,13 +160,68 @@ if [[ -z "$redis_namespace" ]]; then
|
||||||
ynh_app_setting_set --app=$app --key=redis_namespace --value=$redis_namespace
|
ynh_app_setting_set --app=$app --key=redis_namespace --value=$redis_namespace
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -z "$max_toot_chars" ]; then
|
||||||
|
max_toot_chars="500"
|
||||||
|
ynh_app_setting_set --app=$app --key=max_toot_chars --value=$max_toot_chars
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$max_pinned_toots" ]; then
|
||||||
|
max_pinned_toots="5"
|
||||||
|
ynh_app_setting_set --app=$app --key=max_pinned_toots --value=$max_pinned_toots
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$max_bio_chars" ]; then
|
||||||
|
max_bio_chars="500"
|
||||||
|
ynh_app_setting_set --app=$app --key=max_bio_chars --value=$max_bio_chars
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$max_profile_fields" ]; then
|
||||||
|
max_profile_fields="4"
|
||||||
|
ynh_app_setting_set --app=$app --key=max_profile_fields --value=$max_profile_fields
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$max_display_name_chars" ]; then
|
||||||
|
max_display_name_chars="30"
|
||||||
|
ynh_app_setting_set --app=$app --key=max_display_name_chars --value=$max_display_name_chars
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$max_poll_options" ]; then
|
||||||
|
max_poll_options="5"
|
||||||
|
ynh_app_setting_set --app=$app --key=max_poll_options --value=$max_poll_options
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$max_poll_option_chars" ]; then
|
||||||
|
max_poll_option_chars="100"
|
||||||
|
ynh_app_setting_set --app=$app --key=max_poll_option_chars --value=$max_poll_option_chars
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$max_image_size" ]; then
|
||||||
|
max_image_size="8388608"
|
||||||
|
ynh_app_setting_set --app=$app --key=max_image_size --value=$max_image_size
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$max_video_size" ]; then
|
||||||
|
max_video_size="41943040"
|
||||||
|
ynh_app_setting_set --app=$app --key=max_video_size --value=$max_video_size
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$max_emoji_size" ]; then
|
||||||
|
max_emoji_size="51200"
|
||||||
|
ynh_app_setting_set --app=$app --key=max_emoji_size --value=$max_emoji_size
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$max_remote_emoji_size" ]; then
|
||||||
|
max_remote_emoji_size="204800"
|
||||||
|
ynh_app_setting_set --app=$app --key=max_remote_emoji_size --value=$max_remote_emoji_size
|
||||||
|
fi
|
||||||
|
|
||||||
#Remove previous added repository
|
#Remove previous added repository
|
||||||
ynh_remove_extra_repo
|
ynh_remove_extra_repo
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Making sure dedicated system user exists..."
|
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
||||||
|
|
||||||
# Create a dedicated user (if not existing)
|
# Create a dedicated user (if not existing)
|
||||||
ynh_system_user_create --username=$app --home_dir=$final_path
|
ynh_system_user_create --username=$app --home_dir=$final_path
|
||||||
|
@ -165,7 +232,7 @@ ynh_system_user_create --username=$app --home_dir=$final_path
|
||||||
|
|
||||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Upgrading source files..."
|
ynh_script_progression --message="Upgrading source files..." --weight=1
|
||||||
|
|
||||||
# Download Glitch-Soc
|
# Download Glitch-Soc
|
||||||
tmpdir="$(mktemp -d)"
|
tmpdir="$(mktemp -d)"
|
||||||
|
@ -187,16 +254,16 @@ then
|
||||||
|
|
||||||
# Clean files which are not needed anymore
|
# Clean files which are not needed anymore
|
||||||
ynh_secure_remove --file="$final_path/live/config/initializers/timeout.rb"
|
ynh_secure_remove --file="$final_path/live/config/initializers/timeout.rb"
|
||||||
fi
|
|
||||||
|
|
||||||
chmod 750 "$final_path"
|
chmod 750 "$final_path"
|
||||||
chmod -R o-rwx "$final_path"
|
chmod -R o-rwx "$final_path"
|
||||||
chown -R $app:www-data "$final_path"
|
chown -R $app:www-data "$final_path"
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading NGINX web server configuration..."
|
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
|
||||||
|
|
||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
@ -204,7 +271,7 @@ ynh_add_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPGRADE DEPENDENCIES
|
# UPGRADE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading dependencies..."
|
ynh_script_progression --message="Upgrading dependencies..." --weight=60
|
||||||
|
|
||||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
|
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
|
||||||
|
@ -216,7 +283,7 @@ ynh_exec_warn_less ynh_install_ruby --ruby_version=$RUBY_VERSION
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD SWAP IF NEEDED
|
# ADD SWAP IF NEEDED
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding swap if needed..."
|
ynh_script_progression --message="Adding swap if needed..." --weight=1
|
||||||
|
|
||||||
total_memory=$(ynh_get_ram --total)
|
total_memory=$(ynh_get_ram --total)
|
||||||
swap_needed=0
|
swap_needed=0
|
||||||
|
@ -226,24 +293,24 @@ if [ $total_memory -lt $MEMORY_NEEDED ]; then
|
||||||
swap_needed=$(($MEMORY_NEEDED - $total_memory))
|
swap_needed=$(($MEMORY_NEEDED - $total_memory))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_script_progression --message="Adding $swap_needed Mo to swap..."
|
ynh_script_progression --message="Adding $swap_needed Mo to swap..." --weight=1
|
||||||
ynh_add_swap --size=$swap_needed
|
ynh_add_swap --size=$swap_needed
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALLING RUBY AND BUNDLER
|
# INSTALLING RUBY AND BUNDLER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installing Ruby..."
|
ynh_script_progression --message="Installing Ruby dependencies..." --weight=6
|
||||||
|
|
||||||
pushd "$final_path/live"
|
pushd "$final_path/live"
|
||||||
ynh_use_ruby
|
ynh_use_ruby
|
||||||
ynh_gem update --system
|
ynh_gem update --system --no-document
|
||||||
ynh_gem install bundler --no-document
|
ynh_gem install bundler --no-document
|
||||||
popd
|
popd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPDATE A CONFIG FILE
|
# UPDATE A CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating a config file..."
|
ynh_script_progression --message="Updating a config file..." --weight=1
|
||||||
|
|
||||||
language="$(echo $language | head -c 2)"
|
language="$(echo $language | head -c 2)"
|
||||||
|
|
||||||
|
@ -255,7 +322,7 @@ chown $app:$app "$config"
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading systemd configuration..."
|
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
# Create a dedicated systemd config
|
||||||
ynh_add_systemd_config --service="$app-web" --template="glitchsoc-web.service"
|
ynh_add_systemd_config --service="$app-web" --template="glitchsoc-web.service"
|
||||||
|
@ -265,24 +332,27 @@ ynh_add_systemd_config --service="$app-streaming" --template="glitchsoc-streamin
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPGRADE GLITCH-SOC
|
# UPGRADE GLITCH-SOC
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading Glitch-Soc..."
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
|
then
|
||||||
|
ynh_script_progression --message="Upgrading Glitch-Soc..." --weight=30
|
||||||
|
|
||||||
pushd "$final_path/live"
|
pushd "$final_path/live"
|
||||||
ynh_exec_as $app $ynh_ruby_load_path bin/bundle config deployment 'true'
|
ynh_exec_as $app $ynh_ruby_load_path bin/bundle config deployment 'true'
|
||||||
ynh_exec_as $app $ynh_ruby_load_path bin/bundle config without 'development test'
|
ynh_exec_as $app $ynh_ruby_load_path bin/bundle config without 'development test'
|
||||||
ynh_exec_as $app $ynh_ruby_load_path bin/bundle install -j$(getconf _NPROCESSORS_ONLN)
|
ynh_exec_as $app $ynh_ruby_load_path bin/bundle install -j$(getconf _NPROCESSORS_ONLN)
|
||||||
ynh_use_nodejs
|
ynh_use_nodejs
|
||||||
ynh_exec_as $app $ynh_node_load_PATH yarn install --pure-lockfile
|
ynh_exec_as $app $ynh_node_load_PATH yarn install --pure-lockfile
|
||||||
ynh_exec_warn_less ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rails assets:clean
|
ynh_exec_warn_less ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rails assets:clean
|
||||||
ynh_exec_warn_less ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rails assets:precompile
|
ynh_exec_warn_less ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rails assets:precompile
|
||||||
ynh_exec_warn_less ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rails db:migrate
|
ynh_exec_warn_less ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rails db:migrate
|
||||||
ynh_exec_warn_less ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path bin/tootctl cache clear
|
ynh_exec_warn_less ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path bin/tootctl cache clear
|
||||||
popd
|
popd
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP THE CRON FILE
|
# SETUP THE CRON FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setuping the cron file..."
|
ynh_script_progression --message="Setuping the cron file..." --weight=1
|
||||||
|
|
||||||
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
|
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
|
||||||
|
|
||||||
|
@ -291,7 +361,7 @@ ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||||
|
|
||||||
yunohost service add "$app-web" --description="$app web service"
|
yunohost service add "$app-web" --description="$app web service"
|
||||||
yunohost service add "$app-sidekiq" --description="$app sidekiq service"
|
yunohost service add "$app-sidekiq" --description="$app sidekiq service"
|
||||||
|
@ -300,7 +370,7 @@ yunohost service add "$app-streaming" --description="$app streaming service"
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..."
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=${app}-web --action="start" --log_path=systemd --line_match="Listening on"
|
ynh_systemd_action --service_name=${app}-web --action="start" --log_path=systemd --line_match="Listening on"
|
||||||
ynh_systemd_action --service_name=${app}-sidekiq --action="start" --log_path=systemd --line_match="Schedules Loaded"
|
ynh_systemd_action --service_name=${app}-sidekiq --action="start" --log_path=systemd --line_match="Schedules Loaded"
|
||||||
|
@ -309,7 +379,7 @@ ynh_systemd_action --service_name=${app}-streaming --action="start" --log_path=s
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading NGINX web server..."
|
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
|
@ -317,4 +387,4 @@ ynh_systemd_action --service_name=nginx --action=reload
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Upgrade of $app completed"
|
ynh_script_progression --message="Upgrade of $app completed" --weight=1
|
||||||
|
|
Loading…
Add table
Reference in a new issue