mirror of
https://github.com/YunoHost-Apps/openproject_ynh.git
synced 2024-09-03 19:56:10 +02:00
commit
4279d458b1
28 changed files with 488 additions and 766 deletions
55
.github/ISSUE_TEMPLATE.md
vendored
Normal file
55
.github/ISSUE_TEMPLATE.md
vendored
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. *Determine if you are on the right place:*
|
||||
- *If you were performing an action on the app 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.*
|
||||
- *When in doubt, post here and we will figure it out together.*
|
||||
3. *Delete the 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 the_app
|
||||
```
|
||||
- *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.*
|
16
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
16
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
## Problem
|
||||
|
||||
- *Description of why you made this PR*
|
||||
|
||||
## Solution
|
||||
|
||||
- *And how do you fix that problem*
|
||||
|
||||
## PR Status
|
||||
|
||||
- [ ] Code finished and ready to be reviewed/tested
|
||||
- [ ] The fix/enhancement were manually tested (if applicable)
|
||||
|
||||
## Automatic tests
|
||||
|
||||
Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization)
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,2 +0,0 @@
|
|||
*~
|
||||
*.sw[op]
|
|
@ -1,19 +0,0 @@
|
|||
# What it takes to go to v1
|
||||
|
||||
Package will be in v1 and in "working" conditions in Yunohost-Apps when:
|
||||
|
||||
- [x] All codes will be finished
|
||||
- [x] First bash review performed
|
||||
- [x] Reviewed with package-linter
|
||||
- [ ] Remove all the TODOs
|
||||
- [ ] CI tested on vagrant : install
|
||||
- [ ] Remove tested : nothing must be left
|
||||
- [ ] Quiet-ize installer
|
||||
- [ ] Measure timing of installer to bring proper weight
|
||||
|
||||
And some breadcrumbs:
|
||||
- [x] change way to install ruby with crappy `rbenv`
|
||||
- [x] Remove: if the PostgreSQL is empty, remove it ==> NOT APPLICABLE ANYMORE
|
||||
- [ ] fully remove `/var/$app` (ynh helper crappy?)
|
||||
|
||||
Goal of full-quality :)
|
72
README.md
72
README.md
|
@ -1,16 +1,19 @@
|
|||
# OpenProject App for YunoHost
|
||||
<!--
|
||||
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
|
||||
It shall NOT be edited by hand.
|
||||
-->
|
||||
|
||||
[![Invtegration level](https://dash.yunohost.org/integration/Openproject.svg)](https://dash.yunohost.org/appci/app/Openproject)
|
||||
[![Install Openproject with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=Openproject)
|
||||
# OpenProject for YunoHost
|
||||
|
||||
[![Integration level](https://dash.yunohost.org/integration/openproject.svg)](https://dash.yunohost.org/appci/app/openproject) ![](https://ci-apps.yunohost.org/ci/badges/openproject.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/openproject.maintain.svg)
|
||||
[![Install OpenProject with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=openproject)
|
||||
|
||||
*[Lire ce readme en français.](./README_fr.md)*
|
||||
|
||||
<p align="center">
|
||||
<img src="https://upload.wikimedia.org/wikipedia/commons/d/d5/OpenProjectLogo.png">
|
||||
</p>
|
||||
> *This package allows you to install OpenProject 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.*
|
||||
|
||||
*This package allow you to install Openproject quickly and simply on a YunoHost server.
|
||||
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
|
||||
## Overview
|
||||
|
||||
## Overview
|
||||
OpenProject is a web-based project management software. Its key features are:
|
||||
|
@ -25,44 +28,35 @@ OpenProject is a web-based project management software. Its key features are:
|
|||
- Forums
|
||||
- Meeting agendas and meeting minutes
|
||||
|
||||
**Shipped version:** 10.0
|
||||
|
||||
**Shipped version:** 10.5.1~ynh1
|
||||
|
||||
|
||||
|
||||
## Screenshots
|
||||
|
||||
![GANTT-Chart displayed y the App.](https://www.openproject.org/wp-content/uploads/2018/09/Gantt-chart.jpg)
|
||||
![](./doc/screenshots/screenshot1.png)
|
||||
|
||||
## Configuration
|
||||
## Disclaimers / important information
|
||||
|
||||
After installation, every change can be made directly in the web application.
|
||||
* default user and password is admin / admin
|
||||
## Documentation and resources
|
||||
|
||||
## Documentation
|
||||
* Official app website: https://www.openproject.org/
|
||||
* Official admin documentation: https://www.openproject.org/docs/
|
||||
* Upstream app code repository: https://github.com/opf/openproject
|
||||
* YunoHost documentation for this app: https://yunohost.org/app_openproject
|
||||
* Report a bug: https://github.com/YunoHost-Apps/openproject_ynh/issues
|
||||
|
||||
- [Official documentation here](https://github.com/opf/openproject/tree/stable/10).
|
||||
- YunoHost documentation: If specific documentation is needed, feel free to contribute!
|
||||
## Developer info
|
||||
|
||||
## YunoHost specific features
|
||||
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/openproject_ynh/tree/testing).
|
||||
|
||||
#### Multi-users support
|
||||
To try the testing branch, please proceed like that.
|
||||
```
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/openproject_ynh/tree/testing --debug
|
||||
or
|
||||
sudo yunohost app upgrade openproject -u https://github.com/YunoHost-Apps/openproject_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
LDAP is not embedded yet, neither HTTP authentication support.
|
||||
|
||||
#### Supported architectures
|
||||
|
||||
- x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/Openproject%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/Openproject/)
|
||||
- ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/Openproject%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/Openproject/)
|
||||
- Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/Openproject%20%28Apps%29.svg)](https://ci-stretch.nohost.me/ci/apps/Openproject/)
|
||||
|
||||
## Limitations
|
||||
|
||||
- No known limitations :)
|
||||
|
||||
## License
|
||||
|
||||
This repository is under the GNU AGPL licence v3. Please see [the license file](./LICENSE) for more information.
|
||||
|
||||
## Links
|
||||
|
||||
- Report a bug: https://github.com/YunoHost-Apps/Openproject_ynh/issues
|
||||
- App website: https://www.openproject.org/
|
||||
- Upstream app repository: https://github.com/opf/openproject
|
||||
- YunoHost website: https://yunohost.org/
|
||||
**More info regarding app packaging:** https://yunohost.org/packaging_apps
|
90
README_fr.md
90
README_fr.md
|
@ -1,68 +1,58 @@
|
|||
# OpenProject pour YunoHost
|
||||
|
||||
[![Niveau d'intégration](https://dash.yunohost.org/integration/Openproject.svg)](https://dash.yunohost.org/appci/app/Openproject)
|
||||
[![Installer Openproject avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=Openproject)
|
||||
[![Niveau d'intégration](https://dash.yunohost.org/integration/openproject.svg)](https://dash.yunohost.org/appci/app/openproject) ![](https://ci-apps.yunohost.org/ci/badges/openproject.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/openproject.maintain.svg)
|
||||
[![Installer OpenProject avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=openproject)
|
||||
|
||||
*[Read this readme in English.](./ README.md)*
|
||||
*[Read this readme in english.](./README.md)*
|
||||
*[Lire ce readme en français.](./README_fr.md)*
|
||||
|
||||
<p align="center">
|
||||
<img src="https://upload.wikimedia.org/wikipedia/commons/d/d5/OpenProjectLogo.png">
|
||||
</p>
|
||||
|
||||
Ce dépôt vous permet d'installer Openproject rapidement et simplement sur un serveur YunoHost.
|
||||
Si vous n'avez pas YunoHost, veuillez consulter [ici] (https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.
|
||||
> *Ce package vous permet d'installer OpenProject rapidement et simplement sur un serveur YunoHost.
|
||||
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
|
||||
|
||||
## Vue d'ensemble
|
||||
OpenProject est un logiciel de gestion de projet entièrement en Web. Ses principales caractéristiques sont :
|
||||
|
||||
- Planification et ordonnancement de projets,
|
||||
- Feuille de route du produit et planification des versions,
|
||||
- Gestion des tâches et collaboration au sein des équipes,
|
||||
- Agile et Scrum,
|
||||
- Suivi du temps, reporting des coûts et budgétisation,
|
||||
- Suivi des bogues,
|
||||
- Wikis,
|
||||
- Forums,
|
||||
- Ordres du jour et comptes rendus,
|
||||
## Overview
|
||||
OpenProject is a web-based project management software. Its key features are:
|
||||
|
||||
- Project planning and scheduling
|
||||
- Product roadmap and release planning
|
||||
- Task management and team collaboration
|
||||
- Agile and Scrum
|
||||
- Time tracking, cost reporting and budgeting
|
||||
- Bug tracking
|
||||
- Wikis
|
||||
- Forums
|
||||
- Meeting agendas and meeting minutes
|
||||
|
||||
|
||||
**Version incluse :** 10.5.1~ynh1
|
||||
|
||||
|
||||
** Version incluse : ** 10.0
|
||||
|
||||
## Captures d'écran
|
||||
|
||||
![GANTT-Chart affiché dans l'application.](https://www.openproject.org/wp-content/uploads/2018/09/Gantt-chart.jpg)
|
||||
![](./doc/screenshots/screenshot1.png)
|
||||
|
||||
## Configuration
|
||||
## Avertissements / informations importantes
|
||||
|
||||
Après l'installation, chaque modification peut être effectuée directement dans la page d'admin Web.
|
||||
* default user and password is admin / admin
|
||||
## Documentations et ressources
|
||||
|
||||
## Documentation
|
||||
* Site officiel de l'app : https://www.openproject.org/
|
||||
* Documentation officielle de l'admin : https://www.openproject.org/docs/
|
||||
* Dépôt de code officiel de l'app : https://github.com/opf/openproject
|
||||
* Documentation YunoHost pour cette app : https://yunohost.org/app_openproject
|
||||
* Signaler un bug : https://github.com/YunoHost-Apps/openproject_ynh/issues
|
||||
|
||||
* [Documentation officielle ici](https://github.com/opf/openproject/tree/stable/10)
|
||||
* Documentation YunoHost: Si une documentation spécifique est nécessaire, n'hésitez pas à contribuer.
|
||||
## Informations pour les développeurs
|
||||
|
||||
#### Support multi-utilisateurs
|
||||
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/openproject_ynh/tree/testing).
|
||||
|
||||
LDAP n'est pas encore intégré, ni le support de l'authentification HTTP.
|
||||
|
||||
#### Architectures supportées
|
||||
|
||||
* x86-64b - [![Statut du _build_](https://ci-apps.yunohost.org/ci/logs/Openproject%20%28Apps%29.svg)](https: //ci-apps.yunohost. org / ci / apps / Openproject /)
|
||||
* ARMv8-A - [![Statut du _build_](https://ci-apps-arm.yunohost.org/ci/logs/Openproject%20%28Apps%29.svg)](https: // ci-apps- arm.yunohost.org/ci/apps/Openproject/)
|
||||
* Jessie x86-64b - [![Statut du _build_](https://ci-stretch.nohost.me/ci/logs/Openproject%20%28Apps%29.svg)](https: //ci-stretch.nohost .me / ci / apps / Openproject /)
|
||||
|
||||
## Limitations
|
||||
|
||||
* Aucune limitation connue :)
|
||||
|
||||
|
||||
## Licence
|
||||
|
||||
Ce dépôt et son code sont sous la licence GNU AGPL v3. Vous pouvez consulter [le fichier de licence](./LICENSE) pour plus d'informations.
|
||||
|
||||
## Liens
|
||||
|
||||
* Signaler un bug: https://github.com/YunoHost-Apps/Openproject_ynh/issues
|
||||
* Site Web de l'application: https://www.openproject.org/
|
||||
* Référentiel d'applications en amont: https://github.com/opf/openproject
|
||||
* Site Web YunoHost: https://yunohost.org/
|
||||
Pour essayer la branche testing, procédez comme suit.
|
||||
```
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/openproject_ynh/tree/testing --debug
|
||||
ou
|
||||
sudo yunohost app upgrade openproject -u https://github.com/YunoHost-Apps/openproject_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps
|
25
check_process
Normal file
25
check_process
Normal file
|
@ -0,0 +1,25 @@
|
|||
;; Test complet
|
||||
; Manifest
|
||||
domain="domain.tld"
|
||||
language="en"
|
||||
is_public=1
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=0
|
||||
setup_root=1
|
||||
setup_nourl=0
|
||||
setup_private=1
|
||||
setup_public=1
|
||||
upgrade=1
|
||||
#upgrade=1 from_commit=CommitHash
|
||||
backup_restore=1
|
||||
multi_instance=0
|
||||
port_already_use=0
|
||||
change_url=1
|
||||
;;; Options
|
||||
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=pass&port=666&
|
|
@ -1,40 +0,0 @@
|
|||
# See here for more information
|
||||
# https://github.com/YunoHost/package_check#syntax-check_process-file
|
||||
|
||||
# Move this file from check_process.default to check_process when you have filled it.
|
||||
|
||||
;; Test complet
|
||||
; Manifest
|
||||
domain="domain.tld" (DOMAIN)
|
||||
path="/path" (PATH)
|
||||
admin="john" (USER)
|
||||
language="fr"
|
||||
is_public=1 (PUBLIC|public=1|private=0)
|
||||
password="pass"
|
||||
port="666" (PORT)
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=1
|
||||
setup_root=1
|
||||
setup_nourl=0
|
||||
setup_private=1
|
||||
setup_public=1
|
||||
upgrade=1
|
||||
upgrade=1 from_commit=CommitHash
|
||||
backup_restore=1
|
||||
multi_instance=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
|
||||
change_url=1
|
||||
;;; Levels
|
||||
# If the level 5 (Package linter) is forced to 1. Please add justifications here.
|
||||
Level 5=auto
|
||||
;;; Options
|
||||
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=pass&port=666&
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
SOURCE_URL=https://github.com/opf/openproject/archive/v10.5.1.zip
|
||||
SOURCE_SUM=38d07c757112ef9445ac6278f1963d0021d5c01e09958719896a51ee95b64c45
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=zip
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=openproject-10.5.1.zip
|
|
@ -1,18 +1,14 @@
|
|||
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
||||
location __PATH__/ {
|
||||
|
||||
# Force usage of https
|
||||
|
||||
if ($scheme = http) {
|
||||
rewrite ^ https://$server_name$request_uri? permanent;
|
||||
}
|
||||
|
||||
proxy_pass http://127.0.0.1:__PORT__/;
|
||||
proxy_set_header Host $host;
|
||||
proxy_buffering off;
|
||||
tcp_nodelay on;
|
||||
access_log off;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Host $host:$server_port;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
proxy_set_header X-Forwarded-Server $host:$server_port;
|
||||
proxy_read_timeout 1200s;
|
||||
|
||||
# Include SSOWAT user panel.
|
||||
include conf.d/yunohost_panel.conf.inc;
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
[Unit]
|
||||
Description=Launches Application server for OpenProject Rails project
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=__APP__
|
||||
Group=__APP__
|
||||
WorkingDirectory=__FINALPATH__/
|
||||
Environment=RAILS_ENV=production
|
||||
|
||||
ExecStart=/usr/local/bin/bundle exec puma -t 5:5 -p ${PORT:-__PORT__} -e ${RACK_ENV:-production} >> /var/log/__APP__/__APP__.log 2>&1
|
||||
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
12
doc/DESCRIPTION.md
Normal file
12
doc/DESCRIPTION.md
Normal file
|
@ -0,0 +1,12 @@
|
|||
## Overview
|
||||
OpenProject is a web-based project management software. Its key features are:
|
||||
|
||||
- Project planning and scheduling
|
||||
- Product roadmap and release planning
|
||||
- Task management and team collaboration
|
||||
- Agile and Scrum
|
||||
- Time tracking, cost reporting and budgeting
|
||||
- Bug tracking
|
||||
- Wikis
|
||||
- Forums
|
||||
- Meeting agendas and meeting minutes
|
1
doc/DISCLAIMER.md
Normal file
1
doc/DISCLAIMER.md
Normal file
|
@ -0,0 +1 @@
|
|||
* default user and password is admin / admin
|
0
doc/screenshots/.gitkeep
Normal file
0
doc/screenshots/.gitkeep
Normal file
BIN
doc/screenshots/screenshot1.png
Normal file
BIN
doc/screenshots/screenshot1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 84 KiB |
|
@ -3,59 +3,42 @@
|
|||
"id": "openproject",
|
||||
"packaging_format": 1,
|
||||
"description": {
|
||||
"en": "OpenProject integration",
|
||||
"fr": "Intégration de OpenProject"
|
||||
"en": "web-based project management software"
|
||||
},
|
||||
"version": "1.0~ynh1",
|
||||
"url": "https://github.com/opf/openproject",
|
||||
"license": "free",
|
||||
"version": "10.5.1~ynh1",
|
||||
"url": "https://www.openproject.org/",
|
||||
"upstream": {
|
||||
"license": "GPL-3.0-or-later",
|
||||
"website": "https://www.openproject.org/",
|
||||
"admindoc": "https://www.openproject.org/docs/",
|
||||
"code": "https://github.com/opf/openproject"
|
||||
},
|
||||
"license": "GPL-3.0-or-later",
|
||||
"maintainer": {
|
||||
"name": "Moutonjr \"Geoff\"",
|
||||
"email": "Moutonjr[at]jserv.fr",
|
||||
"url": "http://jserv.fr"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 3.6"
|
||||
"yunohost": ">= 4.3.0"
|
||||
},
|
||||
"multi_instance": false,
|
||||
"services": [
|
||||
"nginx",
|
||||
"php7.0-fpm",
|
||||
"mysql"
|
||||
"nginx"
|
||||
],
|
||||
"arguments": {
|
||||
"install" : [
|
||||
"install": [
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "domain",
|
||||
"ask": {
|
||||
"en": "Choose a domain name for openproject",
|
||||
"fr": "Choisissez un nom de domaine pour openproject"
|
||||
},
|
||||
"example": "example.com"
|
||||
},
|
||||
{
|
||||
"name": "path",
|
||||
"type": "path",
|
||||
"ask": {
|
||||
"en": "Choose a path for openproject",
|
||||
"fr": "Choisissez un chemin pour openproject"
|
||||
},
|
||||
"example": "/openproject",
|
||||
"default": "/openproject"
|
||||
"type": "domain"
|
||||
},
|
||||
{
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"ask": {
|
||||
"en": "Is it a public application?",
|
||||
"fr": "Est-ce une application publique ?"
|
||||
},
|
||||
"default": true,
|
||||
"help": {
|
||||
"en": "A public Openproject app could be less secure depending your configuration. Butit can allow external people from your Yunohost instance to participate to project management.",
|
||||
"fr": "Une instance publique de YunoHost peut-être moins sécurisée mais peut permettre à des personnes externes à l'instance YunoHost de participer à votre projet (invité)"
|
||||
}
|
||||
"help": {
|
||||
"en": "A public Openproject app could be less secure depending your configuration. Butit can allow external people from your Yunohost instance to participate to project management."
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "language",
|
||||
|
@ -65,7 +48,7 @@
|
|||
"fr": "Choisissez la langue de l'application"
|
||||
},
|
||||
"choices": ["fr", "en"],
|
||||
"default": "fr"
|
||||
"default": "en"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
## Problem
|
||||
- *Description of why you made this PR*
|
||||
|
||||
## Solution
|
||||
- *And how do you fix that problem*
|
||||
|
||||
## PR Status
|
||||
- [x] Code finished.
|
||||
- [x] 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/APP_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/APP_ynh%20PR-NUM-%20(USERNAME)/)
|
|
@ -4,52 +4,20 @@
|
|||
# COMMON VARIABLES
|
||||
#=================================================
|
||||
|
||||
PROJECT_VERSION=12
|
||||
|
||||
# dependencies used by the app
|
||||
export pkg_dependencies="apt-transport-https memcached openproject postgresql postgresql-common"
|
||||
pkg_dependencies="apt-transport-https memcached postgresql postgresql-common"
|
||||
extra_pkg_dependencies="openproject"
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
#=================================================
|
||||
|
||||
# Checks if string existin a file, or add it.
|
||||
ynh_string_in_file () {
|
||||
# Declare an array to define the options of this helper.
|
||||
local legacy_args=msf
|
||||
declare -Ar args_array=( [m]=match_string= [s]=string= [f]=target_file= )
|
||||
local match_string
|
||||
local string
|
||||
local target_file
|
||||
# Manage arguments with getopts
|
||||
ynh_handle_getopts_args "$@"
|
||||
|
||||
local delimit=@
|
||||
# Escape the delimiter if it's in the string.
|
||||
if grep "$match_string" $target_file; then
|
||||
else
|
||||
echo $string >
|
||||
fi
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# EXPERIMENTAL HELPERS
|
||||
#=================================================
|
||||
|
||||
source ynh_add_extra_apt_repos
|
||||
|
||||
# Execute a command as another user
|
||||
# usage: ynh_exec_as USER COMMAND [ARG ...]
|
||||
ynh_exec_as() {
|
||||
local USER=$1
|
||||
shift 1
|
||||
|
||||
if [[ $USER = $(whoami) ]]; then
|
||||
eval "$@"
|
||||
else
|
||||
# use sudo twice to be root and be allowed to use another user
|
||||
sudo sudo -u "$USER" "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# FUTURE OFFICIAL HELPERS
|
||||
#=================================================
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
|
@ -14,83 +14,50 @@ 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..." --time --weight=1
|
||||
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)
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
|
||||
#=================================================
|
||||
# STANDARD BACKUP STEPS
|
||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||
#=================================================
|
||||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..." --time --weight=1
|
||||
|
||||
ynh_systemd_action --service_name="$app" --action="stop" --log_path="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the main app directory..." --time --weight=1
|
||||
|
||||
ynh_backup --src_path="$final_path"
|
||||
ynh_print_info --message="Declaring files to be backed up..."
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up nginx web server configuration..." --time --weight=1
|
||||
|
||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the PostgreSQL database..." --time --weight=1
|
||||
|
||||
ynh_psql_dump_db -d "$db_name" > db.postgres
|
||||
|
||||
#=================================================
|
||||
# BACKUP FAIL2BAN CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up fail2ban configuration..." --time --weight=1
|
||||
|
||||
ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf"
|
||||
ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC BACKUP
|
||||
#=================================================
|
||||
# BACKUP LOGROTATE
|
||||
# BACKUP VARIOUS FILES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up logrotate configuration..." --time --weight=1
|
||||
|
||||
ynh_backup --src_path="/etc/logrotate.d/$app"
|
||||
ynh_backup --src_path="/etc/$app/"
|
||||
|
||||
#=================================================
|
||||
# BACKUP SYSTEMD
|
||||
# BACKUP THE POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up systemd configuration..." --time --weight=1
|
||||
ynh_print_info --message="Backing up the PostgreSQL database..."
|
||||
|
||||
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --time --weight=1
|
||||
|
||||
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"
|
||||
ynh_psql_dump_db --database="$db_name" > db.sql
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --time --last
|
||||
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||
|
|
|
@ -17,20 +17,35 @@ old_domain=$YNH_APP_OLD_DOMAIN
|
|||
old_path=$YNH_APP_OLD_PATH
|
||||
|
||||
new_domain=$YNH_APP_NEW_DOMAIN
|
||||
new_path=$YNH_APP_NEW_PATH
|
||||
new_path="/"
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --time --weight=1
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
# Needed for helper "ynh_add_nginx_config"
|
||||
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
|
||||
export final_path
|
||||
port=$(ynh_app_setting_get --app="$app" --key=port)
|
||||
export port
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..."
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
|
||||
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||
|
||||
# Restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# CHECK WHICH PARTS SHOULD BE CHANGED
|
||||
|
@ -50,41 +65,56 @@ fi
|
|||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
|
||||
|
||||
#=================================================
|
||||
# MODIFY URL IN NGINX CONF
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating nginx web server configuration..." --time --weight=1
|
||||
ynh_script_progression --message="Updating NGINX web server configuration..."
|
||||
|
||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||
|
||||
# Change the path in the nginx config file
|
||||
# Change the path in the NGINX config file
|
||||
if [ $change_path -eq 1 ]
|
||||
then
|
||||
# Make a backup of the original nginx config file if modified
|
||||
# Make a backup of the original NGINX config file if modified
|
||||
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
|
||||
# Set global variables for nginx helper
|
||||
export domain="$old_domain"
|
||||
export path_url="$new_path"
|
||||
# Create a dedicated nginx config
|
||||
# Set global variables for NGINX helper
|
||||
domain="$old_domain"
|
||||
path_url="$new_path"
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
fi
|
||||
|
||||
# Change the domain for nginx
|
||||
# Change the domain for NGINX
|
||||
if [ $change_domain -eq 1 ]
|
||||
then
|
||||
# Delete file checksum for the old conf file location
|
||||
ynh_delete_file_checksum --file="$nginx_conf_path"
|
||||
mv "$nginx_conf_path" "/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
||||
# Store file checksum for the new config file location
|
||||
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALISATION
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading nginx web server..." --time --weight=1
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
@ -92,4 +122,4 @@ ynh_systemd_action --service_name=nginx --action=reload
|
|||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Change of URL completed for $app" --time --last
|
||||
ynh_script_progression --message="Change of URL completed for $app"
|
||||
|
|
198
scripts/install
198
scripts/install
|
@ -3,105 +3,115 @@
|
|||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _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
|
||||
|
||||
#=================================================
|
||||
# Dealing with script's variables
|
||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||
#=================================================
|
||||
# Note: variables are stored in a single location to avoid confusion
|
||||
# and declaration sequencing issues.
|
||||
# Arguments from Manifest
|
||||
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url=$YNH_APP_ARG_PATH
|
||||
path_url="/"
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
language=$YNH_APP_ARG_LANGUAGE
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
# Installer variables
|
||||
db_name=$(ynh_sanitize_dbid --db_name="$app")
|
||||
db_pwd=$(ynh_string_random) # Generate a random password
|
||||
db_user=$db_name
|
||||
final_path="/var/www/$app"
|
||||
_homedir="/var/$app/"
|
||||
_openproject_install_dat="/etc/openproject/installer.dat"
|
||||
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating installation parameters..." --weight=1
|
||||
|
||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||
|
||||
# Find a free port.
|
||||
# This will only be used:
|
||||
# - By OpenProject to fire app server listening to this port, and
|
||||
# - Nginx to proxify on this.
|
||||
port=$(ynh_find_port --port=6000)
|
||||
ynh_script_progression --message="Validating installation parameters..."
|
||||
|
||||
# Register (book) web path
|
||||
ynh_webpath_register --app="$app" --domain="$domain" --path_url="$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=1
|
||||
ynh_script_progression --message="Storing installation settings..."
|
||||
|
||||
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_app_setting_set --app="$app" --key=domain --value="$domain"
|
||||
ynh_app_setting_set --app="$app" --key=final_path --value="$final_path"
|
||||
ynh_app_setting_set --app="$app" --key=homedir --value="$_homedir"
|
||||
ynh_app_setting_set --app="$app" --key=is_public --value="$is_public"
|
||||
ynh_app_setting_set --app="$app" --key=language --value="$language"
|
||||
ynh_app_setting_set --app="$app" --key=path --value="$path_url"
|
||||
ynh_app_setting_set --app="$app" --key=port --value="$port"
|
||||
|
||||
# Make app public if necessary
|
||||
[ "$is_public" -eq 1 ] && ynh_app_setting_set --app="$app" --key=unprotected_uris --value="/"
|
||||
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=language --value=$language
|
||||
ynh_app_setting_set --app=$app --key=_homedir --value=$_homedir
|
||||
|
||||
#=================================================
|
||||
# ENVIRONMENT SETUP
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
# Note: it follows: https://www.openproject.org/download-and-installation/
|
||||
# FIND AND OPEN A PORT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Finding an available port..."
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..." --weight=1
|
||||
ynh_system_user_create --username="$app" --home_dir="$_homedir" -s
|
||||
# Find an available port
|
||||
port=$(ynh_find_port --port=8095)
|
||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing OpenProject & its dependencies..." --weight=1
|
||||
ynh_script_progression --message="Installing OpenProject & its dependencies..."
|
||||
|
||||
# Add Openproject Key & repo
|
||||
# Var APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE to disable the STDOUT redirection warning
|
||||
wget -qO- https://dl.packager.io/srv/opf/openproject/key | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - >/dev/null
|
||||
wget -qO /etc/apt/sources.list.d/openproject.list https://dl.packager.io/srv/opf/openproject/stable/10/installer/debian/9.repo
|
||||
debian_release=$(lsb_release -r -s)
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_install_extra_app_dependencies --repo="deb https://dl.packager.io/srv/deb/opf/openproject/stable/$PROJECT_VERSION/debian $debian_release main" --package="$extra_pkg_dependencies" --key="https://dl.packager.io/srv/opf/openproject/key"
|
||||
|
||||
ynh_install_app_dependencies "$pkg_dependencies" >> "$YNH_STDINFO"
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..."
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app
|
||||
|
||||
#=================================================
|
||||
# CREATE A POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating a PostgreSQL database..."
|
||||
|
||||
ynh_psql_test_if_first_run
|
||||
|
||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
db_user=$db_name
|
||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring nginx web server..." --weight=1
|
||||
ynh_script_progression --message="Configuring NGINX web server..."
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
# OPENPROJECT CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring OpenProject..." --weight=1
|
||||
ynh_script_progression --message="Configuring OpenProject..."
|
||||
|
||||
mkdir -p "/etc/openproject/"
|
||||
_openproject_install_dat="/etc/openproject/installer.dat"
|
||||
|
||||
#TODO Not sure about this email sending. To be tested.
|
||||
cat >> "$_openproject_install_dat" << EOF
|
||||
cat >> "$_openproject_install_dat"<< EOF
|
||||
postgres/autoinstall reuse
|
||||
postgres/db_host 127.0.0.1
|
||||
postgres/db_port 5432
|
||||
|
@ -109,6 +119,8 @@ postgres/db_username $db_user
|
|||
postgres/db_password $db_pwd
|
||||
postgres/db_name $db_name
|
||||
server/autoinstall skip
|
||||
server/hostname $domain
|
||||
server/protocol HTTPS
|
||||
smtp/autoinstall smtp
|
||||
smtp/authentication none
|
||||
smtp/host 127.0.0.1
|
||||
|
@ -123,86 +135,58 @@ EOF
|
|||
|
||||
ynh_store_file_checksum --file="$_openproject_install_dat"
|
||||
|
||||
chmod 750 "/etc/openproject/"
|
||||
chmod -R o-rwx "/etc/openproject/"
|
||||
chown -R $app:$app "/etc/openproject/"
|
||||
|
||||
ynh_replace_string --match_string=".*PORT=.*" --replace_string="export PORT=$port" --target_file="/etc/default/openproject"
|
||||
|
||||
#=================================================
|
||||
# CREATE A POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating a PostgreSQL database..." --weight=1
|
||||
|
||||
ynh_psql_create_user "$db_user" "$db_pwd"
|
||||
ynh_psql_create_db "$db_name" "$db_user" "$db_pwd"
|
||||
|
||||
#=================================================
|
||||
# OPENPROJECT POST-INSTALL
|
||||
#=================================================
|
||||
# Note: This section is undocumented on the installer.
|
||||
|
||||
ynh_script_progression --message="Post-install of OpenProject" --weight=1
|
||||
openproject config:set PORT=$port
|
||||
openproject config:set SERVER_PROTOCOL_FORCE_HTTPS="true"
|
||||
openproject config:set SERVER_HOSTNAME=$domain
|
||||
openproject config:set SERVER_PATH_PREFIX=$path_url
|
||||
|
||||
openproject configure >> "$YNH_STDINFO"
|
||||
|
||||
####=================================================
|
||||
#### SETUP APPLICATION WITH CURL
|
||||
####=================================================
|
||||
###
|
||||
#### Set the app as temporarily public for curl call
|
||||
###ynh_script_progression --message="Configuring SSOwat..." --weight=1
|
||||
###ynh_app_setting_set --app="$app" --key=skipped_uris --value="/"
|
||||
#### Reload SSOwat config
|
||||
###yunohost app ssowatconf
|
||||
###
|
||||
#### Reload Nginx
|
||||
###ynh_systemd_action --service_name=nginx --action=reload
|
||||
###
|
||||
##### TODO REMOVE ? # Installation with curl
|
||||
##### TODO REMOVE ? ynh_script_progression --message="Finalizing installation..." --weight=1
|
||||
##### TODO REMOVE ? ynh_local_curl "/INSTALL_PATH" "key1=value1" "key2=value2" "key3=value3"
|
||||
###
|
||||
#### Remove the public access
|
||||
###if [ $is_public -eq 0 ]
|
||||
###then
|
||||
### ynh_app_setting_delete --app="$app" --key=skipped_uris
|
||||
###fi
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
ynh_script_progression --message="Configuring log rotation..." --weight=1
|
||||
ynh_use_logrotate
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
|
||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
yunohost service add "$app" --log "/var/log/$app/$app.log"
|
||||
yunohost service add $app
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
# Compat YNH<3.5
|
||||
#ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"
|
||||
systemctl restart openproject.service
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
## SETUP FAIL2BAN
|
||||
#ynh_script_progression --message="Configuring fail2ban..." --weight=1
|
||||
#
|
||||
## Create a dedicated fail2ban config
|
||||
#ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login"
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring SSOwat..." --weight=1
|
||||
ynh_script_progression --message="Configuring permissions..."
|
||||
|
||||
# Make app public if necessary
|
||||
if [ $is_public -eq 1 ]
|
||||
then
|
||||
# Everyone can access the app.
|
||||
# The "main" permission is automatically created before the install script.
|
||||
ynh_permission_update --permission="main" --add="visitors"
|
||||
fi
|
||||
|
||||
ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading nginx web server..." --weight=1
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
|
||||
systemctl reload nginx.service
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Installation of $app completed" --last
|
||||
ynh_script_progression --message="Installation of $app completed"
|
||||
|
|
|
@ -12,33 +12,32 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
db_name=$(ynh_app_setting_get --app="$app" --key=db_name)
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
|
||||
|
||||
_homedir=/var/$app
|
||||
_homedir=$(ynh_app_setting_get --app=$app --key=_homedir)
|
||||
|
||||
#=================================================
|
||||
# STANDARD REMOVE
|
||||
#=================================================
|
||||
# REMOVE SERVICE FROM ADMIN PANEL
|
||||
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
||||
#=================================================
|
||||
|
||||
# Remove a service from the admin panel, added by `yunohost service add`
|
||||
if ynh_exec_warn_less yunohost service status "$app" >/dev/null
|
||||
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
||||
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
||||
then
|
||||
ynh_script_progression --message="Removing $app service..." --weight=1
|
||||
yunohost service remove "$app"
|
||||
ynh_script_progression --message="Removing $app service integration..."
|
||||
yunohost service remove $app
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# STOP AND REMOVE SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
|
||||
ynh_script_progression --message="Stopping and removing the systemd service..."
|
||||
|
||||
# Remove the dedicated systemd config
|
||||
ynh_remove_systemd_config
|
||||
|
@ -46,66 +45,51 @@ ynh_remove_systemd_config
|
|||
#=================================================
|
||||
# REMOVE THE POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the PostgreSQL database..." --weight=1
|
||||
ynh_script_progression --message="Removing the PostgreSQL database..."
|
||||
|
||||
# Remove a database if it exists, along with the associated user
|
||||
ynh_psql_remove_db "$db_name" "$db_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..."
|
||||
|
||||
# Remove the dedicated NGINX config
|
||||
ynh_remove_nginx_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing dependencies..." --weight=1
|
||||
ynh_script_progression --message="Removing dependencies..."
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
# SPECIFIC REMOVE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing app main directory..." --weight=1
|
||||
# REMOVE VARIOUS FILES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing various files..."
|
||||
|
||||
# Remove the app directory securely
|
||||
ynh_secure_remove --file="$final_path"
|
||||
ynh_secure_remove --file="$_homedir"
|
||||
ynh_secure_remove --file="/etc/$app/"
|
||||
ynh_secure_remove --file="/etc/apt/sources.list.d/openproject.list"
|
||||
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing nginx web server configuration..." --weight=1
|
||||
|
||||
# Remove the dedicated nginx config
|
||||
ynh_remove_nginx_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
|
||||
|
||||
# Remove the app-specific logrotate config
|
||||
ynh_remove_logrotate
|
||||
|
||||
#=================================================
|
||||
# REMOVE FAIL2BAN CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing fail2ban configuration..." --weight=1
|
||||
|
||||
# Remove the dedicated fail2ban config
|
||||
ynh_remove_fail2ban_config
|
||||
# Remove a directory securely
|
||||
ynh_secure_remove --file="/etc/$app"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# REMOVE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
|
||||
ynh_script_progression --message="Removing the dedicated system user..."
|
||||
|
||||
# Delete a system user
|
||||
ynh_system_user_delete --username="$app"
|
||||
ynh_system_user_delete --username=$app
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Removal of $app completed" --last
|
||||
ynh_script_progression --message="Removal of $app completed"
|
||||
|
|
109
scripts/restore
109
scripts/restore
|
@ -6,121 +6,114 @@
|
|||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
source ../settings/scripts/_common.sh
|
||||
source /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_script_progression --message="Loading settings..." --time --weight=1
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
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)
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE RESTORED
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating restoration parameters..." --time --weight=1
|
||||
|
||||
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 "
|
||||
ynh_script_progression --message="Validating restoration parameters..."
|
||||
|
||||
#=================================================
|
||||
# STANDARD RESTORATION STEPS
|
||||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the NGINX web server configuration..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app main directory..." --time --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="$final_path"
|
||||
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Recreating the dedicated system user..." --time --weight=1
|
||||
ynh_script_progression --message="Recreating the dedicated system user..."
|
||||
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create --username="$app"
|
||||
|
||||
#=================================================
|
||||
# RESTORE USER RIGHTS
|
||||
#=================================================
|
||||
|
||||
# Restore permissions on app files
|
||||
chown -R "$app": "$final_path"
|
||||
|
||||
#=================================================
|
||||
# RESTORE FAIL2BAN CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the fail2ban configuration..." --time --weight=1
|
||||
|
||||
ynh_restore_file "/etc/fail2ban/jail.d/$app.conf"
|
||||
ynh_restore_file "/etc/fail2ban/filter.d/$app.conf"
|
||||
ynh_systemd_action --action=restart --service_name=fail2ban
|
||||
ynh_system_user_create --username=$app
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reinstalling dependencies..." --time --weight=1
|
||||
ynh_script_progression --message="Reinstalling dependencies..."
|
||||
|
||||
# Define and install dependencies
|
||||
ynh_install_app_dependencies "$pkg_dependencies"
|
||||
debian_release=$(lsb_release -r -s)
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_install_extra_app_dependencies --repo="deb https://dl.packager.io/srv/deb/opf/openproject/stable/$PROJECT_VERSION/debian $debian_release main" --package="$extra_pkg_dependencies" --key="https://dl.packager.io/srv/opf/openproject/key"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the PostgreSQL database..." --time --weight=1
|
||||
ynh_script_progression --message="Restoring the PostgreSQL database..."
|
||||
|
||||
exec_as postgres psql < db.postgres
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
||||
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
|
||||
# RESTORE VARIOUS FILES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the systemd configuration..." --time --weight=1
|
||||
ynh_script_progression --message="Restoring various files..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||
systemctl enable "$app.service"
|
||||
ynh_restore_file --origin_path="/etc/$app/"
|
||||
|
||||
chmod 750 "/etc/openproject/"
|
||||
chmod -R o-rwx "/etc/openproject/"
|
||||
chown -R $app:$app "/etc/openproject/"
|
||||
|
||||
openproject config:set PORT=$port
|
||||
openproject config:set SERVER_PROTOCOL_FORCE_HTTPS="true"
|
||||
openproject config:set SERVER_HOSTNAME=$domain
|
||||
openproject config:set SERVER_PATH_PREFIX=$path_url
|
||||
|
||||
openproject configure >> "$YNH_STDINFO"
|
||||
|
||||
#=================================================
|
||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
|
||||
yunohost service add "$app" --log "/var/log/$app/$app.log"
|
||||
yunohost service add $app
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --time --weight=1
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# RELOAD NGINX AND PHP-FPM
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading nginx web server and php-fpm..." --time --weight=1
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
@ -128,4 +121,4 @@ ynh_systemd_action --service_name=nginx --action=reload
|
|||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Restoration completed for $app" --time --last
|
||||
ynh_script_progression --message="Restoration completed for $app"
|
||||
|
|
170
scripts/upgrade
170
scripts/upgrade
|
@ -12,191 +12,109 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --time --weight=1
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app="$app" --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app="$app" --key=path)
|
||||
is_public=$(ynh_app_setting_get --app="$app" --key=is_public)
|
||||
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
|
||||
#language=$(ynh_app_setting_get --app="$app" --key=language)
|
||||
db_name=$(ynh_app_setting_get --app="$app" --key=db_name)
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
language=$(ynh_app_setting_get --app=$app --key=language)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Checking 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
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..." --time --weight=1
|
||||
|
||||
# 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 --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
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --time --weight=1
|
||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
# restore it if the upgrade fails
|
||||
ynh_clean_check_starting
|
||||
# Restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# CHECK THE PATH
|
||||
#=================================================
|
||||
|
||||
# Normalize the URL path syntax
|
||||
# N.B. : this is for app installations before YunoHost 2.7
|
||||
# where this value might be something like /foo/ or foo/
|
||||
# instead of /foo ....
|
||||
# If nobody installed your app before 2.7, then you may
|
||||
# safely remove this line
|
||||
path_url=$(ynh_normalize_url_path --path_url="$path_url")
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..." --time --weight=1
|
||||
ynh_script_progression --message="Stopping a systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name="$app" --action="stop" --log_path="/var/log/$app/$app.log"
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..."
|
||||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
ynh_script_progression --message="Upgrading source files..." --time --weight=1
|
||||
# Cleaning legacy permissions
|
||||
if ynh_legacy_permissions_exists; then
|
||||
ynh_legacy_permissions_delete_all
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path"
|
||||
ynh_app_setting_delete --app=$app --key=is_public
|
||||
fi
|
||||
|
||||
# Create a permission if needed
|
||||
if ! ynh_permission_exists --permission="api"; then
|
||||
ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..."
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading nginx web server configuration..." --time --weight=1
|
||||
ynh_script_progression --message="Upgrading NGINX web server configuration..."
|
||||
|
||||
# Create a dedicated nginx config
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading dependencies..." --time --weight=1
|
||||
ynh_script_progression --message="Upgrading dependencies..."
|
||||
|
||||
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"
|
||||
|
||||
#=================================================
|
||||
# STORE THE CONFIG FILE CHECKSUM
|
||||
#=================================================
|
||||
|
||||
### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
|
||||
### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it.
|
||||
ynh_backup_if_checksum_is_different --file="$final_path/CONFIG_FILE"
|
||||
# Recalculate and store the checksum of the file for the next upgrade.
|
||||
ynh_store_file_checksum --file="$final_path/CONFIG_FILE"
|
||||
|
||||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading logrotate configuration..." --time --weight=1
|
||||
|
||||
# Use logrotate to manage app-specific logfile(s)
|
||||
ynh_use_logrotate --non-append
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading systemd configuration..." --time --weight=1
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
debian_release=$(lsb_release -r -s)
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_install_extra_app_dependencies --repo="deb https://dl.packager.io/srv/deb/opf/openproject/stable/$PROJECT_VERSION/debian $debian_release main" --package="$extra_pkg_dependencies" --key="https://dl.packager.io/srv/opf/openproject/key"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# UPGRADE FAIL2BAN
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reconfiguring fail2ban..." --time --weight=1
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
|
||||
# Create a dedicated fail2ban config
|
||||
ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login"
|
||||
|
||||
#=================================================
|
||||
# SECURE FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
|
||||
# Set permissions on app files
|
||||
chown -R root: "$final_path"
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading SSOwat configuration..." --time --weight=1
|
||||
|
||||
# Make app public if necessary
|
||||
if [ $is_public -eq 1 ]
|
||||
then
|
||||
# unprotected_uris allows SSO credentials to be passed anyway
|
||||
ynh_app_setting_set --app="$app" --key=unprotected_uris --value="/"
|
||||
fi
|
||||
yunohost service add $app
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --time --weight=1
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading nginx web server..." --time --weight=1
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
@ -204,4 +122,4 @@ ynh_systemd_action --service_name=nginx --action=reload
|
|||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Upgrade of $app completed" --time --last
|
||||
ynh_script_progression --message="Upgrade of $app completed"
|
||||
|
|
|
@ -1,88 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Helper to add a repos quickly and without problem. It create a repos.list in $etc/apt/sources.list.d/. It doesn't update the repos, so it must be used with the ynh_add_dependencies.
|
||||
# usage : ynh_add_repos nameoftherepos url
|
||||
# URL IS SOMETHING LIKE : "deb $mirrorurl $prefix(stable or jessie...) $otherprefix(main, non-free, or somting like that)"
|
||||
ynh_add_repo(){
|
||||
local name_repos="$1"
|
||||
local url_repos="$2"
|
||||
echo "# $name_repos
|
||||
${url_repos}"
|
||||
> "/etc/apt/sources.list.d/$name_repos.list"
|
||||
}
|
||||
|
||||
# Helper to pin a repos easily.
|
||||
# usage : ynh_add_pin_repo nameoftherepos nbrofthepin origin
|
||||
# Origin is the name of the orga which set up this repos ex: Debian
|
||||
ynh_add_pin_repo() {
|
||||
local name_repos="$1"
|
||||
local pin="$2"
|
||||
local origin="$3"
|
||||
echo "Package: *
|
||||
Pin: release o=$origin,a=$name_repos
|
||||
Pin-Priority: $pin" \
|
||||
> "/etc/apt/preferences.d/$name_repos"
|
||||
}
|
||||
|
||||
# Add in a secure way backports repo.
|
||||
# usage : ynh_add_secure_backport
|
||||
ynh_add_secure_backport() {
|
||||
local name_repos="debian-backports"
|
||||
local origin="Debian"
|
||||
local lsb_version="$(ynh_get_debian_release)"
|
||||
local url="deb https://ftp.debian.org/debian $lsb_version-backports main"
|
||||
local pin="450"
|
||||
ynh_add_repos $name_repos $url
|
||||
ynh_add_pin_repo $name_repos $origin $pin
|
||||
}
|
||||
|
||||
# Remove a repos easily in a secure way using the ynh_secure_remove helper
|
||||
ynh_rm_secure_repos() {
|
||||
local name_repos=$1
|
||||
ynh_secure_remove "/etc/apt/preferences.d/$name_repos"
|
||||
ynh_secure_remove "/etc/apt/sources.list.d/$name_repos.list"
|
||||
}
|
||||
|
||||
# Backup the repo
|
||||
ynh_backup_repo() {
|
||||
local name_repo=$1
|
||||
ynh_backup "/etc/apt/preference.d/$name_repo"
|
||||
ynh_backup "/etc/apt/sources.list.d/$name_repo.list"
|
||||
}
|
||||
|
||||
ynh_restore_repo() {
|
||||
local name_repo=$1
|
||||
local custom_arch=$2
|
||||
ynh_restore "/etc/apt/preference.d/$name_repo"
|
||||
if [[ custom_arch -ne true ]]
|
||||
local arch_system=$(lsb_release -c)
|
||||
arch_system=$(echo ${arch#Codename:})
|
||||
same_arch=$(cat $name_repo | grep $arch)
|
||||
archs = [jessie, stretch, buster]
|
||||
ynh_restore "/etc/apt/sources.list.d/$name_repo.list"
|
||||
for arch in archs
|
||||
do
|
||||
same_arch=$(cat $name_repo | grep $arch)
|
||||
if [[ same_arch -e arch ]]
|
||||
then
|
||||
echo "Everything is ok"
|
||||
else
|
||||
sed -i "s@$arch@$arch_system@g" "/etc/apt/sources.list.d/$name_repo.list"
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo "Attention: vous avez choisi de personnaliser votre header"
|
||||
ynh_restore "/etc/apt/sources.list.d/$name_repo.list"
|
||||
fi
|
||||
}
|
||||
|
||||
ynh_backup_all_repos() {
|
||||
if [[ $(ls /etc/apt/preference.d/) -ne "" ]]
|
||||
then
|
||||
ynh_backup "/etc/apt/preference.d/*"
|
||||
fi
|
||||
if [[ $(ls /eyc/apt/sources.list.d/) -ne "" ]]
|
||||
then
|
||||
ynh_backup "/etc/apt/sources.list.d/*"
|
||||
fi
|
||||
}
|
2
sources/extra_files/app/.gitignore
vendored
2
sources/extra_files/app/.gitignore
vendored
|
@ -1,2 +0,0 @@
|
|||
*~
|
||||
*.sw[op]
|
2
sources/patches/.gitignore
vendored
2
sources/patches/.gitignore
vendored
|
@ -1,2 +0,0 @@
|
|||
*~
|
||||
*.sw[op]
|
Loading…
Reference in a new issue