mirror of
https://github.com/YunoHost-Apps/castopod_ynh.git
synced 2024-09-03 18:16:14 +02:00
commit
8ae9bec1e2
9 changed files with 62 additions and 8 deletions
|
@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
|
|||
|
||||
Hosting platform made for podcasters
|
||||
|
||||
**Shipped version:** 1.0.0-62~ynh1
|
||||
**Shipped version:** 1.0.0-64~ynh1
|
||||
|
||||
**Demo:** https://podcast.podlibre.org/@podlibre_fr
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
|
|||
|
||||
Plateforme d'hébergement conçue pour les podcasteurs
|
||||
|
||||
**Version incluse :** 1.0.0-62~ynh1
|
||||
**Version incluse :** 1.0.0-64~ynh1
|
||||
|
||||
**Démo :** https://podcast.podlibre.org/@podlibre_fr
|
||||
|
||||
|
|
|
@ -34,4 +34,4 @@ cache.handler="redis"
|
|||
cache.redis.host="127.0.0.1"
|
||||
cache.redis.password=null
|
||||
cache.redis.port=6379
|
||||
cache.redis.database=__REDIS_NUMBER__
|
||||
cache.redis.database=__REDIS_DB__
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
SOURCE_URL=https://code.podlibre.org/podlibre/castopod-host/uploads/94954ec7cb77783cc9354d51a57e91b7/castopod-host-1.0.0-alpha.62.zip
|
||||
SOURCE_SUM=8959db163b049a1e937da19fe7174402b8c7d8c1f8fbf74dd90dd50d2f3edda4
|
||||
SOURCE_URL=https://code.podlibre.org/podlibre/castopod-host/uploads/142d6a7830b73f74c03962c9c209ac87/castopod-host-1.0.0-alpha.64.zip
|
||||
SOURCE_SUM=ca0151e8b52734f20a94a85c4981bcfe8895aa507d430c05276273af34c9ee37
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=zip
|
||||
SOURCE_IN_SUBDIR=true
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"en": "Hosting platform made for podcasters",
|
||||
"fr": "Plateforme d'hébergement conçue pour les podcasteurs"
|
||||
},
|
||||
"version": "1.0.0-62~ynh1",
|
||||
"version": "1.0.0-64~ynh1",
|
||||
"url": "https://podlibre.org/",
|
||||
"upstream": {
|
||||
"license": "GPL-3.0-only",
|
||||
|
|
|
@ -21,3 +21,45 @@ pkg_dependencies="redis-server redis-tools"
|
|||
#=================================================
|
||||
# FUTURE OFFICIAL HELPERS
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# REDIS HELPERS
|
||||
#=================================================
|
||||
|
||||
# get the first available redis database
|
||||
#
|
||||
# usage: ynh_redis_get_free_db
|
||||
# | returns: the database number to use
|
||||
ynh_redis_get_free_db() {
|
||||
local result max db
|
||||
result="$(redis-cli INFO keyspace)"
|
||||
|
||||
# get the num
|
||||
max=$(cat /etc/redis/redis.conf | grep ^databases | grep -Eow "[0-9]+")
|
||||
|
||||
db=0
|
||||
# default Debian setting is 15 databases
|
||||
for i in $(seq 0 "$max")
|
||||
do
|
||||
if ! echo "$result" | grep -q "db$i"
|
||||
then
|
||||
db=$i
|
||||
break 1
|
||||
fi
|
||||
db=-1
|
||||
done
|
||||
|
||||
test "$db" -eq -1 && ynh_die --message="No available Redis databases..."
|
||||
|
||||
echo "$db"
|
||||
}
|
||||
|
||||
# Create a master password and set up global settings
|
||||
# Please always call this script in install and restore scripts
|
||||
#
|
||||
# usage: ynh_redis_remove_db database
|
||||
# | arg: database - the database to erase
|
||||
ynh_redis_remove_db() {
|
||||
local db=$1
|
||||
redis-cli -n "$db" flushall
|
||||
}
|
||||
|
|
|
@ -111,7 +111,11 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
|||
#=================================================
|
||||
ynh_script_progression --message="Configuring Castopod..." --weight=1
|
||||
|
||||
redis_number=$(( $YNH_APP_INSTANCE_NUMBER - 1 ))
|
||||
# Configure redis
|
||||
redis_db=$(ynh_redis_get_free_db)
|
||||
ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db"
|
||||
|
||||
#redis_number=$(( $YNH_APP_INSTANCE_NUMBER - 1 ))
|
||||
ynh_add_config --template="../conf/.env.example" --destination="$final_path/.env"
|
||||
chmod 600 $final_path/.env
|
||||
chown $app:www-data "$final_path/.env"
|
||||
|
|
|
@ -20,6 +20,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE MYSQL DATABASE
|
||||
|
@ -29,6 +30,13 @@ ynh_script_progression --message="Removing the MySQL database..." --weight=1
|
|||
# Remove a database if it exists, along with the associated user
|
||||
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE REDIS DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the Redis database..." --weight=1
|
||||
|
||||
ynh_redis_remove_db "$redis_db"
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
|
|
|
@ -21,6 +21,7 @@ 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_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)
|
||||
phpversion=$YNH_PHP_VERSION
|
||||
|
||||
#=================================================
|
||||
|
@ -121,7 +122,6 @@ ynh_add_fpm_config --package="$extra_php_dependencies"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Configuring Castopod..." --weight=1
|
||||
|
||||
redis_number=$(( $YNH_APP_INSTANCE_NUMBER - 1 ))
|
||||
ynh_add_config --template="../conf/.env.example" --destination="$final_path/.env"
|
||||
chmod 600 $final_path/.env
|
||||
chown $app:www-data "$final_path/.env"
|
||||
|
|
Loading…
Add table
Reference in a new issue