mirror of
https://github.com/YunoHost-Apps/discourse_ynh.git
synced 2024-09-03 18:26:18 +02:00
Update README and helpers
This commit is contained in:
parent
5be413e2dd
commit
20f21c4bbc
2 changed files with 26 additions and 21 deletions
|
@ -20,7 +20,9 @@ Moreover, you should have in mind Discourse [hardware requirements](https://gith
|
||||||
- 64 bit Linux compatible with Docker
|
- 64 bit Linux compatible with Docker
|
||||||
- 10 GB disk space minimum
|
- 10 GB disk space minimum
|
||||||
|
|
||||||
Finally, if installing on a low-end ARM device (e.g. Raspberry Pi), first access right after installation could take a couple of minutes.
|
Finally, if installing on a low-end ARM device (e.g. Raspberry Pi):
|
||||||
|
- installation can last up to 3 hours,
|
||||||
|
- first access right after installation could take a couple of minutes.
|
||||||
## Overview
|
## Overview
|
||||||
[Discourse](http://www.discourse.org) is the 100% open source discussion platform built for the next decade of the Internet. Use it as a:
|
[Discourse](http://www.discourse.org) is the 100% open source discussion platform built for the next decade of the Internet. Use it as a:
|
||||||
|
|
||||||
|
|
|
@ -157,7 +157,6 @@ ynh_psql_execute_file_as_root() {
|
||||||
# | arg: pwd - Password of the database. If not given, a password will be generated
|
# | arg: pwd - Password of the database. If not given, a password will be generated
|
||||||
ynh_psql_setup_db () {
|
ynh_psql_setup_db () {
|
||||||
db_user="$1"
|
db_user="$1"
|
||||||
app="$1"
|
|
||||||
db_name="$2"
|
db_name="$2"
|
||||||
new_db_pwd=$(ynh_string_random) # Generate a random password
|
new_db_pwd=$(ynh_string_random) # Generate a random password
|
||||||
# If $3 is not given, use new_db_pwd instead for db_pwd.
|
# If $3 is not given, use new_db_pwd instead for db_pwd.
|
||||||
|
@ -513,10 +512,10 @@ ynh_remove_ruby () {
|
||||||
# Returns true if upstream version is up to date
|
# Returns true if upstream version is up to date
|
||||||
#
|
#
|
||||||
# This helper should be used to avoid an upgrade of the upstream version
|
# This helper should be used to avoid an upgrade of the upstream version
|
||||||
# when it's not needed (but yet allowing to upgrade other part of the
|
# when it's not needed (but yet allowing to upgrade other parts of the
|
||||||
# YunoHost application (e.g. nginx conf)
|
# YunoHost application (e.g. nginx conf)
|
||||||
#
|
#
|
||||||
# usage: ynh_is_upstream_up_to_date
|
# usage: ynh_is_upstream_up_to_date (returns a boolean)
|
||||||
ynh_is_upstream_up_to_date () {
|
ynh_is_upstream_up_to_date () {
|
||||||
local version=$(ynh_read_manifest "/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" "version" || echo 1.0)
|
local version=$(ynh_read_manifest "/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" "version" || echo 1.0)
|
||||||
version="${version/~ynh*/}"
|
version="${version/~ynh*/}"
|
||||||
|
@ -572,23 +571,17 @@ ynh_app_package_version () {
|
||||||
#
|
#
|
||||||
# usage: ynh_check_starting "Line to match" [Log file] [Timeout] [Service name]
|
# usage: ynh_check_starting "Line to match" [Log file] [Timeout] [Service name]
|
||||||
#
|
#
|
||||||
# | arg: Log file - The log file to watch, specify "systemd" to read systemd journal for specified service
|
|
||||||
# | arg: Line to match - The line to find in the log to attest the service have finished to boot.
|
# | arg: Line to match - The line to find in the log to attest the service have finished to boot.
|
||||||
# | arg: Service name
|
# | arg: Log file - The log file to watch; specify "systemd" to read systemd journal for specified service
|
||||||
# /var/log/$app/$app.log will be used if no other log is defined.
|
# /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.
|
# | arg: Timeout - The maximum time to wait before ending the watching. Defaut 300 seconds.
|
||||||
|
# | arg: Service name
|
||||||
ynh_check_starting () {
|
ynh_check_starting () {
|
||||||
local line_to_match="$1"
|
local line_to_match="$1"
|
||||||
local service_name="${4:-$app}"
|
local service_name="${4:-$app}"
|
||||||
local app_log="${2:-/var/log/$service_name/$service_name.log}"
|
local app_log="${2:-/var/log/$service_name/$service_name.log}"
|
||||||
local timeout=${3:-300}
|
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
|
echo "Starting of $service_name" >&2
|
||||||
systemctl stop $service_name
|
systemctl stop $service_name
|
||||||
local templog="$(mktemp)"
|
local templog="$(mktemp)"
|
||||||
|
@ -607,7 +600,7 @@ ynh_check_starting () {
|
||||||
local i=0
|
local i=0
|
||||||
for i in `seq 1 $timeout`
|
for i in `seq 1 $timeout`
|
||||||
do
|
do
|
||||||
# Read the log until the sentence is found, that means the app finished to start. Or run until the timeout
|
# Read the log until the sentence is found, which means the app finished starting. Or run until the timeout.
|
||||||
if grep --quiet "$line_to_match" "$templog"
|
if grep --quiet "$line_to_match" "$templog"
|
||||||
then
|
then
|
||||||
echo "The service $service_name has correctly started." >&2
|
echo "The service $service_name has correctly started." >&2
|
||||||
|
@ -624,3 +617,13 @@ ynh_check_starting () {
|
||||||
echo ""
|
echo ""
|
||||||
ynh_clean_check_starting
|
ynh_clean_check_starting
|
||||||
}
|
}
|
||||||
|
# Clean temporary process and file used by ynh_check_starting
|
||||||
|
# (usually used in ynh_clean_setup scripts)
|
||||||
|
#
|
||||||
|
# usage: ynh_clean_check_starting
|
||||||
|
|
||||||
|
ynh_clean_check_starting () {
|
||||||
|
# Stop the execution of tail.
|
||||||
|
kill -s 15 $pid_tail 2>&1
|
||||||
|
ynh_secure_remove "$templog" 2>&1
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue