mirror of
https://github.com/YunoHost-Apps/movim_ynh.git
synced 2024-09-03 19:46:19 +02:00
Merge pull request #11 from ericgaspar/enh-testing
Upgrade to v0.18rc14
This commit is contained in:
commit
351284f3f7
20 changed files with 734 additions and 332 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,2 +0,0 @@
|
|||
*~
|
||||
*.sw[op]
|
75
README.md
75
README.md
|
@ -1,45 +1,70 @@
|
|||
Movim for Yunohost.
|
||||
==========
|
||||
# Movim for YunoHost
|
||||
|
||||
[](https://dash.yunohost.org/appci/app/movim)  
|
||||
[](https://install-app.yunohost.org/?app=movim)
|
||||
|
||||
Movim is a decentralized social network, written in PHP and HTML5 and based on the XMPP standard protocol : https://movim.eu .
|
||||
*[Lire ce readme en français.](./README_fr.md)*
|
||||
|
||||
It is recommended to use a "valid" certificate to use Movim, auto-signed is sometimes problematic. You might want to take a look a StartSSL or Let's Encrypt.
|
||||
> *This package allows you to install Movim quickly and simply on a YunoHost server.
|
||||
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
|
||||
|
||||
Provided Movim version: 0.13
|
||||
## Overview
|
||||
|
||||
Please read CHANGELOG.
|
||||
[Movim](https://movim.eu) is a decentralized social network, written in PHP and HTML5 and based on the XMPP standard protocol.
|
||||
|
||||
**Installation**
|
||||
**Shipped version:** 0.18rc14
|
||||
|
||||
yunohost app install https://github.com/movim/movim_ynh
|
||||
## Screenshots
|
||||
|
||||
**Upgrade**
|
||||

|
||||
|
||||
yunohost app upgrade movim -u https://github.com/movim/movim_ynh
|
||||
## Demo
|
||||
|
||||
**Options**
|
||||
* [Official demo](https://nl.movim.eu/?login)
|
||||
|
||||
* domain : Your domain name.
|
||||
* path : Path to the Movim pod.
|
||||
* admin : Allowed acces to /?admin (pod advanced options), must exist in Yunohost.
|
||||
* password : Password to access /?admin.
|
||||
* language : Pod language.
|
||||
* enable sso : Automatic login.
|
||||
* port : Local port for Movim daemon (no firewall configuration needed).
|
||||
## Configuration
|
||||
|
||||
**Pod advanced configuration**
|
||||
* How to configure this app: From an admin panel at this address https://example.com/movim/?admin. Username and password are defined during installation.
|
||||
|
||||
https://example.com/movim/?admin
|
||||
## Documentation
|
||||
|
||||
Username and password are defined during installation.
|
||||
* Official documentation: https://github.com/movim/movim/wiki
|
||||
* YunoHost documentation: If specific documentation is needed, feel free to contribute.
|
||||
|
||||
**Remove**
|
||||
## YunoHost specific features
|
||||
|
||||
yunohost app remove movim
|
||||
#### Multi-user support
|
||||
|
||||
**Help**
|
||||
* Are LDAP and HTTP auth supported? **No**
|
||||
* Can the app be used by multiple users? **Yes**
|
||||
|
||||
Just open an issue.
|
||||
#### Supported architectures
|
||||
|
||||
* x86-64 - [](https://ci-apps.yunohost.org/ci/apps/movim/)
|
||||
* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/movim/)
|
||||
|
||||
## Limitations
|
||||
|
||||
* Any known limitations.
|
||||
|
||||
## Additional information
|
||||
|
||||
## Links
|
||||
|
||||
* Report a bug: https://github.com/YunoHost-Apps/movim_ynh/issues
|
||||
* App website: https://movim.eu/
|
||||
* Upstream app repository: https://github.com/movim/movim
|
||||
* YunoHost website: https://yunohost.org/
|
||||
|
||||
---
|
||||
|
||||
## Developer info
|
||||
|
||||
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/movim_ynh/tree/testing).
|
||||
|
||||
To try the testing branch, please proceed like that.
|
||||
```
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/movim_ynh/tree/testing --debug
|
||||
or
|
||||
sudo yunohost app upgrade movim -u https://github.com/YunoHost-Apps/movim_ynh/tree/testing --debug
|
||||
```
|
||||
|
|
70
README_fr.md
Normal file
70
README_fr.md
Normal file
|
@ -0,0 +1,70 @@
|
|||
# Movim pour YunoHost
|
||||
|
||||
[](https://dash.yunohost.org/appci/app/movim)  
|
||||
[](https://install-app.yunohost.org/?app=movim)
|
||||
|
||||
*[Read this readme in english.](./README.md)*
|
||||
|
||||
> *Ce package vous permet d'installer Movim rapidement et simplement sur un serveur YunoHost.
|
||||
Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install) pour apprendre comment l'installer.*
|
||||
|
||||
## Vue d'ensemble
|
||||
|
||||
[Movim](https://movim.eu) est un réseau social décentralisé, écrit en PHP et HTML5 et basé sur le protocole standard XMPP.
|
||||
|
||||
**Version incluse :** 0.18rc14
|
||||
|
||||
## Captures d'écran
|
||||
|
||||

|
||||
|
||||
## Démo
|
||||
|
||||
* [Démo officielle](https://nl.movim.eu/?login)
|
||||
|
||||
## Configuration
|
||||
|
||||
* Comment configurer cette application : via le panneau d'administration a cette adresse https://example.com/movim/?admin. Le nom d'utilisateur et le mot de passe sont définis lors de l'installation.
|
||||
|
||||
## Documentation
|
||||
|
||||
* Documentation officielle : https://github.com/movim/movim/wiki
|
||||
* Documentation YunoHost : Si une documentation spécifique est nécessaire, n'hésitez pas à contribuer.
|
||||
|
||||
## Caractéristiques spécifiques YunoHost
|
||||
|
||||
#### Support multi-utilisateur
|
||||
|
||||
* L'authentification LDAP et HTTP est-elle prise en charge ? **No**
|
||||
* L'application peut-elle être utilisée par plusieurs utilisateurs ? **Oui**
|
||||
|
||||
#### Architectures supportées
|
||||
|
||||
* x86-64 - [](https://ci-apps.yunohost.org/ci/apps/movim/)
|
||||
* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/movim/)
|
||||
|
||||
## Limitations
|
||||
|
||||
* Limitations connues.
|
||||
|
||||
## Informations additionnelles
|
||||
|
||||
## Liens
|
||||
|
||||
* Signaler un bug : https://github.com/YunoHost-Apps/movim_ynh/issues
|
||||
* Site de l'application : https://movim.eu/
|
||||
* Dépôt de l'application principale : https://github.com/movim/movim
|
||||
* Site web YunoHost : https://yunohost.org/
|
||||
|
||||
---
|
||||
|
||||
## Developer info
|
||||
|
||||
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/movim_ynh/tree/testing).
|
||||
|
||||
To try the testing branch, please proceed like that.
|
||||
```
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/movim_ynh/tree/testing --debug
|
||||
or
|
||||
sudo yunohost app upgrade movim -u https://github.com/YunoHost-Apps/movim_ynh/tree/testing --debug
|
||||
```
|
|
@ -6,21 +6,21 @@
|
|||
;; Test complet
|
||||
; Manifest
|
||||
domain="domain.tld" (DOMAIN)
|
||||
path="/path" (PATH)
|
||||
admin="john" (USER)
|
||||
path="/path" (PATH)
|
||||
admin="john" (USER)
|
||||
is_public=1 (PUBLIC|public=1|private=0)
|
||||
password="phrasedepasse"
|
||||
language="fr"
|
||||
ssoenabled="Yes"
|
||||
port=9537 (PORT)
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=1
|
||||
setup_root=1
|
||||
setup_nourl=0
|
||||
setup_private=0
|
||||
setup_private=1
|
||||
setup_public=1
|
||||
upgrade=1
|
||||
backup_restore=0
|
||||
backup_restore=1
|
||||
multi_instance=0
|
||||
incorrect_path=1
|
||||
port_already_use=1
|
||||
|
@ -29,9 +29,7 @@
|
|||
Level 1=auto
|
||||
Level 2=auto
|
||||
Level 3=auto
|
||||
# Level 4:
|
||||
Level 4=1
|
||||
# Level 5:
|
||||
Level 4=auto
|
||||
Level 5=auto
|
||||
Level 6=auto
|
||||
Level 7=auto
|
||||
|
@ -39,5 +37,9 @@
|
|||
Level 9=0
|
||||
Level 10=0
|
||||
;;; Options
|
||||
Email=jean-baptiste@holcroft.fr
|
||||
Notification=all
|
||||
Email=
|
||||
Notification=none
|
||||
;;; Upgrade options
|
||||
; commit=CommitHash
|
||||
name=Name and date of the commit.
|
||||
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=phrasedepasse&port=9537&
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
SOURCE_URL=https://github.com/movim/movim/archive/v0.13.tar.gz
|
||||
SOURCE_SUM=7aa5b2b6cd97e87a440981cfb6788a6f04ffd5eb4545026c49e1c61771593d11
|
||||
SOURCE_URL=https://github.com/movim/movim/archive/v0.18rc14.tar.gz
|
||||
SOURCE_SUM=5296c995ee4d70f965284487deb609ab322ac04eab826bf30f964f198f914aad
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=
|
||||
|
|
|
@ -3,15 +3,15 @@
|
|||
# You need to copy an rename this file to 'db.inc.php' and complete the values
|
||||
$conf = [
|
||||
# The type can be 'pgsql' or 'mysql'
|
||||
'type' => 'mysql',
|
||||
'type' => 'pgsql',
|
||||
# The database username
|
||||
'username' => '__DB_USER__',
|
||||
'username' => '__DB_NAME__',
|
||||
# The password
|
||||
'password' => '__DB_PWD__',
|
||||
# Where can we find the database ?
|
||||
'host' => 'localhost',
|
||||
# The port number, 3306 for MySQL and 5432 for PostGreSQL
|
||||
'port' => 3306,
|
||||
# The port number, 3306 for MySQL and 5432 for PostgreSQL
|
||||
'port' => 5432,
|
||||
# The database name
|
||||
'database' => '__DB_NAME__'
|
||||
];
|
|
@ -1,6 +1,7 @@
|
|||
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
||||
location __PATH__/ {
|
||||
alias __FINALPATH__/;
|
||||
|
||||
alias __FINALPATH__/public/;
|
||||
|
||||
if ($scheme = http) {
|
||||
rewrite ^ https://$server_name$request_uri? permanent;
|
||||
|
@ -10,12 +11,8 @@ location __PATH__/ {
|
|||
try_files $uri $uri/ /index.php;
|
||||
|
||||
location ~ [^/]\.php(/|$) {
|
||||
if ($request_uri ~ "\/movim\/\?infos") {
|
||||
return 403;
|
||||
}
|
||||
|
||||
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||
fastcgi_pass unix:/var/run/php-fpm-__NAME__.sock;
|
||||
fastcgi_pass unix:/var/run/php__PHPVERSION__-fpm-__NAME__.sock;
|
||||
fastcgi_index index.php;
|
||||
include fastcgi_params;
|
||||
fastcgi_param REMOTE_USER $remote_user;
|
||||
|
@ -24,15 +21,15 @@ location __PATH__/ {
|
|||
}
|
||||
|
||||
location ~ ^__PATH__/ws/ {
|
||||
proxy_pass http://localhost:__PORT__;
|
||||
proxy_pass http://127.0.0.1:__PORT__;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
proxy_redirect off;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
proxy_redirect off;
|
||||
|
||||
# To avoid disconnecting after 60sec :
|
||||
proxy_read_timeout 14400s;
|
||||
|
@ -42,19 +39,3 @@ location __PATH__/ {
|
|||
# Include SSOWAT user panel.
|
||||
include conf.d/yunohost_panel.conf.inc;
|
||||
}
|
||||
|
||||
location ~ /\.ht {
|
||||
deny all;
|
||||
}
|
||||
|
||||
location ^~ /movim/log/ {
|
||||
return 403;
|
||||
}
|
||||
|
||||
location ^~ /movim/config/ {
|
||||
return 403;
|
||||
}
|
||||
|
||||
location ^~ /movim/?infos {
|
||||
return 403;
|
||||
}
|
|
@ -30,7 +30,7 @@ group = __USER__
|
|||
; specific port;
|
||||
; '/path/to/unix/socket' - to listen on a unix socket.
|
||||
; Note: This value is mandatory.
|
||||
listen = /var/run/php-fpm-__NAMETOCHANGE__.sock
|
||||
listen = /var/run/php__PHPVERSION__-fpm-__NAMETOCHANGE__.sock
|
||||
|
||||
; Set listen(2) backlog. A value of '-1' means unlimited.
|
||||
; Default Value: 128 (-1 on FreeBSD and OpenBSD)
|
||||
|
@ -390,3 +390,6 @@ catch_workers_output = yes
|
|||
;php_admin_value[error_log] = /var/log/fpm-php.www.log
|
||||
;php_admin_flag[log_errors] = on
|
||||
;php_admin_value[memory_limit] = 32M
|
||||
|
||||
php_admin_value[open_basedir] = none
|
||||
php_admin_value[date.timezone] = "__TIMEZONE__"
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
open_basedir = none
|
||||
date.timezone = "YHTZ"
|
|
@ -1,15 +1,17 @@
|
|||
[Unit]
|
||||
Description=Movim daemon (__APP__)
|
||||
After=nginx.service network.target local-fs.target mysql.service
|
||||
Description=Movim: Responsive web-based XMPP client
|
||||
After=nginx.service network.target local-fs.target postgresql.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=__APP__
|
||||
Group=__APP__
|
||||
WorkingDirectory=__FINALPATH__/
|
||||
ExecStart=/usr/bin/php daemon.php start --url=https://__URL__ --port=__PORT__
|
||||
WorkingDirectory=__FINALPATH__
|
||||
ExecStart=/usr/bin/php7.3 daemon.php start --interface=127.0.0.1 --url=https://__DOMAIN____PATH__/ --port=__PORT__
|
||||
StandardOutput=syslog
|
||||
SyslogIdentifier=__APP__
|
||||
PIDFile=/run/movim.pid
|
||||
Restart=on-failure
|
||||
RestartSec=10
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
55
issue_template.md
Normal file
55
issue_template.md
Normal file
|
@ -0,0 +1,55 @@
|
|||
---
|
||||
name: Bug report
|
||||
about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently.
|
||||
|
||||
---
|
||||
|
||||
**How to post a meaningful bug report**
|
||||
1. *Read this whole template first.*
|
||||
2. *Make sure you are on the right place:*
|
||||
- *If you were performing an action on Movim from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!*
|
||||
- *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.*
|
||||
- *In doubt, ask here and we will figure it out together.*
|
||||
3. *Delete these italic comments as you write over them below, and remove this guide.*
|
||||
---
|
||||
|
||||
### Describe the bug
|
||||
|
||||
*A clear and concise description of what the bug is.*
|
||||
|
||||
### Context
|
||||
|
||||
- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...*
|
||||
- YunoHost version: x.x.x
|
||||
- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...*
|
||||
- Are you in a special context or did you perform some particular tweaking on your YunoHost instance ?: *no / yes*
|
||||
- If yes, please explain:
|
||||
- Using, or trying to install package version/branch:
|
||||
- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`*
|
||||
|
||||
### Steps to reproduce
|
||||
|
||||
- *If you performed a command from the CLI, the command itself is enough. For example:*
|
||||
```sh
|
||||
sudo yunohost app install movim
|
||||
```
|
||||
- *If you used the webadmin, please perform the equivalent command from the CLI first.*
|
||||
- *If the error occurs in your browser, explain what you did:*
|
||||
1. *Go to '...'*
|
||||
2. *Click on '...'*
|
||||
3. *Scroll down to '...'*
|
||||
4. *See error*
|
||||
|
||||
### Expected behavior
|
||||
|
||||
*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.*
|
||||
|
||||
### Logs
|
||||
|
||||
*When an operation fails, YunoHost provides a simple way to share the logs.*
|
||||
- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.*
|
||||
- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.*
|
||||
|
||||
*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)*
|
||||
|
||||
*If applicable and useful, add screenshots to help explain your problem.*
|
|
@ -3,34 +3,34 @@
|
|||
"id": "movim",
|
||||
"packaging_format": 1,
|
||||
"description": {
|
||||
"en": "The Kickass Social Network"
|
||||
"en": "Web-based cross-platform XMPP client",
|
||||
"fr": "Client XMPP multiplateforme basé sur le Web"
|
||||
},
|
||||
"version": "0.13.0~ynh1",
|
||||
"requirements": {
|
||||
"yunohost": ">= 3.0"
|
||||
},
|
||||
"url": "https://movim.eu/",
|
||||
"version": "0.18rc14~ynh1",
|
||||
"url": "https://movim.eu",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"maintainer": {
|
||||
"name": "src386",
|
||||
"email": "soyouz@src386.org",
|
||||
"url": "http://github.com/src386"
|
||||
"name": "",
|
||||
"email": ""
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 3.8.1"
|
||||
},
|
||||
"multi_instance": false,
|
||||
"services": [
|
||||
"nginx",
|
||||
"php5-fpm",
|
||||
"mysql",
|
||||
"php7.0-fpm",
|
||||
"postgresql",
|
||||
"metronome"
|
||||
],
|
||||
"multi_instance": false,
|
||||
"arguments": {
|
||||
"install" : [
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "domain",
|
||||
"ask": {
|
||||
"en": "Domain of the pod",
|
||||
"fr": "Domaine du pod"
|
||||
"en": "Choose a domain name for Movim",
|
||||
"fr": "Choisissez un nom de domaine pour Movim"
|
||||
},
|
||||
"example": "domain.org"
|
||||
},
|
||||
|
@ -38,8 +38,8 @@
|
|||
"name": "path",
|
||||
"type": "path",
|
||||
"ask": {
|
||||
"en": "Path to the pod",
|
||||
"fr": "Chemin vers le pod"
|
||||
"en": "Choose a path for Movim",
|
||||
"fr": "Choisissez un chemin pour Movim"
|
||||
},
|
||||
"example": "/movim",
|
||||
"default": "/movim"
|
||||
|
@ -48,37 +48,28 @@
|
|||
"name": "admin",
|
||||
"type": "user",
|
||||
"ask": {
|
||||
"en": "Pod administrator",
|
||||
"fr": "Administrateur du pod"
|
||||
"en": "Choose an admin user",
|
||||
"fr": "Choisissez l'administrateur"
|
||||
},
|
||||
"example": "homer"
|
||||
"example": "johndoe"
|
||||
},
|
||||
{
|
||||
"name": "password",
|
||||
"type": "password",
|
||||
"ask": {
|
||||
"en": "Administrator password",
|
||||
"fr": "Mot de passe administrateur"
|
||||
"en": "Set the administrator password",
|
||||
"fr": "Définissez le mot de passe administrateur"
|
||||
},
|
||||
"example" : "password"
|
||||
"example": "Choose a password"
|
||||
},
|
||||
{
|
||||
"name": "language",
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"ask": {
|
||||
"en": "Pod language",
|
||||
"fr": "Langue du pod"
|
||||
"en": "Is it a public application?",
|
||||
"fr": "Est-ce une application publique ?"
|
||||
},
|
||||
"choices" : ["ar", "de", "en", "es", "fr", "it", "ja", "nl", "ru"],
|
||||
"default" : "en"
|
||||
},
|
||||
{
|
||||
"name": "ssoenabled",
|
||||
"ask": {
|
||||
"en": "Enable SSO support (autologin) ?",
|
||||
"fr": "Activer le support SSO (connexin auto) ?"
|
||||
},
|
||||
"choices": ["Yes", "No"],
|
||||
"default": "Yes"
|
||||
"default": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
18
pull_request_template.md
Normal file
18
pull_request_template.md
Normal file
|
@ -0,0 +1,18 @@
|
|||
## Problem
|
||||
- *Description of why you made this PR*
|
||||
|
||||
## Solution
|
||||
- *And how do you fix that problem*
|
||||
|
||||
## PR Status
|
||||
- [ ] Code finished.
|
||||
- [ ] Tested with Package_check.
|
||||
- [ ] Fix or enhancement tested.
|
||||
- [ ] Upgrade from last version tested.
|
||||
- [ ] Can be reviewed and tested.
|
||||
|
||||
## Package_check results
|
||||
---
|
||||
*If you have access to [App Continuous Integration for packagers](https://yunohost.org/#/packaging_apps_ci) you can provide a link to the package_check results like below, replacing '-NUM-' in this link by the PR number and USERNAME by your username on the ci-apps-dev. Or you provide a screenshot or a pastebin of the results*
|
||||
|
||||
[/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/movim_ynh%20PR-NUM-%20(USERNAME)/)
|
|
@ -1,20 +1,37 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Common variables
|
||||
#
|
||||
|
||||
# App package root directory should be the parent folder
|
||||
PKGDIR=$(cd ../; pwd)
|
||||
#=================================================
|
||||
# COMMON VARIABLES
|
||||
#=================================================
|
||||
|
||||
#
|
||||
# Common helpers
|
||||
#
|
||||
# dependencies used by the app
|
||||
pkg_dependencies="postgresql postgresql-contrib apt-transport-https"
|
||||
|
||||
# Undo the SSO patch to source code (applied by default with ynh_setup_source)
|
||||
# usage: undo_sso_patch
|
||||
undo_sso_patch() {
|
||||
(
|
||||
cd $final_path
|
||||
patch -p1 -R < $YNH_CWD/../sources/patches/app-00-sso-logout.patch
|
||||
)
|
||||
YNH_PHP_VERSION="7.3"
|
||||
|
||||
extra_php_dependencies="php${YNH_PHP_VERSION}-fpm php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-pgsql php${YNH_PHP_VERSION}-xml"
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# EXPERIMENTAL HELPERS
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# FUTURE OFFICIAL HELPERS
|
||||
#=================================================
|
||||
|
||||
# Execute a command as another user
|
||||
# usage: ynh_exec_as USER COMMAND [ARG ...]
|
||||
ynh_exec_as() {
|
||||
local USER=$1
|
||||
shift 1
|
||||
|
||||
if [[ $USER = $(whoami) ]]; then
|
||||
eval "$@"
|
||||
else
|
||||
sudo -u "$USER" "$@"
|
||||
fi
|
||||
}
|
||||
|
|
76
scripts/backup
Normal file
76
scripts/backup
Normal file
|
@ -0,0 +1,76 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_print_info --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
#=================================================
|
||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||
#=================================================
|
||||
ynh_print_info --message="Declaring files to be backed up..."
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE APP MAIN DIR
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="$final_path"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP SYSTEMD
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_print_info --message="Backing up the PostgreSQL database..."
|
||||
|
||||
ynh_psql_dump_db --database="$db_name" > db.sql
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info --message="Backup script completed for Movim. (YunoHost will then actually copy those files to the archive)."
|
167
scripts/install
167
scripts/install
|
@ -23,123 +23,117 @@ ynh_abort_if_errors
|
|||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url=$YNH_APP_ARG_PATH
|
||||
admin=$YNH_APP_ARG_ADMIN
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
password=$YNH_APP_ARG_PASSWORD
|
||||
language=$YNH_APP_ARG_LANGUAGE
|
||||
ssoenabled=$YNH_APP_ARG_SSOENABLED
|
||||
timezone=$(cat /etc/timezone)
|
||||
|
||||
### 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 instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...)
|
||||
### The app instance name is available as $YNH_APP_INSTANCE_NAME
|
||||
### - 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
|
||||
### - ynhexample__{N} for the subsequent installations, with N=3,4, ...
|
||||
### 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,
|
||||
### db names, ...
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating installation parameters..." --weight=1
|
||||
|
||||
final_path=/var/www/$app
|
||||
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
||||
|
||||
# Normalize the url path syntax
|
||||
path_url=$(ynh_normalize_url_path $path_url)
|
||||
|
||||
# Check web path availability
|
||||
ynh_webpath_available $domain $path_url
|
||||
# Register (book) web path
|
||||
ynh_webpath_register $app $domain $path_url
|
||||
|
||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||
|
||||
#=================================================
|
||||
# STORE SETTINGS FROM MANIFEST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Storing installation settings..." --weight=2
|
||||
|
||||
# Save app settings
|
||||
ynh_app_setting_set "$app" admin "$admin"
|
||||
ynh_app_setting_set "$app" ssoenabled "$ssoenabled"
|
||||
ynh_app_setting_set "$app" path "$path_url"
|
||||
|
||||
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
||||
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
||||
ynh_app_setting_set --app=$app --key=admin --value=$admin
|
||||
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
# FIND AND OPEN A PORT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring firewall..." --weight=2
|
||||
|
||||
# Find a free port
|
||||
port=$(ynh_find_port 9537)
|
||||
# Open this port
|
||||
yunohost firewall allow --no-upnp TCP "$port" 2>&1
|
||||
ynh_app_setting_set "$app" port "$port"
|
||||
port=$(ynh_find_port --port=9537)
|
||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing dependencies..." --weight=1
|
||||
|
||||
# Install packages
|
||||
ynh_install_app_dependencies php-gd php-curl php-imagick php-cli php-zmq
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# CREATE A MYSQL DATABASE
|
||||
# CREATE A POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating a PostgreSQL database..." --weight=2
|
||||
|
||||
db_name=$(ynh_sanitize_dbid "$app")
|
||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
db_user=$db_name
|
||||
ynh_app_setting_set "$app" db_name "$db_name"
|
||||
ynh_mysql_setup_db "$db_user" "$db_name"
|
||||
db_pwd=$(ynh_string_random --length=30)
|
||||
|
||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd
|
||||
|
||||
ynh_psql_test_if_first_run
|
||||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
|
||||
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS unaccent;" --database=$db_name
|
||||
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Setting up source files..." --weight=4
|
||||
|
||||
ynh_app_setting_set "$app" final_path "$final_path"
|
||||
|
||||
ynh_setup_source "$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
|
||||
ynh_setup_source --dest_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring NGINX web server..." --weight=11
|
||||
|
||||
# Create a dedicated nginx config
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
ynh_replace_string "//ws/" "/ws/" "$finalnginxconf" # Avoid duplicate /
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..." --weight=3
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create "$app"
|
||||
ynh_system_user_create --username=$app
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring PHP-FPM..." --weight=1
|
||||
|
||||
# Create a dedicated php-fpm config
|
||||
ynh_replace_string "YHTZ" "$timezone" ../conf/php-fpm.ini
|
||||
ynh_add_fpm_config
|
||||
# Create a dedicated PHP-FPM config
|
||||
ynh_replace_string --match_string="__TIMEZONE__" --replace_string="$timezone" --target_file=../conf/php-fpm.conf
|
||||
|
||||
ynh_add_fpm_config --phpversion=$YNH_PHP_VERSION --package="$extra_php_dependencies"
|
||||
phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion)
|
||||
|
||||
#=================================================
|
||||
# SET CONFIGURATION FILE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Modifying a config file..." --weight=1
|
||||
|
||||
# TODO: add checksum
|
||||
cp ../conf/db.inc.php "$final_path/config/db.inc.php"
|
||||
cp ../conf/db.example.inc.php $final_path/config/db.inc.php
|
||||
|
||||
ynh_replace_string "__DB_USER__" "$db_user" "$final_path/config/db.inc.php"
|
||||
ynh_replace_string "__DB_PWD__" "$db_pwd" "$final_path/config/db.inc.php"
|
||||
ynh_replace_string "__DB_NAME__" "$db_name" "$final_path/config/db.inc.php"
|
||||
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/config/db.inc.php"
|
||||
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/config/db.inc.php"
|
||||
|
||||
## TODO: consider installation in a subpath
|
||||
ynh_replace_string "'/ws/'" "'${path_url%/}/ws/'" \
|
||||
"$final_path/app/assets/js/movim_websocket.js"
|
||||
ynh_store_file_checksum --file="$final_path/config/db.inc.php"
|
||||
|
||||
#=================================================
|
||||
# Install PHP dependencies using composer
|
||||
|
@ -149,30 +143,34 @@ ynh_replace_string "'/ws/'" "'${path_url%/}/ws/'" \
|
|||
cd "$final_path"
|
||||
export COMPOSER_HOME=$final_path
|
||||
curl -sS https://getcomposer.org/installer | php -- --install-dir="$final_path" \
|
||||
&& php composer.phar config --global discard-changes true --quiet \
|
||||
&& php composer.phar install --no-interaction --quiet
|
||||
&& php"${phpversion}" composer.phar install --no-interaction --quiet
|
||||
)
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring a systemd service..." --weight=1
|
||||
|
||||
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file=../conf/systemd.service
|
||||
ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file=../conf/systemd.service
|
||||
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file=../conf/systemd.service
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_replace_string "__URL__" "${domain}${path_url}" ../conf/systemd.service
|
||||
ynh_replace_string "__PORT__" "${port}" ../conf/systemd.service
|
||||
ynh_add_systemd_config
|
||||
|
||||
#=================================================
|
||||
# Set-up database and configuration
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring database..." --weight=1
|
||||
|
||||
(
|
||||
cd "$final_path"
|
||||
php mud.php db --set
|
||||
php mud.php config --loglevel=1 \
|
||||
--locale="$language" --timezone="$timezone" \
|
||||
--username="$admin" --password="$password"
|
||||
)
|
||||
cache_dir="/home/$app"
|
||||
|
||||
# Create cachedir folder
|
||||
mkdir -p $cache_dir
|
||||
chown -R $app $cache_dir
|
||||
|
||||
cd "$final_path"
|
||||
ynh_exec_as $app php"${phpversion}" composer.phar $app:migrate
|
||||
php"${phpversion}" daemon.php config --username=$admin --password=$password
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
@ -180,27 +178,44 @@ ynh_add_systemd_config
|
|||
# SET PERMISSIONS
|
||||
#=================================================
|
||||
|
||||
# TODO: use more strict permissions
|
||||
chown -R "$app":www-data "$final_path"
|
||||
find "${final_path}/" -type f -print0 | xargs -0 chmod 0644
|
||||
find "${final_path}/" -type d -print0 | xargs -0 chmod 0755
|
||||
chmod 400 "${final_path}/config/db.inc.php"
|
||||
chown -R $app:www-data $final_path
|
||||
chown -R $app $final_path/src/Movim/
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||
|
||||
yunohost service add $app --description "Responsive web-based XMPP client" --log="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=2
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" #--line_match="HTTP Server listening"
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring SSOwat..." --weight=1
|
||||
|
||||
# SSOwat configuration
|
||||
if [[ "$ssoenabled" = "No" ]]; then
|
||||
ynh_app_setting_set "$app" skipped_uris "/"
|
||||
(cd "$final_path" && php mud.php config --xmppwhitelist="$domain")
|
||||
undo_sso_patch
|
||||
else
|
||||
ynh_app_setting_set "$app" unprotected_uris "/"
|
||||
# Make app public if necessary or protect it
|
||||
if [ $is_public -eq 1 ]
|
||||
then
|
||||
ynh_permission_update --permission "main" --add "visitors"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
|
||||
service nginx reload
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Installation of Movim completed" --last
|
||||
|
|
|
@ -16,33 +16,38 @@ source /usr/share/yunohost/helpers
|
|||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
# Retrieve app settings
|
||||
domain=$(ynh_app_setting_get "$app" domain)
|
||||
final_path=$(ynh_app_setting_get "$app" final_path)
|
||||
port=$(ynh_app_setting_get "$app" port)
|
||||
db_name=$(ynh_app_setting_get "$app" db_name)
|
||||
domain=$(ynh_app_setting_get --app="$app" --key=domain)
|
||||
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
|
||||
port=$(ynh_app_setting_get --app="$app" --key=port)
|
||||
db_name=$(ynh_app_setting_get --app="$app" --key=db_name)
|
||||
db_user=$db_name
|
||||
|
||||
#=================================================
|
||||
# STANDARD REMOVE
|
||||
#=================================================
|
||||
# STOP AND REMOVE SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping and removing the systemd service" --weight=1
|
||||
|
||||
# Remove the dedicated systemd config
|
||||
ynh_remove_systemd_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the PostgreSQL database" --weight=1
|
||||
|
||||
# Remove a database if it exists, along with the associated user
|
||||
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=5
|
||||
|
||||
# Remove the dedicated nginx config
|
||||
# Remove the dedicated NGINX config
|
||||
ynh_remove_nginx_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
# Remove the dedicated php-fpm config
|
||||
ynh_remove_fpm_config
|
||||
|
||||
#=================================================
|
||||
# STOP AND REMOVE SERVICE
|
||||
#=================================================
|
||||
|
||||
# Remove the dedicated systemd config
|
||||
ynh_remove_systemd_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
|
@ -50,33 +55,42 @@ ynh_remove_systemd_config
|
|||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
|
||||
ynh_mysql_remove_db "$db_user" "$db_name"
|
||||
|
||||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing Movim main directory..." --weight=6
|
||||
|
||||
ynh_secure_remove "$final_path"
|
||||
# Remove the app directory securely
|
||||
ynh_secure_remove --file="$final_path"
|
||||
|
||||
#=================================================
|
||||
# CLOSE A PORT
|
||||
# REMOVE APP CACHE DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing Movim cache directory..." --weight=6
|
||||
|
||||
if yunohost firewall list | grep -q "\- $port$"
|
||||
then
|
||||
echo "Close port $port" >&2
|
||||
yunohost firewall disallow TCP "$port" 2>&1
|
||||
fi
|
||||
# Remove the app directory securely
|
||||
ynh_secure_remove --file="/home/$app"
|
||||
|
||||
#=================================================
|
||||
# REMOVE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=2
|
||||
|
||||
# Remove the dedicated PHP_FPM config
|
||||
ynh_remove_fpm_config
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# REMOVE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
|
||||
|
||||
# Delete a system user
|
||||
ynh_system_user_delete "$app"
|
||||
ynh_system_user_delete --username=$app
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Removal of Movim completed" --last
|
||||
|
|
139
scripts/restore
Normal file
139
scripts/restore
Normal file
|
@ -0,0 +1,139 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
true
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE RESTORED
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating restoration parameters..." --weight=2
|
||||
|
||||
ynh_webpath_available --domain=$domain --path_url=$path_url \
|
||||
|| ynh_die --message="Path not available: ${domain}${path_url}"
|
||||
test ! -d $final_path \
|
||||
|| ynh_die --message="There is already a directory: $final_path "
|
||||
|
||||
#=================================================
|
||||
# STANDARD RESTORATION STEPS
|
||||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring Movim main directory..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="$final_path"
|
||||
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
||||
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app
|
||||
|
||||
#=================================================
|
||||
# RESTORE USER RIGHTS
|
||||
#=================================================
|
||||
|
||||
# Restore permissions on app files
|
||||
chown -R $app:www-data $final_path
|
||||
chown -R $app $final_path/src/Movim/
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_restore_file --origin_path="/etc/php/${phpversion}/fpm/pool.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=2
|
||||
|
||||
# Define and install dependencies
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=6
|
||||
|
||||
ynh_psql_test_if_first_run
|
||||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEMD
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the systemd configuration..." --weight=4
|
||||
|
||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||
systemctl enable $app.service
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
|
||||
yunohost service add $app --description "Responsive web-based XMPP client" --log "/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=2
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# RELOAD NGINX AND PHP-FPM
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=php${phpversion}-fpm --action=reload
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Restoration completed for Movim" --last
|
163
scripts/upgrade
163
scripts/upgrade
|
@ -12,47 +12,64 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
# Retrieve app settings
|
||||
domain=$(ynh_app_setting_get "$app" domain)
|
||||
path_url=$(ynh_app_setting_get "$app" path)
|
||||
port=$(ynh_app_setting_get "$app" port)
|
||||
ssoenabled=$(ynh_app_setting_get "$app" ssoenabled)
|
||||
public_site=$(ynh_app_setting_get "$app" public_site)
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
||||
phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion)
|
||||
timezone=$(cat /etc/timezone)
|
||||
final_path=$(ynh_app_setting_get "$app" final_path)
|
||||
db_name=$(ynh_app_setting_get "$app" db_name)
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
#=================================================
|
||||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=4
|
||||
|
||||
# If final_path doesn't exist, create it
|
||||
if [ -z "$final_path" ]; then
|
||||
final_path="/var/www/$app"
|
||||
ynh_app_setting_set "$app" final_path "$final_path"
|
||||
# Fix is_public as a boolean value
|
||||
if [ "$is_public" = "Yes" ]; then
|
||||
ynh_app_setting_set --app=$app --key=is_public --value=1
|
||||
is_public=1
|
||||
elif [ "$is_public" = "No" ]; then
|
||||
ynh_app_setting_set --app=$app --key=is_public --value=0
|
||||
is_public=0
|
||||
fi
|
||||
|
||||
|
||||
# If db_name doesn't exist, create it
|
||||
if [ -z "$db_name" ]; then
|
||||
db_name=$(ynh_sanitize_dbid "$app")
|
||||
ynh_app_setting_set "$app" db_name "$db_name"
|
||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
fi
|
||||
|
||||
# If final_path doesn't exist, create it
|
||||
if [ -z "$final_path" ]; then
|
||||
final_path=/var/www/$app
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# ACTIVE TRAP
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up Movim before upgrading (may take a while)..." --weight=1
|
||||
|
||||
# TODO: activate backup
|
||||
# Backup the current version of the app
|
||||
# ynh_backup_before_upgrade
|
||||
# ynh_clean_setup () {
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
# restore it if the upgrade fails
|
||||
# ynh_restore_upgradebackup
|
||||
# }
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
|
@ -63,56 +80,67 @@ ynh_abort_if_errors
|
|||
# Normalize the URL path syntax
|
||||
path_url=$(ynh_normalize_url_path $path_url)
|
||||
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..." --weight=23
|
||||
|
||||
ynh_install_app_dependencies php-gd php-curl php-imagick php-cli php-zmq
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
||||
ynh_setup_source "$final_path"
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
ynh_script_progression --message="Upgrading source files..." --weight=1
|
||||
|
||||
## TODO: consider installation in a subpath
|
||||
ynh_replace_string "'/ws/'" "'${path_url%/}/ws/'" \
|
||||
"${final_path}/app/assets/js/movim_websocket.js"
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=5
|
||||
|
||||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading dependencies..." --weight=4
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=7
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create "$app"
|
||||
ynh_system_user_create --username=$app
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
|
||||
|
||||
# Create a dedicated php-fpm config
|
||||
ynh_add_fpm_config
|
||||
# Create a dedicated PHP-FPM config
|
||||
ynh_replace_string --match_string="__TIMEZONE__" --replace_string="$timezone" --target_file=../conf/php-fpm.conf
|
||||
|
||||
ynh_add_fpm_config --phpversion=$YNH_PHP_VERSION --package="$extra_php_dependencies"
|
||||
phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion)
|
||||
|
||||
#=================================================
|
||||
# SET PERMISSIONS
|
||||
#=================================================
|
||||
|
||||
chown -R "$app":www-data "$final_path"
|
||||
find "${final_path}/" -type f -print0 | xargs -0 chmod 0644
|
||||
find "${final_path}/" -type d -print0 | xargs -0 chmod 0755
|
||||
chmod 400 "${final_path}/config/db.inc.php"
|
||||
chown -R $app:www-data $final_path
|
||||
chown -R $app $final_path/src/Movim/Bootstrap.php
|
||||
|
||||
#=================================================
|
||||
# Install PHP dependencies using composer
|
||||
|
@ -128,58 +156,39 @@ chmod 400 "${final_path}/config/db.inc.php"
|
|||
#=================================================
|
||||
# Set-up database
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Configuring database.." --weight=1
|
||||
(
|
||||
cd "$final_path"
|
||||
php mud.php db --set
|
||||
ynh_exec_as $app php"${phpversion}" composer.phar movim:migrate
|
||||
)
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
|
||||
# Reset SSO parameters
|
||||
ynh_app_setting_delete "$app" protected_uris
|
||||
ynh_app_setting_delete "$app" skipped_uris
|
||||
yunohost app clearaccess "$app"
|
||||
|
||||
# Replace old public_site variable (if exists) by ssoenabled
|
||||
# TODO: add clean support for old/new setting public_site/ssoenabled
|
||||
if [ ! -z "$public_site" ]; then
|
||||
[[ $public_site = "Yes" ]] \
|
||||
&& ssoenabled="No" \
|
||||
|| ssoenabled="Yes"
|
||||
ynh_app_setting_delete "$app" public_site
|
||||
ynh_app_setting_set "$app" ssoenabled "$ssoenabled"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
|
||||
# SSOwat configuration
|
||||
if [[ "$ssoenabled" = "No" ]]; then
|
||||
ynh_app_setting_set "$app" skipped_uris "/"
|
||||
(cd "$final_path" && php mud.php config --xmppwhitelist="$domain")
|
||||
yunohost app ssowatconf
|
||||
undo_sso_patch
|
||||
else
|
||||
ynh_app_setting_set "$app" unprotected_uris "/"
|
||||
fi
|
||||
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_replace_string "__URL__" "${domain}${path_url}" ../conf/systemd.service
|
||||
ynh_replace_string "__PORT__" "${port}" ../conf/systemd.service
|
||||
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file=../conf/systemd.service
|
||||
ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file=../conf/systemd.service
|
||||
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file=../conf/systemd.service
|
||||
|
||||
ynh_add_systemd_config
|
||||
|
||||
#=================================================
|
||||
# RELOAD SERVICES
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
# Reload services
|
||||
service nginx reload
|
||||
ynh_script_progression --message="Upgrade of Movim completed" --last
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
diff --git a/app/controllers/DisconnectController.php b/app/controllers/DisconnectController.php
|
||||
index abe2006..af72e68 100644
|
||||
--- a/app/controllers/DisconnectController.php
|
||||
+++ b/app/controllers/DisconnectController.php
|
||||
@@ -20,6 +20,7 @@ class DisconnectController extends Base
|
||||
// Fresh cookie
|
||||
Cookie::renew();
|
||||
|
||||
- $this->redirect('login');
|
||||
+ $main_domain = exec('cat /etc/yunohost/current_host');
|
||||
+ header('Location: https://' . $main_domain . '/yunohost/sso/?action=logout');
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue