mirror of
https://github.com/YunoHost-Apps/glitchsoc_ynh.git
synced 2024-09-03 19:15:59 +02:00
convert v2
This commit is contained in:
parent
08f4b5e8da
commit
1c142857b9
14 changed files with 267 additions and 281 deletions
|
@ -1,24 +0,0 @@
|
|||
;; Test complet
|
||||
; Manifest
|
||||
domain="domain.tld"
|
||||
admin="john"
|
||||
language="fr_FR"
|
||||
is_public=1
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=0
|
||||
setup_root=1
|
||||
setup_nourl=0
|
||||
setup_private=1
|
||||
setup_public=1
|
||||
upgrade=1
|
||||
# 2022.04.28~ynh1
|
||||
upgrade=1 from_commit=614380eeeefce3bab1b3106990138f526f950664
|
||||
backup_restore=1
|
||||
multi_instance=0
|
||||
port_already_use=0
|
||||
change_url=0
|
||||
;;; Options
|
||||
;;; Upgrade options
|
||||
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
SOURCE_URL=https://github.com/glitch-soc/mastodon/archive/f08f6d20e607f8af02dcd23afa019ebee7ad36a9.tar.gz
|
||||
SOURCE_SUM=7659cd68254f9c1a99411232665f1846c38c452b82f869437bbbb39d6b111425
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=f08f6d20e607f8af02dcd23afa019ebee7ad36a9.tar.gz
|
||||
SOURCE_EXTRACT=true
|
|
@ -5,7 +5,7 @@ After=network.target
|
|||
[Service]
|
||||
Type=simple
|
||||
User=__APP__
|
||||
WorkingDirectory=__FINALPATH__/live
|
||||
WorkingDirectory=__INSTALL_DIR__/live
|
||||
Environment="__LD_PRELOAD__"
|
||||
Environment="RAILS_ENV=production"
|
||||
Environment="DB_POOL=25"
|
||||
|
|
|
@ -5,7 +5,7 @@ After=network.target
|
|||
[Service]
|
||||
Type=simple
|
||||
User=__APP__
|
||||
WorkingDirectory=__FINALPATH__/live
|
||||
WorkingDirectory=__INSTALL_DIR__/live
|
||||
Environment="NODE_ENV=production"
|
||||
Environment="PORT=__PORT_STREAM__"
|
||||
Environment="STREAMING_CLUSTER_NUM=1"
|
||||
|
|
|
@ -5,7 +5,7 @@ After=network.target
|
|||
[Service]
|
||||
Type=simple
|
||||
User=__APP__
|
||||
WorkingDirectory=__FINALPATH__/live
|
||||
WorkingDirectory=__INSTALL_DIR__/live
|
||||
|
||||
Environment="RAILS_ENV=production"
|
||||
Environment="PORT=__PORT_WEB__"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
client_max_body_size 100M;
|
||||
|
||||
# add to v1.4 assets
|
||||
root __FINALPATH__/live/public;
|
||||
root __INSTALL_DIR__/live/public;
|
||||
|
||||
location / {
|
||||
|
||||
|
|
|
@ -1,61 +0,0 @@
|
|||
{
|
||||
"name": "Glitch-Soc",
|
||||
"id": "glitchsoc",
|
||||
"packaging_format": 1,
|
||||
"description": {
|
||||
"en": "Libre and federated social network, fork of Mastodon",
|
||||
"fr": "Réseau social libre et fédéré, scission de Mastodon"
|
||||
},
|
||||
"version": "2023.05.09~ynh1",
|
||||
"url": "https://github.com/glitch-soc/mastodon",
|
||||
"upstream": {
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"website": "https://glitch-soc.github.io/docs/",
|
||||
"code": "https://github.com/glitch-soc/mastodon"
|
||||
},
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"maintainer": {
|
||||
"name": "Tagada"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 4.3.0"
|
||||
},
|
||||
"multi_instance": true,
|
||||
"services": [
|
||||
"nginx"
|
||||
],
|
||||
"arguments": {
|
||||
"install": [
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "domain"
|
||||
},
|
||||
{
|
||||
"name": "admin",
|
||||
"type": "user"
|
||||
},
|
||||
{
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"help": {
|
||||
"en": "Needed for federation.",
|
||||
"fr": "Nécessaire pour la fédération."
|
||||
},
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
"name": "language",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "Choose the application language",
|
||||
"fr": "Choisissez la langue de l'application"
|
||||
},
|
||||
"choices": [
|
||||
"en_EN",
|
||||
"fr_FR"
|
||||
],
|
||||
"default": "fr_FR"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
78
manifest.toml
Normal file
78
manifest.toml
Normal file
|
@ -0,0 +1,78 @@
|
|||
packaging_format = 2
|
||||
|
||||
id = "glitchsoc"
|
||||
name = "Glitch-Soc"
|
||||
description.en = "Libre and federated social network, fork of Mastodon"
|
||||
description.fr = "Réseau social libre et fédéré, scission de Mastodon"
|
||||
|
||||
version = "2023.05.09~ynh1"
|
||||
|
||||
maintainers = ["Tagada"]
|
||||
|
||||
[upstream]
|
||||
license = "AGPL-3.0-or-later"
|
||||
website = "https://glitch-soc.github.io/docs/"
|
||||
code = "https://github.com/glitch-soc/mastodon"
|
||||
cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number)
|
||||
fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin.
|
||||
|
||||
[integration]
|
||||
yunohost = ">= 4.3.0"
|
||||
architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"]
|
||||
multi_instance = true
|
||||
ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials.
|
||||
sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal.
|
||||
disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ...
|
||||
ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
|
||||
ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
|
||||
|
||||
[install]
|
||||
[install.domain]
|
||||
# this is a generic question - ask strings are automatically handled by Yunohost's core
|
||||
type = "domain"
|
||||
full_domain = true
|
||||
|
||||
[install.admin]
|
||||
# this is a generic question - ask strings are automatically handled by Yunohost's core
|
||||
type = "user"
|
||||
|
||||
[install.init_main_permission]
|
||||
help.en = "Needed for federation."
|
||||
help.fr = "Nécessaire pour la fédération."
|
||||
type = "group"
|
||||
default = "visitors"
|
||||
|
||||
[install.language]
|
||||
ask.en = "Choose the application language"
|
||||
ask.fr = "Choisissez la langue de l'application"
|
||||
type = "string"
|
||||
choices = ["en_EN", "fr_FR"]
|
||||
default = "fr_FR"
|
||||
|
||||
[resources]
|
||||
[resources.sources.main]
|
||||
url = "https://github.com/glitch-soc/mastodon/archive/f08f6d20e607f8af02dcd23afa019ebee7ad36a9.tar.gz"
|
||||
sha256 = "7659cd68254f9c1a99411232665f1846c38c452b82f869437bbbb39d6b111425"
|
||||
|
||||
|
||||
[resources.system_user]
|
||||
|
||||
[resources.install_dir]
|
||||
|
||||
[resources.permissions]
|
||||
main.url = "/"
|
||||
|
||||
[resources.ports]
|
||||
web.default = 3000
|
||||
stream.default = 4000
|
||||
|
||||
[resources.apt]
|
||||
packages = "imagemagick, ffmpeg, libpq-dev, libxml2-dev, libxslt1-dev, file, git-core, g++, libprotobuf-dev, protobuf-compiler, pkg-config, gcc, autoconf, bison, build-essential, libssl-dev, libyaml-dev, libreadline6-dev, zlib1g-dev, libncurses5-dev, libffi-dev, libgdbm3|libgdbm6, libgdbm-dev, redis-server, redis-tools, postgresql, postgresql-contrib, libidn11-dev, libicu-dev, libjemalloc-dev, curl, apt-transport-https"
|
||||
|
||||
[[resources.apt.extras]]
|
||||
repo = "deb https://dl.yarnpkg.com/debian/ stable main"
|
||||
key = "https://dl.yarnpkg.com/debian/pubkey.gpg"
|
||||
packages = "yarn"
|
||||
|
||||
[resources.database]
|
||||
type = "postgresql"
|
|
@ -5,7 +5,7 @@
|
|||
#=================================================
|
||||
|
||||
# dependencies used by the app
|
||||
pkg_dependencies="imagemagick ffmpeg libpq-dev libxml2-dev libxslt1-dev file git-core g++ libprotobuf-dev protobuf-compiler pkg-config gcc autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3|libgdbm6 libgdbm-dev redis-server redis-tools postgresql postgresql-contrib libidn11-dev libicu-dev libjemalloc-dev curl apt-transport-https"
|
||||
#REMOVEME? pkg_dependencies="imagemagick ffmpeg libpq-dev libxml2-dev libxslt1-dev file git-core g++ libprotobuf-dev protobuf-compiler pkg-config gcc autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3|libgdbm6 libgdbm-dev redis-server redis-tools postgresql postgresql-contrib libidn11-dev libicu-dev libjemalloc-dev curl apt-transport-https"
|
||||
|
||||
MEMORY_NEEDED="2560"
|
||||
|
||||
|
@ -171,14 +171,14 @@ export rbenv_root="$rbenv_install_dir"
|
|||
# However, $PATH is duplicated into $ruby_path to outlast any manipulation of $PATH
|
||||
# You can use the variable `$ynh_ruby_load_path` to quickly load your Ruby version
|
||||
# in $PATH for an usage into a separate script.
|
||||
# Exemple: $ynh_ruby_load_path $final_path/script_that_use_gem.sh`
|
||||
# Exemple: $ynh_ruby_load_path $install_dir/script_that_use_gem.sh`
|
||||
#
|
||||
#
|
||||
# Finally, to start a Ruby service with the correct version, 2 solutions
|
||||
# Either the app is dependent of Ruby or gem, but does not called it directly.
|
||||
# In such situation, you need to load PATH
|
||||
# `Environment="__YNH_RUBY_LOAD_ENV_PATH__"`
|
||||
# `ExecStart=__FINALPATH__/my_app`
|
||||
# `ExecStart=__INSTALL_DIR__/my_app`
|
||||
# You will replace __YNH_RUBY_LOAD_ENV_PATH__ with $ynh_ruby_load_path
|
||||
#
|
||||
# Or Ruby start the app directly, then you don't need to load the PATH variable
|
||||
|
@ -193,10 +193,10 @@ export rbenv_root="$rbenv_install_dir"
|
|||
#
|
||||
# Requires YunoHost version 3.2.2 or higher.
|
||||
ynh_use_ruby () {
|
||||
ruby_version=$(ynh_app_setting_get --app=$app --key=ruby_version)
|
||||
#REMOVEME? ruby_version=$(ynh_app_setting_get --app=$app --key=ruby_version)
|
||||
|
||||
# Get the absolute path of this version of Ruby
|
||||
ruby_path="$ruby_version_path/$YNH_APP_INSTANCE_NAME/bin"
|
||||
#REMOVEME? ruby_path="$ruby_version_path/$YNH_APP_INSTANCE_NAME/bin"
|
||||
|
||||
# Allow alias to be used into bash script
|
||||
shopt -s expand_aliases
|
||||
|
@ -216,7 +216,7 @@ ynh_use_ruby () {
|
|||
ynh_ruby_load_path="PATH=$PATH"
|
||||
|
||||
# Sets the local application-specific Ruby version
|
||||
pushd $final_path
|
||||
pushd $install_dir
|
||||
$rbenv_install_dir/bin/rbenv local $ruby_version
|
||||
popd
|
||||
}
|
||||
|
@ -354,16 +354,16 @@ ynh_install_ruby () {
|
|||
CONFIGURE_OPTS="--disable-install-doc --with-jemalloc" MAKE_OPTS="-j2" rbenv install --skip-existing $final_ruby_version > /dev/null 2>&1
|
||||
|
||||
# Store ruby_version into the config of this app
|
||||
ynh_app_setting_set --app=$YNH_APP_INSTANCE_NAME --key=ruby_version --value=$final_ruby_version
|
||||
#REMOVEME? ynh_app_setting_set --app=$YNH_APP_INSTANCE_NAME --key=ruby_version --value=$final_ruby_version
|
||||
|
||||
# Remove app virtualenv
|
||||
if `rbenv alias --list | grep --quiet "$YNH_APP_INSTANCE_NAME " 1>/dev/null 2>&1`
|
||||
#REMOVEME? if `rbenv alias --list | grep --quiet "$YNH_APP_INSTANCE_NAME " 1>/dev/null 2>&1`
|
||||
then
|
||||
rbenv alias $YNH_APP_INSTANCE_NAME --remove
|
||||
#REMOVEME? rbenv alias $YNH_APP_INSTANCE_NAME --remove
|
||||
fi
|
||||
|
||||
# Create app virtualenv
|
||||
rbenv alias $YNH_APP_INSTANCE_NAME $final_ruby_version
|
||||
#REMOVEME? rbenv alias $YNH_APP_INSTANCE_NAME $final_ruby_version
|
||||
|
||||
# Cleanup Ruby versions
|
||||
ynh_cleanup_ruby
|
||||
|
@ -385,7 +385,7 @@ eval \"\$(rbenv init -)\"
|
|||
#
|
||||
# usage: ynh_remove_ruby
|
||||
ynh_remove_ruby () {
|
||||
local ruby_version=$(ynh_app_setting_get --app=$YNH_APP_INSTANCE_NAME --key=ruby_version)
|
||||
#REMOVEME? #REMOVEME? local ruby_version=$(ynh_app_setting_get --app=$YNH_APP_INSTANCE_NAME --key=ruby_version)
|
||||
|
||||
# Load rbenv path in PATH
|
||||
local CLEAR_PATH="$rbenv_install_dir/bin:$PATH"
|
||||
|
@ -393,10 +393,10 @@ ynh_remove_ruby () {
|
|||
# Remove /usr/local/bin in PATH in case of Ruby prior installation
|
||||
PATH=$(echo $CLEAR_PATH | sed 's@/usr/local/bin:@@')
|
||||
|
||||
rbenv alias $YNH_APP_INSTANCE_NAME --remove
|
||||
#REMOVEME? rbenv alias $YNH_APP_INSTANCE_NAME --remove
|
||||
|
||||
# Remove the line for this app
|
||||
ynh_app_setting_delete --app=$YNH_APP_INSTANCE_NAME --key=ruby_version
|
||||
#REMOVEME? ynh_app_setting_delete --app=$YNH_APP_INSTANCE_NAME --key=ruby_version
|
||||
|
||||
# Cleanup Ruby versions
|
||||
ynh_cleanup_ruby
|
||||
|
@ -416,7 +416,7 @@ ynh_cleanup_ruby () {
|
|||
local required_ruby_versions=""
|
||||
for installed_app in $installed_apps
|
||||
do
|
||||
local installed_app_ruby_version=$(ynh_app_setting_get --app=$installed_app --key="ruby_version")
|
||||
#REMOVEME? local installed_app_ruby_version=$(ynh_app_setting_get --app=$installed_app --key="ruby_version")
|
||||
if [[ $installed_app_ruby_version ]]
|
||||
then
|
||||
required_ruby_versions="${installed_app_ruby_version}\n${required_ruby_versions}"
|
||||
|
|
|
@ -14,22 +14,22 @@ source /usr/share/yunohost/helpers
|
|||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
#REMOVEME? ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
#REMOVEME? ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_print_info --message="Loading installation settings..."
|
||||
#REMOVEME? ynh_print_info --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
|
||||
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
|
||||
#=================================================
|
||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||
|
@ -40,7 +40,7 @@ ynh_print_info --message="Declaring files to be backed up..."
|
|||
# BACKUP THE APP MAIN DIR
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="$final_path"
|
||||
ynh_backup --src_path="$install_dir"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
|
|
116
scripts/install
116
scripts/install
|
@ -13,24 +13,24 @@ source /usr/share/yunohost/helpers
|
|||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
#REMOVEME? ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
#REMOVEME? ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||
#=================================================
|
||||
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url="/"
|
||||
admin=$YNH_APP_ARG_ADMIN
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
language=$YNH_APP_ARG_LANGUAGE
|
||||
#REMOVEME? domain=$YNH_APP_ARG_DOMAIN
|
||||
path="/"
|
||||
#REMOVEME? admin=$YNH_APP_ARG_ADMIN
|
||||
#REMOVEME? is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
#REMOVEME? language=$YNH_APP_ARG_LANGUAGE
|
||||
admin_mail=$(ynh_user_get_info $admin 'mail')
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
max_toot_chars="500"
|
||||
max_pinned_toots="5"
|
||||
|
@ -47,22 +47,22 @@ max_remote_emoji_size="204800"
|
|||
#=================================================
|
||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating installation parameters..." --weight=1
|
||||
#REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=1
|
||||
|
||||
final_path=/var/www/$app
|
||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||
#REMOVEME? install_dir=/var/www/$app
|
||||
#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder"
|
||||
|
||||
# Register (book) web path
|
||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||
#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path
|
||||
|
||||
#=================================================
|
||||
# STORE SETTINGS FROM MANIFEST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Storing installation settings..." --weight=1
|
||||
#REMOVEME? 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=path --value=$path_url
|
||||
ynh_app_setting_set --app=$app --key=admin --value=$admin
|
||||
#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain
|
||||
#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path
|
||||
#REMOVEME? 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=max_toot_chars --value=$max_toot_chars
|
||||
ynh_app_setting_set --app=$app --key=max_pinned_toots --value=$max_pinned_toots
|
||||
|
@ -81,47 +81,47 @@ ynh_app_setting_set --app=$app --key=max_remote_emoji_size --value=$max_remote_e
|
|||
#=================================================
|
||||
# FIND AND OPEN A PORT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Finding an available port..." --weight=1
|
||||
#REMOVEME? ynh_script_progression --message="Finding an available port..." --weight=1
|
||||
|
||||
# Find an available port
|
||||
port_web=$(ynh_find_port --port=3000)
|
||||
ynh_app_setting_set --app=$app --key=port_web --value=$port_web
|
||||
#REMOVEME? port_web=$(ynh_find_port --port=3000)
|
||||
#REMOVEME? ynh_app_setting_set --app=$app --key=port_web --value=$port_web
|
||||
|
||||
port_stream=$(ynh_find_port --port=4000)
|
||||
ynh_app_setting_set --app=$app --key=port_stream --value=$port_stream
|
||||
#REMOVEME? port_stream=$(ynh_find_port --port=4000)
|
||||
#REMOVEME? ynh_app_setting_set --app=$app --key=port_stream --value=$port_stream
|
||||
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing dependencies..." --weight=10
|
||||
#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=10
|
||||
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||
#REMOVEME? 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_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
|
||||
#REMOVEME? ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
|
||||
ynh_exec_warn_less ynh_install_ruby --ruby_version=$RUBY_VERSION
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..." --weight=1
|
||||
#REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=1
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app --home_dir=$final_path
|
||||
#REMOVEME? ynh_system_user_create --username=$app --home_dir=$install_dir
|
||||
|
||||
#=================================================
|
||||
# CREATE A POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating a PostgreSQL database..." --weight=3
|
||||
#REMOVEME? ynh_script_progression --message="Creating a PostgreSQL database..." --weight=3
|
||||
|
||||
ynh_psql_test_if_first_run
|
||||
#REMOVEME? ynh_psql_test_if_first_run
|
||||
# Create PostgreSQL database
|
||||
db_name=$(ynh_sanitize_dbid --db_name="${app}_production")
|
||||
db_user=$(ynh_sanitize_dbid --db_name=$app)
|
||||
db_pwd=$(ynh_string_random --length=30)
|
||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
ynh_app_setting_set --app=$app --key=db_user --value=$db_user
|
||||
ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd
|
||||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
#REMOVEME? db_name=$(ynh_sanitize_dbid --db_name="${app}_production")
|
||||
#REMOVEME? db_user=$(ynh_sanitize_dbid --db_name=$app)
|
||||
#REMOVEME? db_pwd=$(ynh_string_random --length=30)
|
||||
#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
#REMOVEME? ynh_app_setting_set --app=$app --key=db_user --value=$db_user
|
||||
#REMOVEME? ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd
|
||||
#REMOVEME? ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
ynh_psql_execute_as_root --sql="ALTER USER $db_user CREATEDB;"
|
||||
|
||||
#=================================================
|
||||
|
@ -129,13 +129,13 @@ ynh_psql_execute_as_root --sql="ALTER USER $db_user CREATEDB;"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Setting up source files..." --weight=3
|
||||
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path/live"
|
||||
ynh_setup_source --dest_dir="$install_dir/live"
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
chmod 750 "$install_dir"
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
|
@ -166,9 +166,9 @@ ynh_add_swap --size=$swap_needed
|
|||
#=================================================
|
||||
# INSTALLING RUBY AND BUNDLER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing Ruby dependencies..." --weight=3
|
||||
#REMOVEME? ynh_script_progression --message="Installing Ruby dependencies..." --weight=3
|
||||
|
||||
pushd "$final_path/live"
|
||||
pushd "$install_dir/live"
|
||||
ynh_use_ruby
|
||||
ynh_gem update --system --no-document
|
||||
ynh_gem install bundler --no-document
|
||||
|
@ -179,7 +179,7 @@ popd
|
|||
#=================================================
|
||||
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||
|
||||
config="$final_path/live/.env.production"
|
||||
config="$install_dir/live/.env.production"
|
||||
|
||||
language="$(echo $language | head -c 2)"
|
||||
|
||||
|
@ -200,13 +200,13 @@ ynh_add_config --template="../conf/.env.production.sample" --destination="$confi
|
|||
chmod 400 "$config"
|
||||
chown $app:$app "$config"
|
||||
|
||||
ynh_replace_string --match_string="registrations_mode: 'open'" --replace_string="registrations_mode: 'none'" --target_file="$final_path/live/config/settings.yml"
|
||||
ynh_replace_string --match_string="min_invite_role: 'admin'" --replace_string="min_invite_role: 'none'" --target_file="$final_path/live/config/settings.yml"
|
||||
ynh_replace_string --match_string="registrations_mode: 'open'" --replace_string="registrations_mode: 'none'" --target_file="$install_dir/live/config/settings.yml"
|
||||
ynh_replace_string --match_string="min_invite_role: 'admin'" --replace_string="min_invite_role: 'none'" --target_file="$install_dir/live/config/settings.yml"
|
||||
|
||||
ynh_store_file_checksum --file="$final_path/live/config/settings.yml"
|
||||
ynh_store_file_checksum --file="$install_dir/live/config/settings.yml"
|
||||
|
||||
chmod 400 "$final_path/live/config/settings.yml"
|
||||
chown $app:$app "$final_path/live/config/settings.yml"
|
||||
chmod 400 "$install_dir/live/config/settings.yml"
|
||||
chown $app:$app "$install_dir/live/config/settings.yml"
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
|
@ -223,7 +223,7 @@ ynh_add_systemd_config --service="$app-streaming" --template="glitchsoc-streamin
|
|||
#=================================================
|
||||
ynh_script_progression --message="Installing Glitch-Soc..." --weight=5
|
||||
|
||||
pushd "$final_path/live"
|
||||
pushd "$install_dir/live"
|
||||
ynh_exec_as $app $ynh_ruby_load_path $ld_preload bin/bundle config deployment 'true'
|
||||
ynh_exec_as $app $ynh_ruby_load_path $ld_preload bin/bundle config without 'development test'
|
||||
ynh_exec_as $app $ynh_ruby_load_path $ld_preload bin/bundle install -j$(getconf _NPROCESSORS_ONLN)
|
||||
|
@ -237,13 +237,13 @@ pushd "$final_path/live"
|
|||
ynh_exec_warn_less ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path $ld_preload bin/tootctl accounts modify "$admin" --approve
|
||||
popd
|
||||
|
||||
vapid_private_key=$(grep -oP "VAPID_PRIVATE_KEY=\K.+" "$final_path/live/key.txt")
|
||||
vapid_private_key=$(grep -oP "VAPID_PRIVATE_KEY=\K.+" "$install_dir/live/key.txt")
|
||||
ynh_app_setting_set --app="$app" --key=vapid_private_key --value="$vapid_private_key"
|
||||
|
||||
vapid_public_key=$(grep -oP "VAPID_PUBLIC_KEY=\K.+" "$final_path/live/key.txt")
|
||||
vapid_public_key=$(grep -oP "VAPID_PUBLIC_KEY=\K.+" "$install_dir/live/key.txt")
|
||||
ynh_app_setting_set --app="$app" --key=vapid_public_key --value="$vapid_public_key"
|
||||
|
||||
ynh_secure_remove --file="$final_path/live/key.txt"
|
||||
#REMOVEME? ynh_secure_remove --file="$install_dir/live/key.txt"
|
||||
|
||||
ynh_delete_file_checksum --file="$config"
|
||||
|
||||
|
@ -282,23 +282,23 @@ ynh_systemd_action --service_name=${app}-streaming --action="start" --log_path=s
|
|||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring permissions..." --weight=1
|
||||
#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1
|
||||
|
||||
# Make app public if necessary
|
||||
if [ $is_public -eq 1 ]
|
||||
#REMOVEME? if [ $is_public -eq 1 ]
|
||||
then
|
||||
# Everyone can access the app.
|
||||
# The "main" permission is automatically created before the install script.
|
||||
ynh_permission_update --permission="main" --add="visitors"
|
||||
ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true"
|
||||
#REMOVEME? ynh_permission_update --permission="main" --add="visitors"
|
||||
#REMOVEME? ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -12,14 +12,14 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$(ynh_app_setting_get --app=$app --key=db_user)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
#REMOVEME? db_user=$(ynh_app_setting_get --app=$app --key=db_user)
|
||||
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
|
||||
|
||||
#=================================================
|
||||
# STANDARD REMOVE
|
||||
|
@ -59,18 +59,18 @@ ynh_remove_systemd_config --service="$app-streaming"
|
|||
#=================================================
|
||||
# REMOVE THE POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the PostgreSQL database..." --weight=10
|
||||
#REMOVEME? ynh_script_progression --message="Removing the PostgreSQL database..." --weight=10
|
||||
|
||||
# Remove a database if it exists, along with the associated user
|
||||
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
#REMOVEME? ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
|
||||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing app main directory..." --weight=10
|
||||
#REMOVEME? ynh_script_progression --message="Removing app main directory..." --weight=10
|
||||
|
||||
# Remove the app directory securely
|
||||
ynh_secure_remove --file="$final_path"
|
||||
#REMOVEME? ynh_secure_remove --file="$install_dir"
|
||||
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
|
@ -83,12 +83,12 @@ ynh_remove_nginx_config
|
|||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing dependencies..." --weight=10
|
||||
#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=10
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_ruby
|
||||
ynh_remove_nodejs
|
||||
ynh_remove_app_dependencies
|
||||
#REMOVEME? ynh_remove_app_dependencies
|
||||
ynh_remove_extra_repo
|
||||
|
||||
#=================================================
|
||||
|
@ -109,10 +109,10 @@ ynh_del_swap
|
|||
#=================================================
|
||||
# REMOVE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
|
||||
#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." --weight=1
|
||||
|
||||
# Delete a system user
|
||||
ynh_system_user_delete --username=$app
|
||||
#REMOVEME? ynh_system_user_delete --username=$app
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -14,33 +14,33 @@ source /usr/share/yunohost/helpers
|
|||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
#REMOVEME? ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
#REMOVEME? ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$(ynh_app_setting_get --app=$app --key=db_user)
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
||||
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
|
||||
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
|
||||
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
#REMOVEME? db_user=$(ynh_app_setting_get --app=$app --key=db_user)
|
||||
#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE RESTORED
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
||||
#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
||||
|
||||
test ! -d $final_path \
|
||||
|| ynh_die --message="There is already a directory: $final_path "
|
||||
#REMOVEME? test ! -d $install_dir \
|
||||
|| ynh_die --message="There is already a directory: $install_dir "
|
||||
|
||||
#=================================================
|
||||
# STANDARD RESTORATION STEPS
|
||||
|
@ -54,42 +54,42 @@ 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
|
||||
#REMOVEME? 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
|
||||
#REMOVEME? ynh_system_user_create --username=$app --home_dir=$install_dir
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app main directory..." --weight=10
|
||||
|
||||
ynh_restore_file --origin_path="$final_path"
|
||||
ynh_restore_file --origin_path="$install_dir"
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
chmod 750 "$install_dir"
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=10
|
||||
#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=10
|
||||
|
||||
# Define and install dependencies
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||
#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
|
||||
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
|
||||
#REMOVEME? ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
|
||||
ynh_install_ruby --ruby_version=$RUBY_VERSION
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=10
|
||||
#REMOVEME? ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=10
|
||||
|
||||
ynh_psql_test_if_first_run
|
||||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
#REMOVEME? ynh_psql_test_if_first_run
|
||||
#REMOVEME? ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
ynh_psql_execute_as_root --sql="ALTER USER $db_user CREATEDB;"
|
||||
ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name"
|
||||
|
||||
|
@ -112,9 +112,9 @@ ynh_add_swap --size=$swap_needed
|
|||
#=================================================
|
||||
# INSTALLING RUBY AND BUNDLER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing Ruby dependencies..." --weight=10
|
||||
#REMOVEME? ynh_script_progression --message="Installing Ruby dependencies..." --weight=10
|
||||
|
||||
pushd "$final_path/live"
|
||||
pushd "$install_dir/live"
|
||||
ynh_use_ruby
|
||||
ynh_gem update --system --no-document
|
||||
ynh_gem install bundler --no-document
|
||||
|
|
128
scripts/upgrade
128
scripts/upgrade
|
@ -12,41 +12,41 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
language=$(ynh_app_setting_get --app=$app --key=language)
|
||||
redis_namespace=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$(ynh_app_setting_get --app=$app --key=db_user)
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
||||
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
|
||||
#REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
|
||||
#REMOVEME? language=$(ynh_app_setting_get --app=$app --key=language)
|
||||
#REMOVEME? redis_namespace=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
#REMOVEME? db_user=$(ynh_app_setting_get --app=$app --key=db_user)
|
||||
#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
||||
admin_mail=$(ynh_user_get_info --username=$admin --key='mail')
|
||||
port_web=$(ynh_app_setting_get --app=$app --key=port_web)
|
||||
port_stream=$(ynh_app_setting_get --app=$app --key=port_stream)
|
||||
#REMOVEME? port_web=$(ynh_app_setting_get --app=$app --key=port_web)
|
||||
#REMOVEME? port_stream=$(ynh_app_setting_get --app=$app --key=port_stream)
|
||||
|
||||
secret_key_base=$(ynh_app_setting_get --app=$app --key=secret_key_base)
|
||||
otp_secret=$(ynh_app_setting_get --app=$app --key=otp_secret)
|
||||
vapid_private_key=$(ynh_app_setting_get --app=$app --key=vapid_private_key)
|
||||
vapid_public_key=$(ynh_app_setting_get --app=$app --key=vapid_public_key)
|
||||
#REMOVEME? secret_key_base=$(ynh_app_setting_get --app=$app --key=secret_key_base)
|
||||
#REMOVEME? otp_secret=$(ynh_app_setting_get --app=$app --key=otp_secret)
|
||||
#REMOVEME? vapid_private_key=$(ynh_app_setting_get --app=$app --key=vapid_private_key)
|
||||
#REMOVEME? vapid_public_key=$(ynh_app_setting_get --app=$app --key=vapid_public_key)
|
||||
|
||||
config="$final_path/live/.env.production"
|
||||
config="$install_dir/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)
|
||||
#REMOVEME? max_toot_chars=$(ynh_app_setting_get --app=$app --key=max_toot_chars)
|
||||
#REMOVEME? max_pinned_toots=$(ynh_app_setting_get --app=$app --key=max_pinned_toots)
|
||||
#REMOVEME? max_bio_chars=$(ynh_app_setting_get --app=$app --key=max_bio_chars)
|
||||
#REMOVEME? max_profile_fields=$(ynh_app_setting_get --app=$app --key=max_profile_fields)
|
||||
#REMOVEME? max_display_name_chars=$(ynh_app_setting_get --app=$app --key=max_display_name_chars)
|
||||
#REMOVEME? max_poll_options=$(ynh_app_setting_get --app=$app --key=max_poll_options)
|
||||
#REMOVEME? max_poll_option_chars=$(ynh_app_setting_get --app=$app --key=max_poll_option_chars)
|
||||
#REMOVEME? max_image_size=$(ynh_app_setting_get --app=$app --key=max_image_size)
|
||||
#REMOVEME? max_video_size=$(ynh_app_setting_get --app=$app --key=max_video_size)
|
||||
#REMOVEME? max_emoji_size=$(ynh_app_setting_get --app=$app --key=max_emoji_size)
|
||||
#REMOVEME? max_remote_emoji_size=$(ynh_app_setting_get --app=$app --key=max_remote_emoji_size)
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
|
@ -58,17 +58,17 @@ upgrade_type=$(ynh_check_app_version_changed)
|
|||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
|
||||
#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
#REMOVEME? ynh_backup_before_upgrade
|
||||
#REMOVEME? ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
# Restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
#REMOVEME? ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
#REMOVEME? ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
|
@ -87,40 +87,40 @@ ynh_systemd_action --service_name=${app}-streaming --action="stop" --log_path=sy
|
|||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||
|
||||
# Cleaning legacy permissions
|
||||
if ynh_legacy_permissions_exists; then
|
||||
ynh_legacy_permissions_delete_all
|
||||
#REMOVEME? if ynh_legacy_permissions_exists; then
|
||||
#REMOVEME? ynh_legacy_permissions_delete_all
|
||||
|
||||
ynh_app_setting_delete --app=$app --key=is_public
|
||||
fi
|
||||
|
||||
# Create a permission if needed
|
||||
if ! ynh_permission_exists --permission="api"; then
|
||||
ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true"
|
||||
#REMOVEME? if ! ynh_permission_exists --permission="api"; then
|
||||
#REMOVEME? ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true"
|
||||
fi
|
||||
|
||||
# If port_web doesn't exist, create it, needed for old install
|
||||
if [[ -z "$port_web" ]]; then
|
||||
port_web=3000
|
||||
ynh_app_setting_set --app=$app --key=port_web --value=$port_web
|
||||
#REMOVEME? ynh_app_setting_set --app=$app --key=port_web --value=$port_web
|
||||
fi
|
||||
|
||||
# If port_web doesn't exist, create it, needed for old install
|
||||
if [[ -z "$port_stream" ]]; then
|
||||
port_stream=4000
|
||||
ynh_app_setting_set --app=$app --key=port_stream --value=$port_stream
|
||||
#REMOVEME? ynh_app_setting_set --app=$app --key=port_stream --value=$port_stream
|
||||
fi
|
||||
|
||||
# If db_user doesn't exist, create it, needed for old install
|
||||
if [[ -z "$db_user" ]]; then
|
||||
db_user=$(ynh_sanitize_dbid --db_name=$app)
|
||||
ynh_app_setting_set --app=$app --key=db_user --value=$db_user
|
||||
#REMOVEME? ynh_app_setting_set --app=$app --key=db_user --value=$db_user
|
||||
fi
|
||||
|
||||
# If db_pwd doesn't exist, create it, needed for old install
|
||||
if [[ -z "$db_pwd" ]]; then
|
||||
db_pwd=$(ynh_string_random)
|
||||
ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd
|
||||
ynh_psql_test_if_first_run
|
||||
#REMOVEME? ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd
|
||||
#REMOVEME? ynh_psql_test_if_first_run
|
||||
sudo --login --user=postgres psql -c"ALTER user $app WITH PASSWORD '$db_pwd'" postgres
|
||||
ynh_replace_string --match_string="DB_PASS=" --replace_string="DB_PASS=${db_pwd}" --target_file="$config"
|
||||
fi
|
||||
|
@ -221,10 +221,10 @@ ynh_remove_extra_repo
|
|||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
||||
#REMOVEME? 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
|
||||
#REMOVEME? ynh_system_user_create --username=$app --home_dir=$install_dir
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
|
@ -238,26 +238,26 @@ then
|
|||
tmpdir="$(mktemp -d)"
|
||||
|
||||
mkdir $tmpdir/system
|
||||
if [ -d "$final_path/live/public/system" ]; then
|
||||
mv --verbose --no-target-directory --backup=numbered "$final_path/live/public/system" "$final_path/system.tmp"
|
||||
if [ -d "$install_dir/live/public/system" ]; then
|
||||
mv --verbose --no-target-directory --backup=numbered "$install_dir/live/public/system" "$install_dir/system.tmp"
|
||||
fi
|
||||
rsync -a "$config" "$tmpdir/."
|
||||
ynh_secure_remove --file="$final_path/live"
|
||||
#REMOVEME? ynh_secure_remove --file="$install_dir/live"
|
||||
|
||||
ynh_setup_source --dest_dir="$final_path/live"
|
||||
ynh_setup_source --dest_dir="$install_dir/live"
|
||||
|
||||
if [ -d "$final_path/system.tmp" ]; then
|
||||
mv --verbose --no-target-directory "$final_path/system.tmp" "$final_path/live/public/system"
|
||||
if [ -d "$install_dir/system.tmp" ]; then
|
||||
mv --verbose --no-target-directory "$install_dir/system.tmp" "$install_dir/live/public/system"
|
||||
fi
|
||||
rsync -a "$tmpdir/.env.production" "$final_path/live/."
|
||||
rsync -a "$tmpdir/.env.production" "$install_dir/live/."
|
||||
ynh_secure_remove --file="$tmpdir"
|
||||
|
||||
# Clean files which are not needed anymore
|
||||
ynh_secure_remove --file="$final_path/live/config/initializers/timeout.rb"
|
||||
#REMOVEME? ynh_secure_remove --file="$install_dir/live/config/initializers/timeout.rb"
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
chmod 750 "$install_dir"
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -271,11 +271,11 @@ ynh_add_nginx_config
|
|||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading dependencies..." --weight=10
|
||||
#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=10
|
||||
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||
#REMOVEME? 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_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
|
||||
#REMOVEME? ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
|
||||
ynh_exec_warn_less ynh_install_ruby --ruby_version=$RUBY_VERSION
|
||||
|
||||
#=================================================
|
||||
|
@ -299,9 +299,9 @@ ynh_add_swap --size=$swap_needed
|
|||
#=================================================
|
||||
# INSTALLING RUBY AND BUNDLER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing Ruby dependencies..." --weight=5
|
||||
#REMOVEME? ynh_script_progression --message="Installing Ruby dependencies..." --weight=5
|
||||
|
||||
pushd "$final_path/live"
|
||||
pushd "$install_dir/live"
|
||||
ynh_use_ruby
|
||||
ynh_gem update --system --no-document
|
||||
ynh_gem install bundler --no-document
|
||||
|
@ -336,7 +336,7 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
|
|||
then
|
||||
ynh_script_progression --message="Upgrading Glitch-Soc..." --weight=10
|
||||
|
||||
pushd "$final_path/live"
|
||||
pushd "$install_dir/live"
|
||||
ynh_exec_as $app $ynh_ruby_load_path $ld_preload bin/bundle config deployment 'true'
|
||||
ynh_exec_as $app $ynh_ruby_load_path $ld_preload bin/bundle config without 'development test'
|
||||
ynh_exec_as $app $ynh_ruby_load_path $ld_preload bin/bundle install -j$(getconf _NPROCESSORS_ONLN)
|
||||
|
@ -379,9 +379,9 @@ ynh_systemd_action --service_name=${app}-streaming --action="start" --log_path=s
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
Loading…
Add table
Reference in a new issue