mirror of
https://github.com/YunoHost-Apps/framaforms_ynh.git
synced 2024-09-03 18:36:12 +02:00
[wip] Apply new example_ynh template
This commit is contained in:
parent
6e1b2bbf38
commit
372174575c
16 changed files with 564 additions and 517 deletions
77
README.md
77
README.md
|
@ -1,2 +1,75 @@
|
||||||
# Framaform_ynh
|
# Framaforms for YunoHost
|
||||||
Create online webforms and surveys with Framaform on YunoHost
|
|
||||||
|
[![Integration level](https://dash.yunohost.org/integration/framaforms.svg)](https://dash.yunohost.org/appci/app/framaforms)
|
||||||
|
[![Install FramaForms with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=framaforms)
|
||||||
|
|
||||||
|
> *This package allow you to install FramaForms quickly and simply on a YunoHost server.
|
||||||
|
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
Framaforms helps you create online webforms and surveys.
|
||||||
|
See https://framablog.org/2016/10/05/framaforms-noffrez-plus-les-reponses-que-vous-collectez-a-google/ (in French ) and https://framablog.org/2016/10/05/en-savoir-un-peu-plus-sur-le-projet-framaforms/ (in French) for further informations.
|
||||||
|
|
||||||
|
**Shipped version:** 20190614
|
||||||
|
|
||||||
|
## Screenshots
|
||||||
|
|
||||||
|
![Animation that present how to build a form with Framaforms](https://framaforms.org/sites/default/files/imgforms/anim_creation.gif)
|
||||||
|
|
||||||
|
## Demo
|
||||||
|
|
||||||
|
* [Official demo](https://framaforms.org/)
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
How to configure this app: by an admin panel, a plain file with SSH, or any other way.
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
* Official documentation: https://docs.framasoft.org/fr/framaforms/
|
||||||
|
|
||||||
|
## YunoHost specific features
|
||||||
|
|
||||||
|
#### Multi-users support
|
||||||
|
|
||||||
|
Are LDAP and HTTP auth supported?
|
||||||
|
Can the app be used by multiple users?
|
||||||
|
|
||||||
|
#### Supported architectures
|
||||||
|
|
||||||
|
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/framaforms%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/framaforms/)
|
||||||
|
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/framaforms%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/framaforms/)
|
||||||
|
* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/framaforms%20%28Apps%29.svg)](https://ci-stretch.nohost.me/ci/apps/framaforms/)
|
||||||
|
|
||||||
|
## Limitations
|
||||||
|
|
||||||
|
* Any known limitations.
|
||||||
|
|
||||||
|
## Additional information
|
||||||
|
|
||||||
|
* Other information you would add about this application
|
||||||
|
|
||||||
|
**More information on the documentation page:**
|
||||||
|
https://yunohost.org/packaging_apps
|
||||||
|
|
||||||
|
## Links
|
||||||
|
|
||||||
|
* Report a bug: https://github.com/YunoHost-Apps/framaforms_ynh/issues
|
||||||
|
* App website: https://framaforms.org/
|
||||||
|
* Upstream app repository: https://framagit.org/framasoft/framaforms
|
||||||
|
* YunoHost website: https://yunohost.org/
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Developers info
|
||||||
|
----------------
|
||||||
|
|
||||||
|
**Only if you want to use a testing branch for coding, instead of merging directly into master.**
|
||||||
|
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/framaforms_ynh/tree/testing).
|
||||||
|
|
||||||
|
To try the testing branch, please proceed like that.
|
||||||
|
```
|
||||||
|
sudo yunohost app install https://github.com/YunoHost-Apps/framaforms_ynh/tree/testing --debug
|
||||||
|
or
|
||||||
|
sudo yunohost app upgrade framaforms -u https://github.com/YunoHost-Apps/framaforms_ynh/tree/testing --debug
|
||||||
|
```
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
|
# See here for more information
|
||||||
|
# https://github.com/YunoHost/package_check#syntax-check_process-file
|
||||||
;; Test complet
|
;; Test complet
|
||||||
auto_remove=1
|
|
||||||
; Manifest
|
; Manifest
|
||||||
domain="domain.tld" (DOMAIN)
|
domain="domain.tld" (DOMAIN)
|
||||||
path="/path" (PATH)
|
path="/path" (PATH)
|
||||||
|
@ -12,24 +13,13 @@
|
||||||
setup_nourl=0
|
setup_nourl=0
|
||||||
setup_private=1
|
setup_private=1
|
||||||
setup_public=1
|
setup_public=1
|
||||||
upgrade=0
|
upgrade=1
|
||||||
backup_restore=0
|
backup_restore=1
|
||||||
multi_instance=0
|
multi_instance=1
|
||||||
wrong_user=1
|
change_url=1
|
||||||
wrong_path=1
|
|
||||||
incorrect_path=1
|
|
||||||
corrupt_source=0
|
|
||||||
fail_download_source=0
|
|
||||||
port_already_use=0
|
|
||||||
final_path_already_use=0
|
|
||||||
;;; Levels
|
;;; Levels
|
||||||
Level 1=auto
|
# If the level 5 (Package linter) is forced to 1. Please add justifications here.
|
||||||
Level 2=auto
|
|
||||||
Level 3=auto
|
|
||||||
Level 4=1
|
|
||||||
Level 5=auto
|
Level 5=auto
|
||||||
Level 6=auto
|
;;; Options
|
||||||
Level 7=auto
|
Email=ljf+framaforms_ynh@reflexlibre.net
|
||||||
Level 8=0
|
Notification=down
|
||||||
Level 9=0
|
|
||||||
Level 10=0
|
|
||||||
|
|
|
@ -16,6 +16,12 @@ $databases = array (
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Turn off the X-Frame-Options header entirely, to restore the previous
|
||||||
|
* behavior of allowing the site to be embedded in a frame on another site.
|
||||||
|
*/
|
||||||
|
$conf['x_frame_options'] = '';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* The "driver" property indicates what Drupal database driver the
|
* The "driver" property indicates what Drupal database driver the
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
SOURCE_URL=https://ftp.drupal.org/files/projects/drupal-8.5.3.tar.gz
|
|
||||||
SOURCE_SUM=7fc105f9e04ac5ccd337ff784aeaba6b48841490d7a80fd8ddb002fac0def47b
|
|
||||||
SOURCE_SUM_PRG=sha256sum
|
|
||||||
SOURCE_FORMAT=tar.gz
|
|
|
@ -1,4 +1,4 @@
|
||||||
SOURCE_URL=https://framagit.org/framasoft/framaforms/repository/d318c70d5f9a5e08b229a39d9301075f992f2f65/archive.tar.bz2
|
SOURCE_URL=https://framagit.org/framasoft/framaforms/-/archive/ad53d1a6f3d78ec0748a35a4e82bb013cad22f00/framaforms-ad53d1a6f3d78ec0748a35a4e82bb013cad22f00.tar.gz
|
||||||
SOURCE_SUM=479bba50d13b31562716722679c96f744e625449a95ed4bac41b2a9d431f1550
|
SOURCE_SUM=0272127cfe4e307ce2b824446fab1dfacba54071dcf06cdf48bc265da6719362
|
||||||
SOURCE_SUM_PRG=sha256sum
|
SOURCE_SUM_PRG=sha256sum
|
||||||
SOURCE_FORMAT=tar.bz2
|
SOURCE_FILENAME=framaforms-0.0.0+190614.tar.gz
|
||||||
|
|
|
@ -4,27 +4,21 @@ location __PATH__/ {
|
||||||
# Path to source
|
# Path to source
|
||||||
alias __FINALPATH__/ ;
|
alias __FINALPATH__/ ;
|
||||||
|
|
||||||
|
# Force usage of https
|
||||||
if ($scheme = http) {
|
if ($scheme = http) {
|
||||||
rewrite ^ https://$server_name$request_uri? permanent;
|
rewrite ^ https://$server_name$request_uri? permanent;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Example PHP configuration (remove if not used)
|
### Example PHP configuration (remove it if not used)
|
||||||
index index.php;
|
index index.php;
|
||||||
|
|
||||||
# Common parameter to increase upload size limit in conjuction with dedicated php-fpm file
|
# Common parameter to increase upload size limit in conjunction with dedicated php-fpm file
|
||||||
#client_max_body_size 50M;
|
#client_max_body_size 50M;
|
||||||
|
|
||||||
try_files $uri $uri/ index.php;
|
try_files $uri $uri/ index.php;
|
||||||
location ~ [^/]\.php(/|$) {
|
location ~ [^/]\.php(/|$) {
|
||||||
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||||
fastcgi_pass unix:/var/run/php5-fpm-__NAME__.sock;
|
fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock;
|
||||||
|
|
||||||
# If you don't use a dedicated fpm config for your app,
|
|
||||||
# use a general fpm pool.
|
|
||||||
# This is to be used INSTEAD of line above
|
|
||||||
# Don't forget to adjust scripts install/upgrade/remove/backup accordingly
|
|
||||||
#
|
|
||||||
#fastcgi_pass unix:/var/run/php5-fpm.sock;
|
|
||||||
|
|
||||||
fastcgi_index index.php;
|
fastcgi_index index.php;
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
|
@ -32,7 +26,7 @@ location __PATH__/ {
|
||||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||||
fastcgi_param SCRIPT_FILENAME $request_filename;
|
fastcgi_param SCRIPT_FILENAME $request_filename;
|
||||||
}
|
}
|
||||||
# PHP configuration end
|
### End of PHP configuration part
|
||||||
|
|
||||||
# Include SSOWAT user panel.
|
# Include SSOWAT user panel.
|
||||||
include conf.d/yunohost_panel.conf.inc;
|
include conf.d/yunohost_panel.conf.inc;
|
||||||
|
|
|
@ -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)
|
||||||
[__NAMETOCHANGE__]
|
[__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'
|
||||||
|
@ -24,17 +25,19 @@ 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-__NAMETOCHANGE__.sock
|
listen = /var/run/php/php7.0-fpm-__NAMETOCHANGE__.sock
|
||||||
|
|
||||||
; Set listen(2) backlog. A value of '-1' means unlimited.
|
; 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-__NAMETOCHANGE__.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/__NAMETOCHANGE__.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
|
||||||
|
@ -347,15 +365,24 @@ chdir = __FINALPATH__
|
||||||
; 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
|
||||||
|
|
|
@ -5,17 +5,18 @@
|
||||||
"description": {
|
"description": {
|
||||||
"en": "Framaforms helps you create online webforms and surveys"
|
"en": "Framaforms helps you create online webforms and surveys"
|
||||||
},
|
},
|
||||||
"version": "1.0-0",
|
"version": "0.0.0+190614-ynh1",
|
||||||
"url": "https://framagit.org/framasoft/framaforms",
|
"url": "https://framagit.org/framasoft/framaforms",
|
||||||
"license": "GPL-2.0-only",
|
"license": "GPL-2.0-only",
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 2.7.0"
|
"yunohost": ">= 3.5"
|
||||||
},
|
},
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
"name": "jibec",
|
"name": "ljf",
|
||||||
"email": "jean-baptiste@holcroft.fr"
|
"email": "ljf+framaforms_ynh@reflexlibre.net",
|
||||||
|
"url": "https://reflexlibre.net"
|
||||||
},
|
},
|
||||||
"multi_instance": false,
|
"multi_instance": true,
|
||||||
"services": [
|
"services": [
|
||||||
"nginx",
|
"nginx",
|
||||||
"php5-fpm",
|
"php5-fpm",
|
||||||
|
@ -26,7 +27,7 @@
|
||||||
{
|
{
|
||||||
"name": "domain",
|
"name": "domain",
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Choose a domain for Kanboard"
|
"en": "Choose a domain for Framaforms"
|
||||||
},
|
},
|
||||||
"example": "domain.org",
|
"example": "domain.org",
|
||||||
"type": "domain"
|
"type": "domain"
|
||||||
|
@ -34,27 +35,27 @@
|
||||||
{
|
{
|
||||||
"name": "path",
|
"name": "path",
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Choose a path"
|
"en": "Choose a path for Framaforms"
|
||||||
},
|
},
|
||||||
"type": "path",
|
"type": "path",
|
||||||
"example": "/kanboard",
|
"example": "/poll",
|
||||||
"default": "/kanboard"
|
"default": "/poll"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "admin",
|
"name": "admin",
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Choose the admin user"
|
"en": "Choose an admin user"
|
||||||
},
|
},
|
||||||
"type": "user",
|
"type": "user",
|
||||||
"example": "jean-baptiste"
|
"example": "johndoe"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "is_public",
|
"name": "is_public",
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Is it a public site?"
|
"en": "Are visitors who do not have a YunoHost account on this server allowed to register and create forms ?"
|
||||||
},
|
},
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": "0"
|
"default": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
18
pull_request_template.md
Normal file
18
pull_request_template.md
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
## Problem
|
||||||
|
- *Description of why you made this PR*
|
||||||
|
|
||||||
|
## Solution
|
||||||
|
- *And how do you fix that problem*
|
||||||
|
|
||||||
|
## PR Status
|
||||||
|
- [ ] Code finished.
|
||||||
|
- [ ] Tested with Package_check.
|
||||||
|
- [ ] Fix or enhancement tested.
|
||||||
|
- [ ] Upgrade from last version tested.
|
||||||
|
- [ ] Can be reviewed and tested.
|
||||||
|
|
||||||
|
## Package_check results
|
||||||
|
---
|
||||||
|
*If you have access to [App Continuous Integration for packagers](https://yunohost.org/#/packaging_apps_ci) you can provide a link to the package_check results like below, replacing '-NUM-' in this link by the PR number and USERNAME by your username on the ci-apps-dev. Or you provide a screenshot or a pastebin of the results*
|
||||||
|
|
||||||
|
[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/framaforms_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/framaforms_ynh%20PR-NUM-%20(USERNAME)/)
|
|
@ -1,282 +1,44 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# LOCAL ADDITION:
|
|
||||||
# save file locally if not in the cache
|
|
||||||
#
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
|
||||||
#
|
|
||||||
# The file conf/app.src need to contains:
|
|
||||||
#
|
|
||||||
# SOURCE_URL=Address to download the app archive
|
|
||||||
# SOURCE_SUM=Control sum
|
|
||||||
# # (Optional) Program to check the integrity (sha256sum, md5sum...)
|
|
||||||
# # default: sha256
|
|
||||||
# SOURCE_SUM_PRG=sha256
|
|
||||||
# # (Optional) Archive format
|
|
||||||
# # default: tar.gz
|
|
||||||
# SOURCE_FORMAT=tar.gz
|
|
||||||
# # (Optional) Put false if sources are directly in the archive root
|
|
||||||
# # default: true
|
|
||||||
# SOURCE_IN_SUBDIR=false
|
|
||||||
# # (Optionnal) Name of the local archive (offline setup support)
|
|
||||||
# # default: ${src_id}.${src_format}
|
|
||||||
# SOURCE_FILENAME=example.tar.gz
|
|
||||||
#
|
|
||||||
# Details:
|
|
||||||
# This helper downloads sources from SOURCE_URL if there is no local source
|
|
||||||
# archive in /opt/yunohost-apps-src/APP_ID/SOURCE_FILENAME
|
|
||||||
#
|
|
||||||
# Next, it checks the integrity with "SOURCE_SUM_PRG -c --status" command.
|
|
||||||
#
|
|
||||||
# If it's ok, the source archive will be uncompressed in $dest_dir. If the
|
|
||||||
# SOURCE_IN_SUBDIR is true, the first level directory of the archive will be
|
|
||||||
# removed.
|
|
||||||
#
|
|
||||||
# Finally, patches named sources/patches/${src_id}-*.patch and extra files in
|
|
||||||
# sources/extra_files/$src_id will be applied to dest_dir
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# usage: ynh_setup_source dest_dir [source_id]
|
|
||||||
# | arg: dest_dir - Directory where to setup sources
|
|
||||||
# | arg: source_id - Name of the app, if the package contains more than one app
|
|
||||||
ynh_setup_source_local () {
|
|
||||||
local dest_dir=$1
|
|
||||||
local src_id=${2:-app} # If the argument is not given, source_id equals "app"
|
|
||||||
|
|
||||||
# Load value from configuration file (see above for a small doc about this file
|
|
||||||
# format)
|
|
||||||
local src_url=$(grep 'SOURCE_URL=' "$YNH_CWD/../conf/${src_id}.src" | cut -d= -f2-)
|
|
||||||
local src_sum=$(grep 'SOURCE_SUM=' "$YNH_CWD/../conf/${src_id}.src" | cut -d= -f2-)
|
|
||||||
local src_sumprg=$(grep 'SOURCE_SUM_PRG=' "$YNH_CWD/../conf/${src_id}.src" | cut -d= -f2-)
|
|
||||||
local src_format=$(grep 'SOURCE_FORMAT=' "$YNH_CWD/../conf/${src_id}.src" | cut -d= -f2-)
|
|
||||||
local src_in_subdir=$(grep 'SOURCE_IN_SUBDIR=' "$YNH_CWD/../conf/${src_id}.src" | cut -d= -f2-)
|
|
||||||
local src_filename=$(grep 'SOURCE_FILENAME=' "$YNH_CWD/../conf/${src_id}.src" | cut -d= -f2-)
|
|
||||||
|
|
||||||
# Default value
|
|
||||||
src_sumprg=${src_sumprg:-sha256sum}
|
|
||||||
src_in_subdir=${src_in_subdir:-true}
|
|
||||||
src_format=${src_format:-tar.gz}
|
|
||||||
src_format=$(echo "$src_format" | tr '[:upper:]' '[:lower:]')
|
|
||||||
if [ "$src_filename" = "" ] ; then
|
|
||||||
src_filename="${src_id}.${src_format}"
|
|
||||||
fi
|
|
||||||
local local_src="/var/cache/yunohost/ynh_setup_source/${YNH_APP_ID}/${src_filename}"
|
|
||||||
|
|
||||||
# if cache file exists and the checksum isn't good, download it again
|
|
||||||
# if not, just download the file
|
|
||||||
|
|
||||||
if test -e "$local_src"
|
|
||||||
then
|
|
||||||
echo "${src_sum} ${local_src}" | ${src_sumprg} -c --status \
|
|
||||||
|| wget -nv -O $local_src $src_url
|
|
||||||
else
|
|
||||||
mkdir -p "/var/cache/yunohost/ynh_setup_source/${YNH_APP_ID}"
|
|
||||||
wget -nv -O $local_src $src_url
|
|
||||||
fi
|
|
||||||
cp $local_src $src_filename
|
|
||||||
|
|
||||||
# Check the control sum
|
|
||||||
echo "${src_sum} ${src_filename}" | ${src_sumprg} -c --status \
|
|
||||||
|| ynh_die "Corrupt source"
|
|
||||||
|
|
||||||
# Extract source into the app dir
|
|
||||||
mkdir -p "$dest_dir"
|
|
||||||
if [ "$src_format" = "zip" ]
|
|
||||||
then
|
|
||||||
# Zip format
|
|
||||||
# Using of a temp directory, because unzip doesn't manage --strip-components
|
|
||||||
if $src_in_subdir ; then
|
|
||||||
local tmp_dir=$(mktemp -d)
|
|
||||||
unzip -quo $src_filename -d "$tmp_dir"
|
|
||||||
cp -a $tmp_dir/*/. "$dest_dir"
|
|
||||||
ynh_secure_remove "$tmp_dir"
|
|
||||||
else
|
|
||||||
unzip -quo $src_filename -d "$dest_dir"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
local strip=""
|
|
||||||
if $src_in_subdir ; then
|
|
||||||
strip="--strip-components 1"
|
|
||||||
fi
|
|
||||||
if [[ "$src_format" =~ ^tar.gz|tar.bz2|tar.xz$ ]] ; then
|
|
||||||
tar -xf $src_filename -C "$dest_dir" $strip
|
|
||||||
else
|
|
||||||
ynh_die "Archive format unrecognized."
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Apply patches
|
|
||||||
if (( $(find $YNH_CWD/../sources/patches/ -type f -name "${src_id}-*.patch" 2> /dev/null | wc -l) > "0" )); then
|
|
||||||
local old_dir=$(pwd)
|
|
||||||
(cd "$dest_dir" \
|
|
||||||
&& for p in $YNH_CWD/../sources/patches/${src_id}-*.patch; do \
|
|
||||||
patch -p1 < $p; done) \
|
|
||||||
|| ynh_die "Unable to apply patches"
|
|
||||||
cd $old_dir
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Add supplementary files
|
|
||||||
if test -e "$YNH_CWD/../sources/extra_files/${src_id}"; then
|
|
||||||
cp -a $YNH_CWD/../sources/extra_files/$src_id/. "$dest_dir"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
#
|
# COMMON VARIABLES
|
||||||
# POSTGRES HELPERS
|
|
||||||
#
|
|
||||||
# Point of contact : Jean-Baptiste Holcroft <jean-baptiste@holcroft.fr>
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Create a master password and set up global settings
|
# dependencies used by the app
|
||||||
# Please always call this script in install and restore scripts
|
pkg_dependencies="postgresql php-pgsql php-mbstring"
|
||||||
#
|
|
||||||
# usage: ynh_psql_test_if_first_run
|
|
||||||
|
|
||||||
ynh_psql_test_if_first_run() {
|
#=================================================
|
||||||
if [ -f /etc/yunohost/psql ];
|
# PERSONAL HELPERS
|
||||||
then
|
#=================================================
|
||||||
echo "PostgreSQL is already installed, no need to create master password"
|
|
||||||
else
|
|
||||||
pgsql=$(ynh_string_random)
|
|
||||||
pg_hba=""
|
|
||||||
echo "$pgsql" >> /etc/yunohost/psql
|
|
||||||
|
|
||||||
if [ -e /etc/postgresql/9.4/ ]
|
#=================================================
|
||||||
then
|
# EXPERIMENTAL HELPERS
|
||||||
pg_hba=/etc/postgresql/9.4/main/pg_hba.conf
|
#=================================================
|
||||||
elif [ -e /etc/postgresql/9.6/ ]
|
|
||||||
then
|
|
||||||
pg_hba=/etc/postgresql/9.6/main/pg_hba.conf
|
|
||||||
else
|
|
||||||
ynh_die "postgresql shoud be 9.4 or 9.6"
|
|
||||||
fi
|
|
||||||
|
|
||||||
systemctl start postgresql
|
ynh_export () {
|
||||||
sudo --login --user=postgres psql -c"ALTER user postgres WITH PASSWORD '$pgsql'" postgres
|
local ynh_arg=""
|
||||||
|
for var in $@;
|
||||||
# force all user to connect to local database using passwords
|
do
|
||||||
# https://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html#EXAMPLE-PG-HBA.CONF
|
ynh_arg=$(echo $var | awk '{print toupper($0)}')
|
||||||
# Note: we can't use peer since YunoHost create users with nologin
|
if [ "$var" == "path_url" ]; then
|
||||||
# See: https://github.com/YunoHost/yunohost/blob/unstable/data/helpers.d/user
|
ynh_arg="PATH"
|
||||||
sed -i '/local\s*all\s*all\s*peer/i \
|
fi
|
||||||
local all all password' "$pg_hba"
|
ynh_arg="YNH_APP_ARG_$ynh_arg"
|
||||||
systemctl enable postgresql
|
export $var=${!ynh_arg}
|
||||||
systemctl reload postgresql
|
done
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Open a connection as a user
|
# Save listed var in YunoHost app settings
|
||||||
#
|
# usage: ynh_save_args VARNAME1 [VARNAME2 [...]]
|
||||||
# example: ynh_psql_connect_as 'user' 'pass' <<< "UPDATE ...;"
|
ynh_save_args () {
|
||||||
# example: ynh_psql_connect_as 'user' 'pass' < /path/to/file.sql
|
local var
|
||||||
#
|
for var in $@;
|
||||||
# usage: ynh_psql_connect_as user pwd [db]
|
do
|
||||||
# | arg: user - the user name to connect as
|
local setting_var="$var"
|
||||||
# | arg: pwd - the user password
|
if [ "$var" == "path_url" ]; then
|
||||||
# | arg: db - the database to connect to
|
setting_var="path"
|
||||||
ynh_psql_connect_as() {
|
fi
|
||||||
user="$1"
|
ynh_app_setting_set --app=$app --key=$setting_var --value="${!var}"
|
||||||
pwd="$2"
|
done
|
||||||
db="$3"
|
|
||||||
sudo --login --user=postgres PGUSER="$user" PGPASSWORD="$pwd" psql "$db"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# # Execute a command as root user
|
|
||||||
#
|
|
||||||
# usage: ynh_psql_execute_as_root sql [db]
|
|
||||||
# | arg: sql - the SQL command to execute
|
|
||||||
# | arg: db - the database to connect to
|
|
||||||
ynh_psql_execute_as_root () {
|
|
||||||
sql="$1"
|
|
||||||
sudo --login --user=postgres psql <<< "$sql"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Execute a command from a file as root user
|
|
||||||
#
|
|
||||||
# usage: ynh_psql_execute_file_as_root file [db]
|
|
||||||
# | arg: file - the file containing SQL commands
|
|
||||||
# | arg: db - the database to connect to
|
|
||||||
ynh_psql_execute_file_as_root() {
|
|
||||||
file="$1"
|
|
||||||
db="$2"
|
|
||||||
sudo --login --user=postgres psql "$db" < "$file"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Create a database, an user and its password. Then store the password in the app's config
|
|
||||||
#
|
|
||||||
# After executing this helper, the password of the created database will be available in $db_pwd
|
|
||||||
# It will also be stored as "psqlpwd" into the app settings.
|
|
||||||
#
|
|
||||||
# usage: ynh_psql_setup_db user name [pwd]
|
|
||||||
# | arg: user - Owner of the database
|
|
||||||
# | arg: name - Name of the database
|
|
||||||
# | arg: pwd - Password of the database. If not given, a password will be generated
|
|
||||||
ynh_psql_setup_db () {
|
|
||||||
db_user="$1"
|
|
||||||
app="$1"
|
|
||||||
db_name="$2"
|
|
||||||
new_db_pwd=$(ynh_string_random) # Generate a random password
|
|
||||||
# If $3 is not given, use new_db_pwd instead for db_pwd.
|
|
||||||
db_pwd="${3:-$new_db_pwd}"
|
|
||||||
ynh_psql_create_db "$db_name" "$db_user" "$db_pwd" # Create the database
|
|
||||||
ynh_app_setting_set "$app" psqlpwd "$db_pwd" # Store the password in the app's config
|
|
||||||
}
|
|
||||||
|
|
||||||
# Create a database and grant privilegies to a user
|
|
||||||
#
|
|
||||||
# usage: ynh_psql_create_db db [user [pwd]]
|
|
||||||
# | arg: db - the database name to create
|
|
||||||
# | arg: user - the user to grant privilegies
|
|
||||||
# | arg: pwd - the user password
|
|
||||||
ynh_psql_create_db() {
|
|
||||||
db="$1"
|
|
||||||
user="$2"
|
|
||||||
pwd="$3"
|
|
||||||
ynh_psql_create_user "$user" "$pwd"
|
|
||||||
sudo --login --user=postgres createdb --owner="$user" "$db"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Drop a database
|
|
||||||
#
|
|
||||||
# usage: ynh_psql_drop_db db
|
|
||||||
# | arg: db - the database name to drop
|
|
||||||
# | arg: user - the user to drop
|
|
||||||
ynh_psql_remove_db() {
|
|
||||||
db="$1"
|
|
||||||
user="$2"
|
|
||||||
sudo --login --user=postgres dropdb "$db"
|
|
||||||
ynh_psql_drop_user "$user"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Dump a database
|
|
||||||
#
|
|
||||||
# example: ynh_psql_dump_db 'roundcube' > ./dump.sql
|
|
||||||
#
|
|
||||||
# usage: ynh_psql_dump_db db
|
|
||||||
# | arg: db - the database name to dump
|
|
||||||
# | ret: the psqldump output
|
|
||||||
ynh_psql_dump_db() {
|
|
||||||
db="$1"
|
|
||||||
sudo --login --user=postgres pg_dump "$db"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Create a user
|
|
||||||
#
|
|
||||||
# usage: ynh_psql_create_user user pwd [host]
|
|
||||||
# | arg: user - the user name to create
|
|
||||||
ynh_psql_create_user() {
|
|
||||||
user="$1"
|
|
||||||
pwd="$2"
|
|
||||||
sudo --login --user=postgres psql -c"CREATE USER $user WITH PASSWORD '$pwd'" postgres
|
|
||||||
}
|
|
||||||
|
|
||||||
# Drop a user
|
|
||||||
#
|
|
||||||
# usage: ynh_psql_drop_user user
|
|
||||||
# | arg: user - the user name to drop
|
|
||||||
ynh_psql_drop_user() {
|
|
||||||
user="$1"
|
|
||||||
sudo --login --user=postgres dropuser "$user"
|
|
||||||
}
|
|
||||||
|
|
|
@ -6,12 +6,8 @@
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
if [ ! -e _common.sh ]; then
|
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||||
# Get the _common.sh file if it's not in the current directory
|
source ../settings/scripts/_common.sh
|
||||||
cp ../settings/scripts/_common.sh ./_common.sh
|
|
||||||
chmod a+rx _common.sh
|
|
||||||
fi
|
|
||||||
source _common.sh
|
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -24,35 +20,50 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Loading installation settings..." --time --weight=1
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
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)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD BACKUP STEPS
|
# STANDARD BACKUP STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE APP MAIN DIR
|
# BACKUP THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Backing up the main app directory..." --time --weight=1
|
||||||
|
|
||||||
ynh_backup "$final_path"
|
ynh_backup --src_path="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# BACKUP THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Backing up nginx web server configuration..." --time --weight=1
|
||||||
|
|
||||||
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE PHP-FPM CONFIGURATION
|
# BACKUP THE PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Backing up php-fpm configuration..." --time --weight=1
|
||||||
|
|
||||||
ynh_backup "/etc/php5/fpm/pool.d/$app.conf"
|
ynh_backup --src_path="/etc/php/7.0/fpm/pool.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE MYSQL DATABASE
|
# BACKUP THE MYSQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Backing up the PostgreSQL database..." --time --weight=1
|
||||||
|
|
||||||
ynh_psql_dump_db "$db_name" > db.sql
|
ynh_psql_dump_db --database="$db_name" > db.sql
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC BACKUP
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --time --last
|
||||||
|
|
102
scripts/change_url
Normal file
102
scripts/change_url
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC STARTING
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
source _common.sh
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RETRIEVE ARGUMENTS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
old_domain=$YNH_APP_OLD_DOMAIN
|
||||||
|
old_path=$YNH_APP_OLD_PATH
|
||||||
|
|
||||||
|
new_domain=$YNH_APP_NEW_DOMAIN
|
||||||
|
new_path=$YNH_APP_NEW_PATH
|
||||||
|
|
||||||
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# LOAD SETTINGS
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Loading installation settings..." --time --weight=1
|
||||||
|
|
||||||
|
# Needed for helper "ynh_add_nginx_config"
|
||||||
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
|
||||||
|
# Add settings here as needed by your application
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CHECK WHICH PARTS SHOULD BE CHANGED
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
change_domain=0
|
||||||
|
if [ "$old_domain" != "$new_domain" ]
|
||||||
|
then
|
||||||
|
change_domain=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
change_path=0
|
||||||
|
if [ "$old_path" != "$new_path" ]
|
||||||
|
then
|
||||||
|
change_path=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# STANDARD MODIFICATIONS
|
||||||
|
#=================================================
|
||||||
|
# MODIFY URL IN NGINX CONF
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Updating nginx web server configuration..." --time --weight=1
|
||||||
|
|
||||||
|
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||||
|
|
||||||
|
# Change the path in the nginx config file
|
||||||
|
if [ $change_path -eq 1 ]
|
||||||
|
then
|
||||||
|
# Make a backup of the original nginx config file if modified
|
||||||
|
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
|
||||||
|
# Set global variables for nginx helper
|
||||||
|
domain="$old_domain"
|
||||||
|
path_url="$new_path"
|
||||||
|
# Create a dedicated nginx config
|
||||||
|
ynh_add_nginx_config
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Change the domain for nginx
|
||||||
|
if [ $change_domain -eq 1 ]
|
||||||
|
then
|
||||||
|
# Delete file checksum for the old conf file location
|
||||||
|
ynh_delete_file_checksum --file="$nginx_conf_path"
|
||||||
|
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
||||||
|
# Store file checksum for the new config file location
|
||||||
|
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC MODIFICATIONS
|
||||||
|
#=================================================
|
||||||
|
# ...
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC FINALISATION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# 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="Change of URL completed for $app" --time --last
|
149
scripts/install
149
scripts/install
|
@ -20,10 +20,7 @@ ynh_abort_if_errors
|
||||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
ynh_export domain path admin is_public
|
||||||
path_url=$YNH_APP_ARG_PATH
|
|
||||||
admin=$YNH_APP_ARG_ADMIN
|
|
||||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
|
||||||
|
|
||||||
# This is a multi-instance app, meaning it can be installed several times independently
|
# This is a multi-instance app, meaning it can be installed several times independently
|
||||||
# The id of the app as stated in the manifest is available as $YNH_APP_ID
|
# The id of the app as stated in the manifest is available as $YNH_APP_ID
|
||||||
|
@ -40,26 +37,30 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
### About --weight and --time
|
||||||
|
### ynh_script_progression will show to your final users the progression of each scripts.
|
||||||
|
### In order to do that, --weight will represent the relative time of execution compared to the other steps in the script.
|
||||||
|
### --time is a packager option, it will show you the execution time since the previous call.
|
||||||
|
### This option should be removed before releasing your app.
|
||||||
|
### Use the execution time, given by --time, to estimate the weight of a step.
|
||||||
|
### A common way to do it is to set a weight equal to the execution time in second +1.
|
||||||
|
### The execution time is given for the duration since the previous call. So the weight should be applied to this previous call.
|
||||||
|
ynh_script_progression --message="Validating installation parameters..." --time --weight=1
|
||||||
|
|
||||||
|
### If the app uses nginx as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app".
|
||||||
|
### If the app provides an internal web server (or uses another application server such as uwsgi), the final path should be "/opt/yunohost/$app"
|
||||||
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"
|
||||||
|
|
||||||
# Normalize the url path syntax
|
|
||||||
path_url=$(ynh_normalize_url_path $path_url)
|
|
||||||
|
|
||||||
# Check web path availability
|
|
||||||
ynh_webpath_available $domain $path_url
|
|
||||||
# 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_app_setting_set $app domain $domain
|
ynh_save_args domain path admin is_public final_path
|
||||||
ynh_app_setting_set $app path $path_url
|
|
||||||
ynh_app_setting_set $app admin $admin
|
|
||||||
ynh_app_setting_set $app is_public $is_public
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
|
@ -67,100 +68,112 @@ ynh_app_setting_set $app is_public $is_public
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_install_app_dependencies postgresql php-pgsql
|
ynh_script_progression --message="Installing dependencies..." --time --weight=1
|
||||||
|
|
||||||
|
### `ynh_install_app_dependencies` allows you to add any "apt" dependencies to the package.
|
||||||
|
### Those deb packages will be installed as dependencies of this package.
|
||||||
|
### If you're not using this helper:
|
||||||
|
### - Remove the section "REMOVE DEPENDENCIES" in the remove script
|
||||||
|
### - Remove the variable "pkg_dependencies" in _common.sh
|
||||||
|
### - As well as the section "REINSTALL DEPENDENCIES" in the restore script
|
||||||
|
### - And the section "UPGRADE DEPENDENCIES" in the upgrade script
|
||||||
|
|
||||||
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE A PostgreSQL DATABASE
|
# CREATE A PostgreSQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Creating a PostgreSQL database..." --time --weight=1
|
||||||
|
|
||||||
ynh_psql_test_if_first_run
|
ynh_psql_test_if_first_run
|
||||||
|
|
||||||
db_user=$(ynh_sanitize_dbid "$app")
|
db_name=$(ynh_sanitize_dbid --dbname="$app")
|
||||||
db_name=$(ynh_sanitize_dbid "$app")
|
db_user=$db_name
|
||||||
db_pwd=$(ynh_string_random)
|
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||||
ynh_app_setting_set $app db_pwd $db_pwd
|
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name
|
||||||
ynh_psql_setup_db "$db_user" "$db_name" "$db_pwd"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Setting up source files..." --time --weight=1
|
||||||
|
|
||||||
|
### `ynh_setup_source` is used to install an app from a zip or tar.gz file,
|
||||||
|
### downloaded from an upstream source, like a git repository.
|
||||||
|
### `ynh_setup_source` use the file conf/app.src
|
||||||
|
|
||||||
ynh_app_setting_set $app final_path $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_local "$final_path" "drupal"
|
ynh_setup_source --dest_dir="$final_path"
|
||||||
ynh_setup_source_local "$final_path" "framaforms"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configuring nginx web server..." --time --weight=1
|
||||||
|
|
||||||
|
### `ynh_add_nginx_config` will use the file conf/nginx.conf
|
||||||
|
|
||||||
if [ "$path_url" != "/" ]
|
|
||||||
then
|
|
||||||
ynh_replace_string "^#sub_path_only" "" "../conf/nginx.conf"
|
|
||||||
fi
|
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated nginx config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configuring system user..." --time --weight=1
|
||||||
|
|
||||||
# Create a system user
|
# Create a system user
|
||||||
ynh_system_user_create "$app"
|
ynh_system_user_create --username=$app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PHP-FPM CONFIGURATION
|
# PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configuring php-fpm..." --time --weight=1
|
||||||
|
|
||||||
|
### `ynh_add_fpm_config` is used to set up a PHP config.
|
||||||
|
### You can remove it if your app doesn't use PHP.
|
||||||
|
### `ynh_add_fpm_config` will use the files conf/php-fpm.conf
|
||||||
|
### If you're not using these lines:
|
||||||
|
### - You can remove these files in conf/.
|
||||||
|
### - Remove the section "BACKUP THE PHP-FPM CONFIGURATION" in the backup script
|
||||||
|
### - Remove also the section "REMOVE PHP-FPM CONFIGURATION" in the remove script
|
||||||
|
### - As well as the section "RESTORE THE PHP-FPM CONFIGURATION" in the restore script
|
||||||
|
### With the reload at the end of the script.
|
||||||
|
### - And the section "PHP-FPM CONFIGURATION" in the upgrade script
|
||||||
|
|
||||||
# Create a dedicated php-fpm config
|
# Create a dedicated php-fpm config
|
||||||
ynh_add_fpm_config
|
ynh_add_fpm_config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PHP-FPM CONFIGURATION
|
# SPECIFIC SETUP
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# chown -R $app: $final_path
|
|
||||||
# init_composer "$app" "$final_path"
|
|
||||||
|
|
||||||
# (
|
|
||||||
# cd "$final_path"
|
|
||||||
|
|
||||||
# su $app <<INSTALLDRUSH
|
|
||||||
# export PATH="$final_path/.composer/vendor/bin:$PATH"
|
|
||||||
# php composer.phar global require drush/drush
|
|
||||||
# php composer.phar global update
|
|
||||||
# INSTALLDRUSH
|
|
||||||
|
|
||||||
# su $app <<INSTALLDRUPAL
|
|
||||||
# export PATH="$final_path/.composer/vendor/bin:$PATH"
|
|
||||||
# drush si standard --db-url=mysql://$db_user:$db_pwd@localhost/$db_name
|
|
||||||
|
|
||||||
# drush dl webform
|
|
||||||
# drush en -y webform
|
|
||||||
|
|
||||||
# drush dl form_builder
|
|
||||||
# drush en -y form_builder
|
|
||||||
# INSTALLDRUPAL
|
|
||||||
# )
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# Database initialization
|
# Database initialization
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Initializing PostgreSQL database..." --time --weight=1
|
||||||
|
|
||||||
ynh_replace_string "betaforms" "$db_user" "$final_path/framaforms.sql"
|
ynh_replace_string "betaforms" "$db_user" "$final_path/framaforms.sql"
|
||||||
|
|
||||||
ynh_psql_execute_file_as_root "$final_path/framaforms.sql" "$db_name"
|
ynh_psql_execute_file_as_root "$final_path/framaforms.sql" "$db_name"
|
||||||
|
#=================================================
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# configuration file
|
# MODIFY CONFIG FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
config_file=$final_path/sites/default/settings.php
|
config_file=$final_path/sites/default/settings.php
|
||||||
|
|
||||||
cp ../conf/default.settings.php "$config_file"
|
cp ../conf/default.settings.php "$config_file"
|
||||||
ynh_replace_string "__DB_NAME__" "$db_name" "$config_file"
|
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$config_file"
|
||||||
ynh_replace_string "__DB_USER__" "$db_user" "$config_file"
|
ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$config_file"
|
||||||
ynh_replace_string "__DB_PWD__" "$db_pwd" "$config_file"
|
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$config_file"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# STORE THE CONFIG FILE CHECKSUM
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
### `ynh_store_file_checksum` is used to store the checksum of a file.
|
||||||
|
### That way, during the upgrade script, by using `ynh_backup_if_checksum_is_different`,
|
||||||
|
### you can make a backup of this file before modifying it again if the admin had modified it.
|
||||||
|
|
||||||
|
# Calculate and store the config file checksum into the app settings
|
||||||
|
ynh_store_file_checksum --file="$config_file"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
|
@ -174,20 +187,24 @@ chown -R $app: $final_path
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configuring SSOwat..." --time --weight=1
|
||||||
|
|
||||||
if [ $is_public -eq 0 ]
|
|
||||||
then # Remove the public access
|
|
||||||
ynh_app_setting_delete $app skipped_uris
|
|
||||||
fi
|
|
||||||
# Make app public if necessary
|
# Make app public if necessary
|
||||||
if [ $is_public -eq 1 ]
|
if [ $is_public -eq 1 ]
|
||||||
then
|
then
|
||||||
# unprotected_uris allows SSO credentials to be passed anyway.
|
# unprotected_uris allows SSO credentials to be passed anyway.
|
||||||
ynh_app_setting_set $app unprotected_uris "/"
|
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Reloading nginx web server..." --time --weight=1
|
||||||
|
|
||||||
systemctl reload nginx
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_script_progression --message="Installation of $app completed" --time --last
|
||||||
|
|
|
@ -12,41 +12,45 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Loading installation settings..." --time --weight=1
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
port=$(ynh_app_setting_get $app port)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
db_name=$(ynh_sanitize_dbid "$app")
|
|
||||||
db_user=$db_name
|
db_user=$db_name
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD REMOVE
|
# STANDARD REMOVE
|
||||||
|
#=================================================
|
||||||
|
# REMOVE THE PostgresSQL DATABASE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing the database..." --time --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 DEPENDENCIES
|
# REMOVE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing dependencies..." --time --weight=1
|
||||||
|
|
||||||
# Remove metapackage and its dependencies
|
# Remove metapackage and its dependencies
|
||||||
ynh_remove_app_dependencies
|
ynh_remove_app_dependencies
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE THE MYSQL DATABASE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Remove a database if it exists, along with the associated user
|
|
||||||
ynh_psql_remove_db "$db_user" "$db_name"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE APP MAIN DIR
|
# REMOVE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing app main directory..." --time --weight=1
|
||||||
|
|
||||||
# Remove the app directory securely
|
# Remove the app directory securely
|
||||||
ynh_secure_remove "$final_path"
|
ynh_secure_remove --file="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE NGINX CONFIGURATION
|
# REMOVE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing nginx web server configuration..." --time --weight=1
|
||||||
|
|
||||||
# Remove the dedicated nginx config
|
# Remove the dedicated nginx config
|
||||||
ynh_remove_nginx_config
|
ynh_remove_nginx_config
|
||||||
|
@ -54,6 +58,7 @@ ynh_remove_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE PHP-FPM CONFIGURATION
|
# REMOVE PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing php-fpm configuration..." --time --weight=1
|
||||||
|
|
||||||
# Remove the dedicated php-fpm config
|
# Remove the dedicated php-fpm config
|
||||||
ynh_remove_fpm_config
|
ynh_remove_fpm_config
|
||||||
|
@ -62,12 +67,18 @@ ynh_remove_fpm_config
|
||||||
# SPECIFIC REMOVE
|
# SPECIFIC REMOVE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEDICATED USER
|
# REMOVE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing the dedicated system user..." --time --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" --time --last
|
||||||
|
|
|
@ -6,12 +6,8 @@
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
if [ ! -e _common.sh ]; then
|
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||||
# Get the _common.sh file if it's not in the current directory
|
source ../settings/scripts/_common.sh
|
||||||
cp ../settings/scripts/_common.sh ./_common.sh
|
|
||||||
chmod a+rx _common.sh
|
|
||||||
fi
|
|
||||||
source _common.sh
|
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -24,83 +20,73 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Loading settings..." --time --weight=1
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
path_url=$(ynh_app_setting_get $app path)
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
db_name=$(ynh_app_setting_get $app db_name)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
|
db_user=$db_name
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Validating restoration parameters..." --time --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 RESTORATION STEPS
|
# STANDARD RESTORATION STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE NGINX CONFIGURATION
|
ynh_script_progression --message="Restoring all files..." --time --weight=1
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_restore
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTORE THE APP MAIN DIR
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_restore_file "$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTORE THE MYSQL DATABASE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
db_user=$(ynh_sanitize_dbid "$app")
|
|
||||||
db_name=$db_user
|
|
||||||
db_pwd=$(ynh_app_setting_get $app db_pwd)
|
|
||||||
ynh_psql_test_if_first_run
|
|
||||||
ynh_psql_setup_db "$db_user" "$db_name" "$db_pwd"
|
|
||||||
ynh_psql_execute_file_as_root ./db.sql "$db_name"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RECREATE THE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Create the dedicated user (if not existing)
|
|
||||||
ynh_system_user_create "$app"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE USER RIGHTS
|
# RESTORE USER RIGHTS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Restore permissions on app files
|
# Restore permissions on app files
|
||||||
chown -R $app: $final_path
|
chown -R root: $final_path
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTORE THE PHP-FPM CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_restore_file "/etc/php5/fpm/pool.d/$app.conf"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC RESTORATION
|
# SPECIFIC RESTORATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# REINSTALL DEPENDENCIES
|
# REINSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Reinstalling dependencies..." --time --weight=1
|
||||||
|
|
||||||
# Define and install dependencies
|
# Define and install dependencies
|
||||||
ynh_install_app_dependencies postgresql
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE THE DATABASE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restoring the database..." --time --weight=1
|
||||||
|
|
||||||
|
ynh_psql_test_if_first_run
|
||||||
|
|
||||||
|
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||||
|
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||||
|
ynh_psql_execute_file_as_root ./db.sql "$db_name"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX AND PHP-FPM
|
# RELOAD NGINX AND PHP-FPM
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Reloading nginx web server and php-fpm..." --time --weight=1
|
||||||
|
|
||||||
systemctl reload php5-fpm
|
ynh_systemd_action --service_name=php7.0-fpm --action=reload
|
||||||
systemctl reload nginx
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_script_progression --message="Restoration completed for $app" --time --last
|
||||||
|
|
107
scripts/upgrade
107
scripts/upgrade
|
@ -12,44 +12,59 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Loading installation settings..." --time --weight=1
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
path_url=$(ynh_app_setting_get $app path)
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
admin=$(ynh_app_setting_get $app admin)
|
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||||
is_public=$(ynh_app_setting_get $app is_public)
|
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
db_name=$(ynh_app_setting_get $app db_name)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CHECK VERSION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
### This helper will compare the version of the currently installed app and the version of the upstream package.
|
||||||
|
### $upgrade_type can have 2 different values
|
||||||
|
### - UPGRADE_APP if the upstream app version has changed
|
||||||
|
### - UPGRADE_PACKAGE if only the YunoHost package has changed
|
||||||
|
### ynh_check_app_version_changed will stop the upgrade if the app is up to date.
|
||||||
|
### UPGRADE_APP should be used to upgrade the core app only if there's an upgrade to do.
|
||||||
|
upgrade_type=$(ynh_check_app_version_changed)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Ensuring downward compatibility..." --time --weight=1
|
||||||
|
|
||||||
# Fix is_public as a boolean value
|
# Fix is_public as a boolean value
|
||||||
if [ "$is_public" = "Yes" ]; then
|
if [ "$is_public" = "Yes" ]; then
|
||||||
ynh_app_setting_set $app is_public 1
|
ynh_app_setting_set --app=$app --key=is_public --value=1
|
||||||
is_public=1
|
is_public=1
|
||||||
elif [ "$is_public" = "No" ]; then
|
elif [ "$is_public" = "No" ]; then
|
||||||
ynh_app_setting_set $app is_public 0
|
ynh_app_setting_set --app=$app --key=is_public --value=0
|
||||||
is_public=0
|
is_public=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If db_name doesn't exist, create it
|
# If db_name doesn't exist, create it
|
||||||
if [ -z $db_name ]; then
|
if [ -z "$db_name" ]; then
|
||||||
db_name=$(ynh_sanitize_dbid $app)
|
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||||
ynh_app_setting_set $app db_name $db_name
|
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If final_path doesn't exist, create it
|
# If final_path doesn't exist, create it
|
||||||
if [ -z $final_path ]; then
|
if [ -z "$final_path" ]; then
|
||||||
final_path=/var/www/$app
|
final_path=/var/www/$app
|
||||||
ynh_app_setting_set $app final_path $final_path
|
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --time --weight=1
|
||||||
|
|
||||||
# Backup the current version of the app
|
# Backup the current version of the app
|
||||||
ynh_backup_before_upgrade
|
ynh_backup_before_upgrade
|
||||||
|
@ -65,7 +80,12 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Normalize the URL path syntax
|
# Normalize the URL path syntax
|
||||||
path_url=$(ynh_normalize_url_path $path_url)
|
# N.B. : this is for app installations before YunoHost 2.7
|
||||||
|
# where this value might be something like /foo/ or foo/
|
||||||
|
# instead of /foo ....
|
||||||
|
# If nobody installed your app before 2.7, then you may
|
||||||
|
# safely remove this line
|
||||||
|
path_url=$(ynh_normalize_url_path --path_url=$path_url)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD UPGRADE STEPS
|
# STANDARD UPGRADE STEPS
|
||||||
|
@ -73,31 +93,41 @@ path_url=$(ynh_normalize_url_path $path_url)
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
ynh_setup_source_local "$final_path" "drupal"
|
then
|
||||||
ynh_setup_source_local "$final_path" "framaforms"
|
ynh_script_progression --message="Upgrading source files..." --time --weight=1
|
||||||
|
|
||||||
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
|
ynh_setup_source --dest_dir="$final_path"
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrading nginx web server configuration..." --time --weight=1
|
||||||
|
|
||||||
if [ "$path_url" != "/" ]
|
|
||||||
then
|
|
||||||
ynh_replace_string "^#sub_path_only" "" "../conf/nginx.conf"
|
|
||||||
fi
|
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated nginx config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# UPGRADE DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrading dependencies..." --time --weight=1
|
||||||
|
|
||||||
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Making sure dedicated system user exists..." --time --weight=1
|
||||||
|
|
||||||
# Create a system user
|
# Create a dedicated user (if not existing)
|
||||||
ynh_system_user_create "$app"
|
ynh_system_user_create --username=$app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PHP-FPM CONFIGURATION
|
# PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrading php-fpm configuration..." --time --weight=1
|
||||||
|
|
||||||
# Create a dedicated php-fpm config
|
# Create a dedicated php-fpm config
|
||||||
ynh_add_fpm_config
|
ynh_add_fpm_config
|
||||||
|
@ -105,36 +135,49 @@ ynh_add_fpm_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC UPGRADE
|
# SPECIFIC UPGRADE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
# ...
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# STORE THE CONFIG FILE CHECKSUM
|
||||||
|
#=================================================
|
||||||
|
config_file=$final_path/sites/default/settings.php
|
||||||
|
|
||||||
|
### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
|
||||||
|
### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it.
|
||||||
|
ynh_backup_if_checksum_is_different --file="$config_file"
|
||||||
|
# Recalculate and store the checksum of the file for the next upgrade.
|
||||||
|
ynh_store_file_checksum --file="$config_file"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
|
||||||
# SECURE FILES AND DIRECTORIES
|
# SECURE FILES AND DIRECTORIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Set right permissions for curl installation
|
# Set permissions on app files
|
||||||
chown -R $app: $final_path
|
chown -R root: $final_path
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrading SSOwat configuration..." --time --weight=1
|
||||||
|
|
||||||
if [ $is_public -eq 0 ]
|
|
||||||
then # Remove the public access
|
|
||||||
ynh_app_setting_delete $app skipped_uris
|
|
||||||
fi
|
|
||||||
# Make app public if necessary
|
# Make app public if necessary
|
||||||
if [ $is_public -eq 1 ]
|
if [ $is_public -eq 1 ]
|
||||||
then
|
then
|
||||||
# unprotected_uris allows SSO credentials to be passed anyway
|
# unprotected_uris allows SSO credentials to be passed anyway
|
||||||
ynh_app_setting_set $app unprotected_uris "/"
|
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Reloading nginx web server..." --time --weight=1
|
||||||
|
|
||||||
systemctl reload nginx
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_script_progression --message="Upgrade of $app completed" --time --last
|
||||||
|
|
Loading…
Reference in a new issue