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

Merge branch 'master' into ynh_install_nodejs

This commit is contained in:
yalh76 2022-04-06 00:02:08 +02:00
commit fe32f20d05
27 changed files with 460 additions and 222 deletions

View file

@ -8,7 +8,7 @@ about: When creating a bug report, please use the following template to provide
1. *Read this whole template first.*
2. *Determine if you are on the right place:*
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!*
- *Otherwise, the issue may be due to Wiki.js itself. Refer to its documentation or repository for help.*
- *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.*
- *When in doubt, post here and we will figure it out together.*
3. *Delete the italic comments as you write over them below, and remove this guide.*
---
@ -31,7 +31,7 @@ about: When creating a bug report, please use the following template to provide
- *If you performed a command from the CLI, the command itself is enough. For example:*
```sh
sudo yunohost app install wikijs
sudo yunohost app install the_app
```
- *If you used the webadmin, please perform the equivalent command from the CLI first.*
- *If the error occurs in your browser, explain what you did:*

16
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,16 @@
## Problem
- *Description of why you made this PR*
## Solution
- *And how do you fix that problem*
## PR Status
- [ ] Code finished and ready to be reviewed/tested
- [ ] The fix/enhancement were manually tested (if applicable)
## Automatic tests
Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization)

106
.github/workflows/updater.sh vendored Normal file
View file

@ -0,0 +1,106 @@
#!/bin/bash
#=================================================
# PACKAGE UPDATING HELPER
#=================================================
# This script is meant to be run by GitHub Actions
# The YunoHost-Apps organisation offers a template Action to run this script periodically
# Since each app is different, maintainers can adapt its contents so as to perform
# automatic actions when a new upstream release is detected.
#=================================================
# FETCHING LATEST RELEASE AND ITS ASSETS
#=================================================
# Fetching information
current_version=$(cat manifest.json | jq -j '.version|split("~")[0]')
repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]')
# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions)
version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .prerelease != true ) | .tag_name' | sort -V | tail -1)
assets="https://github.com/Requarks/wiki/releases/download/$version/wiki-js.tar.gz"
# Later down the script, we assume the version has only digits and dots
# Sometimes the release name starts with a "v", so let's filter it out.
# You may need more tweaks here if the upstream repository has different naming conventions.
if [[ ${version:0:1} == "v" || ${version:0:1} == "V" ]]; then
version=${version:1}
fi
# Setting up the environment variables
echo "Current version: $current_version"
echo "Latest release from upstream: $version"
echo "VERSION=$version" >> $GITHUB_ENV
# For the time being, let's assume the script will fail
echo "PROCEED=false" >> $GITHUB_ENV
# Proceed only if the retrieved version is greater than the current one
if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then
echo "::warning ::No new version available"
exit 0
# Proceed only if a PR for this new version does not already exist
elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then
echo "::warning ::A branch already exists for this update"
exit 0
fi
#=================================================
# UPDATE SOURCE FILES
#=================================================
# Let's download source tarball
asset_url=$assets
echo "Handling asset at $asset_url"
src="app"
# Create the temporary directory
tempdir="$(mktemp -d)"
# Download sources and calculate checksum
filename=${asset_url##*/}
curl --silent -4 -L $asset_url -o "$tempdir/$filename"
checksum=$(sha256sum "$tempdir/$filename" | head -c 64)
# Delete temporary directory
rm -rf $tempdir
# Get extension
if [[ $filename == *.tar.gz ]]; then
extension=tar.gz
else
extension=${filename##*.}
fi
# Rewrite source file
cat <<EOT > conf/$src.src
SOURCE_URL=$asset_url
SOURCE_SUM=$checksum
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=$extension
SOURCE_IN_SUBDIR=false
SOURCE_FILENAME=
SOURCE_EXTRACT=true
EOT
echo "... conf/$src.src updated"
#=================================================
# SPECIFIC UPDATE STEPS
#=================================================
# Any action on the app's source code can be done.
# The GitHub Action workflow takes care of committing all changes after this script ends.
#=================================================
# GENERIC FINALIZATION
#=================================================
# Replace new version in manifest
echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json
# No need to update the README, yunohost-bot takes care of it
# The Action will proceed only if the PROCEED environment variable is set to true
echo "PROCEED=true" >> $GITHUB_ENV
exit 0

50
.github/workflows/updater.yml vendored Normal file
View file

@ -0,0 +1,50 @@
# This workflow allows GitHub Actions to automagically update your app whenever a new upstream release is detected.
# You need to enable Actions in your repository settings, and fetch this Action from the YunoHost-Apps organization.
# This file should be enough by itself, but feel free to tune it to your needs.
# It calls updater.sh, which is where you should put the app-specific update steps.
name: Check for new upstream releases
on:
# Allow to manually trigger the workflow
workflow_dispatch:
# Run it every day at 6:00 UTC
schedule:
- cron: '0 6 * * *'
jobs:
updater:
runs-on: ubuntu-latest
steps:
- name: Fetch the source code
uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run the updater script
id: run_updater
run: |
# Setting up Git user
git config --global user.name 'yunohost-bot'
git config --global user.email 'yunohost-bot@users.noreply.github.com'
# Run the updater script
/bin/bash .github/workflows/updater.sh
- name: Commit changes
id: commit
if: ${{ env.PROCEED == 'true' }}
run: |
git commit -am "Upgrade to v$VERSION"
- name: Create Pull Request
id: cpr
if: ${{ env.PROCEED == 'true' }}
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update to version ${{ env.VERSION }}
committer: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
author: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
signoff: false
base: testing
branch: ci-auto-update-v${{ env.VERSION }}
delete-branch: true
title: 'Upgrade to version ${{ env.VERSION }}'
body: |
Upgrade to v${{ env.VERSION }}
draft: false

View file

@ -1,60 +1,46 @@
<!--
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.
-->
# Wiki.js for YunoHost
[![Integration level](https://dash.yunohost.org/integration/wikijs.svg)](https://dash.yunohost.org/appci/app/wikijs) ![](https://ci-apps.yunohost.org/ci/badges/wikijs.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/wikijs.maintain.svg)
[![Install Wiki.js with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=wikijs)
> *This package allows you to install Wiki.js quickly and simply on a YunoHost server.
*[Lire ce readme en français.](./README_fr.md)*
> *This package allows you to install Wiki.js quickly and simply on a YunoHost server.
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Overview
Wiki.js is a copylefted libre software, modern and powerful wiki app built on Node.js, Git and Markdown for YunoHost.
**Shipped version:** 2.5.170
## Important points before installing
**Shipped version:** 2.5.277~ynh1
**Wiki.js** requires a dedicated **root domain**, e.g. wikijs.domain.tld
**Demo:** https://docs-beta.requarks.io/
## Screenshots
![wikijs-screenshot1](https://user-images.githubusercontent.com/30271971/52230053-b9ed3400-28b6-11e9-945e-355a752b8391.png)
![](./doc/screenshots/screenshot2.png)
![](./doc/screenshots/screenshot1.png)
![wikijs-screenshot2](https://user-images.githubusercontent.com/30271971/52230062-beb1e800-28b6-11e9-99c1-2bd04857600e.png)
## Disclaimers / important information
## Demo
* **Wiki.js** requires a dedicated **root domain**, e.g. wikijs.domain.tld
* LDAP is implemented, root will receive an e-mail at the end of the installation or the upgrade with the info on how to configure LDAP.
* No HTTP auth for now, but planned for the future.
* [Official demo](https://docs-beta.requarks.io/)
## Documentation and resources
## Documentation
* Official documentation: https://docs-beta.requarks.io/
* YunoHost documentation: https://yunohost.org/#/app_wikijs
## YunoHost specific features
#### Multi-user support
LDAP is implemented, root will receive an e-mail at the end of the installation or the upgrade with the info on how to configure LDAP.
No HTTP auth for now, but planned for the future.
The app can be used by multiple users.
#### Supported architectures
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/wikijs%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/wikijs/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/wikijs%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/wikijs/)
## Limitations
* No known limitations.
## Links
* Report a bug: https://github.com/YunoHost-Apps/wikijs_ynh/issues
* App website: https://wiki.js.org/
* Upstream app repository: https://github.com/Requarks/wiki
* YunoHost website: https://yunohost.org/
---
* Official app website: https://wiki.js.org/
* Official user documentation: https://docs-beta.requarks.io/
* Official admin documentation: https://yunohost.org/en/app_wikijs
* Upstream app code repository: https://github.com/Requarks/wiki
* YunoHost documentation for this app: https://yunohost.org/app_wikijs
* Report a bug: https://github.com/YunoHost-Apps/wikijs_ynh/issues
## Developer info
@ -66,3 +52,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/wikijs_ynh/tree/testi
or
sudo yunohost app upgrade wikijs -u https://github.com/YunoHost-Apps/wikijs_ynh/tree/testing --debug
```
**More info regarding app packaging:** https://yunohost.org/packaging_apps

52
README_fr.md Normal file
View file

@ -0,0 +1,52 @@
# Wiki.js pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/wikijs.svg)](https://dash.yunohost.org/appci/app/wikijs) ![](https://ci-apps.yunohost.org/ci/badges/wikijs.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/wikijs.maintain.svg)
[![Installer Wiki.js avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=wikijs)
*[Read this readme in english.](./README.md)*
*[Lire ce readme en français.](./README_fr.md)*
> *Ce package vous permet d'installer Wiki.js rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
## Vue d'ensemble
Wiki.js is a copylefted libre software, modern and powerful wiki app built on Node.js, Git and Markdown for YunoHost.
**Version incluse :** 2.5.277~ynh1
**Démo :** https://docs-beta.requarks.io/
## Captures d'écran
![](./doc/screenshots/screenshot2.png)
![](./doc/screenshots/screenshot1.png)
## Avertissements / informations importantes
* **Wiki.js** requires a dedicated **root domain**, e.g. wikijs.domain.tld
* LDAP is implemented, root will receive an e-mail at the end of the installation or the upgrade with the info on how to configure LDAP.
* No HTTP auth for now, but planned for the future.
## Documentations et ressources
* Site officiel de l'app : https://wiki.js.org/
* Documentation officielle utilisateur : https://docs-beta.requarks.io/
* Documentation officielle de l'admin : https://yunohost.org/en/app_wikijs
* Dépôt de code officiel de l'app : https://github.com/Requarks/wiki
* Documentation YunoHost pour cette app : https://yunohost.org/app_wikijs
* Signaler un bug : https://github.com/YunoHost-Apps/wikijs_ynh/issues
## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/wikijs_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit.
```
sudo yunohost app install https://github.com/YunoHost-Apps/wikijs_ynh/tree/testing --debug
ou
sudo yunohost app upgrade wikijs -u https://github.com/YunoHost-Apps/wikijs_ynh/tree/testing --debug
```
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps

View file

@ -1,35 +1,57 @@
;; Test complet
; Manifest
domain="domain.tld" (DOMAIN)
is_public=1 (PUBLIC|public=1|private=0)
domain="domain.tld"
is_public=1
; Checks
pkg_linter=1
setup_sub_dir=0
setup_sub_dir=1
setup_root=1
setup_nourl=0
setup_private=1
setup_public=1
upgrade=1
# 2.0.0-beta.303
upgrade=1 from_commit=62db8a96750dfd28880126d3eb9228d4d71f0814
#upgrade=1 from_commit=62db8a96750dfd28880126d3eb9228d4d71f0814
# 2.0.12
upgrade=1 from_commit=90fb1a7cb3db812a8b2558673d5f1f22b39becec
#upgrade=1 from_commit=90fb1a7cb3db812a8b2558673d5f1f22b39becec
# 2.1.113
upgrade=1 from_commit=f9dd286ff1d662e4ece78364230fc2fddef721cd
#upgrade=1 from_commit=f9dd286ff1d662e4ece78364230fc2fddef721cd
# 2.2.51
upgrade=1 from_commit=1898f27765068f49de23e7ba66b1fc23571799dc
#upgrade=1 from_commit=1898f27765068f49de23e7ba66b1fc23571799dc
# 2.3.77
upgrade=1 from_commit=8c74d870a550e99db4b6cac0a695f3155b28b514
#upgrade=1 from_commit=8c74d870a550e99db4b6cac0a695f3155b28b514
# 2.3.81~ynh1
upgrade=1 from_commit=ddb3a60b6f0f8024169db5a79ea07a9ac936b290
#upgrade=1 from_commit=ddb3a60b6f0f8024169db5a79ea07a9ac936b290
# 2.4.75~ynh1
upgrade=1 from_commit=164ef6bac3a65fe075850ec060edcd9c3249f83a
#upgrade=1 from_commit=164ef6bac3a65fe075850ec060edcd9c3249f83a
# 2.4.107~ynh1
upgrade=1 from_commit=ed3d16ea928155936ecf8753fcc6096a01971e6d
#upgrade=1 from_commit=ed3d16ea928155936ecf8753fcc6096a01971e6d
# 2.5.170~ynh2
#upgrade=1 from_commit=6ee6878a94407749d768ee347f163904537dc945
# 2.5.191~ynh1
#upgrade=1 from_commit=f241d2586694d9aff19ae6d67209142faa8b25ca
# 2.5.197~ynh1
#upgrade=1 from_commit=3c9ab32ee147ef1f39aff2773fc3be506164d873
# 2.5.201~ynh1
#upgrade=1 from_commit=bce2bfa3f9f0e28ffdde79df17a34bd5302559ea
# 2.5.201~ynh2
#upgrade=1 from_commit=17ee20b13ba56babe0231b3f9bd87e9118908838
# 2.5.201~ynh3
#upgrade=1 from_commit=16d047d802582d0d6db6d0d7343bd1fc0fb2eebf
# 2.5.214~ynh1
#upgrade=1 from_commit=078ffc6ade0df8efd2e035c25e36218c163d158d
# 2.5.219~ynh1
upgrade=1 from_commit=8d478fadb941f2d8d4407f90cb3ae7e939ff8924
# 2.5.219~ynh2
upgrade=1 from_commit=b59ca572505eb6b4b4f29596100c68808ec143cd
# 2.5.268~ynh1
upgrade=1 from_commit=de01b48bfee4abff5edcf2fd288d3ff930ccc45a
# 2.5.272~ynh1
upgrade=1 from_commit=0721e06b03c1fa384adcade256b1d67c9462d61e
backup_restore=1
multi_instance=1
port_already_use=0
change_url=0
change_url=1
;;; Options
Email=yalh@yahoo.com
Notification=yes
@ -50,3 +72,25 @@ Notification=yes
name=2.4.75~ynh1
; commit=ed3d16ea928155936ecf8753fcc6096a01971e6d
name=2.4.107~ynh1
; commit=6ee6878a94407749d768ee347f163904537dc945
name=2.5.170~ynh2
; commit=f241d2586694d9aff19ae6d67209142faa8b25ca
name=2.5.191~ynh1
; commit=3c9ab32ee147ef1f39aff2773fc3be506164d873
name=2.5.197~ynh1
; commit=bce2bfa3f9f0e28ffdde79df17a34bd5302559ea
name=2.5.201~ynh1
; commit=17ee20b13ba56babe0231b3f9bd87e9118908838
name=2.5.201~ynh2
; commit=16d047d802582d0d6db6d0d7343bd1fc0fb2eebf
name=2.5.201~ynh3
; commit=078ffc6ade0df8efd2e035c25e36218c163d158d
name=2.5.214~ynh1
; commit=8d478fadb941f2d8d4407f90cb3ae7e939ff8924
name=2.5.219~ynh1
; commit=b59ca572505eb6b4b4f29596100c68808ec143cd
name=2.5.219~ynh2
; commit=de01b48bfee4abff5edcf2fd288d3ff930ccc45a
name=2.5.268~ynh1
; commit=0721e06b03c1fa384adcade256b1d67c9462d61e
name=2.5.272~ynh1

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://github.com/Requarks/wiki/releases/download/2.5.170/wiki-js.tar.gz
SOURCE_SUM=37c8415bb19bc4e7923123f7c37d7609ef737bb90bb8bea0eb8cf5615517e99b
SOURCE_URL=https://github.com/Requarks/wiki/releases/download/v2.5.277/wiki-js.tar.gz
SOURCE_SUM=60bc340d1e1d6cf7cd639ea53726c44055c51153d9f7db109300e5ea0b73e341
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=false

View file

@ -43,6 +43,9 @@ db:
# pfx: path/to/cert.pfx
# passphrase: xyz123
# Optional - PostgreSQL only:
schema: public
# SQLite only:
storage: path/to/database.sqlite

View file

@ -4,11 +4,6 @@ location / {
# Path to source
#alias __FINALPATH__/ ;
# Force usage of https
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent;
}
# Common parameter to increase upload size limit in conjunction with dedicated php-fpm file
client_max_body_size 50M;

View file

@ -12,5 +12,35 @@ Restart=always
Environment=__YNH_NODE_LOAD_PATH__
Environment=NODE_ENV=production
# Sandboxing options to harden security
# Depending on specificities of your service/app, you may need to tweak these
# .. but this should be a good baseline
# Details for these options: https://www.freedesktop.org/software/systemd/man/systemd.exec.html
NoNewPrivileges=yes
PrivateTmp=yes
PrivateDevices=yes
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 AF_NETLINK
RestrictNamespaces=yes
RestrictRealtime=yes
DevicePolicy=closed
ProtectSystem=full
ProtectControlGroups=yes
ProtectKernelModules=yes
ProtectKernelTunables=yes
LockPersonality=yes
SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap
# Denying access to capabilities that should not be relevant for webapps
# Doc: https://man7.org/linux/man-pages/man7/capabilities.7.html
CapabilityBoundingSet=~CAP_RAWIO CAP_MKNOD
CapabilityBoundingSet=~CAP_AUDIT_CONTROL CAP_AUDIT_READ CAP_AUDIT_WRITE
CapabilityBoundingSet=~CAP_SYS_BOOT CAP_SYS_TIME CAP_SYS_MODULE CAP_SYS_PACCT
CapabilityBoundingSet=~CAP_LEASE CAP_LINUX_IMMUTABLE CAP_IPC_LOCK
CapabilityBoundingSet=~CAP_BLOCK_SUSPEND CAP_WAKE_ALARM
CapabilityBoundingSet=~CAP_SYS_TTY_CONFIG
CapabilityBoundingSet=~CAP_MAC_ADMIN CAP_MAC_OVERRIDE
CapabilityBoundingSet=~CAP_NET_ADMIN CAP_NET_BROADCAST CAP_NET_RAW
CapabilityBoundingSet=~CAP_SYS_ADMIN CAP_SYS_PTRACE CAP_SYSLOG
[Install]
WantedBy=multi-user.target

0
doc/.gitkeep Normal file
View file

1
doc/DESCRIPTION.md Normal file
View file

@ -0,0 +1 @@
Wiki.js is a copylefted libre software, modern and powerful wiki app built on Node.js, Git and Markdown for YunoHost.

3
doc/DISCLAIMER.md Normal file
View file

@ -0,0 +1,3 @@
* **Wiki.js** requires a dedicated **root domain**, e.g. wikijs.domain.tld
* LDAP is implemented, root will receive an e-mail at the end of the installation or the upgrade with the info on how to configure LDAP.
* No HTTP auth for now, but planned for the future.

0
doc/screenshots/.gitkeep Normal file
View file

Binary file not shown.

After

Width:  |  Height:  |  Size: 708 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 KiB

View file

@ -3,40 +3,39 @@
"id": "wikijs",
"packaging_format": 1,
"description": {
"en": "An open source, modern and powerful wiki app built on Node.js, Git and Markdown.",
"fr": "Un wiki moderne et open source propulsé Node.js, Git et Markdown."
"en": "Open source powerful wiki app built on Node.js, Git and Markdown",
"fr": "Wiki open source propulsé par Node.js, Git et Markdown"
},
"version": "2.5.170~ynh2",
"version": "2.5.277~ynh1",
"url": "https://wiki.js.org/",
"upstream": {
"license": "AGPL-3.0-or-later",
"website": "https://wiki.js.org/",
"demo": "https://docs-beta.requarks.io/",
"admindoc": "https://yunohost.org/en/app_wikijs",
"userdoc": "https://docs-beta.requarks.io/",
"code": "https://github.com/Requarks/wiki"
},
"license": "AGPL-3.0-or-later",
"maintainer": {
"name": "yalh76"
},
"requirements": {
"yunohost": ">= 4.1.7.3"
"yunohost": ">= 4.3.0"
},
"multi_instance": true,
"services": [
"nginx"
],
"arguments": {
"install" : [
"install": [
{
"name": "domain",
"type": "domain",
"ask": {
"en": "Choose a domain name for Wiki.js",
"fr": "Choisissez un nom de domaine pour Wiki.js"
},
"example": "example.com"
"type": "domain"
},
{
"name": "is_public",
"type": "boolean",
"ask": {
"en": "Is it a public application?",
"fr": "Est-ce une application publique ?"
},
"default": true
}
]

View file

@ -1,16 +0,0 @@
## Problem
- *Description of why you made this PR*
## Solution
- *And how do you fix that problem*
## PR Status
- [ ] Code finished.
- [ ] Tested with Package_check.
- [ ] Fix or enhancement tested.
- [ ] Upgrade from last version tested.
- [ ] Can be reviewed and tested.
## Package_check results
---
* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"*

View file

@ -7,7 +7,7 @@
# dependencies used by the app
pkg_dependencies="postgresql postgresql-contrib"
NODEJS_VERSION=12.14.1
NODEJS_VERSION=16
#=================================================
# PERSONAL HELPERS

View file

@ -6,7 +6,7 @@
# IMPORT GENERIC HELPERS
#=================================================
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
source ../settings/scripts/ynh_install_nodejs
@ -16,7 +16,7 @@ source ../settings/scripts/ynh_install_nodejs
#=================================================
ynh_clean_setup () {
ynh_clean_check_starting
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors

View file

@ -30,14 +30,10 @@ 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
#db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#db_user=$db_name
#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
port=$(ynh_app_setting_get --app=$app --key=port)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..."
@ -47,7 +43,7 @@ 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
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script

View file

@ -73,6 +73,15 @@ ynh_script_progression --message="Installing dependencies..."
ynh_install_app_dependencies $pkg_dependencies
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
ynh_use_nodejs
#=================================================
# 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
@ -98,6 +107,10 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path
ynh_setup_source --dest_dir="$final_path"
ynh_use_nodejs
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:$app "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
@ -106,14 +119,6 @@ ynh_script_progression --message="Configuring NGINX web server..."
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..."
# Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# SPECIFIC SETUP
#=================================================
@ -121,7 +126,17 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
ynh_script_progression --message="Creating LDAP user..."
yunohost user create $ldap_user --firstname "SvcWikijsLdap" --lastname "SvcWikijsLdap" --mail ${ldap_user}@$domain --password $ldap_password -q 0
yunohost user create $ldap_user --firstname "SvcWikijsLdap" --lastname "SvcWikijsLdap" --domain $domain --password $ldap_password -q 0
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..."
ynh_add_config --template="../conf/config.sample.yml" --destination="$final_path/config.yml"
chmod 400 "$final_path/config.yml"
chown $app:$app "$final_path/config.yml"
#=================================================
# SETUP SYSTEMD
@ -129,25 +144,10 @@ yunohost user create $ldap_user --firstname "SvcWikijsLdap" --lastname "SvcWikij
ynh_script_progression --message="Configuring a systemd service..."
# Create a dedicated systemd config
ynh_add_systemd_config --others_var="ynh_node ynh_node_load_PATH"
#=================================================
# MODIFY A CONFIG FILE
#=================================================
ynh_script_progression --message="Modifying a config file..."
ynh_add_config --template="../conf/config.sample.yml" --destination="$final_path/config.yml"
ynh_add_systemd_config
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_script_progression --message="Securing files and directories..."
# Set permissions to app files
chown -R "$app":"$app" "$final_path"
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
@ -171,8 +171,6 @@ 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

View file

@ -30,7 +30,7 @@ ldap_user=$(ynh_app_setting_get --app=$app --key=ldap_user)
# REMOVE SERVICE INTEGRATION IN YUNOHOST
#=================================================
# Remove the service from the list of services known by Yunohost (added from `yunohost service add`)
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status $app >/dev/null
then
ynh_script_progression --message="Removing $app service integration..."
@ -51,16 +51,7 @@ ynh_remove_systemd_config
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 DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..."
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
ynh_remove_nodejs
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
#=================================================
# REMOVE APP MAIN DIR
@ -79,14 +70,13 @@ ynh_script_progression --message="Removing NGINX web server configuration..."
ynh_remove_nginx_config
#=================================================
# CLOSE A PORT
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..."
if yunohost firewall list | grep -q "\- $port$"
then
ynh_script_progression --message="Closing port $port..."
ynh_exec_warn_less yunohost firewall disallow TCP $port
fi
# Remove metapackage and its dependencies
ynh_remove_nodejs
ynh_remove_app_dependencies
#=================================================
# SPECIFIC REMOVE

View file

@ -6,7 +6,7 @@
# IMPORT GENERIC HELPERS
#=================================================
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
source ../settings/scripts/ynh_install_nodejs
@ -24,7 +24,7 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading settings..."
ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
@ -42,8 +42,6 @@ ldap_password=$(ynh_app_setting_get --app=$app --key=ldap_password)
#=================================================
ynh_script_progression --message="Validating restoration parameters..."
ynh_webpath_available --domain=$domain --path_url=$path_url \
|| ynh_die --message="Path not available: ${domain}${path_url}"
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
@ -52,10 +50,18 @@ test ! -d $final_path \
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring 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
#=================================================
@ -63,21 +69,9 @@ ynh_script_progression --message="Restoring the app main directory..."
ynh_restore_file --origin_path="$final_path"
#=================================================
# 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 USER RIGHTS
#=================================================
ynh_script_progression --message="Restoring user rights..."
# Restore permissions on app files
chown -R "$app":"$app" "$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:$app "$final_path"
#=================================================
# SPECIFIC RESTORATION
@ -128,7 +122,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --lin
#=================================================
ynh_script_progression --message="Creating LDAP user..."
yunohost user create $ldap_user --firstname "SvcWikijsLdap" --lastname "SvcWikijsLdap" --mail ${ldap_user}@$domain --password $ldap_password -q 0
yunohost user create $ldap_user --firstname "SvcWikijsLdap" --lastname "SvcWikijsLdap" --domain $domain --password $ldap_password -q 0
#=================================================
# GENERIC FINALIZATION

View file

@ -34,6 +34,29 @@ 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 () {
# 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
#=================================================
ynh_script_progression --message="Stopping a systemd service..."
ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped wikijs service"
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
@ -45,7 +68,14 @@ if [[ -z "$ldap_user" ]]; then
ldap_password=$(ynh_string_random --length=8)
ynh_app_setting_set "$app" ldap_user "$ldap_user"
ynh_app_setting_set "$app" ldap_password "$ldap_password"
yunohost user create $ldap_user --firstname "SvcWikijsLdap" --lastname "SvcWikijsLdap" --mail ${ldap_user}@$domain --password $ldap_password -q 0
yunohost user create $ldap_user --firstname "SvcWikijsLdap" --lastname "SvcWikijsLdap" --domain $domain --password $ldap_password -q 0
fi
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
# Remove yarn repository
@ -69,27 +99,12 @@ if ynh_legacy_permissions_exists; then
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
ynh_script_progression --message="Making sure dedicated system user exists..."
# 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
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..."
ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped wikijs service"
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir=$final_path
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
@ -123,12 +138,16 @@ then
fi
fi
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:$app "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..."
# Create a dedicated nginx config
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
@ -140,41 +159,28 @@ ynh_install_app_dependencies $pkg_dependencies
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
ynh_use_nodejs
#=================================================
# 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"
#=================================================
# SPECIFIC UPGRADE
#=================================================
# MODIFY A CONFIG FILE
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Modifying a config file..."
ynh_script_progression --message="Updating a configuration file..."
ynh_add_config --template="../conf/config.sample.yml" --destination="$final_path/config.yml"
chmod 400 "$final_path/config.yml"
chown $app:$app "$final_path/config.yml"
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Upgrading systemd configuration..."
# Create a dedicated systemd config
ynh_add_systemd_config --others_var="ynh_node ynh_node_load_PATH"
ynh_add_systemd_config
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_script_progression --message="Securing files and directories..."
# Set permissions on app files
chown -R "$app":"$app" "$final_path"
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================

View file

@ -72,17 +72,7 @@ ynh_send_readme_to_admin() {
Specific information for the application $app.
$(if [ -n "$app_message" ]
then
cat "$app_message"
else
echo "...No specific information..."
fi)
---
Automatic diagnosis data from YunoHost
__PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')__PRE_TAG2__"
$(cat "$app_message")"
# Store the message into a file for further modifications.
echo "$mail_message" > mail_to_send
@ -103,10 +93,6 @@ __PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/service
# Insert url links tags
ynh_replace_string "__URL_TAG1__\(.*\)__URL_TAG2__\(.*\)__URL_TAG3__" "<a href=\"\2\">\1</a>" mail_to_send
# Insert pre tags
ynh_replace_string "__PRE_TAG1__" "<pre>" mail_to_send
ynh_replace_string "__PRE_TAG2__" "<\pre>" mail_to_send
# Insert finishing HTML tags
echo -e "\n</body>\n</html>" >> mail_to_send
@ -115,9 +101,6 @@ __PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/service
# Remove URL tags
ynh_replace_string "__URL_TAG[1,3]__" "" mail_to_send
ynh_replace_string "__URL_TAG2__" ": " mail_to_send
# Remove PRE tags
ynh_replace_string "__PRE_TAG[1-2]__" "" mail_to_send
fi
# Define binary to use for mail command