1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/gogs_ynh.git synced 2024-09-03 20:36:23 +02:00

Merge pull request #75 from YunoHost-Apps/testing

Testing
This commit is contained in:
Éric Gaspar 2023-03-23 08:08:34 +01:00 committed by GitHub
commit 4f6c6408fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 139 additions and 557 deletions

View file

@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Fetch the source code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run the updater script
@ -33,7 +33,7 @@ jobs:
- name: Create Pull Request
id: cpr
if: ${{ env.PROCEED == 'true' }}
uses: peter-evans/create-pull-request@v3
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update to version ${{ env.VERSION }}

View file

@ -5,7 +5,8 @@ It shall NOT be edited by hand.
# Gogs for YunoHost
[![Integration level](https://dash.yunohost.org/integration/gogs.svg)](https://dash.yunohost.org/appci/app/gogs) ![Working status](https://ci-apps.yunohost.org/ci/badges/gogs.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/gogs.maintain.svg)
[![Integration level](https://dash.yunohost.org/integration/gogs.svg)](https://dash.yunohost.org/appci/app/gogs) ![Working status](https://ci-apps.yunohost.org/ci/badges/gogs.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/gogs.maintain.svg)
[![Install Gogs with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=gogs)
*[Lire ce readme en français.](./README_fr.md)*
@ -20,7 +21,6 @@ Gogs (Go Git Service) is a git-based multiplatform forge written in Go. Its part
### Features
- User dashboard, user profile and activity timeline.
- User, organization and repository management.
- Repository and organization webhooks, including Slack, Discord and Dingtalk.
- Repository Git hooks, deploy keys and Git LFS.
- Repository issues, pull requests, wiki, protected branches and collaboration.
@ -28,11 +28,9 @@ Gogs (Go Git Service) is a git-based multiplatform forge written in Go. Its part
- Web editor for quick editing repository files and wiki.
- Jupyter Notebook and PDF rendering.
- Authentication via SMTP, LDAP.
- Customize HTML templates, static files and many others.
**Shipped version:** 0.12.10~ynh1
**Shipped version:** 0.13.0~ynh1
**Demo:** https://try.gogs.io/user/login
@ -40,33 +38,6 @@ Gogs (Go Git Service) is a git-based multiplatform forge written in Go. Its part
![Screenshot of Gogs](./doc/screenshots/screenshot.png)
## Disclaimers / important information
## Notes on SSH usage
If you want to use Gogs with SSH and be able to pull/push with you SSH key, your SSH daemon must be properly configured to use private/public keys. Here is a sample configuration of `/etc/ssh/sshd_config` that works with Gogs:
```bash
PubkeyAuthentication yes
AuthorizedKeysFile %h/.ssh/authorized_keys
ChallengeResponseAuthentication no
PasswordAuthentication no
UsePAM no
```
You also need to add your public key to your Gogs profile.
If you use SSH on another port than 22, you need to add theses lines to your ssh config in `~/.ssh/config`:
```bash
Host domain.tld
port 2222 # change this with the port you use
```
## Private Mode
Actually it's possible to access to the Git repositories by the `git` command over HTTP also in private mode installation. It's important to know that in this mode the repository could be ALSO getted if you don't set the repository as private in the repos settings.
## Documentation and resources
* Official app website: <http://gogs.io>

View file

@ -5,60 +5,33 @@ It shall NOT be edited by hand.
# Gogs pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/gogs.svg)](https://dash.yunohost.org/appci/app/gogs) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/gogs.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/gogs.maintain.svg)
[![Niveau dintégration](https://dash.yunohost.org/integration/gogs.svg)](https://dash.yunohost.org/appci/app/gogs) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/gogs.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/gogs.maintain.svg)
[![Installer Gogs avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=gogs)
*[Read this readme in english.](./README.md)*
> *Ce package vous permet d'installer Gogs rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
> *Ce package vous permet dinstaller Gogs rapidement et simplement sur un serveur YunoHost.
Si vous navez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment linstaller et en profiter.*
## Vue d'ensemble
## Vue densemble
Gogs (Go Git Service) est une forge multiplateforme basée sur git écrite en Go. Sa particularité est dêtre léger et pouvant fonctionner sur carte ARM, ce qui fait quil est adapté à lauto-hébergement. Gogs a une interface web similaire à celle de GitHub.
**Version incluse :** 0.12.10~ynh1
**Version incluse :** 0.13.0~ynh1
**Démo :** https://try.gogs.io/user/login
## Captures d'écran
## Captures décran
![Capture d'écran de Gogs](./doc/screenshots/screenshot.png)
## Avertissements / informations importantes
## Notes on SSH usage
If you want to use Gogs with SSH and be able to pull/push with you SSH key, your SSH daemon must be properly configured to use private/public keys. Here is a sample configuration of `/etc/ssh/sshd_config` that works with Gogs:
```bash
PubkeyAuthentication yes
AuthorizedKeysFile %h/.ssh/authorized_keys
ChallengeResponseAuthentication no
PasswordAuthentication no
UsePAM no
```
You also need to add your public key to your Gogs profile.
If you use SSH on another port than 22, you need to add theses lines to your ssh config in `~/.ssh/config`:
```bash
Host domain.tld
port 2222 # change this with the port you use
```
## Private Mode
Actually it's possible to access to the Git repositories by the `git` command over HTTP also in private mode installation. It's important to know that in this mode the repository could be ALSO getted if you don't set the repository as private in the repos settings.
![Capture décran de Gogs](./doc/screenshots/screenshot.png)
## Documentations et ressources
* Site officiel de l'app : <http://gogs.io>
* Documentation officielle de l'admin : <https://gogs.io/docs>
* Dépôt de code officiel de l'app : <https://github.com/gogs/gogs>
* Site officiel de lapp : <http://gogs.io>
* Documentation officielle de ladmin : <https://gogs.io/docs>
* Dépôt de code officiel de lapp : <https://github.com/gogs/gogs>
* Documentation YunoHost pour cette app : <https://yunohost.org/app_gogs>
* Signaler un bug : <https://github.com/YunoHost-Apps/gogs_ynh/issues>
@ -74,4 +47,4 @@ ou
sudo yunohost app upgrade gogs -u https://github.com/YunoHost-Apps/gogs_ynh/tree/testing --debug
```
**Plus d'infos sur le packaging d'applications :** <https://yunohost.org/packaging_apps>
**Plus dinfos sur le packaging dapplications :** <https://yunohost.org/packaging_apps>

View file

@ -1,21 +0,0 @@
;; General
; Manifest
domain="domain.tld"
path="/path"
admin="john"
is_public=1
; 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=
backup_restore=1
multi_instance=1
change_url=1
;;; Upgrade options
; commit=
name=

View file

@ -1,5 +0,0 @@
SOURCE_URL=https://github.com/gogs/gogs/releases/download/v0.12.10/gogs_0.12.10_linux_amd64.tar.gz
SOURCE_SUM=7b7bb550a99c0b0a4c182c30ffcb456ae6fccac58f2ddcaf59ca3836f7156575
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true

View file

@ -46,7 +46,7 @@ DISABLE_ROUTER_LOG = true
ENABLE_GZIP = false
; The path for storing application specific data.
APP_DATA_PATH = __DATADIR__/data
APP_DATA_PATH = __DATA_DIR__/data
; Whether to enable to load assets (i.e. "conf", "templates", "public") from disk instead of embedded bindata.
LOAD_ASSETS_FROM_DISK = false
@ -91,7 +91,7 @@ DSA = 1024
[repository]
; The root path for storing managed repositories, default is "~/gogs-repositories"
ROOT = __DATADIR__/repositories
ROOT = __DATA_DIR__/repositories
; The script type server supports, sometimes could be "sh".
SCRIPT_TYPE = bash
; Default ANSI charset for an unrecognized charset.
@ -126,7 +126,7 @@ PREVIEWABLE_FILE_MODES = markdown
; Whether to enable repository file uploads.
ENABLED = true
; The path to temporarily store uploads (content under this path gets wiped out on every start).
TEMP_PATH = __DATADIR__/data/tmp/uploads
TEMP_PATH = __DATA_DIR__/data/tmp/uploads
; File types that are allowed to be uploaded, e.g. "image/jpeg|image/png". Leave empty to allow any file type.
ALLOWED_TYPES =
; The maximum size of each file in MB.
@ -267,13 +267,13 @@ ACCESS_CONTROL_ALLOW_ORIGIN =
; The storage backend for uploading new objects.
STORAGE = local
; The root path to store LFS objects on local file system.
OBJECTS_PATH = __DATADIR__/data/lfs-objects
OBJECTS_PATH = __DATA_DIR__/data/lfs-objects
[attachment]
; Whether to enabled upload attachments in general.
ENABLED = true
; The path to store attachments on the file system.
PATH = __DATADIR__/data/attachments
PATH = __DATA_DIR__/data/attachments
; File types that are allowed to be uploaded, e.g. "image/jpeg|image/png". Leave empty to allow any file type.
ALLOWED_TYPES = image/jpeg|image/png
; The maximum size of each file in MB.
@ -300,9 +300,9 @@ FORMAT = RFC1123
[picture]
; The path to store user avatars on the file system.
AVATAR_UPLOAD_PATH = __DATADIR__/data/avatars
AVATAR_UPLOAD_PATH = __DATA_DIR__/data/avatars
; The path to store repository avatars on the file system.
REPOSITORY_AVATAR_UPLOAD_PATH = __DATADIR__/data/repo-avatars
REPOSITORY_AVATAR_UPLOAD_PATH = __DATA_DIR__/data/repo-avatars
; Chinese users can use a custom avatar source, such as http://cn.gravatar.com/avatar/.
GRAVATAR_SOURCE = gravatar
; Whether to disable Gravatar, this value will be forced to be true in offline mode.

View file

@ -1,5 +0,0 @@
SOURCE_URL=https://github.com/gogs/gogs/releases/download/v0.12.10/gogs_0.12.10_linux_armv8.tar.gz
SOURCE_SUM=103c13ad8ff304767c7618e80429e294c059e44608050d1d19ba9ca53d41c40a
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true

View file

@ -1,5 +0,0 @@
SOURCE_URL=https://github.com/gogs/gogs/releases/download/v0.12.10/gogs_0.12.10_linux_armv7.tar.gz
SOURCE_SUM=c9eb724591be817bdcd835057d1ae22f0a6236135a20d25c0da331e3046d34f3
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true

View file

@ -1,5 +0,0 @@
SOURCE_URL=https://github.com/gogs/gogs/releases/download/v0.12.10/gogs_0.12.10_linux_386.tar.gz
SOURCE_SUM=8cc9aaa8ffa4b0e8579a49b285d0e67642dbf8ec94d0d130759727fa51d6d415
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true

View file

@ -1,7 +1,7 @@
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ {
proxy_pass http://localhost:__PORT__/;
proxy_pass http://127.0.0.1:__PORT__/;
proxy_set_header Host $host;
proxy_buffering off;
fastcgi_param REMOTE_USER $remote_user;

View file

@ -1,15 +1,15 @@
[Unit]
Description=Gogs (Go Git Service)
Description=Gogs: Go Git Service
After=syslog.target network.target mysql.service slapd.service redis.service
[Service]
Type=simple
User=__APP__
Group=__APP__
WorkingDirectory=__DATADIR__
ExecStart=__FINALPATH__/gogs web
WorkingDirectory=__DATA_DIR__
ExecStart=__INSTALL_DIR__/gogs web
Restart=always
Environment=USER=__APP__ HOME=__DATADIR__
Environment=USER=__APP__ HOME=__DATA_DIR__
[Install]
WantedBy=multi-user.target

View file

@ -3,7 +3,6 @@ Gogs (Go Git Service) is a git-based multiplatform forge written in Go. Its part
### Features
- User dashboard, user profile and activity timeline.
- User, organization and repository management.
- Repository and organization webhooks, including Slack, Discord and Dingtalk.
- Repository Git hooks, deploy keys and Git LFS.
- Repository issues, pull requests, wiki, protected branches and collaboration.
@ -11,4 +10,3 @@ Gogs (Go Git Service) is a git-based multiplatform forge written in Go. Its part
- Web editor for quick editing repository files and wiki.
- Jupyter Notebook and PDF rendering.
- Authentication via SMTP, LDAP.
- Customize HTML templates, static files and many others.

View file

@ -1,63 +0,0 @@
{
"name": "Gogs",
"id": "gogs",
"packaging_format": 1,
"description": {
"en": "Lightweight self-hosted Git forge",
"fr": "Forge Git légère auto-hébergé"
},
"version": "0.12.10~ynh1",
"url": "http://gogs.io",
"upstream": {
"license": "MIT",
"website": "http://gogs.io",
"demo": "https://try.gogs.io/user/login",
"admindoc": "https://gogs.io/docs",
"code": "https://github.com/gogs/gogs",
"cpe": "cpe:2.3:a:gogs:gogs"
},
"license": "MIT",
"maintainer": {
"name": "",
"email": ""
},
"previous_maintainers": {
"name": "tostaki",
"email": "maxime@max.privy.place"
},
"multi_instance": true,
"services": [
"nginx",
"mysql"
],
"requirements": {
"yunohost": ">= 11.0.9"
},
"arguments": {
"install": [
{
"name": "domain",
"type": "domain"
},
{
"name": "path",
"type": "path",
"example": "/gogs",
"default": "/gogs"
},
{
"name": "admin",
"type": "user"
},
{
"name": "is_public",
"type": "boolean",
"help": {
"en": "If enabled, Gogs will be accessible by people who do not have an account. This can be changed later via the webadmin.",
"fr": "Si cette case est cochée, Gogs sera accessible aux personnes nayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin."
},
"default": true
}
]
}
}

74
manifest.toml Normal file
View file

@ -0,0 +1,74 @@
packaging_format = 2
id = "gogs"
name = "Gogs"
description.en = "Lightweight self-hosted Git forge"
description.fr = "Forge Git légère auto-hébergé"
version = "0.13.0~ynh1"
maintainers = []
[upstream]
license = "MIT"
website = "http://gogs.io"
demo = "https://try.gogs.io/user/login"
admindoc = "https://gogs.io/docs"
code = "https://github.com/gogs/gogs"
[integration]
yunohost = ">= 11.1.15"
architectures = "all"
multi_instance = true
ldap = true
sso = true
disk = "50M"
ram.build = "50M"
ram.runtime = "50M"
[install]
[install.domain]
type = "domain"
[install.path]
type = "path"
default = "/gogs"
[install.admin]
type = "user"
[install.init_main_permission]
help.en = "If enabled, Gogs will be accessible by people who do not have an account. This can be changed later via the webadmin."
help.fr = "Si cette case est cochée, Gogs sera accessible aux personnes nayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin."
type = "group"
default = "visitors"
[resources]
[resources.sources]
[resources.sources.main]
amd64.url = "https://github.com/gogs/gogs/releases/download/v0.13.0/gogs_0.13.0_linux_amd64.tar.gz"
amd64.sha256 = "75da1c026cacb187a7c1dcad8263873ec566ce30cc0df56dd1dc129b8292d34f"
arm64.url = "https://github.com/gogs/gogs/releases/download/v0.13.0/gogs_0.13.0_linux_armv8.tar.gz"
arm64.sha256 = "3a8401ed3f9f9b73708c682f9b3211401dec01d3ce36294655b9394c28eab2e1"
armhf.url = "https://github.com/gogs/gogs/releases/download/v0.13.0/gogs_0.13.0_linux_armv7.tar.gz"
armhf.sha256 = "816e753719fc920e5df5f43b98e31db04d8e5e8c3b49cab662ad69852e2a8863"
i386.url = "https://github.com/gogs/gogs/releases/download/v0.13.0/gogs_0.13.0_linux_386.tar.gz"
i386.sha256 = "c4ddd0c9f1d9216ff15e0fbcb53f9da0999d0a3e84b2e270601aa86c8ff6f00c"
[resources.ports]
[resources.system_user]
[resources.install_dir]
[resources.data_dir]
[resources.permissions]
main.url = "/"
[resources.apt]
packages = "mariadb-server"
[resources.database]
type = "mysql"

View file

@ -9,24 +9,6 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
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
#=================================================
@ -36,13 +18,13 @@ ynh_print_info --message="Declaring files to be backed up..."
# BACKUP THE APP MAIN DIR
#=================================================
ynh_backup --src_path="$final_path"
ynh_backup --src_path="$install_dir"
#=================================================
# BACKUP THE DATA DIR
#=================================================
ynh_backup --src_path="$datadir" --is_big
ynh_backup --src_path="$data_dir" --is_big
#=================================================
# BACKUP THE NGINX CONFIGURATION

View file

@ -9,67 +9,6 @@
source _common.sh
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..." --weight=1
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
port=$(ynh_app_setting_get --app=$app --key=port)
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=mysqlpwd)
key=$(ynh_app_setting_get --app=$app --key=key)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
path_url=$(ynh_app_setting_get --app=$app --key=path)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# 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
#=================================================
@ -84,29 +23,7 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=3
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
# 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
ynh_change_url_nginx_config
#=================================================
# SPECIFIC MODIFICATIONS
@ -121,10 +38,10 @@ fi
domain=$new_domain
ynh_add_config --template="../conf/app.ini" --destination="$final_path/custom/conf/app.ini"
ynh_add_config --template="../conf/app.ini" --destination="$install_dir/custom/conf/app.ini"
chmod 400 "$final_path/custom/conf/app.ini"
chown $app:$app "$final_path/custom/conf/app.ini"
chmod 400 "$install_dir/custom/conf/app.ini"
chown $app:$app "$install_dir/custom/conf/app.ini"
#=================================================
# GENERIC FINALISATION
@ -135,13 +52,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=2
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -9,88 +9,30 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
# Retrieve arguments
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
admin=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_IS_PUBLIC
key=$(ynh_string_random)
app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
ynh_script_progression --message="Validating installation parameters..." --weight=1
final_path=/var/www/$app
test ! -e "$final_path" || ynh_die --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..." --weight=1
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=key --value=$key
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# FIND AND OPEN A PORT
#=================================================
ynh_script_progression --message="Finding an available port..." --weight=1
# Find an available port
port=$(ynh_find_port --port=6000)
ynh_app_setting_set --app=$app --key=port --value=$port
#=================================================
# CREATE A MYSQL DATABASE
#=================================================
ynh_script_progression --message="Creating a MySQL database..." --weight=3
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_mysql_setup_db --db_user=$db_user --db_name=$db_name
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=1
# Create a system user
ynh_system_user_create --username=$app --home_dir=$final_path
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=3
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir=$final_path --source_id=$YNH_ARCH
ynh_setup_source --dest_dir=$install_dir
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#=================================================
# NGINX CONFIGURATION
@ -105,39 +47,33 @@ ynh_add_nginx_config
#=================================================
ynh_script_progression --message="Creating a data directory..." --weight=1
datadir=/home/yunohost.app/$app
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
mkdir -p $datadir
# create needed directories
mkdir -p "$final_path/custom/conf/auth.d"
mkdir -p "$datadir/data/repositories"
mkdir -p "$datadir/data/avatars"
mkdir -p "$datadir/data/attachments"
mkdir -p "$install_dir/custom/conf/auth.d"
mkdir -p "$data_dir/data/repositories"
mkdir -p "$data_dir/data/avatars"
mkdir -p "$data_dir/data/attachments"
chmod 750 "$datadir"
chmod -R o-rwx "$datadir"
chown -R $app:www-data "$datadir"
chmod -R o-rwx "$data_dir"
chown -R $app:www-data "$data_dir"
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
if [ "$path_url" = "/" ]
if [ "$path" = "/" ]
then
url="$domain"
else
url="$domain${path_url%/}"
url="$domain${path%/}"
fi
ynh_add_config --template="../conf/app.ini" --destination="$final_path/custom/conf/app.ini"
ynh_add_config --template="../conf/app.ini" --destination="$install_dir/custom/conf/app.ini"
chmod 400 "$final_path/custom/conf/app.ini"
chown $app:$app "$final_path/custom/conf/app.ini"
chmod 400 "$install_dir/custom/conf/app.ini"
chown $app:$app "$install_dir/custom/conf/app.ini"
ynh_add_config --template="../conf/ldap.conf" --destination="$final_path/custom/conf/auth.d/ldap.conf"
ynh_add_config --template="../conf/ldap.conf" --destination="$install_dir/custom/conf/auth.d/ldap.conf"
#=================================================
# SETUP SYSTEMD
@ -175,24 +111,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=3
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary or protect it
if [ $is_public -eq 1 ]
then
ynh_permission_update --permission="main" --add="visitors"
fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -9,20 +9,6 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
port=$(ynh_app_setting_get --app=$app --key=port)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#=================================================
# STANDARD REMOVE
#=================================================
@ -44,33 +30,6 @@ ynh_script_progression --message="Stopping and removing the systemd service..."
# Remove the dedicated systemd config
ynh_remove_systemd_config
#=================================================
# REMOVE THE MYSQL DATABASE
#=================================================
ynh_script_progression --message="Removing the MySQL database..." --weight=2
# Remove a database if it exists, along with the associated user
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Removing app main directory..." --weight=3
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE DATA DIR
#=================================================
# Remove the app data directory with the command `yunohost app remove gogs --purge`
if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
then
ynh_script_progression --message="Removing $app data directory..." --weight=2
ynh_secure_remove --file="$datadir"
fi
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
@ -94,14 +53,6 @@ ynh_script_progression --message="Removing various files..." --weight=1
ynh_secure_remove --file="/var/log/$app"
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
# Delete a system user
ynh_system_user_delete --username=$app
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -9,35 +9,6 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
admin=$(ynh_app_setting_get --app=$app --key=admin)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=2
test ! -d $final_path || ynh_die --message="There is already a directory: $final_path "
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
@ -47,45 +18,30 @@ ynh_script_progression --message="Restoring the NGINX configuration..." --weight
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..." --weight=1
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring $app main directory..." --weight=10
ynh_restore_file --origin_path="$final_path"
ynh_restore_file --origin_path="$install_dir"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#=================================================
# RESTORE 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
chmod 750 "$datadir"
chmod -R o-rwx "$datadir"
chown -R $app:www-data "$datadir"
chown -R $app:www-data "$data_dir"
#=================================================
# RESTORE THE MYSQL DATABASE
#=================================================
ynh_script_progression --message="Restoring the MySQL database..." --weight=3
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
#=================================================

View file

@ -9,57 +9,12 @@
source _common.sh
source /usr/share/yunohost/helpers
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
admin=$(ynh_app_setting_get --app=$app --key=admin)
port=$(ynh_app_setting_get --app=$app --key=port)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#=================================================
# CHECK 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)..." --weight=1
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
@ -74,13 +29,11 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=3
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir=$final_path --source_id=$YNH_ARCH --keep="custom/conf/app.ini custom/conf/auth.d/ldap.conf"
ynh_setup_source --dest_dir=$install_dir --keep="custom/conf/app.ini custom/conf/auth.d/ldap.conf"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#=================================================
# SETUP SYSTEMD
@ -126,13 +79,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================

7
tests.toml Normal file
View file

@ -0,0 +1,7 @@
test_format = 1.0
[default]
# ------------
# Tests to run
# ------------