mirror of
https://github.com/YunoHost-Apps/pagure_ynh.git
synced 2024-09-03 19:56:19 +02:00
commit
9d0c378dd2
30 changed files with 315 additions and 983 deletions
24
README.md
24
README.md
|
@ -1,5 +1,5 @@
|
||||||
<!--
|
<!--
|
||||||
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
|
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.
|
It shall NOT be edited by hand.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
@ -17,27 +17,21 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
A git-centered forge, python based using pygit2.
|
A git-centered forge, python based using pygit2.
|
||||||
|
**Shipped version:** 5.13.3~ynh3
|
||||||
|
|
||||||
**Shipped version:** 5.13.3~ynh2
|
**Demo:** <https://pagure.io>
|
||||||
|
|
||||||
**Demo:** https://pagure.io
|
|
||||||
|
|
||||||
## Screenshots
|
## Screenshots
|
||||||
|
|
||||||
![Screenshot of Pagure](./doc/screenshots/screenshot.png)
|
![Screenshot of Pagure](./doc/screenshots/screenshot.png)
|
||||||
|
|
||||||
## Disclaimers / important information
|
|
||||||
|
|
||||||
* The admin you choose during the installation has been added to the PAGURE_ADMIN_USERS
|
|
||||||
* After installation, you must create an account with the same username
|
|
||||||
|
|
||||||
## Documentation and resources
|
## Documentation and resources
|
||||||
|
|
||||||
* Official app website: <https://pagure.io/pagure>
|
- Official app website: <https://pagure.io/pagure>
|
||||||
* Official admin documentation: <https://docs.pagure.org/pagure/>
|
- Official admin documentation: <https://docs.pagure.org/pagure/>
|
||||||
* Upstream app code repository: <https://pagure.io/pagure>
|
- Upstream app code repository: <https://pagure.io/pagure>
|
||||||
* YunoHost Store: <https://apps.yunohost.org/app/pagure>
|
- YunoHost Store: <https://apps.yunohost.org/app/pagure>
|
||||||
* Report a bug: <https://github.com/YunoHost-Apps/pagure_ynh/issues>
|
- Report a bug: <https://github.com/YunoHost-Apps/pagure_ynh/issues>
|
||||||
|
|
||||||
## Developer info
|
## Developer info
|
||||||
|
|
||||||
|
@ -45,7 +39,7 @@ Please send your pull request to the [testing branch](https://github.com/YunoHos
|
||||||
|
|
||||||
To try the testing branch, please proceed like that.
|
To try the testing branch, please proceed like that.
|
||||||
|
|
||||||
``` bash
|
```bash
|
||||||
sudo yunohost app install https://github.com/YunoHost-Apps/pagure_ynh/tree/testing --debug
|
sudo yunohost app install https://github.com/YunoHost-Apps/pagure_ynh/tree/testing --debug
|
||||||
or
|
or
|
||||||
sudo yunohost app upgrade pagure -u https://github.com/YunoHost-Apps/pagure_ynh/tree/testing --debug
|
sudo yunohost app upgrade pagure -u https://github.com/YunoHost-Apps/pagure_ynh/tree/testing --debug
|
||||||
|
|
26
README_fr.md
26
README_fr.md
|
@ -1,5 +1,5 @@
|
||||||
<!--
|
<!--
|
||||||
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
|
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.
|
It shall NOT be edited by hand.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
@ -17,27 +17,21 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po
|
||||||
## Vue d’ensemble
|
## Vue d’ensemble
|
||||||
|
|
||||||
|
|
||||||
|
**Version incluse :** 5.13.3~ynh3
|
||||||
|
|
||||||
**Version incluse :** 5.13.3~ynh2
|
**Démo :** <https://pagure.io>
|
||||||
|
|
||||||
**Démo :** https://pagure.io
|
|
||||||
|
|
||||||
## Captures d’écran
|
## Captures d’écran
|
||||||
|
|
||||||
![Capture d’écran de Pagure](./doc/screenshots/screenshot.png)
|
![Capture d’écran de Pagure](./doc/screenshots/screenshot.png)
|
||||||
|
|
||||||
## Avertissements / informations importantes
|
|
||||||
|
|
||||||
* The admin you choose during the installation has been added to the PAGURE_ADMIN_USERS
|
|
||||||
* After installation, you must create an account with the same username
|
|
||||||
|
|
||||||
## Documentations et ressources
|
## Documentations et ressources
|
||||||
|
|
||||||
* Site officiel de l’app : <https://pagure.io/pagure>
|
- Site officiel de l’app : <https://pagure.io/pagure>
|
||||||
* Documentation officielle de l’admin : <https://docs.pagure.org/pagure/>
|
- Documentation officielle de l’admin : <https://docs.pagure.org/pagure/>
|
||||||
* Dépôt de code officiel de l’app : <https://pagure.io/pagure>
|
- Dépôt de code officiel de l’app : <https://pagure.io/pagure>
|
||||||
* YunoHost Store: <https://apps.yunohost.org/app/pagure>
|
- YunoHost Store : <https://apps.yunohost.org/app/pagure>
|
||||||
* Signaler un bug : <https://github.com/YunoHost-Apps/pagure_ynh/issues>
|
- Signaler un bug : <https://github.com/YunoHost-Apps/pagure_ynh/issues>
|
||||||
|
|
||||||
## Informations pour les développeurs
|
## Informations pour les développeurs
|
||||||
|
|
||||||
|
@ -45,10 +39,10 @@ Merci de faire vos pull request sur la [branche testing](https://github.com/Yuno
|
||||||
|
|
||||||
Pour essayer la branche testing, procédez comme suit.
|
Pour essayer la branche testing, procédez comme suit.
|
||||||
|
|
||||||
``` bash
|
```bash
|
||||||
sudo yunohost app install https://github.com/YunoHost-Apps/pagure_ynh/tree/testing --debug
|
sudo yunohost app install https://github.com/YunoHost-Apps/pagure_ynh/tree/testing --debug
|
||||||
ou
|
ou
|
||||||
sudo yunohost app upgrade pagure -u https://github.com/YunoHost-Apps/pagure_ynh/tree/testing --debug
|
sudo yunohost app upgrade pagure -u https://github.com/YunoHost-Apps/pagure_ynh/tree/testing --debug
|
||||||
```
|
```
|
||||||
|
|
||||||
**Plus d’infos sur le packaging d’applications :** <https://yunohost.org/packaging_apps>
|
**Plus d’infos sur le packaging d’applications :** <https://yunohost.org/packaging_apps>
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
;; Test complet
|
|
||||||
; Manifest
|
|
||||||
domain="domain.tld"
|
|
||||||
path="/path"
|
|
||||||
is_public=1
|
|
||||||
admin="john"
|
|
||||||
; 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=0
|
|
||||||
port_already_use=0
|
|
||||||
change_url=1
|
|
||||||
;;; Options
|
|
||||||
Email=
|
|
||||||
Notification=none
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
[alembic]
|
[alembic]
|
||||||
# path to migration scripts
|
# path to migration scripts
|
||||||
script_location = __FINALPATH__/alembic
|
script_location = __INSTALL_DIR__/alembic
|
||||||
|
|
||||||
# template used to generate migration files
|
# template used to generate migration files
|
||||||
# file_template = %%(rev)s_%%(slug)s
|
# file_template = %%(rev)s_%%(slug)s
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
SOURCE_URL=https://releases.pagure.org/pagure/pagure-5.13.3.tar.gz
|
|
||||||
SOURCE_SUM=f684d8193d4c4cf637b465c80cbfece6eb2b1646df3ec4f993adf75ea78d5a1a
|
|
||||||
SOURCE_SUM_PRG=sha256sum
|
|
||||||
SOURCE_FORMAT=tar.gz
|
|
||||||
SOURCE_IN_SUBDIR=true
|
|
||||||
SOURCE_FILENAME=
|
|
||||||
SOURCE_EXTRACT=true
|
|
|
@ -1,12 +1,12 @@
|
||||||
location __PATH__/ {
|
location __PATH__/ {
|
||||||
#Source: https://docs.weblate.org/en/latest/admin/install.html#sample-configuration-for-nginx-and-uwsgi
|
#Source: https://docs.weblate.org/en/latest/admin/install.html#sample-configuration-for-nginx-and-uwsgi
|
||||||
# Path to source
|
# Path to source
|
||||||
alias __FINALPATH__/ ;
|
alias __INSTALL_DIR__/ ;
|
||||||
|
|
||||||
include uwsgi_params;
|
include uwsgi_params;
|
||||||
# Needed for long running operations in admin interface
|
# Needed for long running operations in admin interface
|
||||||
uwsgi_read_timeout 3600;
|
uwsgi_read_timeout 3600;
|
||||||
uwsgi_pass unix://__FINALPATH__/__NAME__.socket;
|
uwsgi_pass unix://__INSTALL_DIR__/__NAME__.socket;
|
||||||
|
|
||||||
# Include SSOWAT user panel.
|
# Include SSOWAT user panel.
|
||||||
include conf.d/yunohost_panel.conf.inc;
|
include conf.d/yunohost_panel.conf.inc;
|
||||||
|
|
|
@ -75,12 +75,12 @@ GIT_URL_SSH = 'ssh://git@__DOMAIN____PATH__'
|
||||||
GIT_URL_GIT = 'git://__DOMAIN____PATH__'
|
GIT_URL_GIT = 'git://__DOMAIN____PATH__'
|
||||||
|
|
||||||
### Folder containing to the git repos
|
### Folder containing to the git repos
|
||||||
GIT_FOLDER = '__DATADIR__/repos'
|
GIT_FOLDER = '__DATA_DIR__/repos'
|
||||||
|
|
||||||
REPOSPANNER_PSEUDO_FOLDER = '__DATADIR__/pseudo'
|
REPOSPANNER_PSEUDO_FOLDER = '__DATA_DIR__/pseudo'
|
||||||
|
|
||||||
### Folder containing the clones for the remote pull-requests
|
### Folder containing the clones for the remote pull-requests
|
||||||
REMOTE_GIT_FOLDER = '__DATADIR__/remotes'
|
REMOTE_GIT_FOLDER = '__DATA_DIR__/remotes'
|
||||||
|
|
||||||
### Whether to enable scanning for viruses in attachments
|
### Whether to enable scanning for viruses in attachments
|
||||||
VIRUS_SCAN_ATTACHMENTS = False
|
VIRUS_SCAN_ATTACHMENTS = False
|
||||||
|
|
|
@ -9,7 +9,7 @@ import pkg_resources
|
||||||
|
|
||||||
# Set the environment variable pointing to the configuration file
|
# Set the environment variable pointing to the configuration file
|
||||||
import os
|
import os
|
||||||
os.environ['PAGURE_CONFIG'] = '__FINALPATH__/pagure.cfg'
|
os.environ['PAGURE_CONFIG'] = '__INSTALL_DIR__/pagure.cfg'
|
||||||
|
|
||||||
# Set the environment variable if the tmp folder needs to be moved
|
# Set the environment variable if the tmp folder needs to be moved
|
||||||
# Might be necessary to work around bug in libgit2:
|
# Might be necessary to work around bug in libgit2:
|
||||||
|
@ -20,7 +20,7 @@ os.environ['TEMP'] = '/var/tmp/'
|
||||||
# The following is only needed if you did not install pagure
|
# The following is only needed if you did not install pagure
|
||||||
# as a python module (for example if you run it from a git clone).
|
# as a python module (for example if you run it from a git clone).
|
||||||
#import sys
|
#import sys
|
||||||
#sys.path.insert(0, '__FINALPATH__/')
|
#sys.path.insert(0, '__INSTALL_DIR__/')
|
||||||
|
|
||||||
|
|
||||||
# The most important line to make the wsgi working
|
# The most important line to make the wsgi working
|
||||||
|
|
|
@ -7,9 +7,9 @@ Documentation=https://pagure.io/pagure
|
||||||
Type=simple
|
Type=simple
|
||||||
User=__APP__
|
User=__APP__
|
||||||
Group=__APP__
|
Group=__APP__
|
||||||
WorkingDirectory=__FINALPATH__/
|
WorkingDirectory=__INSTALL_DIR__/
|
||||||
ExecStart=__FINALPATH__/venv/bin/celery -A pagure.lib.tasks worker --loglevel=info -c 1 -Q authorized_keys_queue
|
ExecStart=__INSTALL_DIR__/venv/bin/celery -A pagure.lib.tasks worker --loglevel=info -c 1 -Q authorized_keys_queue
|
||||||
Environment="PAGURE_CONFIG=__FINALPATH__/pagure.cfg"
|
Environment="PAGURE_CONFIG=__INSTALL_DIR__/pagure.cfg"
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
|
|
@ -7,9 +7,9 @@ Documentation=https://pagure.io/pagure
|
||||||
Type=simple
|
Type=simple
|
||||||
User=__APP__
|
User=__APP__
|
||||||
Group=__APP__
|
Group=__APP__
|
||||||
WorkingDirectory=__FINALPATH__/
|
WorkingDirectory=__INSTALL_DIR__/
|
||||||
ExecStart=__FINALPATH__/venv/bin/celery -A pagure.lib.tasks_services worker --loglevel=info -Q pagure_ci
|
ExecStart=__INSTALL_DIR__/venv/bin/celery -A pagure.lib.tasks_services worker --loglevel=info -Q pagure_ci
|
||||||
Environment="PAGURE_CONFIG=__FINALPATH__/pagure.cfg"
|
Environment="PAGURE_CONFIG=__INSTALL_DIR__/pagure.cfg"
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
|
|
@ -7,8 +7,8 @@ Documentation=https://pagure.io/pagure
|
||||||
Type=simple
|
Type=simple
|
||||||
User=__APP__
|
User=__APP__
|
||||||
Group=__APP__
|
Group=__APP__
|
||||||
WorkingDirectory=__FINALPATH__/
|
WorkingDirectory=__INSTALL_DIR__/
|
||||||
ExecStart=__FINALPATH__/venv/bin/python3 __FINALPATH__/pagure-ev/pagure_stream_server.py
|
ExecStart=__INSTALL_DIR__/venv/bin/python3 __INSTALL_DIR__/pagure-ev/pagure_stream_server.py
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
|
|
@ -7,9 +7,9 @@ Documentation=https://pagure.io/pagure
|
||||||
Type=simple
|
Type=simple
|
||||||
User=__APP__
|
User=__APP__
|
||||||
Group=__APP__
|
Group=__APP__
|
||||||
WorkingDirectory=__FINALPATH__/
|
WorkingDirectory=__INSTALL_DIR__/
|
||||||
ExecStart=__FINALPATH__/venv/bin/celery -A pagure.lib.tasks worker --loglevel=info -c 1 -Q gitolite_queue
|
ExecStart=__INSTALL_DIR__/venv/bin/celery -A pagure.lib.tasks worker --loglevel=info -c 1 -Q gitolite_queue
|
||||||
Environment="PAGURE_CONFIG=__FINALPATH__/pagure.cfg"
|
Environment="PAGURE_CONFIG=__INSTALL_DIR__/pagure.cfg"
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
|
|
@ -7,9 +7,9 @@ Documentation=https://pagure.io/pagure
|
||||||
Type=simple
|
Type=simple
|
||||||
User=__APP__
|
User=__APP__
|
||||||
Group=__APP__
|
Group=__APP__
|
||||||
WorkingDirectory=__FINALPATH__/
|
WorkingDirectory=__INSTALL_DIR__/
|
||||||
ExecStart=__FINALPATH__/venv/bin/celery -A pagure.lib.tasks_services worker --loglevel=info -Q pagure_loadjson
|
ExecStart=__INSTALL_DIR__/venv/bin/celery -A pagure.lib.tasks_services worker --loglevel=info -Q pagure_loadjson
|
||||||
Environment="PAGURE_CONFIG=__FINALPATH__/pagure.cfg"
|
Environment="PAGURE_CONFIG=__INSTALL_DIR__/pagure.cfg"
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
|
|
@ -7,9 +7,9 @@ Documentation=https://pagure.io/pagure
|
||||||
Type=simple
|
Type=simple
|
||||||
User=__APP__
|
User=__APP__
|
||||||
Group=__APP__
|
Group=__APP__
|
||||||
WorkingDirectory=__FINALPATH__/
|
WorkingDirectory=__INSTALL_DIR__/
|
||||||
ExecStart=__FINALPATH__/venv/bin/celery -A pagure.lib.tasks_services worker --loglevel=info -Q pagure_logcom
|
ExecStart=__INSTALL_DIR__/venv/bin/celery -A pagure.lib.tasks_services worker --loglevel=info -Q pagure_logcom
|
||||||
Environment="PAGURE_CONFIG=__FINALPATH__/pagure.cfg"
|
Environment="PAGURE_CONFIG=__INSTALL_DIR__/pagure.cfg"
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
|
|
@ -7,8 +7,8 @@ Documentation=https://pagure.io/pagure
|
||||||
Type=simple
|
Type=simple
|
||||||
User=__APP__
|
User=__APP__
|
||||||
Group=__APP__
|
Group=__APP__
|
||||||
WorkingDirectory=__FINALPATH__/
|
WorkingDirectory=__INSTALL_DIR__/
|
||||||
ExecStart=__FINALPATH__/venv/bin/python3 __FINALPATH__/pagure-milters/comment_email_milter.py
|
ExecStart=__INSTALL_DIR__/venv/bin/python3 __INSTALL_DIR__/pagure-milters/comment_email_milter.py
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
|
|
@ -7,9 +7,9 @@ Documentation=https://pagure.io/pagure
|
||||||
Type=simple
|
Type=simple
|
||||||
User=__APP__
|
User=__APP__
|
||||||
Group=__APP__
|
Group=__APP__
|
||||||
WorkingDirectory=__FINALPATH__/
|
WorkingDirectory=__INSTALL_DIR__/
|
||||||
ExecStart=__FINALPATH__/venv/bin/celery -A pagure.lib.tasks_mirror worker --loglevel=info -Q pagure_mirror
|
ExecStart=__INSTALL_DIR__/venv/bin/celery -A pagure.lib.tasks_mirror worker --loglevel=info -Q pagure_mirror
|
||||||
Environment="PAGURE_CONFIG=__FINALPATH__/pagure.cfg"
|
Environment="PAGURE_CONFIG=__INSTALL_DIR__/pagure.cfg"
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
|
|
@ -7,9 +7,9 @@ Documentation=https://pagure.io/pagure
|
||||||
Type=simple
|
Type=simple
|
||||||
User=__APP__
|
User=__APP__
|
||||||
Group=__APP__
|
Group=__APP__
|
||||||
WorkingDirectory=__FINALPATH__/
|
WorkingDirectory=__INSTALL_DIR__/
|
||||||
ExecStart=__FINALPATH__/venv/bin/celery -A pagure.lib.tasks_services worker --loglevel=info -Q pagure_webhook
|
ExecStart=__INSTALL_DIR__/venv/bin/celery -A pagure.lib.tasks_services worker --loglevel=info -Q pagure_webhook
|
||||||
Environment="PAGURE_CONFIG=__FINALPATH__/pagure.cfg"
|
Environment="PAGURE_CONFIG=__INSTALL_DIR__/pagure.cfg"
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
|
|
@ -7,9 +7,9 @@ Documentation=https://pagure.io/pagure
|
||||||
Type=simple
|
Type=simple
|
||||||
User=__APP__
|
User=__APP__
|
||||||
Group=__APP__
|
Group=__APP__
|
||||||
WorkingDirectory=__FINALPATH__/
|
WorkingDirectory=__INSTALL_DIR__/
|
||||||
ExecStart=__FINALPATH__/venv/bin/celery -A pagure.lib.tasks worker --loglevel=info
|
ExecStart=__INSTALL_DIR__/venv/bin/celery -A pagure.lib.tasks worker --loglevel=info
|
||||||
Environment="PAGURE_CONFIG=__FINALPATH__/pagure.cfg"
|
Environment="PAGURE_CONFIG=__INSTALL_DIR__/pagure.cfg"
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
|
|
@ -4,14 +4,14 @@ gid = __APP__
|
||||||
plugins = python3
|
plugins = python3
|
||||||
master = true
|
master = true
|
||||||
protocol = uwsgi
|
protocol = uwsgi
|
||||||
socket = __FINALPATH__/__APP__.socket
|
socket = __INSTALL_DIR__/__APP__.socket
|
||||||
chmod-socket = 660
|
chmod-socket = 660
|
||||||
virtualenv = __FINALPATH__/venv
|
virtualenv = __INSTALL_DIR__/venv
|
||||||
mount = __PATH__=__FINALPATH__/pagure.wsgi
|
mount = __PATH__=__INSTALL_DIR__/pagure.wsgi
|
||||||
manage-script-name = true
|
manage-script-name = true
|
||||||
# Python related settings
|
# Python related settings
|
||||||
# the base directory (full path)
|
# the base directory (full path)
|
||||||
chdir = __FINALPATH__/
|
chdir = __INSTALL_DIR__/
|
||||||
enable-threads = true
|
enable-threads = true
|
||||||
close-on-exec = true
|
close-on-exec = true
|
||||||
|
|
||||||
|
|
|
@ -1,52 +0,0 @@
|
||||||
{
|
|
||||||
"name": "Pagure",
|
|
||||||
"id": "pagure",
|
|
||||||
"packaging_format": 1,
|
|
||||||
"description": {
|
|
||||||
"en": "A git-centered forge, python based using pygit2."
|
|
||||||
},
|
|
||||||
"version": "5.13.3~ynh2",
|
|
||||||
"url": "https://pagure.io/pagure",
|
|
||||||
"upstream": {
|
|
||||||
"license": "AGPL-3.0",
|
|
||||||
"website": "https://pagure.io/pagure",
|
|
||||||
"demo": "https://pagure.io",
|
|
||||||
"admindoc": "https://docs.pagure.org/pagure/",
|
|
||||||
"code": "https://pagure.io/pagure"
|
|
||||||
},
|
|
||||||
"license": "AGPL-3.0",
|
|
||||||
"maintainer": {
|
|
||||||
"name": "Jean-Baptiste Holcroft",
|
|
||||||
"email": "jean-baptiste@holcroft.fr"
|
|
||||||
},
|
|
||||||
"requirements": {
|
|
||||||
"yunohost": ">= 4.3.0"
|
|
||||||
},
|
|
||||||
"multi_instance": false,
|
|
||||||
"services": [
|
|
||||||
"nginx"
|
|
||||||
],
|
|
||||||
"arguments": {
|
|
||||||
"install": [
|
|
||||||
{
|
|
||||||
"name": "domain",
|
|
||||||
"type": "domain"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "path",
|
|
||||||
"type": "path",
|
|
||||||
"example": "/pagure",
|
|
||||||
"default": "/pagure"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "is_public",
|
|
||||||
"type": "boolean",
|
|
||||||
"default": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "admin",
|
|
||||||
"type": "user"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
85
manifest.toml
Normal file
85
manifest.toml
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json
|
||||||
|
|
||||||
|
packaging_format = 2
|
||||||
|
|
||||||
|
id = "pagure"
|
||||||
|
name = "Pagure"
|
||||||
|
description.en = "A git-centered forge, python based using pygit2."
|
||||||
|
|
||||||
|
version = "5.13.3~ynh3"
|
||||||
|
|
||||||
|
maintainers = ["Jean-Baptiste Holcroft"]
|
||||||
|
|
||||||
|
[upstream]
|
||||||
|
license = "AGPL-3.0"
|
||||||
|
website = "https://pagure.io/pagure"
|
||||||
|
demo = "https://pagure.io"
|
||||||
|
admindoc = "https://docs.pagure.org/pagure/"
|
||||||
|
code = "https://pagure.io/pagure"
|
||||||
|
cpe = "cpe:2.3:a:redhat:pagure"
|
||||||
|
|
||||||
|
[integration]
|
||||||
|
yunohost = ">= 11.2"
|
||||||
|
architectures = "all"
|
||||||
|
multi_instance = false
|
||||||
|
ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials.
|
||||||
|
sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal.
|
||||||
|
disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ...
|
||||||
|
ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
|
||||||
|
ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
|
||||||
|
|
||||||
|
[install]
|
||||||
|
[install.domain]
|
||||||
|
type = "domain"
|
||||||
|
|
||||||
|
[install.path]
|
||||||
|
type = "path"
|
||||||
|
default = "/pagure"
|
||||||
|
|
||||||
|
[install.init_main_permission]
|
||||||
|
type = "group"
|
||||||
|
default = "visitors"
|
||||||
|
|
||||||
|
[install.admin]
|
||||||
|
type = "user"
|
||||||
|
|
||||||
|
[resources]
|
||||||
|
[resources.sources.main]
|
||||||
|
url = "https://releases.pagure.org/pagure/pagure-5.13.3.tar.gz"
|
||||||
|
sha256 = "f684d8193d4c4cf637b465c80cbfece6eb2b1646df3ec4f993adf75ea78d5a1a"
|
||||||
|
|
||||||
|
|
||||||
|
[resources.system_user]
|
||||||
|
|
||||||
|
[resources.install_dir]
|
||||||
|
|
||||||
|
[resources.data_dir]
|
||||||
|
subdirs = ["repos", "remotes", "attachments", "releases"]
|
||||||
|
|
||||||
|
[resources.permissions]
|
||||||
|
main.url = "/"
|
||||||
|
|
||||||
|
[resources.apt]
|
||||||
|
packages = [
|
||||||
|
"gcc",
|
||||||
|
"git",
|
||||||
|
"libffi-dev",
|
||||||
|
"libgit2-dev",
|
||||||
|
"libjpeg-dev",
|
||||||
|
"libpq-dev",
|
||||||
|
"python3-cffi",
|
||||||
|
"python3-dev",
|
||||||
|
"python3-gdbm",
|
||||||
|
"python3-psycopg2",
|
||||||
|
"python3-venv",
|
||||||
|
"python3",
|
||||||
|
"redis-server",
|
||||||
|
"uwsgi-plugin-python3",
|
||||||
|
"uwsgi",
|
||||||
|
"virtualenv",
|
||||||
|
|
||||||
|
"postgresql",
|
||||||
|
]
|
||||||
|
|
||||||
|
[resources.database]
|
||||||
|
type = "postgresql"
|
|
@ -4,9 +4,18 @@
|
||||||
# COMMON VARIABLES
|
# COMMON VARIABLES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# dependencies used by the app
|
services=(
|
||||||
#pkg_dependencies="git python-dev libgit2-dev redis-server libjpeg-dev gcc libffi-dev virtualenv python-virtualenv python-cffi python-gdbm python-psycopg2 postgresql uwsgi uwsgi-plugin-python"
|
"authorized_keys_worker"
|
||||||
pkg_dependencies="git python3 python3-dev libgit2-dev redis-server libjpeg-dev gcc libffi-dev python3-venv python3-cffi python3-gdbm python3-psycopg2 libpq-dev postgresql"
|
"ci"
|
||||||
|
# "ev_server"
|
||||||
|
"gitolite_worker"
|
||||||
|
"loadjson"
|
||||||
|
"logcom"
|
||||||
|
# "milters"
|
||||||
|
"mirror"
|
||||||
|
"webhook"
|
||||||
|
"worker"
|
||||||
|
)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PERSONAL HELPERS
|
# PERSONAL HELPERS
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -10,28 +8,6 @@
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
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_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)
|
|
||||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -41,36 +17,25 @@ ynh_print_info --message="Declaring files to be backed up..."
|
||||||
# BACKUP THE APP MAIN DIR
|
# BACKUP THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="$final_path"
|
ynh_backup --src_path="$install_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE DATA DIR
|
# BACKUP THE DATA DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="$datadir" --is_big
|
ynh_backup --src_path="$data_dir" --is_big
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# BACKUP THE SYSTEM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
for service in "${services[@]}"; do
|
||||||
# SPECIFIC BACKUP
|
ynh_backup --src_path="/etc/systemd/system/${app}_${service}.service"
|
||||||
#=================================================
|
done
|
||||||
# BACKUP SYSTEMD
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/systemd/system/${app}_authorized_keys_worker.service"
|
# ynh_add_config --template="pagure.wsgi" --destination="$install_dir/pagure.wsgi"
|
||||||
ynh_backup --src_path="/etc/systemd/system/${app}_ci.service"
|
|
||||||
#ynh_backup --src_path="/etc/systemd/system/${app}_ev_server.service"
|
|
||||||
ynh_backup --src_path="/etc/systemd/system/${app}_gitolite_worker.service"
|
|
||||||
ynh_backup --src_path="/etc/systemd/system/${app}_loadjson.service"
|
|
||||||
ynh_backup --src_path="/etc/systemd/system/${app}_logcom.service"
|
|
||||||
#ynh_backup --src_path="/etc/systemd/system/${app}_milters.service"
|
|
||||||
ynh_backup --src_path="/etc/systemd/system/${app}_mirror.service"
|
|
||||||
ynh_backup --src_path="/etc/systemd/system/${app}_webhook.service"
|
|
||||||
ynh_backup --src_path="/etc/systemd/system/${app}_worker.service"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE POSTGRESQL DATABASE
|
# BACKUP THE POSTGRESQL DATABASE
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC STARTING
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -11,87 +9,14 @@ source ynh_redis
|
||||||
source ynh_uwsgi_service__2
|
source ynh_uwsgi_service__2
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RETRIEVE ARGUMENTS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
old_domain=$YNH_APP_OLD_DOMAIN
|
|
||||||
old_path=$YNH_APP_OLD_PATH
|
|
||||||
|
|
||||||
new_domain=$YNH_APP_NEW_DOMAIN
|
|
||||||
new_path=$YNH_APP_NEW_PATH
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Loading installation settings..."
|
|
||||||
|
|
||||||
# Needed for helper "ynh_add_nginx_config"
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|
||||||
|
|
||||||
# Add settings here as needed by your application
|
|
||||||
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
|
||||||
db_user=$db_name
|
|
||||||
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
|
||||||
redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)
|
|
||||||
secret_key=$(ynh_app_setting_get --app=$app --key=secret_key)
|
|
||||||
salt_email=$(ynh_app_setting_get --app=$app --key=salt_email)
|
|
||||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# 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
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
change_domain=0
|
|
||||||
if [ "$old_domain" != "$new_domain" ]
|
|
||||||
then
|
|
||||||
change_domain=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
change_path=0
|
|
||||||
if [ "$old_path" != "$new_path" ]
|
|
||||||
then
|
|
||||||
change_path=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD MODIFICATIONS
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STOP SYSTEMD SERVICE
|
# STOP SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Stopping a systemd service..."
|
ynh_script_progression --message="Stopping a systemd service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=${app}_authorized_keys_worker --action="stop" --log_path="systemd"
|
for service in "${services[@]}"; do
|
||||||
ynh_systemd_action --service_name=${app}_ci --action="stop" --log_path="systemd"
|
ynh_systemd_action --service_name="${app}_${service}" --action="stop" --log_path="systemd"
|
||||||
#ynh_systemd_action --service_name=${app}_ev_server --action="stop" --log_path="systemd"
|
done
|
||||||
ynh_systemd_action --service_name=${app}_gitolite_worker --action="stop" --log_path="systemd"
|
|
||||||
ynh_systemd_action --service_name=${app}_loadjson --action="stop" --log_path="systemd"
|
|
||||||
ynh_systemd_action --service_name=${app}_logcom --action="stop" --log_path="systemd"
|
|
||||||
#ynh_systemd_action --service_name=${app}_milters --action="stop" --log_path="systemd"
|
|
||||||
ynh_systemd_action --service_name=${app}_mirror --action="stop" --log_path="systemd"
|
|
||||||
ynh_systemd_action --service_name=${app}_webhook --action="stop" --log_path="systemd"
|
|
||||||
ynh_systemd_action --service_name=${app}_worker --action="stop" --log_path="systemd"
|
|
||||||
ynh_systemd_action --service_name="uwsgi-app@$app.service" --action="stop" --log_path="systemd"
|
ynh_systemd_action --service_name="uwsgi-app@$app.service" --action="stop" --log_path="systemd"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -99,74 +24,31 @@ ynh_systemd_action --service_name="uwsgi-app@$app.service" --action="stop" --log
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating NGINX web server configuration..."
|
ynh_script_progression --message="Updating NGINX web server configuration..."
|
||||||
|
|
||||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
ynh_change_url_nginx_config
|
||||||
|
|
||||||
# Change the path in the NGINX config file
|
|
||||||
if [ $change_path -eq 1 ]
|
|
||||||
then
|
|
||||||
# Make a backup of the original NGINX config file if modified
|
|
||||||
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
|
|
||||||
# Set global variables for NGINX helper
|
|
||||||
domain="$old_domain"
|
|
||||||
path_url="$new_path"
|
|
||||||
# Create a dedicated NGINX config
|
|
||||||
ynh_add_nginx_config
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Change the domain for NGINX
|
|
||||||
if [ $change_domain -eq 1 ]
|
|
||||||
then
|
|
||||||
# Delete file checksum for the old conf file location
|
|
||||||
ynh_delete_file_checksum --file="$nginx_conf_path"
|
|
||||||
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
|
||||||
# Store file checksum for the new config file location
|
|
||||||
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC MODIFICATIONS
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPDATE A CONFIG FILE
|
# UPDATE A CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating a configuration file..."
|
ynh_script_progression --message="Updating a configuration file..."
|
||||||
|
|
||||||
domain=$new_domain
|
ynh_add_config --template="pagure.cfg.sample" --destination="$install_dir/pagure.cfg"
|
||||||
path_url=$new_path
|
|
||||||
|
|
||||||
ynh_add_config --template="../conf/pagure.cfg.sample" --destination="$final_path/pagure.cfg"
|
chmod 400 "$install_dir/pagure.cfg"
|
||||||
|
chown "$app:$app" "$install_dir/pagure.cfg"
|
||||||
|
|
||||||
chmod 400 "$final_path/pagure.cfg"
|
ynh_add_config --template="pagure.wsgi" --destination="$install_dir/pagure.wsgi"
|
||||||
chown $app:$app "$final_path/pagure.cfg"
|
|
||||||
|
|
||||||
ynh_add_config --template="../conf/pagure.wsgi" --destination="$final_path/pagure.wsgi"
|
|
||||||
ynh_add_uwsgi_service --service="$app" --template="uwsgi.ini"
|
ynh_add_uwsgi_service --service="$app" --template="uwsgi.ini"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALISATION
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..."
|
ynh_script_progression --message="Starting a systemd service..."
|
||||||
|
|
||||||
# Start a systemd service
|
# Start a systemd service
|
||||||
ynh_systemd_action --service_name=${app}_authorized_keys_worker --action="start" --log_path="systemd" --line_match="ready"
|
for service in "${services[@]}"; do
|
||||||
ynh_systemd_action --service_name=${app}_ci --action="start" --log_path="systemd" --line_match="ready"
|
ynh_systemd_action --service_name="${app}_${service}" --action="start" --log_path="systemd" --line_match="ready"
|
||||||
#ynh_systemd_action --service_name=${app}_ev_server --action="start" --log_path="systemd" --line_match="ready"
|
done
|
||||||
ynh_systemd_action --service_name=${app}_gitolite_worker --action="start" --log_path="systemd" --line_match="ready"
|
ynh_systemd_action --service_name="uwsgi-app@$app.service" --action="start" --log_path="systemd"
|
||||||
ynh_systemd_action --service_name=${app}_loadjson --action="start" --log_path="systemd" --line_match="ready"
|
|
||||||
ynh_systemd_action --service_name=${app}_logcom --action="start" --log_path="systemd" --line_match="ready"
|
|
||||||
#ynh_systemd_action --service_name=${app}_milters --action="start" --log_path="systemd" --line_match="ready"
|
|
||||||
ynh_systemd_action --service_name=${app}_mirror --action="start" --log_path="systemd" --line_match="ready"
|
|
||||||
ynh_systemd_action --service_name=${app}_webhook --action="start" --log_path="systemd" --line_match="ready"
|
|
||||||
ynh_systemd_action --service_name=${app}_worker --action="start" --log_path="systemd" --line_match="ready"
|
|
||||||
ynh_systemd_action --service_name="uwsgi-app@$app.service" --action="start" --log_path="systemd" --line_match="Started"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RELOAD NGINX
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reloading NGINX web server..."
|
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
240
scripts/install
240
scripts/install
|
@ -1,7 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -12,233 +10,95 @@ source ynh_uwsgi_service__2
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MANAGE SCRIPT FAILURE
|
# INITIALIZE AND STORE SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_clean_setup () {
|
|
||||||
ynh_clean_check_starting
|
|
||||||
}
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
|
||||||
path_url=$YNH_APP_ARG_PATH
|
|
||||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
|
||||||
admin=$YNH_APP_ARG_ADMIN
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
secret_key=$(ynh_string_random)
|
secret_key=$(ynh_string_random)
|
||||||
|
ynh_app_setting_set --app="$app" --key="secret_key" --value="$secret_key"
|
||||||
salt_email=$(ynh_string_random)
|
salt_email=$(ynh_string_random)
|
||||||
|
ynh_app_setting_set --app="$app" --key="salt_email" --value="$salt_email"
|
||||||
#=================================================
|
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Validating installation parameters..."
|
|
||||||
|
|
||||||
final_path=/var/www/$app
|
|
||||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
|
||||||
|
|
||||||
# Register (book) web path
|
|
||||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STORE SETTINGS FROM MANIFEST
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Storing installation settings..."
|
|
||||||
|
|
||||||
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=secret_key --value=$secret_key
|
|
||||||
ynh_app_setting_set --app=$app --key=salt_email --value=$salt_email
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD MODIFICATIONS
|
|
||||||
#=================================================
|
|
||||||
# INSTALL DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Installing dependencies..."
|
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CREATE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configuring system user..."
|
|
||||||
|
|
||||||
# Create a system user
|
|
||||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setting up source files..."
|
ynh_script_progression --message="Setting up source files..."
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
ynh_setup_source --dest_dir="$final_path"
|
ynh_setup_source --dest_dir="$install_dir"
|
||||||
|
|
||||||
chmod 750 "$final_path"
|
chmod -R o-rwx "$install_dir"
|
||||||
chmod -R o-rwx "$final_path"
|
chown -R "$app:www-data" "$install_dir"
|
||||||
chown -R $app:www-data "$final_path"
|
|
||||||
|
chmod -R o-rwx "$data_dir"
|
||||||
|
chown -R "$app:www-data" "$data_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# APP INITIAL CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring NGINX web server..."
|
ynh_script_progression --message="Adding $app's configuration files..." --weight=1
|
||||||
|
|
||||||
# Create a dedicated NGINX config
|
|
||||||
ynh_add_nginx_config
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC SETUP
|
|
||||||
#=================================================
|
|
||||||
# CREATE DATA DIRECTORY
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Creating a data directory..."
|
|
||||||
|
|
||||||
datadir=/home/yunohost.app/$app
|
|
||||||
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
|
||||||
|
|
||||||
mkdir -p $datadir
|
|
||||||
mkdir -p "${datadir}"/{repos,remotes,attachments,releases}
|
|
||||||
|
|
||||||
chmod 750 "$datadir"
|
|
||||||
chmod -R o-rwx "$datadir"
|
|
||||||
chown -R $app:www-data "$datadir"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# ADD A CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Adding a configuration file..."
|
|
||||||
|
|
||||||
redis_db=$(ynh_redis_get_free_db)
|
redis_db=$(ynh_redis_get_free_db)
|
||||||
ynh_app_setting_set --app=$app --key=redis_db --value=$redis_db
|
ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db"
|
||||||
|
|
||||||
ynh_add_config --template="../conf/pagure.cfg.sample" --destination="$final_path/pagure.cfg"
|
ynh_add_config --template="pagure.cfg.sample" --destination="$install_dir/pagure.cfg"
|
||||||
|
|
||||||
chmod 400 "$final_path/pagure.cfg"
|
chmod 400 "$install_dir/pagure.cfg"
|
||||||
chown $app:$app "$final_path/pagure.cfg"
|
chown "$app:$app" "$install_dir/pagure.cfg"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SETUP SYSTEMD
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configuring a systemd service..."
|
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
|
||||||
ynh_add_systemd_config --service="${app}_authorized_keys_worker" --template="pagure_authorized_keys_worker.service"
|
|
||||||
ynh_add_systemd_config --service="${app}_ci" --template="pagure_ci.service"
|
|
||||||
#ynh_add_systemd_config --service="${app}_ev_server" --template="pagure_ev_server.service"
|
|
||||||
ynh_add_systemd_config --service="${app}_gitolite_worker" --template="pagure_gitolite_worker.service"
|
|
||||||
ynh_add_systemd_config --service="${app}_loadjson" --template="pagure_loadjson.service"
|
|
||||||
ynh_add_systemd_config --service="${app}_logcom" --template="pagure_logcom.service"
|
|
||||||
#ynh_add_systemd_config --service="${app}_milters" --template="pagure_milters.service"
|
|
||||||
ynh_add_systemd_config --service="${app}_mirror" --template="pagure_mirror.service"
|
|
||||||
ynh_add_systemd_config --service="${app}_webhook" --template="pagure_webhook.service"
|
|
||||||
ynh_add_systemd_config --service="${app}_worker" --template="pagure_worker.service"
|
|
||||||
|
|
||||||
ynh_add_config --template="../conf/pagure.wsgi" --destination="$final_path/pagure.wsgi"
|
|
||||||
ynh_add_uwsgi_service --service="$app" --template="uwsgi.ini"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BUILD APP
|
# BUILD APP
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Building app..."
|
ynh_script_progression --message="Building app..."
|
||||||
|
|
||||||
pushd "$final_path"
|
pushd "$install_dir"
|
||||||
python3 -m venv venv
|
ynh_exec_as "$app" python3 -m venv venv
|
||||||
source ./venv/bin/activate
|
ynh_exec_as "$app" "$install_dir/venv/bin/python3" -m pip install --upgrade pip
|
||||||
pip install --upgrade pip
|
ynh_exec_as "$app" "$install_dir/venv/bin/python3" -m pip install wheel
|
||||||
pip install wheel
|
ynh_exec_as "$app" "$install_dir/venv/bin/python3" -m pip install cffi
|
||||||
pip install cffi
|
ynh_exec_as "$app" "$install_dir/venv/bin/python3" -m pip install psycopg2
|
||||||
pip install psycopg2
|
ynh_exec_as "$app" "$install_dir/venv/bin/python3" -m pip install pyyaml
|
||||||
pip install pyyaml
|
ynh_exec_as "$app" "$install_dir/venv/bin/python3" -m pip install pygit2
|
||||||
pip install pygit2
|
ynh_exec_as "$app" "$install_dir/venv/bin/python3" -m pip install "jinja2<3.1.0"
|
||||||
pip install "jinja2<3.1.0"
|
ynh_exec_as "$app" "$install_dir/venv/bin/python3" -m pip install -r requirements.txt
|
||||||
pip install -r requirements.txt
|
|
||||||
ynh_add_config --template="../conf/alembic.ini" --destination="$final_path/alembic.ini"
|
ynh_add_config --template="alembic.ini" --destination="$install_dir/alembic.ini"
|
||||||
PAGURE_CONFIG=${final_path}/pagure.cfg python createdb.py --initial alembic.ini 2>&1
|
ynh_exec_as "$app" PAGURE_CONFIG="${install_dir}/pagure.cfg" "$install_dir/venv/bin/python3" createdb.py --initial alembic.ini 2>&1
|
||||||
popd
|
popd
|
||||||
|
|
||||||
ynh_replace_string --match_string="validators.Required" --replace_string="validators.DataRequired" --target_file="$final_path/pagure/forms.py"
|
ynh_replace_string --match_string="validators.Required" --replace_string="validators.DataRequired" --target_file="$install_dir/pagure/forms.py"
|
||||||
|
|
||||||
chmod 750 "$final_path"
|
chmod -R o-rwx "$install_dir"
|
||||||
chmod -R o-rwx "$final_path"
|
chown -R "$app:www-data" "$install_dir"
|
||||||
chown -R $app:www-data "$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# SYSTEM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
|
||||||
|
|
||||||
yunohost service add ${app}_authorized_keys_worker
|
# Create a dedicated NGINX config
|
||||||
yunohost service add ${app}_ci
|
ynh_add_nginx_config
|
||||||
#yunohost service add ${app}_ev_server
|
|
||||||
yunohost service add ${app}_gitolite_worker
|
# Create a dedicated systemd config
|
||||||
yunohost service add ${app}_loadjson
|
for service in "${services[@]}"; do
|
||||||
yunohost service add ${app}_logcom
|
ynh_add_systemd_config --service="${app}_${service}" --template="pagure_${service}.service"
|
||||||
#yunohost service add ${app}_milters
|
yunohost service add "${app}_${service}"
|
||||||
yunohost service add ${app}_mirror
|
done
|
||||||
yunohost service add ${app}_webhook
|
|
||||||
yunohost service add ${app}_worker
|
ynh_add_config --template="pagure.wsgi" --destination="$install_dir/pagure.wsgi"
|
||||||
|
ynh_add_uwsgi_service --service="$app" --template="uwsgi.ini"
|
||||||
|
yunohost service add "uwsgi-app@$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..."
|
ynh_script_progression --message="Starting $app's systemd services..."
|
||||||
|
|
||||||
# Start a systemd service
|
# Start a systemd service
|
||||||
ynh_systemd_action --service_name=${app}_authorized_keys_worker --action="start" --log_path="systemd" --line_match="ready"
|
for service in "${services[@]}"; do
|
||||||
ynh_systemd_action --service_name=${app}_ci --action="start" --log_path="systemd" --line_match="ready"
|
ynh_systemd_action --service_name="${app}_${service}" --action="start" --log_path="systemd" --line_match="ready"
|
||||||
#ynh_systemd_action --service_name=${app}_ev_server --action="start" --log_path="systemd" --line_match="ready"
|
done
|
||||||
ynh_systemd_action --service_name=${app}_gitolite_worker --action="start" --log_path="systemd" --line_match="ready"
|
|
||||||
ynh_systemd_action --service_name=${app}_loadjson --action="start" --log_path="systemd" --line_match="ready"
|
|
||||||
ynh_systemd_action --service_name=${app}_logcom --action="start" --log_path="systemd" --line_match="ready"
|
|
||||||
#ynh_systemd_action --service_name=${app}_milters --action="start" --log_path="systemd" --line_match="ready"
|
|
||||||
ynh_systemd_action --service_name=${app}_mirror --action="start" --log_path="systemd" --line_match="ready"
|
|
||||||
ynh_systemd_action --service_name=${app}_webhook --action="start" --log_path="systemd" --line_match="ready"
|
|
||||||
ynh_systemd_action --service_name=${app}_worker --action="start" --log_path="systemd" --line_match="ready"
|
|
||||||
ynh_systemd_action --service_name="uwsgi-app@$app.service" --action="start" --log_path="systemd" --line_match="Started"
|
|
||||||
|
|
||||||
#=================================================
|
ynh_systemd_action --service_name="uwsgi-app@$app.service" --action="start" --log_path="systemd"
|
||||||
# SETUP SSOWAT
|
|
||||||
#=================================================
|
|
||||||
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
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RELOAD NGINX
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reloading NGINX web server..."
|
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
170
scripts/remove
170
scripts/remove
|
@ -1,7 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -12,176 +10,24 @@ source ynh_uwsgi_service__2
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# REMOVE SYSTEM CONFIGURATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Loading installation settings..."
|
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
for service in "${services[@]}"; do
|
||||||
|
if ynh_exec_warn_less yunohost service status "${app}_${service}" >/dev/null; then
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
yunohost service remove "${app}_${service}"
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
fi
|
||||||
db_user=$db_name
|
ynh_remove_systemd_config --service="${app}_${service}"
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
done
|
||||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
|
||||||
redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD REMOVE
|
|
||||||
#=================================================
|
|
||||||
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# 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}_authorized_keys_worker >/dev/null
|
|
||||||
then
|
|
||||||
ynh_script_progression --message="Removing ${app}_authorized_keys_worker service integration..."
|
|
||||||
yunohost service remove ${app}_authorized_keys_worker
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 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}_ci >/dev/null
|
|
||||||
then
|
|
||||||
ynh_script_progression --message="Removing ${app}_ci service integration..."
|
|
||||||
yunohost service remove ${app}_ci
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 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}_ev_server >/dev/null
|
|
||||||
then
|
|
||||||
ynh_script_progression --message="Removing ${app}_ev_server service integration..."
|
|
||||||
yunohost service remove ${app}_ev_server
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 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}_gitolite_worker >/dev/null
|
|
||||||
then
|
|
||||||
ynh_script_progression --message="Removing ${app}_gitolite_worker service integration..."
|
|
||||||
yunohost service remove ${app}_gitolite_worker
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 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}_loadjson >/dev/null
|
|
||||||
then
|
|
||||||
ynh_script_progression --message="Removing ${app}_loadjson service integration..."
|
|
||||||
yunohost service remove ${app}_loadjson
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 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}_logcom >/dev/null
|
|
||||||
then
|
|
||||||
ynh_script_progression --message="Removing ${app}_logcom service integration..."
|
|
||||||
yunohost service remove ${app}_logcom
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 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}_milters >/dev/null
|
|
||||||
then
|
|
||||||
ynh_script_progression --message="Removing ${app}_milters service integration..."
|
|
||||||
yunohost service remove ${app}_milters
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 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}_mirror >/dev/null
|
|
||||||
then
|
|
||||||
ynh_script_progression --message="Removing ${app}_mirror service integration..."
|
|
||||||
yunohost service remove ${app}_mirror
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 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}_webhook >/dev/null
|
|
||||||
then
|
|
||||||
ynh_script_progression --message="Removing ${app}_webhook service integration..."
|
|
||||||
yunohost service remove ${app}_webhook
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 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}_worker >/dev/null
|
|
||||||
then
|
|
||||||
ynh_script_progression --message="Removing ${app}_worker service integration..."
|
|
||||||
yunohost service remove ${app}_worker
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STOP AND REMOVE SERVICE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Stopping and removing the systemd service..."
|
|
||||||
|
|
||||||
# Remove the dedicated systemd config
|
|
||||||
ynh_remove_systemd_config --service="${app}_authorized_keys_worker"
|
|
||||||
ynh_remove_systemd_config --service="${app}_ci"
|
|
||||||
#ynh_remove_systemd_config --service="${app}_ev_server"
|
|
||||||
ynh_remove_systemd_config --service="${app}_gitolite_worker"
|
|
||||||
ynh_remove_systemd_config --service="${app}_loadjson"
|
|
||||||
ynh_remove_systemd_config --service="${app}_logcom"
|
|
||||||
#ynh_remove_systemd_config --service="${app}_milters"
|
|
||||||
ynh_remove_systemd_config --service="${app}_mirror"
|
|
||||||
ynh_remove_systemd_config --service="${app}_webhook"
|
|
||||||
ynh_remove_systemd_config --service="${app}_worker"
|
|
||||||
|
|
||||||
ynh_remove_uwsgi_service --service="$app"
|
ynh_remove_uwsgi_service --service="$app"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE THE POSTGRESQL DATABASE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing the PostgreSQL database..."
|
|
||||||
|
|
||||||
# Remove a database if it exists, along with the associated user
|
|
||||||
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE APP MAIN DIR
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing app main directory..."
|
|
||||||
|
|
||||||
# Remove the app directory securely
|
|
||||||
ynh_secure_remove --file="$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE DATA DIR
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Remove the data directory if --purge option is used
|
|
||||||
if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
|
|
||||||
then
|
|
||||||
ynh_script_progression --message="Removing app data directory..."
|
|
||||||
ynh_secure_remove --file="$datadir"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing NGINX web server configuration..."
|
|
||||||
|
|
||||||
# Remove the dedicated NGINX config
|
# Remove the dedicated NGINX config
|
||||||
ynh_remove_nginx_config
|
ynh_remove_nginx_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing dependencies..."
|
|
||||||
|
|
||||||
# Remove metapackage and its dependencies
|
|
||||||
ynh_remove_app_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC REMOVE
|
|
||||||
#=================================================
|
|
||||||
# REMOVE THE REDIS DATABASE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing the redis database..."
|
|
||||||
|
|
||||||
ynh_redis_remove_db "$redis_db"
|
ynh_redis_remove_db "$redis_db"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
|
||||||
# REMOVE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing the dedicated system user..."
|
|
||||||
|
|
||||||
# Delete a system user
|
|
||||||
ynh_system_user_delete --username=$app
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
158
scripts/restore
158
scripts/restore
|
@ -1,7 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -12,168 +10,62 @@ source ../settings/scripts/ynh_redis
|
||||||
source ../settings/scripts/ynh_uwsgi_service__2
|
source ../settings/scripts/ynh_uwsgi_service__2
|
||||||
source /usr/share/yunohost/helpers
|
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 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)
|
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
|
||||||
db_user=$db_name
|
|
||||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Validating restoration parameters..."
|
|
||||||
|
|
||||||
test ! -d $final_path \
|
|
||||||
|| ynh_die --message="There is already a directory: $final_path "
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# 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"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RECREATE THE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Recreating the dedicated system user..."
|
|
||||||
|
|
||||||
# Create the dedicated user (if not existing)
|
|
||||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# RESTORE THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the app main directory..."
|
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$final_path"
|
ynh_restore_file --origin_path="$install_dir"
|
||||||
|
|
||||||
chmod 750 "$final_path"
|
chown -R "$app:www-data" "$install_dir"
|
||||||
chmod -R o-rwx "$final_path"
|
|
||||||
chown -R $app:www-data "$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE DATA DIRECTORY
|
# RESTORE THE DATA DIRECTORY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the data directory..."
|
ynh_script_progression --message="Restoring the data directory..." --weight=1
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$datadir" --not_mandatory
|
ynh_restore_file --origin_path="$data_dir" --not_mandatory
|
||||||
|
|
||||||
mkdir -p $datadir
|
chown -R "$app:www-data" "$data_dir"
|
||||||
mkdir -p "${datadir}"/{repos,remotes,attachments,releases}
|
|
||||||
|
|
||||||
chmod 750 "$datadir"
|
|
||||||
chmod -R o-rwx "$datadir"
|
|
||||||
chown -R $app:www-data "$datadir"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC RESTORATION
|
|
||||||
#=================================================
|
|
||||||
# REINSTALL DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reinstalling dependencies..."
|
|
||||||
|
|
||||||
# Define and install dependencies
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE POSTGRESQL DATABASE
|
# RESTORE THE POSTGRESQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the PostgreSQL database..."
|
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1
|
||||||
|
|
||||||
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
ynh_psql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./db.sql
|
||||||
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 SYSTEM CONFIGURATIONS
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
|
||||||
|
|
||||||
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE SYSTEMD
|
# RESTORE SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the systemd configuration..."
|
ynh_script_progression --message="Restoring the systemd configuration..."
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/${app}_authorized_keys_worker.service"
|
for service in "${services[@]}"; do
|
||||||
systemctl enable ${app}_authorized_keys_worker.service --quiet
|
ynh_restore_file --origin_path="/etc/systemd/system/${app}_${service}.service"
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/${app}_ci.service"
|
systemctl enable "${app}_${service}.service" --quiet
|
||||||
systemctl enable ${app}_ci.service --quiet
|
yunohost service add "${app}_${service}"
|
||||||
#ynh_restore_file --origin_path="/etc/systemd/system/${app}_ev_server.service"
|
done
|
||||||
#systemctl enable ${app}_ev_server.service --quiet
|
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/${app}_gitolite_worker.service"
|
|
||||||
systemctl enable ${app}_gitolite_worker.service --quiet
|
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/${app}_loadjson.service"
|
|
||||||
systemctl enable ${app}_loadjson.service --quiet
|
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/${app}_logcom.service"
|
|
||||||
systemctl enable ${app}_logcom.service --quiet
|
|
||||||
#ynh_restore_file --origin_path="/etc/systemd/system/${app}_milters.service"
|
|
||||||
#systemctl enable ${app}_milters.service --quiet
|
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/${app}_mirror.service"
|
|
||||||
systemctl enable ${app}_mirror.service --quiet
|
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/${app}_webhook.service"
|
|
||||||
systemctl enable ${app}_webhook.service --quiet
|
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/${app}_worker.service"
|
|
||||||
systemctl enable ${app}_worker.service --quiet
|
|
||||||
|
|
||||||
ynh_add_uwsgi_service --service="$app" --template="uwsgi.ini"
|
ynh_add_uwsgi_service --service="$app" --template="uwsgi.ini"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
|
||||||
|
|
||||||
yunohost service add ${app}_authorized_keys_worker
|
|
||||||
yunohost service add ${app}_ci
|
|
||||||
#yunohost service add ${app}_ev_server
|
|
||||||
yunohost service add ${app}_gitolite_worker
|
|
||||||
yunohost service add ${app}_loadjson
|
|
||||||
yunohost service add ${app}_logcom
|
|
||||||
#yunohost service add ${app}_milters
|
|
||||||
yunohost service add ${app}_mirror
|
|
||||||
yunohost service add ${app}_webhook
|
|
||||||
yunohost service add ${app}_worker
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..."
|
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
|
||||||
|
|
||||||
# Start a systemd service
|
# Start a systemd service
|
||||||
ynh_systemd_action --service_name=${app}_authorized_keys_worker --action="start" --log_path="systemd" --line_match="ready"
|
for service in "${services[@]}"; do
|
||||||
ynh_systemd_action --service_name=${app}_ci --action="start" --log_path="systemd" --line_match="ready"
|
ynh_systemd_action --service_name="${app}_${service}" --action="start" --log_path="systemd" --line_match="ready"
|
||||||
#ynh_systemd_action --service_name=${app}_ev_server --action="start" --log_path="systemd" --line_match="ready"
|
done
|
||||||
ynh_systemd_action --service_name=${app}_gitolite_worker --action="start" --log_path="systemd" --line_match="ready"
|
|
||||||
ynh_systemd_action --service_name=${app}_loadjson --action="start" --log_path="systemd" --line_match="ready"
|
|
||||||
ynh_systemd_action --service_name=${app}_logcom --action="start" --log_path="systemd" --line_match="ready"
|
|
||||||
#ynh_systemd_action --service_name=${app}_milters --action="start" --log_path="systemd" --line_match="ready"
|
|
||||||
ynh_systemd_action --service_name=${app}_mirror --action="start" --log_path="systemd" --line_match="ready"
|
|
||||||
ynh_systemd_action --service_name=${app}_webhook --action="start" --log_path="systemd" --line_match="ready"
|
|
||||||
ynh_systemd_action --service_name=${app}_worker --action="start" --log_path="systemd" --line_match="ready"
|
|
||||||
ynh_systemd_action --service_name="uwsgi-app@$app.service" --action="start" --log_path="systemd" --line_match="Started"
|
|
||||||
|
|
||||||
#=================================================
|
ynh_systemd_action --service_name="uwsgi-app@$app.service" --action="start" --log_path="systemd"
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
|
||||||
# RELOAD NGINX
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reloading NGINX web server..."
|
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
|
|
219
scripts/upgrade
219
scripts/upgrade
|
@ -1,7 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -11,217 +9,96 @@ source ynh_redis
|
||||||
source ynh_uwsgi_service__2
|
source ynh_uwsgi_service__2
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
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)
|
|
||||||
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
|
||||||
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=psqlpwd)
|
|
||||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
|
||||||
redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)
|
|
||||||
secret_key=$(ynh_app_setting_get --app=$app --key=secret_key)
|
|
||||||
salt_email=$(ynh_app_setting_get --app=$app --key=salt_email)
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CHECK VERSION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Checking version..."
|
|
||||||
|
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
|
||||||
#=================================================
|
|
||||||
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 () {
|
|
||||||
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
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD UPGRADE STEPS
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STOP SYSTEMD SERVICE
|
# STOP SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Stopping a systemd service..."
|
ynh_script_progression --message="Stopping a systemd service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=${app}_authorized_keys_worker --action="stop" --log_path="systemd"
|
for service in "${services[@]}"; do
|
||||||
ynh_systemd_action --service_name=${app}_ci --action="stop" --log_path="systemd"
|
ynh_systemd_action --service_name="${app}_${service}" --action="stop" --log_path="systemd"
|
||||||
#ynh_systemd_action --service_name=${app}_ev_server --action="stop" --log_path="systemd"
|
done
|
||||||
ynh_systemd_action --service_name=${app}_gitolite_worker --action="stop" --log_path="systemd"
|
|
||||||
ynh_systemd_action --service_name=${app}_loadjson --action="stop" --log_path="systemd"
|
|
||||||
ynh_systemd_action --service_name=${app}_logcom --action="stop" --log_path="systemd"
|
|
||||||
#ynh_systemd_action --service_name=${app}_milters --action="stop" --log_path="systemd"
|
|
||||||
ynh_systemd_action --service_name=${app}_mirror --action="stop" --log_path="systemd"
|
|
||||||
ynh_systemd_action --service_name=${app}_webhook --action="stop" --log_path="systemd"
|
|
||||||
ynh_systemd_action --service_name=${app}_worker --action="stop" --log_path="systemd"
|
|
||||||
ynh_systemd_action --service_name="uwsgi-app@$app.service" --action="stop" --log_path="systemd"
|
ynh_systemd_action --service_name="uwsgi-app@$app.service" --action="stop" --log_path="systemd"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Ensuring downward compatibility..."
|
# ynh_script_progression --message="Ensuring downward compatibility..."
|
||||||
|
|
||||||
# Cleaning legacy permissions
|
|
||||||
if ynh_legacy_permissions_exists; then
|
|
||||||
ynh_legacy_permissions_delete_all
|
|
||||||
|
|
||||||
ynh_app_setting_delete --app=$app --key=is_public
|
|
||||||
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 --home_dir="$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrading source files..."
|
||||||
|
|
||||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
then
|
ynh_setup_source --dest_dir="$install_dir"
|
||||||
ynh_script_progression --message="Upgrading source files..."
|
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
chmod -R o-rwx "$install_dir"
|
||||||
ynh_setup_source --dest_dir="$final_path"
|
chown -R "$app:www-data" "$install_dir"
|
||||||
fi
|
|
||||||
|
|
||||||
chmod 750 "$final_path"
|
|
||||||
chmod -R o-rwx "$final_path"
|
|
||||||
chown -R $app:www-data "$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Upgrading NGINX web server configuration..."
|
|
||||||
|
|
||||||
# Create a dedicated NGINX config
|
|
||||||
ynh_add_nginx_config
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# UPGRADE DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Upgrading dependencies..."
|
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC UPGRADE
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPDATE A CONFIG FILE
|
# UPDATE A CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating a configuration file..."
|
ynh_script_progression --message="Updating a configuration file..."
|
||||||
|
|
||||||
ynh_add_config --template="../conf/pagure.cfg.sample" --destination="$final_path/pagure.cfg"
|
ynh_add_config --template="pagure.cfg.sample" --destination="$install_dir/pagure.cfg"
|
||||||
|
|
||||||
chmod 400 "$final_path/pagure.cfg"
|
chmod 400 "$install_dir/pagure.cfg"
|
||||||
chown $app:$app "$final_path/pagure.cfg"
|
chown "$app:$app" "$install_dir/pagure.cfg"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SETUP SYSTEMD
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configuring a systemd service..."
|
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
|
||||||
ynh_add_systemd_config --service="${app}_authorized_keys_worker" --template="pagure_authorized_keys_worker.service"
|
|
||||||
ynh_add_systemd_config --service="${app}_ci" --template="pagure_ci.service"
|
|
||||||
#ynh_add_systemd_config --service="${app}_ev_server" --template="pagure_ev_server.service"
|
|
||||||
ynh_add_systemd_config --service="${app}_gitolite_worker" --template="pagure_gitolite_worker.service"
|
|
||||||
ynh_add_systemd_config --service="${app}_loadjson" --template="pagure_loadjson.service"
|
|
||||||
ynh_add_systemd_config --service="${app}_logcom" --template="pagure_logcom.service"
|
|
||||||
#ynh_add_systemd_config --service="${app}_milters" --template="pagure_milters.service"
|
|
||||||
ynh_add_systemd_config --service="${app}_mirror" --template="pagure_mirror.service"
|
|
||||||
ynh_add_systemd_config --service="${app}_webhook" --template="pagure_webhook.service"
|
|
||||||
ynh_add_systemd_config --service="${app}_worker" --template="pagure_worker.service"
|
|
||||||
|
|
||||||
ynh_add_config --template="../conf/pagure.wsgi" --destination="$final_path/pagure.wsgi"
|
|
||||||
ynh_add_uwsgi_service --service="$app" --template="uwsgi.ini"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BUILD APP
|
# BUILD APP
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Building app..."
|
ynh_script_progression --message="Building app..."
|
||||||
|
|
||||||
pushd "$final_path"
|
pushd "$install_dir"
|
||||||
ynh_secure_remove --file="${final_path}/venv"
|
ynh_secure_remove --file="${install_dir}/venv"
|
||||||
python3 -m venv venv
|
ynh_exec_as "$app" python3 -m venv venv
|
||||||
source ./venv/bin/activate
|
ynh_exec_as "$app" "$install_dir/venv/bin/python3" -m pip install --upgrade pip
|
||||||
pip install --upgrade pip
|
ynh_exec_as "$app" "$install_dir/venv/bin/python3" -m pip install wheel
|
||||||
pip install wheel
|
ynh_exec_as "$app" "$install_dir/venv/bin/python3" -m pip install cffi
|
||||||
pip install cffi
|
ynh_exec_as "$app" "$install_dir/venv/bin/python3" -m pip install psycopg2
|
||||||
pip install psycopg2
|
ynh_exec_as "$app" "$install_dir/venv/bin/python3" -m pip install pyyaml
|
||||||
pip install pyyaml
|
ynh_exec_as "$app" "$install_dir/venv/bin/python3" -m pip install pygit2
|
||||||
pip install pygit2
|
ynh_exec_as "$app" "$install_dir/venv/bin/python3" -m pip install "jinja2<3.1.0"
|
||||||
pip install "jinja2<3.1.0"
|
ynh_exec_as "$app" "$install_dir/venv/bin/python3" -m pip install -r requirements.txt
|
||||||
pip install -r requirements.txt
|
|
||||||
ynh_add_config --template="../conf/alembic.ini" --destination="$final_path/alembic.ini"
|
ynh_add_config --template="alembic.ini" --destination="$install_dir/alembic.ini"
|
||||||
PAGURE_CONFIG=${final_path}/pagure.cfg alembic upgrade head 2>&1
|
ynh_exec_as "$app" PAGURE_CONFIG="${install_dir}/pagure.cfg" "$install_dir/venv/bin/python3" alembic upgrade head 2>&1
|
||||||
popd
|
popd
|
||||||
|
|
||||||
ynh_replace_string --match_string="validators.Required" --replace_string="validators.DataRequired" --target_file="$final_path/pagure/forms.py"
|
ynh_replace_string --match_string="validators.Required" --replace_string="validators.DataRequired" --target_file="$install_dir/pagure/forms.py"
|
||||||
|
|
||||||
chmod 750 "$final_path"
|
chmod -R o-rwx "$install_dir"
|
||||||
chmod -R o-rwx "$final_path"
|
chown -R "$app:www-data" "$install_dir"
|
||||||
chown -R $app:www-data "$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# REAPPLY SYSTEM CONFIGURATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
|
||||||
|
|
||||||
yunohost service add ${app}_authorized_keys_worker
|
# Create a dedicated NGINX config
|
||||||
yunohost service add ${app}_ci
|
ynh_add_nginx_config
|
||||||
#yunohost service add ${app}_ev_server
|
|
||||||
yunohost service add ${app}_gitolite_worker
|
# Create a dedicated systemd config
|
||||||
yunohost service add ${app}_loadjson
|
for service in "${services[@]}"; do
|
||||||
yunohost service add ${app}_logcom
|
ynh_add_systemd_config --service="${app}_${service}" --template="pagure_${service}.service"
|
||||||
#yunohost service add ${app}_milters
|
yunohost service add "${app}_${service}"
|
||||||
yunohost service add ${app}_mirror
|
done
|
||||||
yunohost service add ${app}_webhook
|
|
||||||
yunohost service add ${app}_worker
|
ynh_add_config --template="pagure.wsgi" --destination="$install_dir/pagure.wsgi"
|
||||||
|
ynh_add_uwsgi_service --service="$app" --template="uwsgi.ini"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..."
|
ynh_script_progression --message="Starting $app's systemd services..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=${app}_authorized_keys_worker --action="start" --log_path="systemd" --line_match="ready"
|
# Start a systemd service
|
||||||
ynh_systemd_action --service_name=${app}_ci --action="start" --log_path="systemd" --line_match="ready"
|
for service in "${services[@]}"; do
|
||||||
#ynh_systemd_action --service_name=${app}_ev_server --action="start" --log_path="systemd" --line_match="ready"
|
ynh_systemd_action --service_name="${app}_${service}" --action="start" --log_path="systemd" --line_match="ready"
|
||||||
ynh_systemd_action --service_name=${app}_gitolite_worker --action="start" --log_path="systemd" --line_match="ready"
|
done
|
||||||
ynh_systemd_action --service_name=${app}_loadjson --action="start" --log_path="systemd" --line_match="ready"
|
|
||||||
ynh_systemd_action --service_name=${app}_logcom --action="start" --log_path="systemd" --line_match="ready"
|
|
||||||
#ynh_systemd_action --service_name=${app}_milters --action="start" --log_path="systemd" --line_match="ready"
|
|
||||||
ynh_systemd_action --service_name=${app}_mirror --action="start" --log_path="systemd" --line_match="ready"
|
|
||||||
ynh_systemd_action --service_name=${app}_webhook --action="start" --log_path="systemd" --line_match="ready"
|
|
||||||
ynh_systemd_action --service_name=${app}_worker --action="start" --log_path="systemd" --line_match="ready"
|
|
||||||
ynh_systemd_action --service_name="uwsgi-app@$app.service" --action="start" --log_path="systemd" --line_match="Started"
|
|
||||||
|
|
||||||
#=================================================
|
ynh_systemd_action --service_name="uwsgi-app@$app.service" --action="start" --log_path="systemd"
|
||||||
# RELOAD NGINX
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reloading NGINX web server..."
|
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
9
tests.toml
Normal file
9
tests.toml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json
|
||||||
|
|
||||||
|
test_format = 1.0
|
||||||
|
|
||||||
|
[default]
|
||||||
|
|
||||||
|
# ------------
|
||||||
|
# Tests to run
|
||||||
|
# ------------
|
Loading…
Reference in a new issue