mirror of
https://github.com/YunoHost-Apps/osada_ynh.git
synced 2024-09-03 19:46:30 +02:00
Apply example_ynh
This commit is contained in:
parent
c49f7f56b4
commit
be3b03d84f
13 changed files with 404 additions and 395 deletions
|
@ -1,8 +1,8 @@
|
||||||
;; Test complet
|
;; Test complet postgresql
|
||||||
; Manifest
|
; Manifest
|
||||||
domain="domain.tld"
|
domain="domain.tld"
|
||||||
admin="john"
|
admin="john"
|
||||||
database="1"
|
database="postgresql"
|
||||||
; Checks
|
; Checks
|
||||||
pkg_linter=1
|
pkg_linter=1
|
||||||
setup_sub_dir=0
|
setup_sub_dir=0
|
||||||
|
@ -11,14 +11,49 @@
|
||||||
setup_private=0
|
setup_private=0
|
||||||
setup_public=1
|
setup_public=1
|
||||||
upgrade=1
|
upgrade=1
|
||||||
|
# 21.05.21~ynh1
|
||||||
upgrade=1 from_commit=81e4171acaa44520d0f527e6af445f4f33f2bca0
|
upgrade=1 from_commit=81e4171acaa44520d0f527e6af445f4f33f2bca0
|
||||||
|
# 21.05.21~ynh2
|
||||||
|
upgrade=1 from_commit=c49f7f56b47a6a00da257ac7e4fd066dba51dcbf
|
||||||
backup_restore=1
|
backup_restore=1
|
||||||
multi_instance=1
|
multi_instance=1
|
||||||
|
port_already_use=0
|
||||||
|
change_url=0
|
||||||
|
;;; Upgrade options
|
||||||
|
; commit=81e4171acaa44520d0f527e6af445f4f33f2bca0
|
||||||
|
name=21.05.21~ynh1
|
||||||
|
manifest_arg=domain=DOMAIN&admin=USER&database=2&
|
||||||
|
; commit=c49f7f56b47a6a00da257ac7e4fd066dba51dcbf
|
||||||
|
name=21.05.21~ynh2
|
||||||
|
manifest_arg=domain=DOMAIN&admin=USER&database=2&
|
||||||
|
;; Test complet mysql
|
||||||
|
; Manifest
|
||||||
|
domain="domain.tld"
|
||||||
|
admin="john"
|
||||||
|
database="mysql"
|
||||||
|
; Checks
|
||||||
|
pkg_linter=1
|
||||||
|
setup_sub_dir=0
|
||||||
|
setup_root=1
|
||||||
|
setup_nourl=0
|
||||||
|
setup_private=0
|
||||||
|
setup_public=1
|
||||||
|
upgrade=1
|
||||||
|
# 21.05.21~ynh1
|
||||||
|
upgrade=1 from_commit=81e4171acaa44520d0f527e6af445f4f33f2bca0
|
||||||
|
# 21.05.21~ynh2
|
||||||
|
upgrade=1 from_commit=c49f7f56b47a6a00da257ac7e4fd066dba51dcbf
|
||||||
|
backup_restore=1
|
||||||
|
multi_instance=1
|
||||||
|
port_already_use=0
|
||||||
change_url=0
|
change_url=0
|
||||||
;;; Options
|
;;; Options
|
||||||
Email=
|
Email=
|
||||||
Notification=none
|
Notification=none
|
||||||
;;; Upgrade options
|
;;; Upgrade options
|
||||||
; commit=81e4171acaa44520d0f527e6af445f4f33f2bca0
|
; commit=81e4171acaa44520d0f527e6af445f4f33f2bca0
|
||||||
name=Merge pull request #9
|
name=21.05.21~ynh1
|
||||||
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666&
|
manifest_arg=domain=DOMAIN&admin=USER&database=1&
|
||||||
|
; commit=c49f7f56b47a6a00da257ac7e4fd066dba51dcbf
|
||||||
|
name=21.05.21~ynh2
|
||||||
|
manifest_arg=domain=DOMAIN&admin=USER&database=1&
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
SOURCE_URL=https://codeberg.org/zot/osada/archive/88b1be4b340262a946b8e2548617cea3641b0a71.tar.gz
|
SOURCE_URL=https://codeberg.org/zot/osada/archive/54a7f397b4fe6a3b3731a2e37c180d9f2a789756.tar.gz
|
||||||
SOURCE_SUM=42f4c004e8d0dd78303aa0118b206be86b67ed9b6ba156c69b1e1e2d109de74b
|
SOURCE_SUM=927e13e46c32a414fd9beec1a8a1f372778b611f8382add49481bb4664db9fad
|
||||||
SOURCE_SUM_PRG=sha256sum
|
SOURCE_SUM_PRG=sha256sum
|
||||||
SOURCE_FORMAT=tar.gz
|
SOURCE_FORMAT=tar.gz
|
||||||
|
SOURCE_IN_SUBDIR=true
|
||||||
|
SOURCE_FILENAME=
|
||||||
|
SOURCE_EXTRACT=true
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
SOURCE_URL=https://codeberg.org/zot/osada-addons/archive/34788e835b87535404aee56d0aece885707565e9.tar.gz
|
SOURCE_URL=https://codeberg.org/zot/osada-addons/archive/2a39590048b3d93795918f20dc5170e9c2a4bcde.tar.gz
|
||||||
SOURCE_SUM=2b0e268472c3c3c1ce14557fa86a7abd1d533554b541a056cd960291160f1328
|
SOURCE_SUM=ba2c83145d98c2948a33eb3250bc29f3116c156f936ca56e7e3051e393804be4
|
||||||
SOURCE_SUM_PRG=sha256sum
|
SOURCE_SUM_PRG=sha256sum
|
||||||
SOURCE_FORMAT=tar.gz
|
SOURCE_FORMAT=tar.gz
|
||||||
|
SOURCE_IN_SUBDIR=true
|
||||||
|
SOURCE_FILENAME=
|
||||||
|
SOURCE_EXTRACT=true
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ $db_port = 0; // leave 0 for default or set your port
|
||||||
$db_user = '__DB_USER__';
|
$db_user = '__DB_USER__';
|
||||||
$db_pass = '__DB_PWD__';
|
$db_pass = '__DB_PWD__';
|
||||||
$db_data = '__DB_NAME__';
|
$db_data = '__DB_NAME__';
|
||||||
$db_type = 0; // use 1 for postgres, 0 for mysql
|
$db_type = __DB_TYPE__; // use 1 for postgres, 0 for mysql
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Notice: Many of the following settings will be available in the admin panel
|
* Notice: Many of the following settings will be available in the admin panel
|
||||||
|
@ -40,7 +40,7 @@ App::$config['system']['timezone'] = 'America/Los_Angeles';
|
||||||
// What is your site name? DO NOT ADD A TRAILING SLASH!
|
// What is your site name? DO NOT ADD A TRAILING SLASH!
|
||||||
|
|
||||||
App::$config['system']['baseurl'] = 'https://__DOMAIN__';
|
App::$config['system']['baseurl'] = 'https://__DOMAIN__';
|
||||||
App::$config['system']['sitename'] = "Zap";
|
App::$config['system']['sitename'] = "YunoHost Osada";
|
||||||
App::$config['system']['location_hash'] = '__RANDOM_STRING__';
|
App::$config['system']['location_hash'] = '__RANDOM_STRING__';
|
||||||
|
|
||||||
|
|
||||||
|
|
108
conf/nginx.conf
108
conf/nginx.conf
|
@ -1,78 +1,68 @@
|
||||||
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
||||||
location __PATH__/ {
|
location __PATH__/ {
|
||||||
alias __FINALPATH__/;
|
|
||||||
# Force https
|
|
||||||
if ($scheme = http)
|
|
||||||
|
|
||||||
{
|
# Path to source
|
||||||
rewrite ^ https://$server_name$request_uri? permanent;
|
alias __FINALPATH__/;
|
||||||
}
|
|
||||||
|
|
||||||
if (!-e $request_filename)
|
if (!-e $request_filename) {
|
||||||
|
rewrite ^(.*)$ /index.php?req=$1;
|
||||||
|
}
|
||||||
|
|
||||||
{
|
# Default indexes and catch-all
|
||||||
rewrite ^(.*)$ /index.php?req=$1;
|
index index.php;
|
||||||
}
|
charset utf-8;
|
||||||
|
|
||||||
client_max_body_size 20m;
|
# Common parameter to increase upload size limit in conjunction with dedicated php-fpm file
|
||||||
client_body_buffer_size 128k;
|
client_max_body_size 20m;
|
||||||
|
client_body_buffer_size 128k;
|
||||||
|
|
||||||
# Default indexes and catch-all
|
location ~* \.php$ {
|
||||||
index index.php;
|
|
||||||
charset utf-8;
|
|
||||||
|
|
||||||
|
|
||||||
# Example PHP configuration
|
|
||||||
location ~* \.php$
|
|
||||||
{
|
|
||||||
try_files $uri =404;
|
try_files $uri =404;
|
||||||
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
|
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
|
||||||
|
|
||||||
fastcgi_index index.php;
|
fastcgi_index index.php;
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
# make sure webfinger and other well known services aren't blocked
|
# make sure webfinger and other well known services aren't blocked
|
||||||
# by denying dot files and rewrite request to the front controller
|
# by denying dot files and rewrite request to the front controller
|
||||||
location ^~ /.well-known/
|
location ^~ /.well-known/ {
|
||||||
{
|
allow all;
|
||||||
allow all;
|
if (!-e $request_filename) {
|
||||||
if (!-e $request_filename)
|
rewrite ^(.*)$ /index.php?req=$1;
|
||||||
{
|
}
|
||||||
rewrite ^(.*)$ /index.php?req=$1;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# statically serve these file types when possible
|
# statically serve these file types when possible
|
||||||
# otherwise fall back to front controller
|
# otherwise fall back to front controller
|
||||||
# allow browser to cache them
|
# allow browser to cache them
|
||||||
# added .htm for advanced source code editor library
|
# added .htm for advanced source code editor library
|
||||||
# location ~* \.(jpg|jpeg|gif|png|ico|css|js|htm|html|map|ttf|woff|woff2|svg)$ {
|
# location ~* \.(jpg|jpeg|gif|png|ico|css|js|htm|html|map|ttf|woff|woff2|svg)$ {
|
||||||
# expires 30d;
|
# expires 30d;
|
||||||
# try_files $uri /index.php?q=$uri&$args;
|
# try_files $uri /index.php?q=$uri&$args;
|
||||||
# }
|
# }
|
||||||
|
|
||||||
# block these file types
|
# block these file types
|
||||||
location ~* \.(tpl|md|tgz|log|out)$
|
location ~* \.(tpl|md|tgz|log|out)$ {
|
||||||
{
|
deny all;
|
||||||
deny all;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
# deny access to all dot files
|
# deny access to all dot files
|
||||||
location ~ /\.
|
location ~ /\. {
|
||||||
{
|
deny all;
|
||||||
deny all;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#deny access to store
|
#deny access to store
|
||||||
location ~ /store
|
location ~ /store {
|
||||||
{
|
deny all;
|
||||||
deny all;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#deny access to util
|
#deny access to util
|
||||||
location ~ /util {
|
location ~ /util {
|
||||||
deny all;
|
deny all;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
# Include SSOWAT user panel.
|
||||||
|
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/php__PHPVERSION__-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
|
||||||
; List of ipv4 addresses of FastCGI clients which are allowed to connect.
|
; 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 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:
|
||||||
|
@ -117,7 +131,7 @@ pm.max_spare_servers = 3
|
||||||
; Note: Used only when pm is set to 'ondemand'
|
; Note: Used only when pm is set to 'ondemand'
|
||||||
; Default Value: 10s
|
; Default Value: 10s
|
||||||
;pm.process_idle_timeout = 10s;
|
;pm.process_idle_timeout = 10s;
|
||||||
|
|
||||||
; The number of requests each child process should execute before respawning.
|
; The number of requests each child process should execute before respawning.
|
||||||
; 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.
|
||||||
|
@ -170,7 +184,7 @@ pm.max_requests = 500
|
||||||
;
|
;
|
||||||
; By default the status page only outputs short status. Passing 'full' in the
|
; By default the status page only outputs short status. Passing 'full' in the
|
||||||
; query string will also return status for each pool process.
|
; query string will also return status for each pool process.
|
||||||
; Example:
|
; Example:
|
||||||
; http://www.foo.bar/status?full
|
; http://www.foo.bar/status?full
|
||||||
; http://www.foo.bar/status?json&full
|
; http://www.foo.bar/status?json&full
|
||||||
; http://www.foo.bar/status?html&full
|
; http://www.foo.bar/status?html&full
|
||||||
|
@ -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
|
||||||
|
@ -283,7 +297,7 @@ pm.max_requests = 500
|
||||||
; - ....
|
; - ....
|
||||||
; %p: PID of the child that serviced the request
|
; %p: PID of the child that serviced the request
|
||||||
; %P: PID of the parent of the child that serviced the request
|
; %P: PID of the parent of the child that serviced the request
|
||||||
; %q: the query string
|
; %q: the query string
|
||||||
; %Q: the '?' character if query string exists
|
; %Q: the '?' character if query string exists
|
||||||
; %r: the request URI (without the query string, see %q and %Q)
|
; %r: the request URI (without the query string, see %q and %Q)
|
||||||
; %R: remote IP address
|
; %R: remote IP address
|
||||||
|
@ -291,47 +305,51 @@ 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"
|
||||||
;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%"
|
;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%"
|
||||||
|
|
||||||
; 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 = /var/log/nginx/__NAMETOCHANGE__.slow.log
|
||||||
|
|
||||||
; 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 = 5s
|
||||||
|
|
||||||
; 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
|
||||||
; does not stop script execution for some reason. A value of '0' means 'off'.
|
; does not stop script execution for some reason. A value of '0' 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_terminate_timeout = 1d
|
request_terminate_timeout = 1d
|
||||||
|
|
||||||
; Set open file descriptor rlimit.
|
; Set open file descriptor rlimit.
|
||||||
; Default Value: system defined value
|
; Default Value: system defined value
|
||||||
;rlimit_files = 1024
|
;rlimit_files = 1024
|
||||||
|
|
||||||
; Set max core size rlimit.
|
; Set max core size rlimit.
|
||||||
; Possible Values: 'unlimited' or an integer greater or equal to 0
|
; Possible Values: 'unlimited' or an integer greater or equal to 0
|
||||||
; Default Value: system defined value
|
; Default Value: system defined value
|
||||||
;rlimit_core = 0
|
;rlimit_core = 0
|
||||||
|
|
||||||
; Chroot to this directory at the start. This value must be defined as an
|
; Chroot to this directory at the start. This value must be defined as an
|
||||||
; absolute path. When this value is not set, chroot is not used.
|
; absolute path. When this value is not set, chroot is not used.
|
||||||
; Note: you can prefix with '$prefix' to chroot to the pool prefix or one
|
; Note: you can prefix with '$prefix' to chroot to the pool prefix or one
|
||||||
; of its subdirectories. If the pool prefix is not set, the global prefix
|
; of its subdirectories. If the pool prefix is not set, the global prefix
|
||||||
; will be used instead.
|
; will be used instead.
|
||||||
; Note: chrooting is a great security feature and should be used whenever
|
; Note: chrooting is a great security feature and should be used whenever
|
||||||
; possible. However, all PHP paths will be relative to the chroot
|
; possible. However, all PHP paths will be relative to the chroot
|
||||||
; (error_log, sessions.save_path, ...).
|
; (error_log, sessions.save_path, ...).
|
||||||
; Default Value: not set
|
; Default Value: not set
|
||||||
|
@ -349,14 +367,23 @@ chdir = __FINALPATH__
|
||||||
; 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.
|
||||||
; Default Value: clean env
|
; Default Value: clean env
|
||||||
|
@ -370,7 +397,7 @@ catch_workers_output = yes
|
||||||
; overwrite the values previously defined in the php.ini. The directives are the
|
; overwrite the values previously defined in the php.ini. The directives are the
|
||||||
; same as the PHP SAPI:
|
; same as the PHP SAPI:
|
||||||
; php_value/php_flag - you can set classic ini defines which can
|
; php_value/php_flag - you can set classic ini defines which can
|
||||||
; be overwritten from PHP call 'ini_set'.
|
; be overwritten from PHP call 'ini_set'.
|
||||||
; php_admin_value/php_admin_flag - these directives won't be overwritten by
|
; php_admin_value/php_admin_flag - these directives won't be overwritten by
|
||||||
; PHP call 'ini_set'
|
; PHP call 'ini_set'
|
||||||
; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no.
|
; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no.
|
||||||
|
@ -392,13 +419,12 @@ catch_workers_output = yes
|
||||||
;php_admin_value[memory_limit] = 32M
|
;php_admin_value[memory_limit] = 32M
|
||||||
|
|
||||||
; Common values to change to increase file upload limit
|
; Common values to change to increase file upload limit
|
||||||
; upload_max_filesize = 50M
|
; php_admin_value[upload_max_filesize] = 50M
|
||||||
; post_max_size = 50M
|
; php_admin_value[post_max_size] = 50M
|
||||||
; mail.add_x_header = Off
|
; php_admin_flag[mail.add_x_header] = Off
|
||||||
|
|
||||||
; Other common parameters
|
; Other common parameters
|
||||||
; max_execution_time = 600
|
; php_admin_value[max_execution_time] = 600
|
||||||
; max_input_time = 300
|
; php_admin_value[max_input_time] = 300
|
||||||
; memory_limit = 256M
|
; php_admin_value[memory_limit] = 256M
|
||||||
; short_open_tag = On
|
; php_admin_flag[short_open_tag] = On
|
||||||
; cgi.fix_pathinfo = 0;
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "Osada",
|
"name": "Osada",
|
||||||
"id": "osada",
|
"id": "osada",
|
||||||
"packaging_format": 1,
|
"packaging_format": 1,
|
||||||
"description": {
|
"description": {
|
||||||
"en": "Decentralized publication platform and social network",
|
"en": "Decentralized publication platform and social network",
|
||||||
"fr": "Plateforme de publication décentralisée et un réseau social"
|
"fr": "Plateforme de publication décentralisée et un réseau social"
|
||||||
},
|
},
|
||||||
"version": "21.05.21~ynh2",
|
"version": "22.06.22~ynh1",
|
||||||
"url": "http://zotlabs.com/osada/",
|
"url": "http://zotlabs.com/osada/",
|
||||||
"upstream": {
|
"upstream": {
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@ -18,18 +18,18 @@
|
||||||
"name": "Anmol Sharma",
|
"name": "Anmol Sharma",
|
||||||
"email": ""
|
"email": ""
|
||||||
},
|
},
|
||||||
|
"requirements": {
|
||||||
|
"yunohost": ">= 4.3.0"
|
||||||
|
},
|
||||||
|
"multi_instance": true,
|
||||||
"services": [
|
"services": [
|
||||||
"nginx",
|
"nginx",
|
||||||
"php7.3-fpm",
|
"php7.3-fpm",
|
||||||
"mysql",
|
"mysql",
|
||||||
"postgresql"
|
"postgresql"
|
||||||
],
|
],
|
||||||
"requirements": {
|
|
||||||
"yunohost": ">= 4.2.0"
|
|
||||||
},
|
|
||||||
"multi_instance": true,
|
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"install" : [
|
"install": [
|
||||||
{
|
{
|
||||||
"name": "domain",
|
"name": "domain",
|
||||||
"type": "domain"
|
"type": "domain"
|
||||||
|
@ -42,11 +42,11 @@
|
||||||
"name": "database",
|
"name": "database",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Choose the database to be used for the Osada [mysql:1,postgresql:2]",
|
"en": "Choose the database to be used for the Osada]",
|
||||||
"fr": "Choisissez la database de Osada [mysql:1,postgresql:2]"
|
"fr": "Choisissez la database de Osada"
|
||||||
},
|
},
|
||||||
"choices": ["1", "2"],
|
"choices": ["mysql", "postgresql"],
|
||||||
"default": "1"
|
"default": "mysql"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,10 +7,10 @@
|
||||||
# dependencies used by the app
|
# dependencies used by the app
|
||||||
YNH_PHP_VERSION="7.3"
|
YNH_PHP_VERSION="7.3"
|
||||||
|
|
||||||
extra_php_dependencies="php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-pgsql php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-gd"
|
pkg_dependencies="php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-pgsql php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-gd"
|
||||||
|
|
||||||
# dependencies used by the app
|
# dependencies used by the app
|
||||||
pkg_dependencies="postgresql postgresql-contrib"
|
pg_pkg_dependencies="postgresql postgresql-contrib"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PERSONAL HELPERS
|
# PERSONAL HELPERS
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
# 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 ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
@ -52,18 +53,6 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP LOGROTATE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/logrotate.d/$app"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP A CRON FILE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/cron.d/$app"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP FAIL2BAN CONFIGURATION
|
# BACKUP FAIL2BAN CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -72,17 +61,31 @@ ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf"
|
||||||
ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
|
ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP OF THE DATABASE
|
# SPECIFIC BACKUP
|
||||||
|
#=================================================
|
||||||
|
# BACKUP LOGROTATE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
if [ $database -eq 1 ]; then
|
ynh_backup --src_path="/etc/logrotate.d/$app"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP VARIOUS FILES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_backup --src_path="/etc/cron.d/$app"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP THE DATABASE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
if [ $database = "mysql" ]; then
|
||||||
# Backup MySQL database
|
# Backup MySQL database
|
||||||
ynh_print_info --message="Backup of the MySQL database..."
|
ynh_print_info --message="Backup of the MySQL database..."
|
||||||
ynh_mysql_dump_db --database="$db_name" > db.sql
|
ynh_mysql_dump_db --database="$db_name" > db.sql
|
||||||
elif [ $database -eq 2 ]; then
|
elif [ $database = "postgresql" ]; then
|
||||||
# Backup PostgreSQL database
|
# Backup PostgreSQL database
|
||||||
ynh_print_info --message="Backup of the PostgreSQL database..."
|
ynh_print_info --message="Backup of the PostgreSQL database..."
|
||||||
ynh_psql_dump_db --database="$db_name" > db.sql
|
ynh_psql_dump_db --database="$db_name" > db.sql
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
162
scripts/install
162
scripts/install
|
@ -23,12 +23,13 @@ ynh_abort_if_errors
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
path_url="/"
|
path_url="/"
|
||||||
admin=$YNH_APP_ARG_ADMIN
|
admin=$YNH_APP_ARG_ADMIN
|
||||||
|
database=$YNH_APP_ARG_DATABASE
|
||||||
|
|
||||||
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
email=$(ynh_user_get_info --username=$admin --key=mail)
|
email=$(ynh_user_get_info --username=$admin --key=mail)
|
||||||
upload="256M"
|
upload="256M"
|
||||||
random_string="$(ynh_string_random --length=48)"
|
random_string="$(ynh_string_random --length=48)"
|
||||||
database=`expr $YNH_APP_ARG_DATABASE`
|
|
||||||
|
|
||||||
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
|
||||||
|
@ -49,9 +50,9 @@ ynh_script_progression --message="Storing installation settings..."
|
||||||
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
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=path --value=$path_url
|
||||||
ynh_app_setting_set --app=$app --key=admin --value=$admin
|
ynh_app_setting_set --app=$app --key=admin --value=$admin
|
||||||
|
ynh_app_setting_set --app=$app --key=database --value=$database
|
||||||
ynh_app_setting_set --app=$app --key=email --value=$email
|
ynh_app_setting_set --app=$app --key=email --value=$email
|
||||||
ynh_app_setting_set --app=$app --key=upload --value=$upload
|
ynh_app_setting_set --app=$app --key=upload --value=$upload
|
||||||
ynh_app_setting_set --app=$app --key=database --value=$database
|
|
||||||
ynh_app_setting_set --app=$app --key=random_string --value=$random_string
|
ynh_app_setting_set --app=$app --key=random_string --value=$random_string
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -61,9 +62,10 @@ ynh_app_setting_set --app=$app --key=random_string --value=$random_string
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installing dependencies..."
|
ynh_script_progression --message="Installing dependencies..."
|
||||||
|
|
||||||
if [ $database -eq 2 ]; then
|
if [ $database = "postgresql" ]; then
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
pkg_dependencies="$pkg_dependencies $pg_pkg_dependencies"
|
||||||
fi
|
fi
|
||||||
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
|
@ -74,113 +76,54 @@ ynh_script_progression --message="Configuring system user..."
|
||||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# CREATE A DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# 1 - Osada
|
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||||
ynh_script_progression --message="Setting up Osada source files..."
|
db_user=$db_name
|
||||||
|
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||||
|
|
||||||
|
if [ $database = "mysql" ]; then
|
||||||
|
ynh_script_progression --message="Creating a MySQL database..."
|
||||||
|
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
|
||||||
|
db_type=0
|
||||||
|
elif [ $database = "postgresql" ]; then
|
||||||
|
# Create postgresql database
|
||||||
|
ynh_script_progression --message="Creating a postgresql database..."
|
||||||
|
ynh_psql_test_if_first_run
|
||||||
|
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name
|
||||||
|
db_type=1
|
||||||
|
else
|
||||||
|
ynh_die --message="Some problem occured in creating the database, contact maintainer"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Setting up source files..."
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
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 --dest_dir="$final_path"
|
ynh_setup_source --dest_dir="$final_path"
|
||||||
git clone https://codeberg.org/zot/osada.git "$final_path" --quiet
|
ynh_setup_source --dest_dir="$final_path/addon" --source_id="app_addons"
|
||||||
|
touch "$final_path/php.log"
|
||||||
# 2 - Osada Addons
|
mkdir -p "$final_path/store"
|
||||||
|
mkdir -p "$final_path/cache/smarty3"
|
||||||
# Make addon Directory and unpack the Osada addons to this directory
|
|
||||||
# ynh_script_progression --message="Create addon directory inside Osada root folder..."
|
|
||||||
# mkdir $final_path/addon
|
|
||||||
ynh_script_progression --message="Setting up Osada addons source files..."
|
|
||||||
|
|
||||||
# ynh_setup_source --dest_dir="$final_path/addon" --source_id="app_addons"
|
|
||||||
pushd "$final_path"
|
|
||||||
mkdir -p extend/addon/zaddons
|
|
||||||
mkdir addon
|
|
||||||
git clone https://codeberg.org/zot/osada-addons.git $final_path/extend/addon/zaddons --quiet
|
|
||||||
filelist=(`ls extend/addon/zaddons`)
|
|
||||||
cd addon
|
|
||||||
for a in "${filelist[@]}" ; do
|
|
||||||
base=`basename $a`
|
|
||||||
if [ $base = '.git' ]; then
|
|
||||||
#echo 'ignoring git'
|
|
||||||
continue;
|
|
||||||
fi
|
|
||||||
if [ ! -d ../extend/addon/zaddons/$base ]; then
|
|
||||||
#echo $a 'not a directory'
|
|
||||||
continue;
|
|
||||||
fi
|
|
||||||
if [ -x $base ]; then
|
|
||||||
#echo $base 'file exists'
|
|
||||||
continue;
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo linking $base
|
|
||||||
|
|
||||||
ln -s ../extend/addon/zaddons/$base $base
|
|
||||||
done
|
|
||||||
popd
|
|
||||||
|
|
||||||
chmod 750 "$final_path"
|
chmod 750 "$final_path"
|
||||||
chmod -R o-rwx "$final_path"
|
chmod -R o-rwx "$final_path"
|
||||||
chown -R $app:www-data "$final_path"
|
chown -R $app:www-data "$final_path"
|
||||||
|
|
||||||
# 3 - Some extra folders
|
|
||||||
ynh_script_progression --message="Creating smarty3 folder for personal data..."
|
|
||||||
|
|
||||||
mkdir -p "$final_path/store"
|
|
||||||
mkdir -p "$final_path/cache/smarty3"
|
|
||||||
chmod -R 775 $final_path/store $final_path/cache
|
chmod -R 775 $final_path/store $final_path/cache
|
||||||
|
|
||||||
# Create php.log inside Osada for logs
|
|
||||||
ynh_script_progression --message="Create php.log for the Osada debuging..."
|
|
||||||
touch "$final_path/php.log"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PHP-FPM CONFIGURATION
|
# PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring PHP-FPM..."
|
ynh_script_progression --message="Configuring PHP-FPM..."
|
||||||
|
|
||||||
# Create a dedicated PHP-FPM config
|
# Create a dedicated PHP-FPM config
|
||||||
ynh_add_fpm_config --package="$extra_php_dependencies"
|
ynh_add_fpm_config
|
||||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CREATE A DATABASE VAR
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
|
||||||
db_user=$db_name
|
|
||||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CREATE A DATABASE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
if [ $database -eq 1 ]; then
|
|
||||||
ynh_script_progression --message="Creating a MySQL database..."
|
|
||||||
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
|
|
||||||
ynh_mysql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_name" < $final_path/install/schema_mysql.sql
|
|
||||||
elif [ $database -eq 2 ]; then
|
|
||||||
# Create postgresql database
|
|
||||||
ynh_script_progression --message="Creating a postgresql database..."
|
|
||||||
ynh_replace_string --match_string="db_type = 0;" --replace_string="db_type = 1;" --target_file="$final_path/.htconfig.php"
|
|
||||||
ynh_psql_test_if_first_run
|
|
||||||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name
|
|
||||||
ynh_psql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_name" < $final_path/install/schema_postgres.sql
|
|
||||||
else
|
|
||||||
ynh_die --message="Some problem occured in creating the database, contact maintainer"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# MODIFY A CONFIG FILE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
|
||||||
|
|
||||||
ynh_add_config --template="../conf/htconfig.sample.php" --destination="$final_path/.htconfig.php"
|
|
||||||
|
|
||||||
chmod 600 "$final_path/.htconfig.php"
|
|
||||||
chown $app:$app "$final_path/.htconfig.php"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -189,15 +132,43 @@ ynh_script_progression --message="Configuring NGINX web server..."
|
||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC SETUP
|
||||||
|
#=================================================
|
||||||
|
# PROVISION DATABASE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Provisionning database..."
|
||||||
|
|
||||||
|
if [ $database = "mysql" ]; then
|
||||||
|
ynh_mysql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_name" < $final_path/install/schema_mysql.sql
|
||||||
|
elif [ $database = "postgresql" ]; then
|
||||||
|
ynh_psql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_name" < $final_path/install/schema_postgres.sql
|
||||||
|
else
|
||||||
|
ynh_die --message="Some problem occured in creating the database, contact maintainer"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# ADD A CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||||
|
|
||||||
|
ynh_add_config --template="../conf/htconfig.sample.php" --destination="$final_path/.htconfig.php"
|
||||||
|
|
||||||
|
chmod 600 "$final_path/.htconfig.php"
|
||||||
|
chown $app:$app "$final_path/.htconfig.php"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SET CRON JOB
|
# SET CRON JOB
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Setuping cron job..."
|
||||||
|
|
||||||
# Set up cron job
|
# Set up cron job
|
||||||
ynh_add_config --template="../conf/poller-cron" --destination="/etc/cron.d/$app"
|
ynh_add_config --template="../conf/poller-cron" --destination="/etc/cron.d/$app"
|
||||||
chown root: "/etc/cron.d/$app"
|
chown root: "/etc/cron.d/$app"
|
||||||
chmod 644 "/etc/cron.d/$app"
|
chmod 644 "/etc/cron.d/$app"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -209,8 +180,9 @@ ynh_use_logrotate "$final_path/php.log"
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP FAIL2BAN
|
# SETUP FAIL2BAN
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Add Fail2Ban..."
|
ynh_script_progression --message="Configuring Fail2Ban..."
|
||||||
|
|
||||||
|
# Create a dedicated Fail2Ban config
|
||||||
ynh_add_fail2ban_config --logpath="$final_path/php.log" --failregex="^.*auth\.php.*failed login attempt.*from IP <HOST>.*$" --max_retry="5"
|
ynh_add_fail2ban_config --logpath="$final_path/php.log" --failregex="^.*auth\.php.*failed login attempt.*from IP <HOST>.*$" --max_retry="5"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -18,34 +18,34 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
db_user="$db_name"
|
db_user=$db_name
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
database=$(ynh_app_setting_get --app=$app --key=database)
|
database=$(ynh_app_setting_get --app=$app --key=database)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD REMOVE
|
# STANDARD REMOVE
|
||||||
|
#=================================================
|
||||||
|
# REMOVE LOGROTATE CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing logrotate configuration..."
|
||||||
|
|
||||||
|
# Remove the app-specific logrotate config
|
||||||
|
ynh_remove_logrotate
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE THE DATABASE
|
# REMOVE THE DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
if [ $database -eq 1 ]; then
|
if [ $database = "mysql" ]; then
|
||||||
# Removing MySQL database
|
# Removing MySQL database
|
||||||
ynh_script_progression --message="Removing MySQL database..."
|
ynh_script_progression --message="Removing MySQL database..."
|
||||||
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
||||||
elif [ $database -eq 2 ]; then
|
elif [ $database = "postgresql" ]; then
|
||||||
# Removing PostgreSQL database
|
# Removing PostgreSQL database
|
||||||
ynh_script_progression --message="Removing postgresql database..."
|
ynh_script_progression --message="Removing postgresql database..."
|
||||||
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
|
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing dependencies..."
|
|
||||||
|
|
||||||
# Remove metapackage and its dependencies
|
|
||||||
ynh_remove_app_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE APP MAIN DIR
|
# REMOVE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -71,27 +71,31 @@ ynh_script_progression --message="Removing PHP-FPM configuration..."
|
||||||
ynh_remove_fpm_config
|
ynh_remove_fpm_config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE LOGROTATE CONFIGURATION
|
# REMOVE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing logrotate configuration..."
|
ynh_script_progression --message="Removing dependencies..."
|
||||||
|
|
||||||
# Remove the app-specific logrotate config
|
# Remove metapackage and its dependencies
|
||||||
ynh_remove_logrotate
|
ynh_remove_app_dependencies
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE THE CRON FILE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Remove a cron file
|
|
||||||
ynh_secure_remove --file="/etc/cron.d/$app"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE FAIL2BAN CONFIGURATION
|
# REMOVE FAIL2BAN CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing Fail2Ban configuration..."
|
ynh_script_progression --message="Removing Fail2Ban configuration..."
|
||||||
|
|
||||||
|
# Remove the dedicated Fail2Ban config
|
||||||
ynh_remove_fail2ban_config
|
ynh_remove_fail2ban_config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC REMOVE
|
||||||
|
#=================================================
|
||||||
|
# REMOVE VARIOUS FILES
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing various files..."
|
||||||
|
|
||||||
|
# Remove a cron file
|
||||||
|
ynh_secure_remove --file="/etc/cron.d/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Loading settings..."
|
ynh_script_progression --message="Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -29,9 +29,9 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
database=$(ynh_app_setting_get --app=$app --key=database)
|
|
||||||
db_user=$db_name
|
db_user=$db_name
|
||||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
|
database=$(ynh_app_setting_get --app=$app --key=database)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
|
@ -43,12 +43,6 @@ test ! -d $final_path \
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD RESTORATION STEPS
|
# STANDARD RESTORATION STEPS
|
||||||
#=================================================
|
|
||||||
# RESTORE THE NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RECREATE THE DEDICATED USER
|
# RECREATE THE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -69,16 +63,51 @@ chmod -R o-rwx "$final_path"
|
||||||
chown -R $app:www-data "$final_path"
|
chown -R $app:www-data "$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE MYSQL DATABASE
|
# RESTORE FAIL2BAN CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restoring the Fail2Ban configuration..."
|
||||||
|
|
||||||
|
ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf"
|
||||||
|
ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf"
|
||||||
|
ynh_systemd_action --action=restart --service_name=fail2ban
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC RESTORATION
|
||||||
|
#=================================================
|
||||||
|
# REINSTALL DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Reinstalling dependencies..."
|
||||||
|
|
||||||
|
if [ $database = "postgresql" ]; then
|
||||||
|
pkg_dependencies="$pkg_dependencies $pg_pkg_dependencies"
|
||||||
|
fi
|
||||||
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE THE PHP-FPM CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restoring the PHP-FPM configuration..."
|
||||||
|
|
||||||
|
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE THE NGINX CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restoring the NGINX web server configuration..."
|
||||||
|
|
||||||
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE THE DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the MySQL database..."
|
ynh_script_progression --message="Restoring the MySQL database..."
|
||||||
|
|
||||||
if [ $database -eq 1 ]; then
|
if [ $database = "mysql" ]; then
|
||||||
ynh_script_progression --message="Restoring MySQL database..."
|
ynh_script_progression --message="Restoring MySQL database..."
|
||||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||||
ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name --db_pwd=$db_pwd
|
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||||
ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ./db.sql
|
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||||
elif [ $database -eq 2 ]; then
|
elif [ $database = "postgresql" ]; then
|
||||||
# Removing postgresql database
|
# Removing postgresql database
|
||||||
ynh_script_progression --message="Reinstalling dependencies..."
|
ynh_script_progression --message="Reinstalling dependencies..."
|
||||||
# Define and install dependencies
|
# Define and install dependencies
|
||||||
|
@ -91,38 +120,19 @@ elif [ $database -eq 2 ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE PHP-FPM CONFIGURATION
|
# RESTORE VARIOUS FILES
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Restoring PHP-FPM configuration..."
|
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
|
||||||
|
|
||||||
# Recreate a dedicated php-fpm config
|
|
||||||
ynh_add_fpm_config --package="$extra_php_dependencies"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC RESTORATION
|
|
||||||
#=================================================
|
|
||||||
# RESTORE THE CRON FILE
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restoring various files..."
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/cron.d/$app"
|
ynh_restore_file --origin_path="/etc/cron.d/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE LOGROTATE CONFIGURATION
|
# RESTORE THE LOGROTATE CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restoring the logrotate configuration..."
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTORE FAIL2BAN CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Restoring the Fail2Ban configuration..."
|
|
||||||
|
|
||||||
ynh_restore_file "/etc/fail2ban/jail.d/$app.conf"
|
|
||||||
ynh_restore_file "/etc/fail2ban/filter.d/$app.conf"
|
|
||||||
ynh_systemd_action --action=restart --service_name=fail2ban
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
178
scripts/upgrade
178
scripts/upgrade
|
@ -19,12 +19,11 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
upload=$(ynh_app_setting_get --app=$app --key=upload)
|
|
||||||
last_update=$(grep update_time: /etc/yunohost/apps/$app/settings.yml | cut -c 14-)
|
|
||||||
database=$(ynh_app_setting_get --app=$app --key=database)
|
|
||||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
db_user=$db_name
|
db_user=$db_name
|
||||||
|
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
|
database=$(ynh_app_setting_get --app=$app --key=database)
|
||||||
|
upload=$(ynh_app_setting_get --app=$app --key=upload)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
|
@ -34,7 +33,7 @@ ynh_script_progression --message="Backing up the app before upgrading (may take
|
||||||
# Backup the current version of the app
|
# Backup the current version of the app
|
||||||
ynh_backup_before_upgrade
|
ynh_backup_before_upgrade
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
# restore it if the upgrade fails
|
# Restore it if the upgrade fails
|
||||||
ynh_restore_upgradebackup
|
ynh_restore_upgradebackup
|
||||||
}
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
|
@ -59,13 +58,23 @@ if [ -z "$db_name" ]; then
|
||||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ynh_legacy_permissions_exists
|
# Cleaning legacy permissions
|
||||||
then
|
if ynh_legacy_permissions_exists; then
|
||||||
ynh_legacy_permissions_delete_all
|
ynh_legacy_permissions_delete_all
|
||||||
|
|
||||||
ynh_app_setting_delete --app=$app --key=is_public
|
ynh_app_setting_delete --app=$app --key=is_public
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ $database -eq 1 ]; then
|
||||||
|
database="mysql"
|
||||||
|
ynh_app_setting_set --app=$app --key=database --value=$database
|
||||||
|
elif [ $database -eq 2 ]; then
|
||||||
|
database="postgresql"
|
||||||
|
ynh_app_setting_set --app=$app --key=database --value=$database
|
||||||
|
else
|
||||||
|
ynh_die --message="Some problem occured in creating the database, contact maintainer"
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -77,83 +86,40 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading source files..."
|
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
ynh_setup_source --dest_dir="$final_path"
|
then
|
||||||
|
ynh_script_progression --message="Upgrading source files..."
|
||||||
# cp -a "$tmpdir/store" "${final_path}"
|
|
||||||
# cp -a "$tmpdir/.htconfig.php" "${final_path}"
|
|
||||||
# cp -a "$tmpdir/php.log" "${final_path}"
|
|
||||||
# ynh_secure_remove "$tmpdir"
|
|
||||||
# chmod -R 775 $final_path/store
|
|
||||||
# mkdir $final_path/addon
|
|
||||||
# ynh_setup_source --dest_dir="$final_path/addon" --source_id="app_addons"
|
|
||||||
|
|
||||||
if [ `cd $final_path && git rev-parse --is-inside-work-tree` ]; then
|
|
||||||
pushd "$final_path"
|
|
||||||
git pull
|
|
||||||
cd extend/addon/zaddons
|
|
||||||
git pull
|
|
||||||
cd ../../..
|
|
||||||
filelist=(`ls extend/addon/zaddons`)
|
|
||||||
cd addon
|
|
||||||
for a in "${filelist[@]}" ; do
|
|
||||||
base=`basename $a`
|
|
||||||
if [ $base = '.git' ]; then
|
|
||||||
#echo 'ignoring git'
|
|
||||||
continue;
|
|
||||||
fi
|
|
||||||
if [ ! -d ../extend/addon/zaddons/$base ]; then
|
|
||||||
#echo $a 'not a directory'
|
|
||||||
continue;
|
|
||||||
fi
|
|
||||||
if [ -x $base ]; then
|
|
||||||
#echo $base 'file exists'
|
|
||||||
continue;
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo linking $base
|
|
||||||
|
|
||||||
ln -s ../extend/addon/zaddons/$base $base
|
|
||||||
done
|
|
||||||
for x in `ls` ; do
|
|
||||||
if [ -L "$x" ] && ! [ -e "$x" ]; then
|
|
||||||
echo "removing dead symlink $x" ;
|
|
||||||
rm -- "$x";
|
|
||||||
fi;
|
|
||||||
done
|
|
||||||
popd
|
|
||||||
chmod -R 775 $final_path/store
|
|
||||||
else
|
|
||||||
|
|
||||||
# Create a temporary directory
|
|
||||||
tmpdir="$(ynh_smart_mktemp 6000)"
|
|
||||||
# Backup the config file in the temp dir
|
|
||||||
cp -a "$final_path/.htconfig.php" "$tmpdir/.htconfig.php"
|
|
||||||
cp -a "$final_path/store" "$tmpdir/store"
|
|
||||||
cp -a "$final_path/php.log" "$tmpdir/php.log"
|
|
||||||
cp -a "$final_path/cache" "$tmpdir/cache"
|
|
||||||
|
|
||||||
# Remove the app directory securely
|
|
||||||
ynh_secure_remove "$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 --dest_dir="$final_path"
|
ynh_setup_source --dest_dir="$final_path" --keep="store/ .htconfig.php php.log"
|
||||||
|
|
||||||
cp -a "$tmpdir/cache" "${final_path}"
|
|
||||||
cp -a "$tmpdir/store" "${final_path}"
|
|
||||||
cp -a "$tmpdir/.htconfig.php" "${final_path}"
|
|
||||||
cp -a "$tmpdir/php.log" "${final_path}"
|
|
||||||
ynh_secure_remove --file="$tmpdir"
|
|
||||||
chmod -R 775 $final_path/store
|
|
||||||
mkdir $final_path/addon
|
|
||||||
ynh_setup_source --dest_dir="$final_path/addon" --source_id="app_addons"
|
ynh_setup_source --dest_dir="$final_path/addon" --source_id="app_addons"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
mkdir -p "$final_path/store"
|
||||||
|
mkdir -p "$final_path/cache/smarty3"
|
||||||
chmod 750 "$final_path"
|
chmod 750 "$final_path"
|
||||||
chmod -R o-rwx "$final_path"
|
chmod -R o-rwx "$final_path"
|
||||||
chown -R $app:www-data "$final_path"
|
chown -R $app:www-data "$final_path"
|
||||||
|
chmod -R 775 $final_path/store $final_path/cache
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# INSTALL DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Installing dependencies..."
|
||||||
|
|
||||||
|
if [ $database = "postgresql" ]; then
|
||||||
|
pkg_dependencies="$pkg_dependencies $pg_pkg_dependencies"
|
||||||
|
fi
|
||||||
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# PHP-FPM CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrading PHP-FPM configuration..."
|
||||||
|
|
||||||
|
# Create a dedicated PHP-FPM config
|
||||||
|
ynh_add_fpm_config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
|
@ -164,19 +130,37 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..."
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PHP-FPM CONFIGURATION
|
# SPECIFIC UPGRADE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Upgrading PHP-FPM configuration..."
|
# UPDATE A CONFIG FILE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Updating a configuration file..." --weight=1
|
||||||
|
|
||||||
# Create a dedicated php-fpm config
|
if [ $database = "mysql" ]; then
|
||||||
ynh_add_fpm_config --package="$extra_php_dependencies"
|
db_type=0
|
||||||
|
elif [ $database = "postgresql" ]; then
|
||||||
|
db_type=1
|
||||||
|
else
|
||||||
|
ynh_die --message="Some problem occured in creating the database, contact maintainer"
|
||||||
|
fi
|
||||||
|
|
||||||
### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
|
ynh_add_config --template="../conf/htconfig.sample.php" --destination="$final_path/.htconfig.php"
|
||||||
### 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="$final_path/.htconfig.php.back"
|
|
||||||
# Recalculate and store the checksum of the file for the next upgrade.
|
|
||||||
ynh_store_file_checksum --file="$final_path/.htconfig.php"
|
|
||||||
|
|
||||||
|
chmod 600 "$final_path/.htconfig.php"
|
||||||
|
chown $app:$app "$final_path/.htconfig.php"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# UPGRADE CRON JOB
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrading cron job..."
|
||||||
|
|
||||||
|
# Set up cron job
|
||||||
|
ynh_add_config --template="../conf/poller-cron" --destination="/etc/cron.d/$app"
|
||||||
|
chown root: "/etc/cron.d/$app"
|
||||||
|
chmod 644 "/etc/cron.d/$app"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -188,33 +172,11 @@ ynh_use_logrotate --non-append
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPGRADE FAIL2BAN
|
# UPGRADE FAIL2BAN
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Re-configure Fail2Ban..."
|
ynh_script_progression --message="Reconfiguring Fail2Ban..."
|
||||||
|
|
||||||
|
# Create a dedicated Fail2Ban config
|
||||||
ynh_add_fail2ban_config --logpath="$final_path/php.log" --failregex="^.*auth\.php.*failed login attempt.*from IP <HOST>.*$" --max_retry="5"
|
ynh_add_fail2ban_config --logpath="$final_path/php.log" --failregex="^.*auth\.php.*failed login attempt.*from IP <HOST>.*$" --max_retry="5"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# UPGRADE CRON JOB
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Set up cron job
|
|
||||||
ynh_add_config --template="../conf/poller-cron" --destination="/etc/cron.d/$app"
|
|
||||||
chown root: "/etc/cron.d/$app"
|
|
||||||
chmod 644 "/etc/cron.d/$app"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# UPGRADE DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Upgrading dependencies..."
|
|
||||||
|
|
||||||
if [ $database -eq 1 ]; then
|
|
||||||
# Check version and if this version was a fresh install push mysql query
|
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
|
||||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
|
||||||
|
|
||||||
elif [ $database -eq 2 ]; then
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue