1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/friendica_ynh.git synced 2024-09-03 18:36:14 +02:00

Merge pull request #27 from YunoHost-Apps/testing

Updated to version 2020.03
This commit is contained in:
anmol26s 2020-04-24 01:51:03 +05:30 committed by GitHub
commit 7c4c2d32e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 361 additions and 246 deletions

View file

@ -1,17 +1,20 @@
# Friendica social network for YunoHost # Friendica social network for YunoHost
[![Integration level](https://dash.yunohost.org/integration/friendica.svg)](https://ci-apps.yunohost.org/jenkins/job/friendica%20%28Community%29/lastBuild/consoleFull)
[![Integration level](https://dash.yunohost.org/integration/friendica.svg)](https://dash.yunohost.org/appci/app/friendica)
[![Install Friendica with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=friendica) [![Install Friendica with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=friendica)
> *This package allow you to install Friendica 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.*
[Friendica](http://friendi.ca/) integration for YunoHost<br> [Friendica](http://friendi.ca/) integration for YunoHost<br>
**Version:2019.01**<br><br> **Version:2020.03**<br><br>
Current snapshot in *sources*: Current snapshot in *sources*:
* https://github.com/friendica/friendica: 2019.01 * https://github.com/friendica/friendica: 2020.03
* https://github.com/friendica/friendica-addons: 2019.01 * https://github.com/friendica/friendica-addons: 2020.03
## Important Notes ## Important Notes
@ -19,7 +22,10 @@ Before installing, read the [Friendica installation instructions](https://github
- SSL certificate validation requirement (now with support for [Let's Encrypt!](https://letsencrypt.org)). See Installation section below. - SSL certificate validation requirement (now with support for [Let's Encrypt!](https://letsencrypt.org)). See Installation section below.
- Dedicated domain (must install under web root like **https://hub.example.com/** not **https://example.com/hub/** ) - Dedicated domain (must install under web root like **https://hub.example.com/** not **https://example.com/hub/** )
<b>Note:</b>You can use accounts from YunoHost's LDAP. There are not yet active SSO.<br><br> #### Multi-users support
LDAP auth supported. There are not yet active SSO.
<br><br>
# To-do # To-do
- [ ] Fail2Ban support - [ ] Fail2Ban support
@ -30,9 +36,6 @@ Before installing, read the [Friendica installation instructions](https://github
### Register a new domain and add it to YunoHost ### Register a new domain and add it to YunoHost
Friendica requires a dedicated domain, so obtain one and add it using the YunoHost admin panel. **Domains -> Add domain**. As Friendica uses the full domain and is installed on the root, you can create a subdomain such as friendica.domain.tld. Don't forget to update your DNS if you manage them manually. Friendica requires a dedicated domain, so obtain one and add it using the YunoHost admin panel. **Domains -> Add domain**. As Friendica uses the full domain and is installed on the root, you can create a subdomain such as friendica.domain.tld. Don't forget to update your DNS if you manage them manually.
Friendica requires browser-approved SSL certificates. If you have certificates not issued by [Let's Encrypt](https://letsencrypt.org/), install them manually as usual.
### Install the Friendica application ### Install the Friendica application
Use the YunoHost admin panel to install Friendica by entering the GitHub repo address in the custom app URL Use the YunoHost admin panel to install Friendica by entering the GitHub repo address in the custom app URL
@ -42,3 +45,17 @@ Make sure to select your domain from the previous section as the application dom
After the installation,login with the username provided at the time of the installaion with your SSO password.You can then create your profile and access the admin panel from the button in the center of the top nav bar, just adjecent to the search bar.<b>(The admin panel don't have text,so don't get confuse with it) </b> After the installation,login with the username provided at the time of the installaion with your SSO password.You can then create your profile and access the admin panel from the button in the center of the top nav bar, just adjecent to the search bar.<b>(The admin panel don't have text,so don't get confuse with it) </b>
Public users can register and use the instance as normal users. SSO users can login with there username and password as normal users too. Public users can register and use the instance as normal users. SSO users can login with there username and password as normal users too.
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/friendica_ynh/tree/testing).
To try the testing branch, please proceed like that.
```
sudo yunohost app install https://github.com/YunoHost-Apps/friendica_ynh/tree/testing --debug
or
sudo yunohost app upgrade REPLACEBYYOURAPP -u https://github.com/YunoHost-Apps/friendica_ynh/tree/testing --debug
```

View file

@ -10,25 +10,17 @@
setup_private=0 setup_private=0
setup_public=1 setup_public=1
upgrade=1 upgrade=1
upgrade=1 from_commit=1c018b9ed379e25d5bcab4bd27e9833feee9da68 upgrade=1 from_commit=3396188976f75170f2217fcc0e6c9b5f61f7b9e9
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
incorrect_path=1 # This test is no longer necessary since the version 2.7 (PR: https://github.com/YunoHost/yunohost/pull/304), you can still do it if your app could be installed with this version.
# incorrect_path=1
port_already_use=0 port_already_use=0
change_url=0 change_url=0
;;; Levels ;;; Levels
Level 1=auto # If the level 5 (Package linter) is forced to 1. Please add justifications here.
Level 2=auto Level 5=auto
Level 3=auto
# There is LDAP support for the app
Level 4=1
Level 5=auto
Level 6=auto
Level 7=auto
Level 8=0
Level 9=0
Level 10=0
;;; Options ;;; Options
Email=anmol@datamol.org Email=anmol@datamol.org
Notification=change Notification=change

View file

@ -1,6 +1,6 @@
SOURCE_URL=https://github.com/friendica/friendica-addons/archive/2019.01.zip SOURCE_URL=https://github.com/friendica/friendica-addons/archive/2020.03.tar.gz
SOURCE_SUM=23edfeddf58de1f605f8cb71603fbb31f415641b76f09a102e4bdb2ec78d508d SOURCE_SUM=937aa87bbe8a40ef78348387969e77ac0422d2ce8bd00579aaf4ce45ea1362da
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true
SOURCE_FILENAME= SOURCE_FILENAME=

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://friendi.ca/wp-content/uploads/2019/02/friendica-full-2019.01.tar.gz SOURCE_URL=https://friendi.ca/wp-content/uploads/2020/03/friendica-full-2020.03.tar.gz
SOURCE_SUM=895025c0adf042b6139ed3e7c4674a49d3a0237ce3490a367be681e6310c92a3 SOURCE_SUM=dbfb001a90533e57fc453ff8d8d5c017236251aef78e5feb9902744d8b8dc1bd
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true

View file

@ -71,7 +71,7 @@ location __PATH__ {
location ~* \.php$ { location ~* \.php$ {
fastcgi_split_path_info ^(.+?\.php)(/.*)$; fastcgi_split_path_info ^(.+?\.php)(/.*)$;
try_files $uri =404; try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm-__NAME__.sock; fastcgi_pass unix:/var/run/php/php7.0-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;

View file

@ -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,28 +25,35 @@ 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
; BSD-derived systems allow connections regardless of permissions. ; BSD-derived systems allow connections regardless of permissions.
; Default Values: user and group are set as the running user ; Default Values: user and group are set as the running user
; mode is set to 0660 ; mode is set to 0660
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:
@ -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'
@ -117,12 +131,12 @@ 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.
; 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:
@ -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 = 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
; 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
@ -347,16 +365,25 @@ 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.
; 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

View file

@ -8,13 +8,13 @@
}, },
"url": "http://friendi.ca", "url": "http://friendi.ca",
"license": "free", "license": "free",
"version": "2019.01", "version": "2020.03-ynh2",
"maintainer": { "maintainer": {
"name": "Anmol Sharma", "name": "Anmol Sharma",
"email": "anmol@datamol.org" "email": "anmol@datamol.org"
}, },
"requirements": { "requirements": {
"yunohost": ">= 2.7.2" "yunohost": ">= 3.5"
}, },
"previous_maintainers": { "previous_maintainers": {
"name": "aymhce", "name": "aymhce",

18
pull_request_template.md Normal file
View 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/REPLACEBYYOURAPP_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/REPLACEBYYOURAPP_ynh%20PR-NUM-%20(USERNAME)/)

View file

@ -1,17 +1,11 @@
#!/bin/bash #!/bin/bash
# ============= FUTURE YUNOHOST HELPER ============= #=================================================
# Delete a file checksum from the app settings # COMMON VARIABLES
# #=================================================
# $app should be defined when calling this helper
# # dependencies used by the app
# usage: ynh_remove_file_checksum file pkg_dependencies="php-mbstring php-cli php-imagick php-gd php-xml"
# | arg: file - The file for which the checksum will be deleted
ynh_delete_file_checksum () {
local checksum_setting_name=checksum_${1//[\/ ]/_} # Replace all '/' and ' ' by '_'
ynh_app_setting_delete $app $checksum_setting_name
}
# ============================================================================= # =============================================================================
# COMMON ROUNDCUBE FUNCTIONS # COMMON ROUNDCUBE FUNCTIONS

View file

@ -24,48 +24,51 @@ ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_print_info "Loading installation 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)
db_pwd=$(ynh_app_setting_get $app mysqlpwd) db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
#================================================= #=================================================
# STANDARD BACKUP STEPS # STANDARD BACKUP STEPS
#================================================= #=================================================
#=================================================
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_print_info "Backing up the main app directory..." 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_print_info "Backing up nginx web server 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_print_info "Backing up 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_print_info "Backing up the MySQL database..." ynh_script_progression --message="Backing up the MySQL database..." --time --weight=1
ynh_mysql_dump_db "$db_name" > db.sql
ynh_mysql_dump_db --database="$db_name" > db.sql
# Backup cron job # Backup cron job
ynh_backup "/etc/cron.d/$app" ynh_backup --src_path="/etc/cron.d/$app"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_print_info "Backup script completed for $app. (YunoHost will now copy those files to the archive)." ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --time --last

View file

@ -28,61 +28,76 @@ 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
admin_mail=$(sudo yunohost user info $admin | grep "mail:" | cut -d' ' -f2) admin_mail=$(yunohost user info $admin | grep "mail:" | cut -d' ' -f2)
is_public=1 is_public=1
database="1" database="1"
# This is a multi-instance app, meaning it can be installed several times independently ### If it's 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
# The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...) ### The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...)
# The app instance name is available as $YNH_APP_INSTANCE_NAME ### The app instance name is available as $YNH_APP_INSTANCE_NAME
# - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample ### - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample
# - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2 ### - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2
# - ynhexample__{N} for the subsequent installations, with N=3,4, ... ### - ynhexample__{N} for the subsequent installations, with N=3,4, ...
# The app instance name is probably what you are interested the most, since this is ### The app instance name is probably what interests you most, since this is
# guaranteed to be unique. This is a good unique identifier to define installation path, ### guaranteed to be unique. This is a good unique identifier to define installation path,
# db names, ... ### db names, ...
app=$YNH_APP_INSTANCE_NAME 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
#================================================= #=================================================
ynh_print_info "Validating installation parameters..." ### About --weight and --time
### ynh_script_progression will show to your final users the progression of each scripts.
# Normalize the url path syntax ### In order to do that, --weight will represent the relative time of execution compared to the other steps in the script.
path_url=$(ynh_normalize_url_path $path_url) ### --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.
# Register (book) web path ### Use the execution time, given by --time, to estimate the weight of a step.
ynh_webpath_register $app $domain $path_url ### 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 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" ### 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"
# Register (book) web path
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#================================================= #=================================================
# STORE SETTINGS FROM MANIFEST # STORE SETTINGS FROM MANIFEST
#================================================= #=================================================
ynh_print_info "Storing installation settings..." ynh_script_progression --message="Storing installation settings..." --time --weight=1
ynh_app_setting_set $app domain $domain ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set $app path $path_url ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set $app admin $admin ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_set $app is_public $is_public ynh_app_setting_set --app=$app --key=is_public --value=$is_public
ynh_app_setting_set $app email $admin_mail ynh_app_setting_set --app=$app --key=email --value=$admin_mail
ynh_app_setting_set $app database $database ynh_app_setting_set --app=$app --key=database --value=$database
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
#================================================= #=================================================
ynh_print_info "Installing dependencies..." ynh_script_progression --message="Installing dependencies..." --time --weight=1
ynh_install_app_dependencies 'php-mbstring|base-files(<<9.0)' php5-cli 'php5-imagick|php-imagick' php5-gd php5-mcrypt 'php-xml|base-files(<<9.0)'
### `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 MYSQL DATABASE # CREATE A MYSQL DATABASE
#================================================= #=================================================
ynh_print_info "Creating a MySQL database..." ynh_script_progression --message="Creating a MySQL database..." --time --weight=1
### Use these lines if you need a database for the application. ### Use these lines if you need a database for the application.
### `ynh_mysql_setup_db` will create a database, an associated user and a ramdom password. ### `ynh_mysql_setup_db` will create a database, an associated user and a ramdom password.
### The password will be stored as 'mysqlpwd' into the app settings, ### The password will be stored as 'mysqlpwd' into the app settings,
@ -92,32 +107,34 @@ ynh_print_info "Creating a MySQL database..."
### - Remove also the section "REMOVE THE MYSQL DATABASE" in the remove script ### - Remove also the section "REMOVE THE MYSQL DATABASE" in the remove script
### - As well as the section "RESTORE THE MYSQL DATABASE" in the restore script ### - As well as the section "RESTORE THE MYSQL DATABASE" in the restore script
db_name=$(ynh_sanitize_dbid $app) db_name=$(ynh_sanitize_dbid --db_name=$app)
ynh_app_setting_set $app db_name $db_name db_user=$db_name
ynh_mysql_setup_db $db_name $db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_print_info "Setting up source files..." 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, ### `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. ### downloaded from an upstream source, like a git repository.
### `ynh_setup_source` use the file conf/app.src ### `ynh_setup_source` use the file conf/app.src
ynh_app_setting_set $app final_path $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 "$final_path" ynh_setup_source --dest_dir="$final_path"
cp -f "$final_path/.htaccess-dist" "$final_path/.htaccess" cp -f "$final_path/.htaccess-dist" "$final_path/.htaccess"
# 2 - Addons # 2 - Addons
sudo mkdir $final_path/addon sudo mkdir $final_path/addon
ynh_setup_source "$final_path/addon" "addons" ynh_setup_source --dest_dir="$final_path/addon" --source_id="addons"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_print_info "Configuring nginx web server..." ynh_script_progression --message="Configuring nginx web server..." --time --weight=1
### `ynh_add_nginx_config` will use the file conf/nginx.conf ### `ynh_add_nginx_config` will use the file conf/nginx.conf
@ -127,36 +144,36 @@ ynh_add_nginx_config
# configure friendica # configure friendica
sudo cp -f "/var/www/$app/config/local-sample.config.php" "/var/www/$app/config/local.config.php" sudo cp -f "/var/www/$app/config/local-sample.config.php" "/var/www/$app/config/local.config.php"
ynh_replace_string "your.mysqlhost.com" "localhost" "$final_path/config/local.config.php" ynh_replace_string --match_string="your.mysqlhost.com" --replace_string="localhost" --target_file="$final_path/config/local.config.php"
ynh_replace_string "mysqlusername" "$db_name" "$final_path/config/local.config.php" ynh_replace_string --match_string="mysqlusername" --replace_string="$db_name" --target_file="$final_path/config/local.config.php"
ynh_replace_string "mysqldatabasename" "$db_name" "$final_path/config/local.config.php" ynh_replace_string --match_string="mysqldatabasename" --replace_string="$db_name" --target_file="$final_path/config/local.config.php"
ynh_replace_string "mysqlpassword" "$db_pwd" "$final_path/config/local.config.php" ynh_replace_string --match_string="mysqlpassword" --replace_string="$db_pwd" --target_file="$final_path/config/local.config.php"
ynh_replace_string "'admin_email' => ''," "'admin_email' => '$admin_mail'," "$final_path/config/local.config.php" ynh_replace_string --match_string="'admin_email' => ''," --replace_string="'admin_email' => '$admin_mail'," --target_file="$final_path/config/local.config.php"
ynh_replace_string "REGISTER_OPEN" "REGISTER_CLOSED" "$final_path/config/local.config.php" ynh_replace_string --match_string="OPEN" --replace_string="CLOSED" --target_file="$final_path/config/local.config.php"
# init db # init db
ynh_mysql_connect_as "$db_name" "$db_pwd" "$db_name" < "$final_path/database.sql" ynh_mysql_connect_as "$db_name" "$db_pwd" "$db_name" < "$final_path/database.sql"
# addon config # addon config
sudo cp "../conf/addon.config.php" "$final_path/config/." cp "../conf/addon.config.php" "$final_path/config/."
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
ynh_print_info "Configuring system 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_print_info "Configuring php-fpm..." ynh_script_progression --message="Configuring php-fpm..." --time --weight=1
### `ynh_add_fpm_config` is used to set up a PHP config. ### `ynh_add_fpm_config` is used to set up a PHP config.
### You can remove it if your app doesn't use PHP. ### You can remove it if your app doesn't use PHP.
### `ynh_add_fpm_config` will use the files conf/php-fpm.conf and conf/php-fpm.ini ### `ynh_add_fpm_config` will use the files conf/php-fpm.conf
### If you're not using these lines: ### If you're not using these lines:
### - You can remove these files in conf/. ### - You can remove these files in conf/.
### - Remove the section "BACKUP THE PHP-FPM CONFIGURATION" in the backup script ### - Remove the section "BACKUP THE PHP-FPM CONFIGURATION" in the backup script
@ -169,15 +186,15 @@ ynh_print_info "Configuring php-fpm..."
ynh_add_fpm_config ynh_add_fpm_config
sudo chown -R www-data:www-data $final_path chown -R www-data:www-data $final_path
# 3 - some extra folders # 3 - some extra folders
sudo mkdir -p "${final_path}/view/smarty3" sudo mkdir -p "${final_path}/view/smarty3"
sudo chmod -R 775 $final_path/view/smarty3 sudo chmod -R 775 $final_path/view/smarty3
# Set up poller # Set up poller
ynh_replace_string "__YNH_WWW_PATH__" "$final_path" ../conf/poller-cron ynh_replace_string --match_string="__YNH_WWW_PATH__" --replace_string="$final_path" --target_file="../conf/poller-cron"
ynh_replace_string "__USER__" "$app" ../conf/poller-cron ynh_replace_string --match_string="__USER__" --replace_string="$app" --target_file="../conf/poller-cron"
sudo cp ../conf/poller-cron /etc/cron.d/$app cp ../conf/poller-cron /etc/cron.d/$app
#================================================= #=================================================
# STORE THE CONFIG FILE CHECKSUM # STORE THE CONFIG FILE CHECKSUM
@ -188,32 +205,31 @@ sudo cp ../conf/poller-cron /etc/cron.d/$app
### you can make a backup of this file before modifying it again if the admin had modified it. ### 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 # Calculate and store the config file checksum into the app settings
ynh_store_file_checksum "$final_path/config/local.config.php" ynh_store_file_checksum --file="$final_path/config/local.config.php"
# Run composer # Run composer
(cd $final_path && sudo php bin/composer.phar install) (cd $final_path && sudo php bin/composer.phar install)
(cd $final_path && sudo bin/console config system addon ldapauth) (cd $final_path && sudo bin/console config system addon ldapauth)
ynh_mysql_connect_as "$db_name" "$db_pwd" "$db_name" <<< "INSERT INTO addon (id, name, version, installed, hidden, timestamp, plugin_admin) VALUES (NULL, 'ldapauth', '', '1', '0', UNIX_TIMESTAMP(), '0');"
chown -R $app: $final_path chown -R $app: $final_path
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================
# 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="/"
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_print_info "Reloading nginx web server..." 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 # END OF SCRIPT
#================================================= #=================================================
ynh_print_info "Installation of $app completed" ynh_script_progression --message="Installation of $app completed" --time --last

View file

@ -12,41 +12,43 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_print_info "Loading installation 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)
db_name=$(ynh_app_setting_get $app db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# REMOVE THE MYSQL DATABASE
#=================================================
ynh_script_progression --message="Removing the MySQL database..." --time --weight=1
# Remove a database if it exists, along with the associated user
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
#================================================= #=================================================
# REMOVE DEPENDENCIES # REMOVE DEPENDENCIES
#================================================= #=================================================
ynh_print_info "Removing 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
#=================================================
ynh_print_info "Removing the MySQL database"
# Remove a database if it exists, along with the associated user
ynh_mysql_remove_db $db_name $db_name
#================================================= #=================================================
# REMOVE APP MAIN DIR # REMOVE APP MAIN DIR
#================================================= #=================================================
ynh_print_info "Removing app main directory" ynh_script_progression --message="Removing app main directory..." --time --weight=1
# Remove the app directory securely # Remove the app directory securely
ynh_secure_remove "/var/www/$app" ynh_secure_remove --file="$final_path"
#================================================= #=================================================
# REMOVE NGINX CONFIGURATION # REMOVE NGINX CONFIGURATION
#================================================= #=================================================
ynh_print_info "Removing nginx web server 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,23 +56,31 @@ ynh_remove_nginx_config
#================================================= #=================================================
# REMOVE PHP-FPM CONFIGURATION # REMOVE PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_print_info "Removing 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
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Removing logrotate configuration..." --time --weight=1
# Remove the app-specific logrotate config
ynh_remove_logrotate
# Remove a cron file # Remove a cron file
ynh_secure_remove "/etc/cron.d/$app" ynh_secure_remove --file="/etc/cron.d/$app"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================
# REMOVE DEDICATED USER # REMOVE DEDICATED USER
#================================================= #=================================================
ynh_print_info "Removing the dedicated system 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 # END OF SCRIPT

View file

@ -26,32 +26,33 @@ ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_print_info "Loading 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)
#================================================= #=================================================
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED
#================================================= #=================================================
ynh_print_info "Validating restoration parameters..." 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 # RESTORE THE NGINX CONFIGURATION
#================================================= #=================================================
ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# RESTORE THE MYSQL DATABASE # RESTORE THE MYSQL DATABASE
@ -63,7 +64,9 @@ ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_restore_file "$final_path" ynh_script_progression --message="Restoring the app main directory..." --time --weight=1
ynh_restore_file --origin_path="$final_path"
#================================================= #=================================================
# RECREATE THE DEDICATED USER # RECREATE THE DEDICATED USER
@ -84,10 +87,10 @@ ynh_restore_file "/etc/php/7.0/fpm/pool.d/$app.conf"
#================================================= #=================================================
# REINSTALL DEPENDENCIES # REINSTALL DEPENDENCIES
#================================================= #=================================================
ynh_print_info "Reinstalling dependencies..." ynh_script_progression --message="Reinstalling dependencies..." --time --weight=1
ynh_install_app_dependencies 'php-mbstring|base-files(<<9.0)' php5-cli 'php5-imagick|php-imagick' php5-gd php5-mcrypt 'php-xml|base-files(<<9.0)'
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
# set permission # set permission
chmod -R 775 $final_path/view/smarty3 chmod -R 775 $final_path/view/smarty3
@ -111,13 +114,13 @@ ynh_app_setting_set $app unprotected_uris "/"
#================================================= #=================================================
# RELOAD NGINX AND PHP-FPM # RELOAD NGINX AND PHP-FPM
#================================================= #=================================================
ynh_print_info "Reloading nginx web server and php-fpm..." ynh_script_progression --message="Reloading nginx web server and php-fpm..." --time --weight=1
systemctl reload php7.0-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 # END OF SCRIPT
#================================================= #=================================================
ynh_print_info "Restoration completed for $app" ynh_script_progression --message="Restoration completed for $app" --time --last

View file

@ -12,33 +12,45 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_print_info "Loading installation 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)
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_pwd=$(ynh_app_setting_get $app mysqlpwd) db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
admin_mail=$(ynh_app_setting_get $app email) admin_mail=$(ynh_app_setting_get --app=$app --key=email)
admin=$(ynh_app_setting_get $app admin) admin=$(ynh_app_setting_get --app=$app --key=admin)
#=================================================
# 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_print_info "Ensuring downward compatibility..." ynh_script_progression --message="Ensuring downward compatibility..." --time --weight=1
# 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
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
ynh_print_info "Backing up the app before upgrading (may take a while)..." 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
@ -49,21 +61,23 @@ ynh_clean_setup () {
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
#================================================= #=================================================
# CHECK THE PATH # CHECK THE PATH
#================================================= #=================================================
# 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/
# Add Dependencies # instead of /foo ....
ynh_install_app_dependencies 'php-mbstring|base-files(<<9.0)' php5-cli 'php5-imagick|php-imagick' php5-gd php5-mcrypt 'php-xml|base-files(<<9.0)' # 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)
# 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
# Remove files for upgrade compatibilty from previous versions of Friendica # Remove files for upgrade compatibilty from previous versions of Friendica
@ -79,66 +93,88 @@ fi
# If admin_mail setting doesn't exist, create it # If admin_mail setting doesn't exist, create it
if [ -z $admin_mail ]; then if [ -z $admin_mail ]; then
admin_mail=$(sudo yunohost user info $admin | grep "mail:" | cut -d' ' -f2) admin_mail=$(sudo yunohost user info $admin | grep "mail:" | cut -d' ' -f2)
ynh_app_setting_set $app email $admin_mail ynh_app_setting_set --app=$app --key=email --value=$admin_mail
fi fi
# Download, check integrity, uncompress and patch the source from app.src #=================================================
ynh_setup_source "$final_path" # DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
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
# Copy config file for correct place # Copy config file for correct place
cp -f "/var/www/$app/config/local-sample.config.php" "/var/www/$app/config/local.config.php" cp -f "/var/www/$app/config/local-sample.config.php" "/var/www/$app/config/local.config.php"
# Replace strings in config file # Replace strings in config file
ynh_replace_string "your.mysqlhost.com" "localhost" "$final_path/config/local.config.php" ynh_replace_string --match_string="your.mysqlhost.com" --replace_string="localhost" --target_file="$final_path/config/local.config.php"
ynh_replace_string "mysqlusername" "$db_name" "$final_path/config/local.config.php" ynh_replace_string --match_string="mysqlusername" --replace_string="$db_name" --target_file="$final_path/config/local.config.php"
ynh_replace_string "mysqldatabasename" "$db_name" "$final_path/config/local.config.php" ynh_replace_string --match_string="mysqldatabasename" --replace_string="$db_name" --target_file="$final_path/config/local.config.php"
ynh_replace_string "mysqlpassword" "$db_pwd" "$final_path/config/local.config.php" ynh_replace_string --match_string="mysqlpassword" --replace_string="$db_pwd" --target_file= "$final_path/config/local.config.php"
ynh_replace_string "'admin_email' => ''," "'admin_email' => '$admin_mail'," "$final_path/config/local.config.php" ynh_replace_string --match_string="'admin_email' => ''," --replace_string="'admin_email' => '$admin_mail'," --target_file="$final_path/config/local.config.php"
ynh_replace_string "REGISTER_OPEN" "REGISTER_CLOSED" "$final_path/config/local.config.php" ynh_replace_string --match_string="OPEN" --replace_string="CLOSED" --target_file="$final_path/config/local.config.php"
#Copy Addons #Copy Addons
rm -Rf "$final_path/addon" rm -Rf "$final_path/addon"
ynh_setup_source "$final_path/addon" "addons" ynh_setup_source --dest_dir="$final_path/addon" --source_id="addons"
# 3 - some extra folders # 3 - some extra folders
sudo chmod -R 775 $final_path/view/smarty3 chmod -R 775 $final_path/view/smarty3
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_print_info "Making sure dedicated system user exists..."
# Create a dedicated user (if not existing)
ynh_system_user_create $app
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_print_info "Upgrading nginx web server configuration..." ynh_script_progression --message="Upgrading nginx web server configuration..." --time --weight=1
# 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
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --time --weight=1
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app
#================================================= #=================================================
# PHP-FPM CONFIGURATION # PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_print_info "Upgrading 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
#=================================================
# STORE THE CONFIG FILE CHECKSUM
#=================================================
### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script. ### 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. ### 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 "$final_path/config/local.config.php" ynh_backup_if_checksum_is_different --file="$final_path/config/local.config.php"
# Recalculate and store the checksum of the file for the next upgrade. # Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum "$final_path/config/local.config.php" ynh_store_file_checksum --file="$final_path/config/local.config.php"
# Set up cron job # Set up cron job
ynh_replace_string "__YNH_WWW_PATH__" "$final_path" ../conf/poller-cron ynh_replace_string --match_string="__YNH_WWW_PATH__" --replace_string="$final_path" --target_file="../conf/poller-cron"
ynh_replace_string "__USER__" "$app" ../conf/poller-cron ynh_replace_string --match_string="__USER__" --replace_string="$app" --target_file="../conf/poller-cron"
sudo cp ../conf/poller-cron /etc/cron.d/$app cp "../conf/poller-cron" "/etc/cron.d/$app"
# Run composer # Run composer
(cd $final_path && sudo php bin/composer.phar install) (cd $final_path && sudo php bin/composer.phar install)
@ -150,21 +186,21 @@ chown -R $app: $final_path
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================
ynh_print_info "Upgrading SSOwat configuration..." ynh_script_progression --message="Upgrading SSOwat configuration..." --time --weight=1
# unprotected_uris allows SSO credentials to be passed anyway. # unprotected_uris allows SSO credentials to be passed anyway.
ynh_app_setting_set $app skipped_uris "/" ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_print_info "Reloading nginx web server..." 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 # END OF SCRIPT
#================================================= #=================================================
ynh_print_info "Upgrade of $app completed" ynh_script_progression --message="Upgrade of $app completed" --time --last