1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/pagure_ynh.git synced 2024-09-03 19:56:19 +02:00

Merge pull request #8 from YunoHost-Apps/testing

Fix
This commit is contained in:
yalh76 2022-05-01 12:38:08 +02:00 committed by GitHub
commit c6ffc7bb47
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 78 additions and 31 deletions

View file

@ -17,10 +17,14 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
A git-centered forge, python based using pygit2. A git-centered forge, python based using pygit2.
**Shipped version:** 5.13.3~ynh1 **Shipped version:** 5.13.3~ynh2
**Demo:** https://pagure.io **Demo:** https://pagure.io
## Screenshots
![](./doc/screenshots/screenshot.png)
## Disclaimers / important information ## Disclaimers / important information
* The admin you choose during the installation has been added to the PAGURE_ADMIN_USERS * The admin you choose during the installation has been added to the PAGURE_ADMIN_USERS

View file

@ -13,10 +13,14 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
**Version incluse :** 5.13.3~ynh1 **Version incluse :** 5.13.3~ynh2
**Démo :** https://pagure.io **Démo :** https://pagure.io
## Captures d'écran
![](./doc/screenshots/screenshot.png)
## Avertissements / informations importantes ## Avertissements / informations importantes
* The admin you choose during the installation has been added to the PAGURE_ADMIN_USERS * The admin you choose during the installation has been added to the PAGURE_ADMIN_USERS

View file

@ -2,8 +2,8 @@
; Manifest ; Manifest
domain="domain.tld" domain="domain.tld"
path="/path" path="/path"
admin="john"
is_public=1 is_public=1
admin="john"
; Checks ; Checks
pkg_linter=1 pkg_linter=1
setup_sub_dir=1 setup_sub_dir=1
@ -18,5 +18,5 @@
port_already_use=0 port_already_use=0
change_url=1 change_url=1
;;; Options ;;; Options
Email=jean-baptiste@holcroft.fr Email=
Notification=all Notification=none

View file

@ -75,24 +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 = os.path.join( GIT_FOLDER = '__DATADIR__/repos'
os.path.abspath(os.path.dirname(__file__)),
'..',
'repos'
)
REPOSPANNER_PSEUDO_FOLDER = os.path.join( REPOSPANNER_PSEUDO_FOLDER = '__DATADIR__/pseudo'
os.path.abspath(os.path.dirname(__file__)),
'..',
'pseudo'
)
### Folder containing the clones for the remote pull-requests ### Folder containing the clones for the remote pull-requests
REMOTE_GIT_FOLDER = os.path.join( REMOTE_GIT_FOLDER = '__DATADIR__/remotes'
os.path.abspath(os.path.dirname(__file__)),
'..',
'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
@ -201,16 +189,16 @@ SESSION_COOKIE_SECURE = True
# The name of the cookie used to store the session id. # The name of the cookie used to store the session id.
# Default: ``.pagure``. # Default: ``.pagure``.
SESSION_COOKIE_NAME = 'pagure' SESSION_COOKIE_NAME = '__APP__'
# Boolean specifying whether to check the user's IP address when retrieving # Boolean specifying whether to check the user's IP address when retrieving
# its session. This make things more secure (thus is on by default) but # its session. This make things more secure (thus is on by default) but
# under certain setup it might not work (for example is there are proxies # under certain setup it might not work (for example is there are proxies
# in front of the application). # in front of the application).
CHECK_SESSION_IP = True CHECK_SESSION_IP = False
# Used by SESSION_COOKIE_PATH # Used by SESSION_COOKIE_PATH
APPLICATION_ROOT = '/' APPLICATION_ROOT = '/__PATH__'
# Allow the backward compatiblity endpoints for the old URLs schema to # Allow the backward compatiblity endpoints for the old URLs schema to
# see the commits of a repo. This is only interesting if you pagure instance # see the commits of a repo. This is only interesting if you pagure instance

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

View file

@ -5,7 +5,7 @@
"description": { "description": {
"en": "A git-centered forge, python based using pygit2." "en": "A git-centered forge, python based using pygit2."
}, },
"version": "5.13.3~ynh1", "version": "5.13.3~ynh2",
"url": "https://pagure.io/pagure", "url": "https://pagure.io/pagure",
"upstream": { "upstream": {
"license": "AGPL-3.0", "license": "AGPL-3.0",
@ -38,14 +38,14 @@
"example": "/pagure", "example": "/pagure",
"default": "/pagure" "default": "/pagure"
}, },
{
"name": "admin",
"type": "user"
},
{ {
"name": "is_public", "name": "is_public",
"type": "boolean", "type": "boolean",
"default": true "default": true
},
{
"name": "admin",
"type": "user"
} }
] ]
} }

