mirror of
https://github.com/YunoHost-Apps/limesurvey_ynh.git
synced 2024-09-03 19:36:32 +02:00
Fix
This commit is contained in:
parent
2f016130bf
commit
dd0e343678
15 changed files with 370 additions and 316 deletions
|
@ -1,11 +1,10 @@
|
||||||
;; Test complet sans multisite
|
;; Test complet
|
||||||
auto_remove=1
|
|
||||||
; Manifest
|
; Manifest
|
||||||
domain="domain.tld" (DOMAIN)
|
domain="domain.tld"
|
||||||
path="/path" (PATH)
|
path="/path"
|
||||||
admin="john" (USER)
|
admin="john"
|
||||||
language="en"
|
language="en"
|
||||||
is_public=1 (PUBLIC|public=1|private=0)
|
is_public=1
|
||||||
; Checks
|
; Checks
|
||||||
pkg_linter=1
|
pkg_linter=1
|
||||||
setup_sub_dir=1
|
setup_sub_dir=1
|
||||||
|
@ -17,29 +16,11 @@
|
||||||
upgrade=1 from_commit=a451e536d79ff0d2b73f3c0d888243a567e7c77e
|
upgrade=1 from_commit=a451e536d79ff0d2b73f3c0d888243a567e7c77e
|
||||||
backup_restore=1
|
backup_restore=1
|
||||||
multi_instance=1
|
multi_instance=1
|
||||||
wrong_user=1
|
|
||||||
wrong_path=1
|
|
||||||
incorrect_path=1
|
|
||||||
corrupt_source=1
|
|
||||||
fail_download_source=1
|
|
||||||
port_already_use=0
|
|
||||||
final_path_already_use=1
|
|
||||||
change_url=0
|
change_url=0
|
||||||
;;; Levels
|
|
||||||
Level 1=auto
|
|
||||||
Level 2=auto
|
|
||||||
Level 3=auto
|
|
||||||
Level 4=1
|
|
||||||
Level 5=auto
|
|
||||||
Level 6=auto
|
|
||||||
Level 7=auto
|
|
||||||
Level 8=0
|
|
||||||
Level 9=0
|
|
||||||
Level 10=0
|
|
||||||
;;; Options
|
;;; Options
|
||||||
Email=ljf+libresurvey_ynh@reflexlibre.net
|
Email=ljf+libresurvey_ynh@reflexlibre.net
|
||||||
Notification=down
|
Notification=down
|
||||||
;;; Upgrade options
|
;;; Upgrade options
|
||||||
; commit=a451e536d79ff0d2b73f3c0d888243a567e7c77e
|
; commit=a451e536d79ff0d2b73f3c0d888243a567e7c77e
|
||||||
name=2.62.5-2 a451e536d79ff0d2b73f3c0d888243a567e7c77e
|
name=2.62.5-2
|
||||||
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=en&is_public=1&
|
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=en&is_public=1&
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
SOURCE_URL=https://github.com/LimeSurvey/LimeSurvey/archive/3.17.1+190408.tar.gz
|
SOURCE_URL=https://github.com/LimeSurvey/LimeSurvey/archive/3.17.1+190408.tar.gz
|
||||||
SOURCE_SUM=a2c63a5a28f7f724f5bd7017959caf76e845c7fce9d8b1177075d030641fdbac
|
SOURCE_SUM=a2c63a5a28f7f724f5bd7017959caf76e845c7fce9d8b1177075d030641fdbac
|
||||||
|
SOURCE_SUM_PRG=sha256sum
|
||||||
SOURCE_FILENAME=limesurvey-3.17.1+190408.tar.gz
|
SOURCE_FILENAME=limesurvey-3.17.1+190408.tar.gz
|
||||||
|
|
|
@ -24,10 +24,10 @@
|
||||||
return array(
|
return array(
|
||||||
'components' => array(
|
'components' => array(
|
||||||
'db' => array(
|
'db' => array(
|
||||||
'connectionString' => 'mysql:host=localhost;port=3306;dbname={{ db_name }};',
|
'connectionString' => 'mysql:host=localhost;port=3306;dbname=__DB_NAME__;',
|
||||||
'emulatePrepare' => true,
|
'emulatePrepare' => true,
|
||||||
'username' => '{{ db_user }}',
|
'username' => '__DB_NAME__',
|
||||||
'password' => '{{ db_pwd }}',
|
'password' => '__DB_PWD__',
|
||||||
'charset' => 'utf8mb4',
|
'charset' => 'utf8mb4',
|
||||||
'tablePrefix' => 'lime_',
|
'tablePrefix' => 'lime_',
|
||||||
),
|
),
|
|
@ -1,22 +1,25 @@
|
||||||
{% if path_url != "/" %}
|
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
||||||
rewrite ^{{ path_url }}$ {{ path_url }}/ permanent;
|
location __PATH__/ {
|
||||||
{% else %}
|
|
||||||
{% set path_url = "" %}
|
# Path to source
|
||||||
{% endif %}
|
alias __FINALPATH__/ ;
|
||||||
location {{ path_url }}/ {
|
|
||||||
alias {{ final_path }}/;
|
|
||||||
index index.php;
|
index index.php;
|
||||||
|
|
||||||
# if (!-e $request_filename)
|
# if (!-e $request_filename)
|
||||||
#{
|
#{
|
||||||
# rewrite ^(.+)$ {{ path_url }}/index.php?q=$1 last;
|
# rewrite ^(.+)$ {{ path_url }}/index.php?q=$1 last;
|
||||||
#}
|
#}
|
||||||
|
|
||||||
if ($scheme = http) {
|
if ($scheme = http) {
|
||||||
rewrite ^ https://$server_name$request_uri? permanent;
|
rewrite ^ https://$server_name$request_uri? permanent;
|
||||||
}
|
}
|
||||||
|
|
||||||
client_max_body_size 30m;
|
client_max_body_size 30m;
|
||||||
|
|
||||||
location ~ [^/]\.php(/|$) {
|
location ~ [^/]\.php(/|$) {
|
||||||
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||||
fastcgi_pass unix:/var/run/php5-fpm-{{ app }}.sock;
|
fastcgi_pass unix:/var/run/php__PHPVERSION__-fpm-__NAME__.sock;
|
||||||
fastcgi_index index.php;
|
fastcgi_index index.php;
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
fastcgi_param REMOTE_USER $remote_user;
|
fastcgi_param REMOTE_USER $remote_user;
|
|
@ -1,10 +1,11 @@
|
||||||
; Start a new pool named 'www'.
|
; Start a new pool named 'www'.
|
||||||
; the variable $pool can we used in any directive and will be replaced by the
|
; the variable $pool can be used in any directive and will be replaced by the
|
||||||
; pool name ('www' here)
|
; pool name ('www' here)
|
||||||
[{{ app }}]
|
[__NAMETOCHANGE__]
|
||||||
|
|
||||||
; Per pool prefix
|
; Per pool prefix
|
||||||
; It only applies on the following directives:
|
; It only applies on the following directives:
|
||||||
|
; - 'access.log'
|
||||||
; - 'slowlog'
|
; - 'slowlog'
|
||||||
; - 'listen' (unixsocket)
|
; - 'listen' (unixsocket)
|
||||||
; - 'chroot'
|
; - 'chroot'
|
||||||
|
@ -19,22 +20,24 @@
|
||||||
; Unix user/group of processes
|
; Unix user/group of processes
|
||||||
; Note: The user is mandatory. If the group is not set, the default user's group
|
; Note: The user is mandatory. If the group is not set, the default user's group
|
||||||
; will be used.
|
; will be used.
|
||||||
user = {{ app }}
|
user = __USER__
|
||||||
group = {{ app }}
|
group = __USER__
|
||||||
|
|
||||||
; The address on which to accept FastCGI requests.
|
; The address on which to accept FastCGI requests.
|
||||||
; Valid syntaxes are:
|
; Valid syntaxes are:
|
||||||
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on
|
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on
|
||||||
; a specific port;
|
; a specific port;
|
||||||
; 'port' - to listen on a TCP socket to all addresses on a
|
; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
|
||||||
; specific port;
|
; a specific port;
|
||||||
|
; 'port' - to listen on a TCP socket to all addresses
|
||||||
|
; (IPv6 and IPv4-mapped) on a specific port;
|
||||||
; '/path/to/unix/socket' - to listen on a unix socket.
|
; '/path/to/unix/socket' - to listen on a unix socket.
|
||||||
; Note: This value is mandatory.
|
; Note: This value is mandatory.
|
||||||
listen = /var/run/php5-fpm-{{ app }}.sock
|
listen = /var/run/php/php__PHPVERSION__-fpm-__NAMETOCHANGE__.sock
|
||||||
|
|
||||||
; Set listen(2) backlog.
|
; Set listen(2) backlog.
|
||||||
; Default Value: 128 (-1 on FreeBSD and OpenBSD)
|
; Default Value: 511 (-1 on FreeBSD and OpenBSD)
|
||||||
;listen.backlog = 128
|
;listen.backlog = 511
|
||||||
|
|
||||||
; Set permissions for unix socket, if one is used. In Linux, read/write
|
; Set permissions for unix socket, if one is used. In Linux, read/write
|
||||||
; permissions must be set in order to allow connections from a web server. Many
|
; permissions must be set in order to allow connections from a web server. Many
|
||||||
|
@ -44,8 +47,13 @@ listen = /var/run/php5-fpm-{{ app }}.sock
|
||||||
listen.owner = www-data
|
listen.owner = www-data
|
||||||
listen.group = www-data
|
listen.group = www-data
|
||||||
;listen.mode = 0660
|
;listen.mode = 0660
|
||||||
|
; When POSIX Access Control Lists are supported you can set them using
|
||||||
|
; these options, value is a comma separated list of user/group names.
|
||||||
|
; When set, listen.owner and listen.group are ignored
|
||||||
|
;listen.acl_users =
|
||||||
|
;listen.acl_groups =
|
||||||
|
|
||||||
; List of ipv4 addresses of FastCGI clients which are allowed to connect.
|
; List of addresses (IPv4/IPv6) of FastCGI clients which are allowed to connect.
|
||||||
; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
|
; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
|
||||||
; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
|
; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
|
||||||
; must be separated by a comma. If this value is left blank, connections will be
|
; must be separated by a comma. If this value is left blank, connections will be
|
||||||
|
@ -59,7 +67,13 @@ listen.group = www-data
|
||||||
; - The pool processes will inherit the master process priority
|
; - The pool processes will inherit the master process priority
|
||||||
; unless it specified otherwise
|
; unless it specified otherwise
|
||||||
; Default Value: no set
|
; Default Value: no set
|
||||||
; priority = -19
|
; process.priority = -19
|
||||||
|
|
||||||
|
; Set the process dumpable flag (PR_SET_DUMPABLE prctl) even if the process user
|
||||||
|
; or group is differrent than the master process user. It allows to create process
|
||||||
|
; core dump and ptrace the process for the pool user.
|
||||||
|
; Default Value: no
|
||||||
|
; process.dumpable = yes
|
||||||
|
|
||||||
; Choose how the process manager will control the number of child processes.
|
; Choose how the process manager will control the number of child processes.
|
||||||
; Possible Values:
|
; Possible Values:
|
||||||
|
@ -96,7 +110,7 @@ pm = dynamic
|
||||||
; forget to tweak pm.* to fit your needs.
|
; forget to tweak pm.* to fit your needs.
|
||||||
; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
|
; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
|
||||||
; Note: This value is mandatory.
|
; Note: This value is mandatory.
|
||||||
pm.max_children = 10
|
pm.max_children = 5
|
||||||
|
|
||||||
; The number of child processes created on startup.
|
; The number of child processes created on startup.
|
||||||
; Note: Used only when pm is set to 'dynamic'
|
; Note: Used only when pm is set to 'dynamic'
|
||||||
|
@ -122,7 +136,7 @@ pm.max_spare_servers = 3
|
||||||
; This can be useful to work around memory leaks in 3rd party libraries. For
|
; This can be useful to work around memory leaks in 3rd party libraries. For
|
||||||
; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
|
; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
|
||||||
; Default Value: 0
|
; Default Value: 0
|
||||||
pm.max_requests = 500
|
;pm.max_requests = 500
|
||||||
|
|
||||||
; The URI to view the FPM status page. If this value is not set, no URI will be
|
; The URI to view the FPM status page. If this value is not set, no URI will be
|
||||||
; recognized as a status page. It shows the following informations:
|
; recognized as a status page. It shows the following informations:
|
||||||
|
@ -215,7 +229,7 @@ pm.max_requests = 500
|
||||||
; last request memory: 0
|
; last request memory: 0
|
||||||
;
|
;
|
||||||
; Note: There is a real-time FPM status monitoring sample web page available
|
; Note: There is a real-time FPM status monitoring sample web page available
|
||||||
; It's available in: ${prefix}/share/fpm/status.html
|
; It's available in: /usr/share/php/7.0/fpm/status.html
|
||||||
;
|
;
|
||||||
; Note: The value must start with a leading slash (/). The value can be
|
; Note: The value must start with a leading slash (/). The value can be
|
||||||
; anything, but it may not be a good idea to use the .php extension or it
|
; anything, but it may not be a good idea to use the .php extension or it
|
||||||
|
@ -275,7 +289,7 @@ pm.max_requests = 500
|
||||||
; - %{megabytes}M
|
; - %{megabytes}M
|
||||||
; - %{mega}M
|
; - %{mega}M
|
||||||
; %n: pool name
|
; %n: pool name
|
||||||
; %o: ouput header
|
; %o: output header
|
||||||
; it must be associated with embraces to specify the name of the header:
|
; it must be associated with embraces to specify the name of the header:
|
||||||
; - %{Content-Type}o
|
; - %{Content-Type}o
|
||||||
; - %{X-Powered-By}o
|
; - %{X-Powered-By}o
|
||||||
|
@ -291,9 +305,13 @@ pm.max_requests = 500
|
||||||
; %t: server time the request was received
|
; %t: server time the request was received
|
||||||
; it can accept a strftime(3) format:
|
; it can accept a strftime(3) format:
|
||||||
; %d/%b/%Y:%H:%M:%S %z (default)
|
; %d/%b/%Y:%H:%M:%S %z (default)
|
||||||
|
; The strftime(3) format must be encapsuled in a %{<strftime_format>}t tag
|
||||||
|
; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t
|
||||||
; %T: time the log has been written (the request has finished)
|
; %T: time the log has been written (the request has finished)
|
||||||
; it can accept a strftime(3) format:
|
; it can accept a strftime(3) format:
|
||||||
; %d/%b/%Y:%H:%M:%S %z (default)
|
; %d/%b/%Y:%H:%M:%S %z (default)
|
||||||
|
; The strftime(3) format must be encapsuled in a %{<strftime_format>}t tag
|
||||||
|
; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t
|
||||||
; %u: remote user
|
; %u: remote user
|
||||||
;
|
;
|
||||||
; Default: "%R - %u %t \"%m %r\" %s"
|
; Default: "%R - %u %t \"%m %r\" %s"
|
||||||
|
@ -302,13 +320,13 @@ pm.max_requests = 500
|
||||||
; The log file for slow requests
|
; The log file for slow requests
|
||||||
; Default Value: not set
|
; Default Value: not set
|
||||||
; Note: slowlog is mandatory if request_slowlog_timeout is set
|
; Note: slowlog is mandatory if request_slowlog_timeout is set
|
||||||
slowlog = /var/log/nginx/{{ app }}.slow.log
|
;slowlog = log/$pool.log.slow
|
||||||
|
|
||||||
; The timeout for serving a single request after which a PHP backtrace will be
|
; The timeout for serving a single request after which a PHP backtrace will be
|
||||||
; dumped to the 'slowlog' file. A value of '0s' means 'off'.
|
; dumped to the 'slowlog' file. A value of '0s' means 'off'.
|
||||||
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
|
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
|
||||||
; Default Value: 0
|
; Default Value: 0
|
||||||
request_slowlog_timeout = 5s
|
;request_slowlog_timeout = 0
|
||||||
|
|
||||||
; The timeout for serving a single request after which the worker process will
|
; The timeout for serving a single request after which the worker process will
|
||||||
; be killed. This option should be used when the 'max_execution_time' ini option
|
; be killed. This option should be used when the 'max_execution_time' ini option
|
||||||
|
@ -340,22 +358,31 @@ request_terminate_timeout = 1d
|
||||||
; Chdir to this directory at the start.
|
; Chdir to this directory at the start.
|
||||||
; Note: relative path can be used.
|
; Note: relative path can be used.
|
||||||
; Default Value: current directory or / when chroot
|
; Default Value: current directory or / when chroot
|
||||||
chdir = {{ final_path }}
|
chdir = __FINALPATH__
|
||||||
|
|
||||||
; Redirect worker stdout and stderr into main error log. If not set, stdout and
|
; Redirect worker stdout and stderr into main error log. If not set, stdout and
|
||||||
; stderr will be redirected to /dev/null according to FastCGI specs.
|
; stderr will be redirected to /dev/null according to FastCGI specs.
|
||||||
; Note: on highloaded environement, this can cause some delay in the page
|
; Note: on highloaded environement, this can cause some delay in the page
|
||||||
; process time (several ms).
|
; process time (several ms).
|
||||||
; Default Value: no
|
; Default Value: no
|
||||||
catch_workers_output = yes
|
;catch_workers_output = yes
|
||||||
|
|
||||||
|
; Clear environment in FPM workers
|
||||||
|
; Prevents arbitrary environment variables from reaching FPM worker processes
|
||||||
|
; by clearing the environment in workers before env vars specified in this
|
||||||
|
; pool configuration are added.
|
||||||
|
; Setting to "no" will make all environment variables available to PHP code
|
||||||
|
; via getenv(), $_ENV and $_SERVER.
|
||||||
|
; Default Value: yes
|
||||||
|
;clear_env = no
|
||||||
|
|
||||||
; Limits the extensions of the main script FPM will allow to parse. This can
|
; Limits the extensions of the main script FPM will allow to parse. This can
|
||||||
; prevent configuration mistakes on the web server side. You should only limit
|
; prevent configuration mistakes on the web server side. You should only limit
|
||||||
; FPM to .php extensions to prevent malicious users to use other extensions to
|
; FPM to .php extensions to prevent malicious users to use other extensions to
|
||||||
; exectute php code.
|
; execute php code.
|
||||||
; Note: set an empty value to allow all extensions.
|
; Note: set an empty value to allow all extensions.
|
||||||
; Default Value: .php
|
; Default Value: .php
|
||||||
;security.limit_extensions = .php .php3 .php4 .php5
|
;security.limit_extensions = .php .php3 .php4 .php5 .php7
|
||||||
|
|
||||||
; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from
|
; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from
|
||||||
; the current environment.
|
; the current environment.
|
||||||
|
@ -391,3 +418,13 @@ catch_workers_output = yes
|
||||||
;php_admin_flag[log_errors] = on
|
;php_admin_flag[log_errors] = on
|
||||||
;php_admin_value[memory_limit] = 32M
|
;php_admin_value[memory_limit] = 32M
|
||||||
|
|
||||||
|
; Common values to change to increase file upload limit
|
||||||
|
; php_admin_value[upload_max_filesize] = 50M
|
||||||
|
; php_admin_value[post_max_size] = 50M
|
||||||
|
; php_admin_flag[mail.add_x_header] = Off
|
||||||
|
|
||||||
|
; Other common parameters
|
||||||
|
; php_admin_value[max_execution_time] = 600
|
||||||
|
; php_admin_value[max_input_time] = 300
|
||||||
|
; php_admin_value[memory_limit] = 256M
|
||||||
|
; php_admin_flag[short_open_tag] = On
|
|
@ -1,3 +0,0 @@
|
||||||
upload_max_filesize=30M
|
|
||||||
post_max_size=30M
|
|
||||||
; max_execution_time=60
|
|
5
doc/DISCLAIMER.md
Normal file
5
doc/DISCLAIMER.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
## YunoHost specific features
|
||||||
|
|
||||||
|
* In private mode, only authorized YunoHost members can create poll, with the public mode, it's possible to create account to people with no YunoHost account.
|
||||||
|
* SSO and LDAP are configured.
|
||||||
|
* Login secured by fail2ban
|
|
@ -2,10 +2,19 @@
|
||||||
"name": "LimeSurvey",
|
"name": "LimeSurvey",
|
||||||
"id": "limesurvey",
|
"id": "limesurvey",
|
||||||
"packaging_format": 1,
|
"packaging_format": 1,
|
||||||
"version": "3.17.1~ynh1",
|
|
||||||
"description": {
|
"description": {
|
||||||
"en": "Creation and distribution survey tool.",
|
"en": "Creation and distribution survey tool",
|
||||||
"fr": "Outil de création et diffusion de sondage."
|
"fr": "Outil de création et diffusion de sondage"
|
||||||
|
},
|
||||||
|
"version": "3.17.1~ynh1",
|
||||||
|
"url": "https://www.limesurvey.org/",
|
||||||
|
"upstream": {
|
||||||
|
"license": "GPL-2.0+",
|
||||||
|
"website": "https://www.limesurvey.org",
|
||||||
|
"demo": "https://demo.example.com",
|
||||||
|
"admindoc": "https://manual.limesurvey.org/LimeSurvey_Manual/fr",
|
||||||
|
"userdoc": "https://yunohost.org/apps",
|
||||||
|
"code": "https://github.com/LimeSurvey/LimeSurvey"
|
||||||
},
|
},
|
||||||
"license": "GPL-2.0+",
|
"license": "GPL-2.0+",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
|
@ -13,14 +22,13 @@
|
||||||
"email": "ljf+limesurvey_ynh@reflexlibre.net",
|
"email": "ljf+limesurvey_ynh@reflexlibre.net",
|
||||||
"url": "https://reflexlibre.net"
|
"url": "https://reflexlibre.net"
|
||||||
},
|
},
|
||||||
"url": "https://www.limesurvey.org/",
|
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 3.5.2"
|
"yunohost": ">= 4.2.0"
|
||||||
},
|
},
|
||||||
"multi_instance": true,
|
"multi_instance": true,
|
||||||
"services": [
|
"services": [
|
||||||
"nginx",
|
"nginx",
|
||||||
"php7.0-fpm",
|
"php7.3-fpm",
|
||||||
"mysql"
|
"mysql"
|
||||||
],
|
],
|
||||||
"arguments": {
|
"arguments": {
|
||||||
|
@ -28,29 +36,17 @@
|
||||||
{
|
{
|
||||||
"name": "domain",
|
"name": "domain",
|
||||||
"type": "domain",
|
"type": "domain",
|
||||||
"ask": {
|
|
||||||
"en": "Choose a domain for LimeSurvey",
|
|
||||||
"fr": "Choisissez un nom de domaine pour LimeSurvey"
|
|
||||||
},
|
|
||||||
"example": "domain.org"
|
"example": "domain.org"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "path",
|
"name": "path",
|
||||||
"type": "path",
|
"type": "path",
|
||||||
"ask": {
|
|
||||||
"en": "Choose a path for LimeSurvey",
|
|
||||||
"fr": "Choisissez l'adresse pour LimeSurvey"
|
|
||||||
},
|
|
||||||
"example": "/poll",
|
"example": "/poll",
|
||||||
"default": "/poll"
|
"default": "/poll"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "admin",
|
"name": "admin",
|
||||||
"type": "user",
|
"type": "user",
|
||||||
"ask": {
|
|
||||||
"en": "Choose the LimeSurvey administrator (must be an existing YunoHost user)",
|
|
||||||
"fr": "Choisissez l'administrateur de LimeSurvey (doit être un utilisateur YunoHost)"
|
|
||||||
},
|
|
||||||
"example": "john"
|
"example": "john"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -66,11 +62,7 @@
|
||||||
{
|
{
|
||||||
"name": "is_public",
|
"name": "is_public",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"ask": {
|
"default": true
|
||||||
"en": "Will people without YunoHost account have LimeSurvey account to be able to create polls?",
|
|
||||||
"fr": "Est-ce que des personnes sans compte YunoHost aurront un compte LimeSurvey pour créer des questionnaires ?"
|
|
||||||
},
|
|
||||||
"default": 1
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,9 @@
|
||||||
# App package root directory should be the parent folder
|
# App package root directory should be the parent folder
|
||||||
PKG_DIR=$(cd ../; pwd)
|
PKG_DIR=$(cd ../; pwd)
|
||||||
|
|
||||||
pkg_dependencies="php7.0-cli php7.0-imap python-pip php7.0-gd php7.0-ldap php7.0-zip"
|
YNH_PHP_VERSION="7.3"
|
||||||
|
|
||||||
|
pkg_dependencies="php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-imap python-pip php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-ldap php${YNH_PHP_VERSION}-zip"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC HELPERS
|
# SPECIFIC HELPERS
|
||||||
|
@ -25,6 +27,7 @@ set_permissions () {
|
||||||
#=================================================
|
#=================================================
|
||||||
# COMMON HELPERS
|
# COMMON HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_set_default_perm () {
|
ynh_set_default_perm () {
|
||||||
local DIRECTORY=$1
|
local DIRECTORY=$1
|
||||||
# Set permissions
|
# Set permissions
|
||||||
|
@ -73,19 +76,6 @@ ynh_save_args () {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# Execute a command as another user
|
|
||||||
# usage: ynh_exec_as USER COMMAND [ARG ...]
|
|
||||||
ynh_exec_as() {
|
|
||||||
local USER=$1
|
|
||||||
shift 1
|
|
||||||
|
|
||||||
if [[ $USER = $(whoami) ]]; then
|
|
||||||
eval "$@"
|
|
||||||
else
|
|
||||||
# use sudo twice to be root and be allowed to use another user
|
|
||||||
sudo sudo -u "$USER" "$@"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# usage: ynh_save_persistent MODE RELATIVE_PATH
|
# usage: ynh_save_persistent MODE RELATIVE_PATH
|
||||||
|
@ -195,13 +185,6 @@ ynh_read_json () {
|
||||||
sudo python3 -c "import sys, json;print(json.load(open('$1'))['$2'])"
|
sudo python3 -c "import sys, json;print(json.load(open('$1'))['$2'])"
|
||||||
}
|
}
|
||||||
|
|
||||||
ynh_read_manifest () {
|
|
||||||
if [ -f '../manifest.json' ] ; then
|
|
||||||
ynh_read_json '../manifest.json' "$1"
|
|
||||||
else
|
|
||||||
ynh_read_json '../settings/manifest.json' "$1"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ynh_configure () {
|
ynh_configure () {
|
||||||
|
@ -212,41 +195,6 @@ ynh_configure () {
|
||||||
sudo cp "${PKG_DIR}/conf/$TEMPLATE" "$DEST"
|
sudo cp "${PKG_DIR}/conf/$TEMPLATE" "$DEST"
|
||||||
}
|
}
|
||||||
|
|
||||||
ynh_add_nginx_config () {
|
|
||||||
finalnginxconf="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
||||||
ynh_backup_if_checksum_is_different "$finalnginxconf"
|
|
||||||
ynh_configure nginx.conf "$finalnginxconf"
|
|
||||||
ynh_store_file_checksum "$finalnginxconf"
|
|
||||||
service nginx reload
|
|
||||||
}
|
|
||||||
|
|
||||||
ynh_add_fpm_config () {
|
|
||||||
# Configure PHP-FPM 7.0 by default
|
|
||||||
local fpm_config_dir="/etc/php/7.0/fpm"
|
|
||||||
local fpm_service="php7.0-fpm"
|
|
||||||
# Configure PHP-FPM 5 on Debian Jessie
|
|
||||||
if is_jessie; then
|
|
||||||
fpm_config_dir="/etc/php5/fpm"
|
|
||||||
fpm_service="php5-fpm"
|
|
||||||
fi
|
|
||||||
ynh_app_setting_set $app fpm_config_dir "$fpm_config_dir"
|
|
||||||
ynh_app_setting_set $app fpm_service "$fpm_service"
|
|
||||||
finalphpconf="$fpm_config_dir/pool.d/$app.conf"
|
|
||||||
ynh_backup_if_checksum_is_different "$finalphpconf"
|
|
||||||
ynh_configure php-fpm.conf "$finalphpconf"
|
|
||||||
sudo chown root: "$finalphpconf"
|
|
||||||
ynh_store_file_checksum "$finalphpconf"
|
|
||||||
|
|
||||||
if [ -e "../conf/php-fpm.ini.j2" ]
|
|
||||||
then
|
|
||||||
finalphpini="$fpm_config_dir/conf.d/20-$app.ini"
|
|
||||||
ynh_backup_if_checksum_is_different "$finalphpini"
|
|
||||||
ynh_configure php-fpm.ini "$finalphpini"
|
|
||||||
chown root: "$finalphpini"
|
|
||||||
ynh_store_file_checksum "$finalphpini"
|
|
||||||
fi
|
|
||||||
systemctl reload $fpm_service
|
|
||||||
}
|
|
||||||
|
|
||||||
# Send an email to inform the administrator
|
# Send an email to inform the administrator
|
||||||
#
|
#
|
||||||
|
@ -340,22 +288,7 @@ ynh_abort_if_up_to_date () {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Remove any logs for all the following commands.
|
|
||||||
#
|
|
||||||
# usage: ynh_print_OFF
|
|
||||||
# WARNING: You should be careful with this helper, and never forgot to use ynh_print_ON as soon as possible to restore the logging.
|
|
||||||
ynh_print_OFF () {
|
|
||||||
set +x
|
|
||||||
}
|
|
||||||
|
|
||||||
# Restore the logging after ynh_print_OFF
|
|
||||||
#
|
|
||||||
# usage: ynh_print_ON
|
|
||||||
ynh_print_ON () {
|
|
||||||
set -x
|
|
||||||
# Print an echo only for the log, to be able to know that ynh_print_ON has been called.
|
|
||||||
echo ynh_print_ON > /dev/null
|
|
||||||
}
|
|
||||||
ynh_version_gt() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"; }
|
ynh_version_gt() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"; }
|
||||||
|
|
||||||
# In upgrade script allow to test if the app is less than or equal a specific version
|
# In upgrade script allow to test if the app is less than or equal a specific version
|
||||||
|
@ -366,27 +299,6 @@ ynh_version_le() {
|
||||||
ynh_version_gt "$1" "${version}"
|
ynh_version_gt "$1" "${version}"
|
||||||
}
|
}
|
||||||
|
|
||||||
ynh_debian_release () {
|
|
||||||
lsb_release --codename --short
|
|
||||||
}
|
|
||||||
|
|
||||||
is_stretch () {
|
|
||||||
if [ "$(ynh_debian_release)" == "stretch" ]
|
|
||||||
then
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
is_jessie () {
|
|
||||||
if [ "$(ynh_debian_release)" == "jessie" ]
|
|
||||||
then
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Reload (or other actions) a service and print a log in case of failure.
|
# Reload (or other actions) a service and print a log in case of failure.
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,53 +1,70 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC STARTING
|
# GENERIC START
|
||||||
#=================================================
|
#=================================================
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||||
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MANAGE SCRIPT FAILURE
|
# 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
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info --message="Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
db_name=$(ynh_app_setting_get $app db_name)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD BACKUP STEPS
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP OF THE MAIN DIR OF THE APP
|
ynh_print_info --message="Declaring files to be backed up..."
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_backup "$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP OF THE NGINX CONFIGURATION
|
# BACKUP THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_backup --src_path="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP OF THE PHP-FPM CONFIGURATION
|
# BACKUP THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup "/etc/php5/fpm/pool.d/$app.conf"
|
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
ynh_backup "/etc/php5/fpm/conf.d/20-$app.ini"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP OF THE SQL BDD
|
# BACKUP THE PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_mysql_dump_db "$db_name" > db.sql
|
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP THE MYSQL DATABASE
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info --message="Backing up the MySQL database..."
|
||||||
|
|
||||||
|
ynh_mysql_dump_db --database="$db_name" > db.sql
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||||
|
|
|
@ -19,78 +19,87 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
export app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
# Retrieve arguments
|
|
||||||
ynh_export domain path_url admin is_public language
|
|
||||||
export prefix=lime_
|
export prefix=lime_
|
||||||
export db_name=$(ynh_sanitize_dbid $app)
|
|
||||||
export db_user=$db_name
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
|
path_url=$YNH_APP_ARG_PATH
|
||||||
|
admin=$YNH_APP_ARG_ADMIN
|
||||||
|
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||||
|
language=$YNH_APP_ARG_LANGUAGE
|
||||||
|
|
||||||
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS
|
# CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Validating installation parameters..." --time --weight=1
|
ynh_script_progression --message="Validating installation parameters..." --weight=1
|
||||||
|
|
||||||
export final_path=/var/www/$app
|
final_path=/var/www/$app
|
||||||
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||||
|
|
||||||
# Register (book) web path
|
# Register (book) web path
|
||||||
ynh_webpath_register $app $domain $path_url
|
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Storing installation settings..." --time --weight=1
|
ynh_script_progression --message="Storing installation settings..." --time --weight=1
|
||||||
|
|
||||||
ynh_save_args domain admin is_public language final_path prefix path_url db_name db_user
|
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
|
||||||
|
ynh_app_setting_set --app=$app --key=language --value=$language
|
||||||
|
|
||||||
|
ynh_save_args prefix
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installing dependencies..." --time --weight=1
|
ynh_script_progression --message="Installing dependencies..." --weight=1
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE A SQL BDD
|
# CREATE A MYSQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Creating a MySQL database..." --time --weight=1
|
ynh_script_progression --message="Creating a MySQL database..." --weight=1
|
||||||
|
|
||||||
ynh_mysql_setup_db $db_user $db_name
|
ydb_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||||
export db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
db_user=$db_name
|
||||||
|
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||||
|
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# 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"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setting up source files..." --time --weight=1
|
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
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
ynh_setup_source "$final_path"
|
ynh_setup_source --dest_dir="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring nginx web server..." --time --weight=1
|
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
||||||
|
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated nginx config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CREATE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configuring system user..." --time --weight=1
|
|
||||||
|
|
||||||
# Create a system user
|
|
||||||
ynh_system_user_create $app
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PHP-FPM CONFIGURATION
|
# PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring php-fpm..." --time --weight=1
|
ynh_script_progression --message="Configuring PHP-FPM..." --weight=1
|
||||||
|
|
||||||
# Create a dedicated php-fpm config
|
# Create a dedicated php-fpm config
|
||||||
ynh_add_fpm_config
|
ynh_add_fpm_config
|
||||||
|
@ -102,17 +111,17 @@ ynh_add_fpm_config
|
||||||
# Set permissions
|
# Set permissions
|
||||||
set_permissions
|
set_permissions
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC SETUP
|
# SPECIFIC SETUP
|
||||||
#=================================================
|
#=================================================
|
||||||
# CONFIGURE
|
# CONFIGURE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_configure config.php "$final_path/application/config/config.php"
|
ynh_add_config --template="../conf/config.php" --destination="$final_path/application/config/config.php"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL
|
# INSTALL
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ls_cli=$final_path/application/commands/console.php
|
ls_cli=$final_path/application/commands/console.php
|
||||||
fullname=$(ynh_user_get_info "$admin" "fullname")
|
fullname=$(ynh_user_get_info "$admin" "fullname")
|
||||||
mail=$(ynh_user_get_info "$admin" "mail")
|
mail=$(ynh_user_get_info "$admin" "mail")
|
||||||
|
@ -130,6 +139,7 @@ ynh_store_file_checksum "$final_path/application/config/config.php"
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SQL SPECIFIC CONFIG
|
# LOAD SQL SPECIFIC CONFIG
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_configure data.sql ./data.sql
|
ynh_configure data.sql ./data.sql
|
||||||
mysql -u $db_user -p$db_pwd $db_user < ./data.sql
|
mysql -u $db_user -p$db_pwd $db_user < ./data.sql
|
||||||
|
|
||||||
|
@ -139,13 +149,13 @@ mysql -u $db_user -p$db_pwd $db_user < ./data.sql
|
||||||
#ynh_setup_source "$final_path/upload/templates/libreform" libreform
|
#ynh_setup_source "$final_path/upload/templates/libreform" libreform
|
||||||
#ynh_setup_source "$final_path/upload/templates/librepoll" librepoll
|
#ynh_setup_source "$final_path/upload/templates/librepoll" librepoll
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALISATION
|
# GENERIC FINALISATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# SECURING FILES AND DIRECTORIES
|
# SECURING FILES AND DIRECTORIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Apply permissions..." --time --weight=1
|
ynh_script_progression --message="Apply permissions..." --weight=1
|
||||||
|
|
||||||
# Set permissions
|
# Set permissions
|
||||||
set_permissions
|
set_permissions
|
||||||
|
|
||||||
|
@ -158,7 +168,7 @@ set_permissions
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring SSOwat..." --time --weight=1
|
ynh_script_progression --message="Configuring SSOwat..." --weight=1
|
||||||
|
|
||||||
yunohost app addaccess $app -u $admin
|
yunohost app addaccess $app -u $admin
|
||||||
ynh_sso_access "/index.php?r=admin,/index.php?r=plugins,/scripts"
|
ynh_sso_access "/index.php?r=admin,/index.php?r=plugins,/scripts"
|
||||||
|
|
|
@ -12,57 +12,68 @@ source _common.sh
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
final_path=${final_path:-/var/www/$app}
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
db_user=$db_name
|
||||||
db_name=$(ynh_app_setting_get $app db_name)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD REMOVE
|
# STANDARD REMOVE
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEPENDENCIES
|
# REMOVE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing dependencies..." --weight=1
|
||||||
|
|
||||||
# Remove metapackage and its dependencies
|
# Remove metapackage and its dependencies
|
||||||
ynh_remove_app_dependencies
|
ynh_remove_app_dependencies
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE THE SQL BDD
|
# REMOVE THE MYSQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing the MySQL database..." --weight=1
|
||||||
|
|
||||||
# Remove a database if it exists, along with the associated user
|
# Remove a database if it exists, along with the associated user
|
||||||
ynh_mysql_remove_db $db_name $db_name
|
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE THE MAIN DIR OF THE APP
|
# REMOVE THE MAIN DIR OF THE APP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Remove the app directory securely
|
# Remove the app directory securely
|
||||||
ynh_secure_remove "$final_path"
|
ynh_secure_remove --file="$final_path"
|
||||||
ynh_secure_remove "/home/yunohost.app/$app"
|
|
||||||
|
ynh_secure_remove --file="/home/yunohost.app/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE THE NGINX CONFIGURATION
|
# REMOVE THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
|
||||||
|
|
||||||
# Remove the dedicated nginx config
|
# Remove the dedicated NGINX config
|
||||||
ynh_remove_nginx_config
|
ynh_remove_nginx_config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE THE PHP-FPM CONFIGURATION
|
# REMOVE PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1
|
||||||
|
|
||||||
# Remove the dedicated php-fpm config
|
# Remove the dedicated PHP-FPM config
|
||||||
ynh_remove_fpm_config
|
ynh_remove_fpm_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALISATION
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEDICATED USER
|
# REMOVE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
|
||||||
|
|
||||||
# Delete a system user
|
# Delete a system user
|
||||||
ynh_system_user_delete $app
|
ynh_system_user_delete --username=$app
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_script_progression --message="Removal of $app completed" --last
|
||||||
|
|
|
@ -19,71 +19,98 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||||
|
|
||||||
export app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
export domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
export path_url=$(ynh_app_setting_get $app path)
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
export admin=$(ynh_app_setting_get $app admin)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
export final_path=$(ynh_app_setting_get $app final_path)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
export is_public=$(ynh_app_setting_get $app is_public)
|
db_user=$db_name
|
||||||
export prefix=$(ynh_app_setting_get $app prefix)
|
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
export db_name=$(ynh_app_setting_get $app db_name)
|
|
||||||
export db_user=$(ynh_app_setting_get $app db_user)
|
|
||||||
export db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
||||||
|
|
||||||
ynh_webpath_available $domain $path_url \
|
ynh_webpath_available --domain=$domain --path_url=$path_url \
|
||||||
|| ynh_die "Path not available: ${domain}${path_url}"
|
|| ynh_die --message="Path not available: ${domain}${path_url}"
|
||||||
test ! -d $final_path \
|
test ! -d $final_path \
|
||||||
|| ynh_die "There is already a directory: $final_path "
|
|| ynh_die --message="There is already a directory: $final_path "
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD RESTORE STEPS
|
# STANDARD RESTORATION STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# RESTORE THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1
|
||||||
|
|
||||||
#=================================================
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
# RESTORE OF THE SQL BDD
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_mysql_setup_db $db_name $db_name $db_pwd
|
|
||||||
ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTORE FILES
|
|
||||||
#=================================================
|
|
||||||
# Restore files
|
|
||||||
ynh_restore
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RECREATE THE DEDICATED USER
|
# RECREATE THE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_system_user_create "$app" "$final_path"
|
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"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE THE PHP-FPM CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=1
|
||||||
|
|
||||||
|
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC RESTORATION
|
||||||
|
#=================================================
|
||||||
|
# REINSTALL DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
|
||||||
|
|
||||||
|
# Define and install dependencies
|
||||||
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE THE MYSQL DATABASE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restoring the MySQL database..." --weight=1
|
||||||
|
|
||||||
|
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||||
|
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||||
|
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE USER RIGHTS
|
# RESTORE USER RIGHTS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
set_permissions
|
set_permissions
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_sso_access "/index.php?r=admin,/index.php?r=plugins,/scripts"
|
ynh_sso_access "/index.php?r=admin,/index.php?r=plugins,/scripts"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALISATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX AND PHP-FPM
|
# RELOAD NGINX AND PHP-FPM
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
|
||||||
|
|
||||||
ynh_system_reload php5-fpm
|
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
|
||||||
ynh_system_reload nginx
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SEND A README FOR THE ADMIN
|
# SEND A README FOR THE ADMIN
|
||||||
|
@ -92,3 +119,9 @@ ynh_system_reload nginx
|
||||||
message="If you facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/leed_ynh"
|
message="If you facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/leed_ynh"
|
||||||
|
|
||||||
ynh_send_readme_to_admin "$message" "$admin"
|
ynh_send_readme_to_admin "$message" "$admin"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_script_progression --message="Restoration completed for $app" --last
|
||||||
|
|
|
@ -12,27 +12,30 @@ source _common.sh
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
export app=$YNH_APP_INSTANCE_NAME
|
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||||
|
|
||||||
export domain=$(ynh_app_setting_get $app domain)
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
export path_url=$(ynh_app_setting_get $app path)
|
|
||||||
export admin=$(ynh_app_setting_get $app admin)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
export final_path=$(ynh_app_setting_get $app final_path)
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
export is_public=$(ynh_app_setting_get $app is_public)
|
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||||
export prefix=$(ynh_app_setting_get $app prefix)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
export db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
export db_name=$(ynh_app_setting_get $app db_name)
|
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||||
export db_user=$(ynh_app_setting_get $app db_user)
|
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
|
|
||||||
|
prefix=$(ynh_app_setting_get $app prefix)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK VERSION
|
# CHECK VERSION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_abort_if_up_to_date
|
upgrade_type=$(ynh_check_app_version_changed)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Backing up $app before upgrading (may take a while)..." --weight=7
|
||||||
|
|
||||||
# Backup the current version of the app
|
# Backup the current version of the app
|
||||||
ynh_backup_before_upgrade
|
ynh_backup_before_upgrade
|
||||||
|
@ -44,14 +47,52 @@ ynh_clean_setup () {
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK THE PATH
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Ensuring downward compatibility..." --time --weight=1
|
||||||
|
|
||||||
path_url=$(ynh_normalize_url_path $path_url) # Vérifie et corrige la syntaxe du path.
|
#
|
||||||
|
# N.B. : the followings setting migrations snippets are provided as *EXAMPLES*
|
||||||
|
# of what you may want to do in some cases (e.g. a setting was not defined on
|
||||||
|
# some legacy installs and you therefore want to initiaze stuff during upgrade)
|
||||||
|
#
|
||||||
|
|
||||||
|
# If db_name doesn't exist, create it
|
||||||
|
#if [ -z "$db_name" ]; then
|
||||||
|
# db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||||
|
# ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||||
|
#fi
|
||||||
|
|
||||||
|
# If final_path doesn't exist, create it
|
||||||
|
#if [ -z "$final_path" ]; then
|
||||||
|
# final_path=/var/www/$app
|
||||||
|
# ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||||
|
#fi
|
||||||
|
|
||||||
|
### If nobody installed your app before 4.1,
|
||||||
|
### then you may safely remove these lines
|
||||||
|
|
||||||
|
# Cleaning legacy permissions
|
||||||
|
if ynh_legacy_permissions_exists; then
|
||||||
|
ynh_legacy_permissions_delete_all
|
||||||
|
|
||||||
|
ynh_app_setting_delete --app=$app --key=is_public
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! ynh_permission_exists --permission="admin"; then
|
||||||
|
# Create the required permissions
|
||||||
|
ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create a permission if needed
|
||||||
|
if ! ynh_permission_exists --permission="api"; then
|
||||||
|
ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --show_tile="false" --protected="true"
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STEP Migrations
|
# STEP Migrations
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
if ynh_version_le "2.0.5" ; then
|
if ynh_version_le "2.0.5" ; then
|
||||||
is_public=${is_public:-0}
|
is_public=${is_public:-0}
|
||||||
prefix=${prefix:-prefix_}
|
prefix=${prefix:-prefix_}
|
||||||
|
@ -108,24 +149,31 @@ ynh_restore_persistent
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
|
||||||
|
|
||||||
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
||||||
|
|
||||||
ynh_system_user_create $app # Create the dedicated user, if not exist
|
# Create a dedicated user (if not existing)
|
||||||
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PHP-FPM CONFIGURATION
|
# PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
|
||||||
|
|
||||||
ynh_add_fpm_config # Créer le fichier de configuration du pool php-fpm et le configure.
|
# Create a dedicated PHP-FPM config
|
||||||
|
ynh_add_fpm_config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SECURING FILES AND DIRECTORIES
|
# SECURING FILES AND DIRECTORIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
set_permissions
|
set_permissions
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -136,12 +184,6 @@ set_permissions
|
||||||
cd $final_path
|
cd $final_path
|
||||||
ynh_exec_as "$app" php application/commands/console.php updatedb
|
ynh_exec_as "$app" php application/commands/console.php updatedb
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RELOAD NGINX
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_system_reload nginx
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# Send message to the admin
|
# Send message to the admin
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -151,3 +193,16 @@ if ynh_version_le "2.62.2-2" ; then
|
||||||
ynh_warn "$message"
|
ynh_warn "$message"
|
||||||
ynh_send_readme_to_admin "$message" "$admin"
|
ynh_send_readme_to_admin "$message" "$admin"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RELOAD NGINX
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1
|
||||||
|
|
||||||
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_script_progression --message="Upgrade of $app completed" --time --last
|
||||||
|
|
Loading…
Add table
Reference in a new issue