mirror of
https://github.com/YunoHost-Apps/fider_ynh.git
synced 2024-09-03 18:36:11 +02:00
Bump to manifestv2
This commit is contained in:
parent
c74ac70130
commit
b084ef15f5
14 changed files with 136 additions and 462 deletions
|
@ -1,6 +0,0 @@
|
|||
SOURCE_URL=https://github.com/getfider/fider/archive/refs/tags/v0.21.1.tar.gz
|
||||
SOURCE_SUM=b981360d7017849e1efd0ae0970df6239a32ebdca2be35785b1208f1552fe99e
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_EXTRACT=true
|
|
@ -1,7 +1,7 @@
|
|||
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
||||
location __PATH__/ {
|
||||
proxy_pass http://localhost:__PORT__;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_pass http://localhost:__PORT__;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Host $host:$server_port;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
cd "__FINAL_PATH__/app"
|
||||
cd "__INSTALL_DIR__/app"
|
||||
|
||||
# Public Host Name
|
||||
export BASE_URL=https://__DOMAIN____PATH__
|
||||
|
|
|
@ -6,8 +6,8 @@ After=network.target
|
|||
Type=simple
|
||||
User=__APP__
|
||||
Group=__APP__
|
||||
WorkingDirectory=__FINALPATH__/
|
||||
ExecStart=__FINALPATH__/run_fider
|
||||
WorkingDirectory=__INSTALL_DIR__/
|
||||
ExecStart=__INSTALL_DIR__/run_fider
|
||||
StandardOutput=append:/var/log/__APP__/__APP__.log
|
||||
StandardError=inherit
|
||||
|
||||
|
|
15
doc/POST_INSTALL.md
Normal file
15
doc/POST_INSTALL.md
Normal file
|
@ -0,0 +1,15 @@
|
|||
Fider is now installed, but needs configuring!
|
||||
|
||||
Please navigate to https://__DOMAIN____PATH__ to subscribe as administrator on $app!
|
||||
You'll receive an email on the adress you'll give there. Please click on the link inside.
|
||||
|
||||
If you want to customize Fider (e.g use OAuth with Github), please edit __INSTALL_DIR__/custom_fider_env (it might not exist yet).
|
||||
Don't forget to *export* the variables in this file, just like in a bash script:
|
||||
|
||||
export OAUTH_GITHUB_SECRET=<your github secret>
|
||||
export OAUTH_GITHUB_CLIENTID=<your github client id>
|
||||
|
||||
You'll find the documentation here for OAuth: https://fider.io/docs/configuring-oauth.
|
||||
|
||||
Are you facing an issue, want to improve this app or say thank you?
|
||||
Please open a new issue in this project: https://github.com/YunoHost-Apps/fider_ynh
|
|
@ -1,66 +0,0 @@
|
|||
{
|
||||
"name": "Fider",
|
||||
"id": "fider",
|
||||
"packaging_format": 1,
|
||||
"description": {
|
||||
"en": "Open platform to collect and prioritize feedback",
|
||||
"fr": "Plateforme ouverte pour récolter et prioriser les retours utilisateurs"
|
||||
},
|
||||
"version": "0.21.1~ynh4",
|
||||
"url": "https://fider.io",
|
||||
"upstream": {
|
||||
"license": "AGPL-3.0",
|
||||
"website": "https://fider.io",
|
||||
"demo": "https://feedback.fider.io",
|
||||
"admindoc": "https://fider.io/docs",
|
||||
"code": "https://github.com/getfider/fider"
|
||||
},
|
||||
"license": "AGPL-3.0",
|
||||
"maintainer": {
|
||||
"name": "Salamandar",
|
||||
"email": "felix@piedallu.me"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 11.0.9"
|
||||
},
|
||||
"multi_instance": true,
|
||||
"services": [
|
||||
"nginx",
|
||||
"postgres",
|
||||
"postfix"
|
||||
],
|
||||
"arguments": {
|
||||
"install": [
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "domain"
|
||||
},
|
||||
{
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"help": {
|
||||
"en": "It should be public for external people to vote.",
|
||||
"fr": "Fider doit être public pour que des personnes externes votent."
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "language",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "Choose the application language",
|
||||
"fr": "Choisissez la langue de l'application"
|
||||
},
|
||||
"choices": [
|
||||
"fr",
|
||||
"en"
|
||||
],
|
||||
"default": "fr"
|
||||
},
|
||||
{
|
||||
"name": "admin",
|
||||
"type": "user"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
71
manifest.toml
Normal file
71
manifest.toml
Normal file
|
@ -0,0 +1,71 @@
|
|||
packaging_format = 2
|
||||
|
||||
id = "fider"
|
||||
name = "Fider"
|
||||
description.en = "Open platform to collect and prioritize feedback"
|
||||
description.fr = "Plateforme ouverte pour récolter et prioriser les retours utilisateurs"
|
||||
|
||||
version = "0.21.1~ynh5"
|
||||
|
||||
maintainers = ["Salamandar"]
|
||||
|
||||
[upstream]
|
||||
license = "AGPL-3.0"
|
||||
website = "https://fider.io"
|
||||
demo = "https://feedback.fider.io"
|
||||
admindoc = "https://fider.io/docs"
|
||||
code = "https://github.com/getfider/fider"
|
||||
|
||||
[integration]
|
||||
yunohost = ">= 11.1.17"
|
||||
architectures = "all"
|
||||
multi_instance = true
|
||||
ldap = false
|
||||
sso = false
|
||||
disk = "?"
|
||||
ram.build = "20M"
|
||||
ram.runtime = "?"
|
||||
|
||||
[install]
|
||||
[install.domain]
|
||||
type = "domain"
|
||||
|
||||
[install.init_main_permission]
|
||||
help.en = "Fider should be public for external people to vote."
|
||||
help.fr = "Fider doit être public pour que des personnes externes votent."
|
||||
type = "group"
|
||||
default = "visitors"
|
||||
|
||||
[install.language]
|
||||
ask.en = "Choose the application language"
|
||||
ask.fr = "Choisissez la langue de l'application"
|
||||
type = "string"
|
||||
choices = ["fr", "en"]
|
||||
default = "fr"
|
||||
|
||||
[install.admin]
|
||||
type = "user"
|
||||
|
||||
[resources]
|
||||
[resources.sources]
|
||||
[resources.sources.main]
|
||||
url = "https://github.com/getfider/fider/archive/refs/tags/v0.21.1.tar.gz"
|
||||
sha256 = "b981360d7017849e1efd0ae0970df6239a32ebdca2be35785b1208f1552fe99e"
|
||||
|
||||
autoupdate.strategy = "latest_github_release"
|
||||
autoupdate.asset = "*.tar.gz"
|
||||
|
||||
[resources.system_user]
|
||||
|
||||
[resources.install_dir]
|
||||
|
||||
[resources.permissions]
|
||||
main.url = "/"
|
||||
|
||||
[resources.ports]
|
||||
|
||||
[resources.apt]
|
||||
packages = "postgresql"
|
||||
|
||||
[resources.database]
|
||||
type = "postgresql"
|
|
@ -6,8 +6,6 @@
|
|||
|
||||
nodejs_version=16
|
||||
|
||||
# dependencies used by the app (must be on a single line)
|
||||
pkg_dependencies="postgresql"
|
||||
pkg_dependency_golang="golang-1.18-go"
|
||||
|
||||
#=================================================
|
||||
|
@ -15,28 +13,28 @@ pkg_dependency_golang="golang-1.18-go"
|
|||
#=================================================
|
||||
|
||||
build_fider() {
|
||||
ynh_exec_as "$app" mkdir -p "$final_path/go_build"
|
||||
ynh_secure_remove -f "$final_path/app"
|
||||
mkdir -p "$final_path/app"
|
||||
ynh_exec_as "$app" mkdir -p "$install_dir/go_build"
|
||||
ynh_secure_remove -f "$install_dir/app"
|
||||
mkdir -p "$install_dir/app"
|
||||
|
||||
pushd "$final_path/sources"
|
||||
pushd "$install_dir/sources" || ynh_die --message "Could not move into $install_dir/sources!"
|
||||
# Build server
|
||||
ynh_exec_as "$app" \
|
||||
GOPATH="$final_path/go_build/go" \
|
||||
GOCACHE="$final_path/go_build/.cache" \
|
||||
GOPATH="$install_dir/go_build/go" \
|
||||
GOCACHE="$install_dir/go_build/.cache" \
|
||||
GOOS=linux GOARCH="$(dpkg --print-architecture)" \
|
||||
PATH=/usr/lib/go-1.18/bin:$PATH \
|
||||
"PATH=/usr/lib/go-1.18/bin:$PATH" \
|
||||
make build-server
|
||||
cp -R migrations views locale LICENSE fider "$final_path/app"
|
||||
cp -R migrations views locale LICENSE fider "$install_dir/app"
|
||||
|
||||
# Build UI
|
||||
ynh_use_nodejs
|
||||
ynh_exec_as "$app" $ynh_node_load_PATH $ynh_npm ci
|
||||
ynh_exec_as "$app" $ynh_node_load_PATH make build-ssr
|
||||
ynh_exec_as "$app" $ynh_node_load_PATH make build-ui
|
||||
cp -R favicon.png dist robots.txt ssr.js "$final_path/app"
|
||||
popd
|
||||
chown $app:www-data -R "$final_path/app"
|
||||
cp -R favicon.png dist robots.txt ssr.js "$install_dir/app"
|
||||
popd || ynh_die
|
||||
chown "$app:www-data" -R "$install_dir/app"
|
||||
}
|
||||
|
||||
#=================================================
|
||||
|
@ -48,61 +46,3 @@ install_golang_from_backports() {
|
|||
--repo="deb http://deb.debian.org/debian $(ynh_get_debian_release)-backports main contrib non-free" \
|
||||
--package="$pkg_dependency_golang"
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# FUTURE OFFICIAL HELPERS
|
||||
#=================================================
|
||||
|
||||
# Send an email to inform the administrator
|
||||
#
|
||||
# usage: ynh_send_readme_to_admin app_message [recipients]
|
||||
# | arg: app_message - The message to send to the administrator.
|
||||
# | arg: recipients - The recipients of this email. Use spaces to separate multiples recipients. - default: root
|
||||
# example: "root admin@domain"
|
||||
# If you give the name of a YunoHost user, ynh_send_readme_to_admin will find its email adress for you
|
||||
# example: "root admin@domain user1 user2"
|
||||
ynh_send_readme_to_admin() {
|
||||
local app_message="${1:-...No specific information...}"
|
||||
local recipients="${2:-root}"
|
||||
|
||||
# Retrieve the email of users
|
||||
find_mails () {
|
||||
local list_mails="$1"
|
||||
local mail
|
||||
local recipients=" "
|
||||
# Read each mail in argument
|
||||
for mail in $list_mails
|
||||
do
|
||||
# Keep root or a real email address as it is
|
||||
if [ "$mail" = "root" ] || echo "$mail" | grep --quiet "@"
|
||||
then
|
||||
recipients="$recipients $mail"
|
||||
else
|
||||
# But replace an user name without a domain after by its email
|
||||
if mail=$(ynh_user_get_info "$mail" "mail" 2> /dev/null)
|
||||
then
|
||||
recipients="$recipients $mail"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
echo "$recipients"
|
||||
}
|
||||
recipients=$(find_mails "$recipients")
|
||||
|
||||
local mail_subject="☁️🆈🅽🅷☁️: \`$app\` was just installed!"
|
||||
|
||||
local mail_message="This is an automated message from your beloved YunoHost server.
|
||||
Specific information for the application $app.
|
||||
$app_message"
|
||||
|
||||
# Define binary to use for mail command
|
||||
if [ -e /usr/bin/bsd-mailx ]
|
||||
then
|
||||
local mail_bin=/usr/bin/bsd-mailx
|
||||
else
|
||||
local mail_bin=/usr/bin/mail.mailutils
|
||||
fi
|
||||
|
||||
# Send the email to the recipients
|
||||
echo "$mail_message" | $mail_bin -a "Content-Type: text/plain; charset=UTF-8" -s "$mail_subject" "$recipients"
|
||||
}
|
||||
|
|
|
@ -10,28 +10,6 @@
|
|||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
true
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_print_info --message="Loading installation settings..."
|
||||
|
||||
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)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
|
||||
#=================================================
|
||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||
#=================================================
|
||||
|
@ -41,7 +19,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
|
||||
|
@ -68,9 +46,6 @@ ynh_backup --src_path="/etc/systemd/system/$app.service"
|
|||
#=================================================
|
||||
ynh_print_info --message="Backing up the PostgreSQL database..."
|
||||
|
||||
### (However, things like MySQL dumps *do* take some time to run, though the
|
||||
### copy of the generated dump to the archive still happens later)
|
||||
|
||||
ynh_psql_dump_db --database="$db_name" > db.sql
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#!/bin/bash
|
||||
# In simple cases, you don't need a config script.
|
||||
# In simple cases, you don't need a config script.
|
||||
|
||||
# With a simple config_panel.toml, you can write in the app settings, in the
|
||||
# With a simple config_panel.toml, you can write in the app settings, in the
|
||||
# upstream config file or replace complete files (logo ...) and restart services.
|
||||
|
||||
# The config scripts allows you to go further, to handle specific cases
|
||||
# The config scripts allows you to go further, to handle specific cases
|
||||
# (validation of several interdependent fields, specific getter/setter for a value,
|
||||
# display dynamic informations or choices, pre-loading of config type .cube... ).
|
||||
|
||||
|
@ -16,14 +16,6 @@
|
|||
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS
|
||||
#=================================================
|
||||
|
||||
final_path=$(ynh_app_setting_get $app final_path)
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC GETTERS FOR TOML SHORT KEY
|
||||
#=================================================
|
||||
|
@ -89,7 +81,7 @@ set__prices() {
|
|||
|
||||
echo "DONATION['$frequency']['$currency'] = '$price_id'" >> "$final_path/settings.py"
|
||||
done
|
||||
|
||||
|
||||
#---------------------------------------------
|
||||
# IMPORTANT: to be able to upgrade properly, you have to saved the value in settings too
|
||||
#---------------------------------------------
|
||||
|
|
137
scripts/install
137
scripts/install
|
@ -9,99 +9,26 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
### Remove this function if there's nothing to clean before calling the remove script.
|
||||
true
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||
#=================================================
|
||||
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url=/
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
language=$YNH_APP_ARG_LANGUAGE
|
||||
admin=$YNH_APP_ARG_ADMIN
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||
#=================================================
|
||||
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"
|
||||
|
||||
# Register (book) web path
|
||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||
|
||||
#=================================================
|
||||
# STORE SETTINGS FROM MANIFEST
|
||||
#=================================================
|
||||
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=language --value=$language
|
||||
ynh_app_setting_set --app=$app --key=admin --value=$admin
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
# FIND AND OPEN A PORT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Finding an available port..." --weight=1
|
||||
|
||||
# Find an available port
|
||||
port=$(ynh_find_port --port=3000)
|
||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing dependencies..." --weight=1
|
||||
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_script_progression --message="Installing Go Lang..." --weight=1
|
||||
install_golang_from_backports
|
||||
|
||||
ynh_script_progression --message="Installing Node JS..." --weight=1
|
||||
ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..." --weight=1
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# CREATE A POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating a PostgreSQL database..." --weight=1
|
||||
|
||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
db_user=$db_name
|
||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Setting up source files..." --weight=1
|
||||
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path/sources"
|
||||
ynh_setup_source --dest_dir="$install_dir/sources"
|
||||
|
||||
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"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
|
@ -127,9 +54,9 @@ ynh_script_progression --message="Adding the configuration file..." --weight=1
|
|||
secret=$(ynh_string_random --length 64)
|
||||
ynh_app_setting_set --app=$app --key=secret --value=$secret
|
||||
|
||||
ynh_add_config --template="run_fider" --destination="$final_path/run_fider"
|
||||
chown $app:www-data "$final_path/run_fider"
|
||||
chmod 744 "$final_path/run_fider"
|
||||
ynh_add_config --template="run_fider" --destination="$install_dir/run_fider"
|
||||
chown $app:www-data "$install_dir/run_fider"
|
||||
chmod 744 "$install_dir/run_fider"
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
|
@ -201,50 +128,6 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap
|
|||
# Create a dedicated Fail2Ban config
|
||||
# ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login"
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring permissions..." --weight=1
|
||||
|
||||
# Make app public if necessary
|
||||
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"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# SEND README TO ADMIN
|
||||
#=================================================
|
||||
ynh_script_progression --message="Sending Readme to admin..." --weight=1
|
||||
|
||||
message="
|
||||
Please navigate to https://$domain$path_url to subscribe as administrator on $app!
|
||||
You'll receive an email on the adress you'll give there. Please click on the link inside.
|
||||
|
||||
If you want to customize Fider (e.g use OAuth with Github), please edit $final_path/custom_fider_env (it might not exist yet).
|
||||
Don't forget to *export* the variables in this file, just like in a bash script:
|
||||
|
||||
export OAUTH_GITHUB_SECRET=<your github secret>
|
||||
export OAUTH_GITHUB_CLIENTID=<your github client id>
|
||||
|
||||
You'll find the documentation here for OAuth: https://fider.io/docs/configuring-oauth.
|
||||
|
||||
|
||||
Are you facing an issue, want to improve this app or say thank you?
|
||||
Please open a new issue in this project: https://github.com/YunoHost-Apps/fider_ynh
|
||||
"
|
||||
|
||||
ynh_send_readme_to_admin "$message"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -9,19 +9,6 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
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)
|
||||
|
||||
#=================================================
|
||||
# STANDARD REMOVE
|
||||
#=================================================
|
||||
|
@ -51,22 +38,6 @@ ynh_script_progression --message="Removing logrotate configuration..." --weight=
|
|||
# Remove the app-specific logrotate config
|
||||
ynh_remove_logrotate
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the PostgreSQL database..." --weight=1
|
||||
|
||||
# Remove a database if it exists, along with the associated user
|
||||
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=1
|
||||
|
||||
# Remove the app directory securely
|
||||
ynh_secure_remove --file="$final_path"
|
||||
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -80,8 +51,6 @@ ynh_remove_nginx_config
|
|||
#=================================================
|
||||
ynh_script_progression --message="Removing dependencies..." --weight=1
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_exec_warn_less ynh_remove_app_dependencies
|
||||
ynh_remove_nodejs
|
||||
|
||||
#=================================================
|
||||
|
@ -94,16 +63,6 @@ ynh_script_progression --message="Removing various files..." --weight=1
|
|||
# Remove the log files
|
||||
ynh_secure_remove --file="/var/log/$app"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# REMOVE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
|
||||
|
||||
# Delete a system user
|
||||
ynh_system_user_delete --username=$app
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -10,60 +10,18 @@
|
|||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
true
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
|
||||
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=$db_name
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE RESTORED
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
||||
|
||||
test ! -d $final_path \
|
||||
|| ynh_die --message="There is already a directory: $final_path "
|
||||
|
||||
#=================================================
|
||||
# STANDARD RESTORATION STEPS
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
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"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
||||
|
||||
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"
|
||||
|
||||
chmod +x "$final_path/run_fider"
|
||||
chmod +x "$install_dir/run_fider"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
|
@ -124,15 +82,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
|
|||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# RELOAD NGINX AND PHP-FPM
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -9,43 +9,12 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
|
||||
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)
|
||||
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=psqlpwd)
|
||||
secret=$(ynh_app_setting_get --app=$app --key=secret)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
#=================================================
|
||||
|
||||
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
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
# Restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
|
@ -62,13 +31,13 @@ ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
|||
|
||||
# Moved fron /opt to /var/www
|
||||
if [ -d "/opt/yunohost/$app" ]; then
|
||||
# Changing final_path...
|
||||
final_path=/var/www/$app
|
||||
ynh_app_setting_set --app="$app" --key=final_path --value="$final_path"
|
||||
# Changing install_dir...
|
||||
install_dir=/var/www/$app
|
||||
ynh_app_setting_set --app="$app" --key=install_dir --value="$install_dir"
|
||||
|
||||
# Moving old final_path to new final_path...
|
||||
ynh_secure_remove "$final_path"
|
||||
mv "/opt/yunohost/$app" "$final_path"
|
||||
# Moving old install_dir to new install_dir...
|
||||
ynh_secure_remove "$install_dir"
|
||||
mv "/opt/yunohost/$app" "$install_dir"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -77,7 +46,7 @@ fi
|
|||
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"
|
||||
ynh_system_user_create --username=$app --home_dir="$install_dir"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
|
@ -88,12 +57,12 @@ then
|
|||
ynh_script_progression --message="Upgrading source files..." --weight=1
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path"
|
||||
ynh_setup_source --dest_dir="$install_dir"
|
||||
fi
|
||||
|
||||
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"
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
|
@ -118,9 +87,9 @@ ynh_add_nginx_config
|
|||
#=================================================
|
||||
ynh_script_progression --message="Updating the configuration file..." --weight=1
|
||||
|
||||
ynh_add_config --template="run_fider" --destination="$final_path/run_fider"
|
||||
chown $app:www-data "$final_path/run_fider"
|
||||
chmod 744 "$final_path/run_fider"
|
||||
ynh_add_config --template="run_fider" --destination="$install_dir/run_fider"
|
||||
chown $app:www-data "$install_dir/run_fider"
|
||||
chmod 744 "$install_dir/run_fider"
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
|
@ -154,13 +123,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
|
|||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
Loading…
Reference in a new issue