View file

@ -30,6 +30,7 @@ app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#================================================= #=================================================
# DECLARE DATA AND CONF FILES TO BACKUP # DECLARE DATA AND CONF FILES TO BACKUP
@ -42,6 +43,12 @@ ynh_print_info --message="Declaring files to be backed up..."
ynh_backup --src_path="$final_path" ynh_backup --src_path="$final_path"
#=================================================
# BACKUP THE DATA DIR
#=================================================
ynh_backup --src_path="$datadir" --is_big
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # BACKUP THE NGINX CONFIGURATION
#================================================= #=================================================

View file

@ -39,6 +39,7 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
redis_db=$(ynh_app_setting_get --app=$app --key=redis_db) redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)
secret_key=$(ynh_app_setting_get --app=$app --key=secret_key) secret_key=$(ynh_app_setting_get --app=$app --key=secret_key)
salt_email=$(ynh_app_setting_get --app=$app --key=salt_email) 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 # BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP

View file

@ -27,8 +27,8 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH path_url=$YNH_APP_ARG_PATH
admin=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_IS_PUBLIC is_public=$YNH_APP_ARG_IS_PUBLIC
admin=$YNH_APP_ARG_ADMIN
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -110,6 +110,21 @@ ynh_add_nginx_config
#================================================= #=================================================
# SPECIFIC SETUP # 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 # ADD A CONFIGURATION
#================================================= #=================================================
@ -157,8 +172,8 @@ pushd "$final_path"
pip install psycopg2 pip install psycopg2
pip install pyyaml pip install pyyaml
pip install pygit2 pip install pygit2
pip install "jinja2<3.1.0"
pip install -r requirements.txt pip install -r requirements.txt
mkdir -p "${final_path}"/lcl/{repos,remotes,attachments,releases}
ynh_add_config --template="../conf/alembic.ini" --destination="$final_path/alembic.ini" ynh_add_config --template="../conf/alembic.ini" --destination="$final_path/alembic.ini"
PAGURE_CONFIG=${final_path}/pagure.cfg python createdb.py --initial alembic.ini 2>&1 PAGURE_CONFIG=${final_path}/pagure.cfg python createdb.py --initial alembic.ini 2>&1
popd popd

View file

@ -22,6 +22,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name db_user=$db_name
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
redis_db=$(ynh_app_setting_get --app=$app --key=redis_db) redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)
#================================================= #=================================================
@ -135,6 +136,17 @@ ynh_script_progression --message="Removing app main directory..."
# Remove the app directory securely # Remove the app directory securely
ynh_secure_remove --file="$final_path" 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 # REMOVE NGINX CONFIGURATION
#================================================= #=================================================

View file

@ -34,6 +34,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name db_user=$db_name
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#================================================= #=================================================
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED
@ -71,6 +72,20 @@ chmod 750 "$final_path"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path" chown -R $app:www-data "$final_path"
#=================================================
# RESTORE THE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Restoring the data directory..."
ynh_restore_file --origin_path="$datadir" --not_mandatory
mkdir -p $datadir
mkdir -p "${datadir}"/{repos,remotes,attachments,releases}
chmod 750 "$datadir"
chmod -R o-rwx "$datadir"
chown -R $app:www-data "$datadir"
#================================================= #=================================================
# SPECIFIC RESTORATION # SPECIFIC RESTORATION
#================================================= #=================================================

View file

@ -25,6 +25,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) 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) redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)
secret_key=$(ynh_app_setting_get --app=$app --key=secret_key) secret_key=$(ynh_app_setting_get --app=$app --key=secret_key)
salt_email=$(ynh_app_setting_get --app=$app --key=salt_email) salt_email=$(ynh_app_setting_get --app=$app --key=salt_email)
@ -168,8 +169,8 @@ pushd "$final_path"
pip install psycopg2 pip install psycopg2
pip install pyyaml pip install pyyaml
pip install pygit2 pip install pygit2
pip install "jinja2<3.1.0"
pip install -r requirements.txt pip install -r requirements.txt
mkdir -p "${final_path}"/lcl/{repos,remotes,attachments,releases}
ynh_add_config --template="../conf/alembic.ini" --destination="$final_path/alembic.ini" ynh_add_config --template="../conf/alembic.ini" --destination="$final_path/alembic.ini"
PAGURE_CONFIG=${final_path}/pagure.cfg alembic upgrade head 2>&1 PAGURE_CONFIG=${final_path}/pagure.cfg alembic upgrade head 2>&1
popd popd