mirror of
https://github.com/YunoHost-Apps/synapse_ynh.git
synced 2024-09-03 20:26:38 +02:00
Improve package
- Use systemd helper - Use official version syntax - Use app_package_version helper - Put all experimental helper in specific file
This commit is contained in:
parent
2473f90c5c
commit
a0b756446f
9 changed files with 211 additions and 145 deletions
|
@ -128,6 +128,10 @@ Synapse is published under the Apache License : https://github.com/matrix-org/sy
|
||||||
To do
|
To do
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
- helper app version
|
||||||
|
- helper systemd
|
||||||
|
- helper ynh_check_starting
|
||||||
|
|
||||||
- Doc (issue about domain)
|
- Doc (issue about domain)
|
||||||
- Test arm
|
- Test arm
|
||||||
- Riot doc
|
- Riot doc
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
"en": "Instant messaging server who use matrix",
|
"en": "Instant messaging server who use matrix",
|
||||||
"fr": "Un serveur de messagerie instantané basé sur matrix"
|
"fr": "Un serveur de messagerie instantané basé sur matrix"
|
||||||
},
|
},
|
||||||
"version": "0.26.0",
|
"version": "0.26.0~ynh1",
|
||||||
"url": "http://matrix.org",
|
"url": "http://matrix.org",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
|
|
|
@ -5,15 +5,7 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
synapse_user="matrix-$app"
|
synapse_user="matrix-$app"
|
||||||
synapse_db_name="matrix_$app"
|
synapse_db_name="matrix_$app"
|
||||||
synapse_db_user="matrix_$app"
|
synapse_db_user="matrix_$app"
|
||||||
|
upstream_version=$(ynh_app_upstream_version)
|
||||||
get_app_version_from_json() {
|
|
||||||
manifest_path="../manifest.json"
|
|
||||||
if [ ! -e "$manifest_path" ]; then
|
|
||||||
manifest_path="../settings/manifest.json" # Into the restore script, the manifest is not at the same place
|
|
||||||
fi
|
|
||||||
echo $(grep '\"version\": ' "$manifest_path" | cut -d '"' -f 4) # Retrieve the version number in the manifest file.
|
|
||||||
}
|
|
||||||
APP_VERSION=$(get_app_version_from_json)
|
|
||||||
|
|
||||||
install_dependances() {
|
install_dependances() {
|
||||||
ynh_install_app_dependencies coturn build-essential python2.7-dev libffi-dev python-pip python-setuptools sqlite3 libssl-dev python-virtualenv libxml2-dev libxslt1-dev python-lxml libjpeg-dev libpq-dev postgresql acl
|
ynh_install_app_dependencies coturn build-essential python2.7-dev libffi-dev python-pip python-setuptools sqlite3 libssl-dev python-virtualenv libxml2-dev libxslt1-dev python-lxml libjpeg-dev libpq-dev postgresql acl
|
||||||
|
@ -56,7 +48,7 @@ install_source() {
|
||||||
pip install --upgrade pip
|
pip install --upgrade pip
|
||||||
pip install --upgrade setuptools
|
pip install --upgrade setuptools
|
||||||
pip install --upgrade cffi ndg-httpsclient psycopg2 lxml
|
pip install --upgrade cffi ndg-httpsclient psycopg2 lxml
|
||||||
pip install --upgrade https://github.com/matrix-org/synapse/archive/v$APP_VERSION.tar.gz
|
pip install --upgrade https://github.com/matrix-org/synapse/archive/v$upstream_version.tar.gz
|
||||||
|
|
||||||
# Fix issue with msgpack see https://github.com/YunoHost-Apps/synapse_ynh/issues/29
|
# Fix issue with msgpack see https://github.com/YunoHost-Apps/synapse_ynh/issues/29
|
||||||
test -e $final_path/lib/python2.7/site-packages/msgpack/__init__.py || (\
|
test -e $final_path/lib/python2.7/site-packages/msgpack/__init__.py || (\
|
||||||
|
@ -108,112 +100,3 @@ config_coturn() {
|
||||||
|
|
||||||
ynh_store_file_checksum /etc/matrix-$app/coturn.conf
|
ynh_store_file_checksum /etc/matrix-$app/coturn.conf
|
||||||
}
|
}
|
||||||
|
|
||||||
####### Solve issue https://dev.yunohost.org/issues/1006
|
|
||||||
|
|
||||||
# Build and install a package from an equivs control file
|
|
||||||
#
|
|
||||||
# example: generate an empty control file with `equivs-control`, adjust its
|
|
||||||
# content and use helper to build and install the package:
|
|
||||||
# ynh_package_install_from_equivs /path/to/controlfile
|
|
||||||
#
|
|
||||||
# usage: ynh_package_install_from_equivs controlfile
|
|
||||||
# | arg: controlfile - path of the equivs control file
|
|
||||||
ynh_package_install_from_equivs () {
|
|
||||||
controlfile=$1
|
|
||||||
|
|
||||||
# Check if the equivs package is installed. Or install it.
|
|
||||||
ynh_package_is_installed 'equivs' \
|
|
||||||
|| ynh_package_install equivs
|
|
||||||
|
|
||||||
# retrieve package information
|
|
||||||
pkgname=$(grep '^Package: ' $controlfile | cut -d' ' -f 2) # Retrieve the name of the debian package
|
|
||||||
pkgversion=$(grep '^Version: ' $controlfile | cut -d' ' -f 2) # And its version number
|
|
||||||
[[ -z "$pkgname" || -z "$pkgversion" ]] \
|
|
||||||
&& echo "Invalid control file" && exit 1 # Check if this 2 variables aren't empty.
|
|
||||||
|
|
||||||
# Update packages cache
|
|
||||||
ynh_package_update
|
|
||||||
|
|
||||||
# Build and install the package
|
|
||||||
TMPDIR=$(mktemp -d)
|
|
||||||
# Note that the cd executes into a sub shell
|
|
||||||
# Create a fake deb package with equivs-build and the given control file
|
|
||||||
# Install the fake package without its dependencies with dpkg
|
|
||||||
# Install missing dependencies with ynh_package_install
|
|
||||||
(cp "$controlfile" "${TMPDIR}/control" && cd "$TMPDIR" \
|
|
||||||
&& equivs-build ./control 1>/dev/null \
|
|
||||||
&& sudo dpkg --force-depends \
|
|
||||||
-i "./${pkgname}_${pkgversion}_all.deb" 2>&1 \
|
|
||||||
&& ynh_package_install -f) || ynh_die "Unable to install dependencies"
|
|
||||||
[[ -n "$TMPDIR" ]] && rm -rf $TMPDIR # Remove the temp dir.
|
|
||||||
|
|
||||||
# check if the package is actually installed
|
|
||||||
ynh_package_is_installed "$pkgname"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Start or restart a service and follow its booting
|
|
||||||
#
|
|
||||||
# usage: ynh_check_starting "Line to match" [service name] [Log file] [Timeout]
|
|
||||||
#
|
|
||||||
# | arg: Line to match - The line to find in the log to attest the service have finished to boot.
|
|
||||||
# | arg: Log file - The log file to watch
|
|
||||||
# /var/log/$app/$app.log will be used if no other log is defined.
|
|
||||||
# | arg: Timeout - The maximum time to wait before ending the watching. Defaut 300 seconds.
|
|
||||||
ynh_check_starting () {
|
|
||||||
local line_to_match="$1"
|
|
||||||
local service_name="${2:-$app}"
|
|
||||||
local app_log="${3:-/var/log/$app/$app.log}"
|
|
||||||
local timeout=${4:-300}
|
|
||||||
|
|
||||||
ynh_clean_check_starting () {
|
|
||||||
# Stop the execution of tail.
|
|
||||||
kill -s 15 $pid_tail 2>&1
|
|
||||||
ynh_secure_remove "$templog" 2>&1
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "Starting of $service_name" >&2
|
|
||||||
systemctl restart $service_name
|
|
||||||
|
|
||||||
local i=0
|
|
||||||
local templog="$(mktemp)"
|
|
||||||
|
|
||||||
# Wait if the log file don't exist
|
|
||||||
if [[ ! -e $app_log ]]
|
|
||||||
then
|
|
||||||
for i in $(seq 1 $timeout)
|
|
||||||
do
|
|
||||||
if [[ -e $app_log ]]
|
|
||||||
then
|
|
||||||
cat $app_log > "$templog"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
echo -n "." >&2
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Following the starting of the app in its log
|
|
||||||
tail -f -n1 "$app_log" >> "$templog" &
|
|
||||||
# Get the PID of the tail command
|
|
||||||
local pid_tail=$!
|
|
||||||
|
|
||||||
for i in $(seq $i $timeout)
|
|
||||||
do
|
|
||||||
# Read the log until the sentence is found, that means the app finished to start. Or run until the timeout
|
|
||||||
if grep --quiet "$line_to_match" "$templog"
|
|
||||||
then
|
|
||||||
echo "The service $service_name has correctly started." >&2
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
echo -n "." >&2
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
if [ $i -eq $timeout ]
|
|
||||||
then
|
|
||||||
echo "The service $service_name didn't fully started before the timeout." >&2
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
ynh_clean_check_starting
|
|
||||||
}
|
|
|
@ -7,8 +7,9 @@ source /usr/share/yunohost/helpers
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
# Import common cmd
|
# Import common cmd
|
||||||
source ../settings/scripts/_common.sh
|
|
||||||
source ../settings/scripts/psql.sh
|
source ../settings/scripts/psql.sh
|
||||||
|
source ../settings/scripts/experimental_helper.sh
|
||||||
|
source ../settings/scripts/_common.sh
|
||||||
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
domain=$(ynh_app_setting_get $app special_domain)
|
domain=$(ynh_app_setting_get $app special_domain)
|
||||||
|
|
184
scripts/experimental_helper.sh
Normal file
184
scripts/experimental_helper.sh
Normal file
|
@ -0,0 +1,184 @@
|
||||||
|
# Read the value of a key in a ynh manifest file
|
||||||
|
#
|
||||||
|
# usage: ynh_read_manifest manifest key
|
||||||
|
# | arg: manifest - Path of the manifest to read
|
||||||
|
# | arg: key - Name of the key to find
|
||||||
|
ynh_read_manifest () {
|
||||||
|
manifest="$1"
|
||||||
|
key="$2"
|
||||||
|
python3 -c "import sys, json;print(json.load(open('$manifest'))['$key'])"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Read the upstream version from the manifest
|
||||||
|
# this include the number before ~ynh
|
||||||
|
#
|
||||||
|
# usage: ynh_app_upstream_version
|
||||||
|
ynh_app_upstream_version () {
|
||||||
|
manifest_path="../manifest.json"
|
||||||
|
if [ ! -e "$manifest_path" ]; then
|
||||||
|
manifest_path="../settings/manifest.json" # Into the restore script, the manifest is not at the same place
|
||||||
|
fi
|
||||||
|
version_key=$(ynh_read_manifest "$manifest_path" "version")
|
||||||
|
echo "${version_key/~ynh*/}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Read package version from the manifest
|
||||||
|
# this include the number after ~ynh
|
||||||
|
#
|
||||||
|
# usage: ynh_app_package_version
|
||||||
|
ynh_app_package_version () {
|
||||||
|
manifest_path="../manifest.json"
|
||||||
|
if [ ! -e "$manifest_path" ]; then
|
||||||
|
manifest_path="../settings/manifest.json" # Into the restore script, the manifest is not at the same place
|
||||||
|
fi
|
||||||
|
version_key=$(ynh_read_manifest "$manifest_path" "version")
|
||||||
|
echo "${version_key/*~ynh/}"
|
||||||
|
}
|
||||||
|
|
||||||
|
####### Solve issue https://dev.yunohost.org/issues/1006
|
||||||
|
|
||||||
|
# Build and install a package from an equivs control file
|
||||||
|
#
|
||||||
|
# example: generate an empty control file with `equivs-control`, adjust its
|
||||||
|
# content and use helper to build and install the package:
|
||||||
|
# ynh_package_install_from_equivs /path/to/controlfile
|
||||||
|
#
|
||||||
|
# usage: ynh_package_install_from_equivs controlfile
|
||||||
|
# | arg: controlfile - path of the equivs control file
|
||||||
|
ynh_package_install_from_equivs () {
|
||||||
|
controlfile=$1
|
||||||
|
|
||||||
|
# Check if the equivs package is installed. Or install it.
|
||||||
|
ynh_package_is_installed 'equivs' \
|
||||||
|
|| ynh_package_install equivs
|
||||||
|
|
||||||
|
# retrieve package information
|
||||||
|
pkgname=$(grep '^Package: ' $controlfile | cut -d' ' -f 2) # Retrieve the name of the debian package
|
||||||
|
pkgversion=$(grep '^Version: ' $controlfile | cut -d' ' -f 2) # And its version number
|
||||||
|
[[ -z "$pkgname" || -z "$pkgversion" ]] \
|
||||||
|
&& echo "Invalid control file" && exit 1 # Check if this 2 variables aren't empty.
|
||||||
|
|
||||||
|
# Update packages cache
|
||||||
|
ynh_package_update
|
||||||
|
|
||||||
|
# Build and install the package
|
||||||
|
TMPDIR=$(mktemp -d)
|
||||||
|
# Note that the cd executes into a sub shell
|
||||||
|
# Create a fake deb package with equivs-build and the given control file
|
||||||
|
# Install the fake package without its dependencies with dpkg
|
||||||
|
# Install missing dependencies with ynh_package_install
|
||||||
|
(cp "$controlfile" "${TMPDIR}/control" && cd "$TMPDIR" \
|
||||||
|
&& equivs-build ./control 1>/dev/null \
|
||||||
|
&& sudo dpkg --force-depends \
|
||||||
|
-i "./${pkgname}_${pkgversion}_all.deb" 2>&1 \
|
||||||
|
&& ynh_package_install -f) || ynh_die "Unable to install dependencies"
|
||||||
|
[[ -n "$TMPDIR" ]] && rm -rf $TMPDIR # Remove the temp dir.
|
||||||
|
|
||||||
|
# check if the package is actually installed
|
||||||
|
ynh_package_is_installed "$pkgname"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Start or restart a service and follow its booting
|
||||||
|
#
|
||||||
|
# usage: ynh_check_starting "Line to match" [Log file] [Timeout] [Service name]
|
||||||
|
#
|
||||||
|
# | arg: Line to match - The line to find in the log to attest the service have finished to boot.
|
||||||
|
# | arg: Log file - The log file to watch
|
||||||
|
# | arg: Service name
|
||||||
|
# /var/log/$app/$app.log will be used if no other log is defined.
|
||||||
|
# | arg: Timeout - The maximum time to wait before ending the watching. Defaut 300 seconds.
|
||||||
|
ynh_check_starting () {
|
||||||
|
local line_to_match="$1"
|
||||||
|
local service_name="${4:-$app}"
|
||||||
|
local app_log="${2:-/var/log/$service_name/$service_name.log}"
|
||||||
|
local timeout=${3:-300}
|
||||||
|
|
||||||
|
ynh_clean_check_starting () {
|
||||||
|
# Stop the execution of tail.
|
||||||
|
kill -s 15 $pid_tail 2>&1
|
||||||
|
ynh_secure_remove "$templog" 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "Starting of $service_name" >&2
|
||||||
|
systemctl restart $service_name
|
||||||
|
local templog="$(mktemp)"
|
||||||
|
# Following the starting of the app in its log
|
||||||
|
tail -F -n1 "$app_log" > "$templog" &
|
||||||
|
# Get the PID of the tail command
|
||||||
|
local pid_tail=$!
|
||||||
|
|
||||||
|
local i=0
|
||||||
|
for i in `seq 1 $timeout`
|
||||||
|
do
|
||||||
|
# Read the log until the sentence is found, that means the app finished to start. Or run until the timeout
|
||||||
|
if grep --quiet "$line_to_match" "$templog"
|
||||||
|
then
|
||||||
|
echo "The service $service_name has correctly started." >&2
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
echo -n "." >&2
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
if [ $i -eq $timeout ]
|
||||||
|
then
|
||||||
|
echo "The service $service_name didn't fully started before the timeout." >&2
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
ynh_clean_check_starting
|
||||||
|
}
|
||||||
|
|
||||||
|
# Create a dedicated systemd config
|
||||||
|
#
|
||||||
|
# usage: ynh_add_systemd_config [Service name] [Source file]
|
||||||
|
# | arg: Service name
|
||||||
|
# | arg: Systemd source file (for example appname.service)
|
||||||
|
#
|
||||||
|
# This will use a template in ../conf/systemd.service
|
||||||
|
# and will replace the following keywords with
|
||||||
|
# global variables that should be defined before calling
|
||||||
|
# this helper :
|
||||||
|
#
|
||||||
|
# __APP__ by $app
|
||||||
|
# __FINALPATH__ by $final_path
|
||||||
|
#
|
||||||
|
# usage: ynh_add_systemd_config
|
||||||
|
ynh_add_systemd_config () {
|
||||||
|
local service_name="${1:-$app}"
|
||||||
|
|
||||||
|
finalsystemdconf="/etc/systemd/system/$service_name.service"
|
||||||
|
ynh_backup_if_checksum_is_different "$finalsystemdconf"
|
||||||
|
sudo cp ../conf/${2:-systemd.service} "$finalsystemdconf"
|
||||||
|
|
||||||
|
# To avoid a break by set -u, use a void substitution ${var:-}. If the variable is not set, it's simply set with an empty variable.
|
||||||
|
# Substitute in a nginx config file only if the variable is not empty
|
||||||
|
if test -n "${final_path:-}"; then
|
||||||
|
ynh_replace_string "__FINALPATH__" "$final_path" "$finalsystemdconf"
|
||||||
|
fi
|
||||||
|
if test -n "${app:-}"; then
|
||||||
|
ynh_replace_string "__APP__" "$app" "$finalsystemdconf"
|
||||||
|
fi
|
||||||
|
ynh_store_file_checksum "$finalsystemdconf"
|
||||||
|
|
||||||
|
sudo chown root: "$finalsystemdconf"
|
||||||
|
sudo systemctl enable $service_name
|
||||||
|
sudo systemctl daemon-reload
|
||||||
|
}
|
||||||
|
|
||||||
|
# Remove the dedicated systemd config
|
||||||
|
#
|
||||||
|
# usage: ynh_remove_systemd_config [Service name]
|
||||||
|
# | arg: Service name
|
||||||
|
#
|
||||||
|
# usage: ynh_remove_systemd_config
|
||||||
|
ynh_remove_systemd_config () {
|
||||||
|
local service_name="${1:-$app}"
|
||||||
|
|
||||||
|
local finalsystemdconf="/etc/systemd/system/$service_name.service"
|
||||||
|
if [ -e "$finalsystemdconf" ]; then
|
||||||
|
sudo systemctl stop $service_name
|
||||||
|
sudo systemctl disable $service_name
|
||||||
|
ynh_secure_remove "$finalsystemdconf"
|
||||||
|
sudo systemctl daemon-reload
|
||||||
|
fi
|
||||||
|
}
|
|
@ -2,12 +2,13 @@
|
||||||
|
|
||||||
# Source YunoHost helpers
|
# Source YunoHost helpers
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
source ./psql.sh
|
|
||||||
|
|
||||||
# Stop script if errors
|
# Stop script if errors
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
# Import common cmd
|
# Import common cmd
|
||||||
|
source ./psql.sh
|
||||||
|
source ./experimental_helper.sh
|
||||||
source ./_common.sh
|
source ./_common.sh
|
||||||
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
|
@ -17,7 +18,7 @@ path_url="/_matrix"
|
||||||
final_path="/opt/yunohost/matrix-$app"
|
final_path="/opt/yunohost/matrix-$app"
|
||||||
|
|
||||||
# Check domain/path availability
|
# Check domain/path availability
|
||||||
test $(ynh_webpath_available $domain $path_url) == 'True' || ynh_die "$domain is not available as domain, please use an other domain."
|
ynh_webpath_available $domain $path_url || ynh_die "$domain is not available as domain, please use an other domain."
|
||||||
test ! -e "/etc/nginx/conf.d/$domain.d/synapse*.conf" || ynh_die "$domain is not available as domain, please use an other domain."
|
test ! -e "/etc/nginx/conf.d/$domain.d/synapse*.conf" || ynh_die "$domain is not available as domain, please use an other domain."
|
||||||
|
|
||||||
# Check Final Path availability
|
# Check Final Path availability
|
||||||
|
@ -42,7 +43,7 @@ synapse_db_pwd=$(ynh_string_random 30)
|
||||||
ynh_app_setting_set $app special_domain $domain
|
ynh_app_setting_set $app special_domain $domain
|
||||||
ynh_app_setting_set $app special_path $path_url
|
ynh_app_setting_set $app special_path $path_url
|
||||||
ynh_app_setting_set $app final_path $final_path
|
ynh_app_setting_set $app final_path $final_path
|
||||||
ynh_app_setting_set $app synapse_version $APP_VERSION
|
ynh_app_setting_set $app synapse_version $upstream_version
|
||||||
ynh_app_setting_set $app synapse_db_pwd $synapse_db_pwd
|
ynh_app_setting_set $app synapse_db_pwd $synapse_db_pwd
|
||||||
ynh_app_setting_set $app is_public $is_public
|
ynh_app_setting_set $app is_public $is_public
|
||||||
ynh_app_setting_set $app synapse_port $port
|
ynh_app_setting_set $app synapse_port $port
|
||||||
|
@ -82,16 +83,10 @@ python $final_path/add_sso_conf.py
|
||||||
|
|
||||||
# Create systemd service for synapse and turnserver
|
# Create systemd service for synapse and turnserver
|
||||||
cp ../conf/default_matrix-synapse /etc/default/matrix-$app
|
cp ../conf/default_matrix-synapse /etc/default/matrix-$app
|
||||||
cp ../conf/matrix-synapse.service /etc/systemd/system/matrix-$app.service
|
ynh_add_systemd_config matrix-$app matrix-synapse.service
|
||||||
ynh_replace_string __APP__ $app /etc/systemd/system/matrix-$app.service
|
|
||||||
|
|
||||||
cp ../conf/default_coturn /etc/default/coturn-$app
|
cp ../conf/default_coturn /etc/default/coturn-$app
|
||||||
cp ../conf/coturn-synapse.service /etc/systemd/system/coturn-$app.service
|
ynh_add_systemd_config coturn-$app coturn-synapse.service
|
||||||
ynh_replace_string __APP__ $app /etc/systemd/system/coturn-$app.service
|
|
||||||
|
|
||||||
systemctl daemon-reload
|
|
||||||
systemctl enable matrix-$app.service
|
|
||||||
systemctl enable coturn-$app.service
|
|
||||||
|
|
||||||
# Config nginx
|
# Config nginx
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
@ -113,4 +108,4 @@ yunohost service add matrix-$app
|
||||||
|
|
||||||
# Reload service
|
# Reload service
|
||||||
systemctl restart coturn-$app.service
|
systemctl restart coturn-$app.service
|
||||||
ynh_check_starting "Synapse now listening on port 8448" "matrix-$app" "/var/log/matrix-$app/homeserver.log" 60
|
ynh_check_starting "Synapse now listening on port 8448" "/var/log/matrix-$app/homeserver.log" 300 "matrix-$app"
|
||||||
|
|
|
@ -2,12 +2,13 @@
|
||||||
|
|
||||||
# Source YunoHost helpers
|
# Source YunoHost helpers
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
source ./psql.sh
|
|
||||||
|
|
||||||
# Stop script if errors
|
# Stop script if errors
|
||||||
set -u
|
set -u
|
||||||
|
|
||||||
# Import common cmd
|
# Import common cmd
|
||||||
|
source ./psql.sh
|
||||||
|
source ./experimental_helper.sh
|
||||||
source ./_common.sh
|
source ./_common.sh
|
||||||
|
|
||||||
# Retrieve app settings
|
# Retrieve app settings
|
||||||
|
@ -54,11 +55,8 @@ ynh_secure_remove /etc/default/coturn-$YNH_APP_INSTANCE_NAME
|
||||||
ynh_remove_nginx_config
|
ynh_remove_nginx_config
|
||||||
|
|
||||||
# Remove systemd service
|
# Remove systemd service
|
||||||
systemctl disable matrix-$YNH_APP_INSTANCE_NAME.service
|
ynh_remove_systemd_config matrix-$YNH_APP_INSTANCE_NAME
|
||||||
systemctl disable coturn-$YNH_APP_INSTANCE_NAME.service
|
ynh_remove_systemd_config coturn-$YNH_APP_INSTANCE_NAME
|
||||||
ynh_secure_remove /etc/systemd/system/matrix-$YNH_APP_INSTANCE_NAME.service
|
|
||||||
ynh_secure_remove /etc/systemd/system/coturn-$app.service
|
|
||||||
systemctl daemon-reload
|
|
||||||
|
|
||||||
# Remove database and user
|
# Remove database and user
|
||||||
ynh_psql_remove_db $synapse_db_name $synapse_db_user
|
ynh_psql_remove_db $synapse_db_name $synapse_db_user
|
||||||
|
|
|
@ -7,8 +7,9 @@ source /usr/share/yunohost/helpers
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
# Import common cmd
|
# Import common cmd
|
||||||
source ../settings/scripts/_common.sh
|
|
||||||
source ../settings/scripts/psql.sh
|
source ../settings/scripts/psql.sh
|
||||||
|
source ../settings/scripts/experimental_helper.sh
|
||||||
|
source ../settings/scripts/_common.sh
|
||||||
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
domain=$(ynh_app_setting_get $app special_domain)
|
domain=$(ynh_app_setting_get $app special_domain)
|
||||||
|
@ -72,4 +73,4 @@ yunohost service add matrix-$app
|
||||||
# Restart service
|
# Restart service
|
||||||
systemctl reload nginx.service
|
systemctl reload nginx.service
|
||||||
systemctl restart coturn-$app.service
|
systemctl restart coturn-$app.service
|
||||||
ynh_check_starting "Synapse now listening on port 8448" "matrix-$app" "/var/log/matrix-$app/homeserver.log" 60
|
ynh_check_starting "Synapse now listening on port 8448" "/var/log/matrix-$app/homeserver.log" 300 "matrix-$app"
|
||||||
|
|
|
@ -2,12 +2,13 @@
|
||||||
|
|
||||||
# Source YunoHost helpers
|
# Source YunoHost helpers
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
source ./psql.sh
|
|
||||||
|
|
||||||
# Stop script if errors
|
# Stop script if errors
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
# Import common cmd
|
# Import common cmd
|
||||||
|
source ./psql.sh
|
||||||
|
source ./experimental_helper.sh
|
||||||
source ./_common.sh
|
source ./_common.sh
|
||||||
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
|
@ -185,9 +186,8 @@ config_coturn
|
||||||
set_permission
|
set_permission
|
||||||
|
|
||||||
# Set new settings
|
# Set new settings
|
||||||
ynh_app_setting_set $app synapse_version $APP_VERSION
|
ynh_app_setting_set $app synapse_version $upstream_version
|
||||||
|
|
||||||
# Restart service
|
# Restart service
|
||||||
systemctl restart coturn-$app.service
|
systemctl restart coturn-$app.service
|
||||||
ynh_check_starting "Synapse now listening on port 8448" "matrix-$app" "/var/log/matrix-$app/homeserver.log" 60
|
ynh_check_starting "Synapse now listening on port 8448" "/var/log/matrix-$app/homeserver.log" 300 "matrix-$app"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue