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

Merge branch 'testing' into mongodb_auth

This commit is contained in:
Éric Gaspar 2023-11-14 14:44:11 +01:00
commit 0adf7d2567
34 changed files with 1038 additions and 582 deletions

View file

@ -1,46 +1,55 @@
---
name: Bug report
about: Create a report to help us debug, it would be nice to fill the template as much as you can to help us, help you and help us all.
about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently.
---
**How to post a meaningful bug report**
1. *Read this whole template first.*
2. *Determine if you are on the right place:*
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change url...), you are on the right place!*
- *Otherwise, the issue may be due to Wekan itself. Refer to its documentation or repository for help.*
- *If you have a doubt, post here, we will figure it out together.*
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!*
- *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.*
- *When in doubt, post here and we will figure it out together.*
3. *Delete the italic comments as you write over them below, and remove this guide.*
---
**Describe the bug**
### Describe the bug
*A clear and concise description of what the bug is.*
**Versions**
### Context
- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...*
- YunoHost version: x.x.x
- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...*
- Are you in a special context or did you perform some particular tweaking on your YunoHost instance ?: *no / yes*
- Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes*
- If yes, please explain:
- Using, or trying to install package version/branch:
- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`*
**To Reproduce**
*Steps to reproduce the behavior.*
### Steps to reproduce
- *If you performed a command from the CLI, the command itself is enough. For example:*
```sh
sudo yunohost app install wekan
sudo yunohost app install the_app
```
- *If you used the webadmin, please perform the equivalent command from the CLI first.*
- *If the error occurs in your browser, explain what you did:*
1. *Go to '...'*
2. *Click on '....'*
3. *Scroll down to '....'*
2. *Click on '...'*
3. *Scroll down to '...'*
4. *See error*
**Expected behavior**
### Expected behavior
*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.*
**Logs**
*After a failed command, YunoHost makes the log available to you, but also to others, thanks to `yunohost log display [log name] --share`. The actual command, with the correct log name, is displayed at the end of the failed attempt in the CLI. Execute it and copy here the share link it outputs.*
### Logs
*When an operation fails, YunoHost provides a simple way to share the logs.*
- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.*
- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.*
*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)*
*If applicable and useful, add screenshots to help explain your problem.*

16
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
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)

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

@ -0,0 +1,133 @@
#!/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=($(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '[ .[] | select(.tag_name=="'$version'").assets[].browser_download_url ] | join(" ") | @sh' | tr -d "'"))
# 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
echo "REPO=$repo" >> $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
# Each release can hold multiple assets (e.g. binaries for different architectures, source code, etc.)
echo "${#assets[@]} available asset(s)"
#=================================================
# UPDATE SOURCE FILES
#=================================================
# Here we use the $assets variable to get the resources published in the upstream release.
# Here is an example for Grav, it has to be adapted in accordance with how the upstream releases look like.
# Let's loop over the array of assets URLs
for asset_url in ${assets[@]}; do
echo "Handling asset at $asset_url"
# Assign the asset to a source file in conf/ directory
# Here we base the source file name upon a unique keyword in the assets url (admin vs. update)
# Leave $src empty to ignore the asset
case $asset_url in
*"amd64"*)
src="amd64"
;;
*"arm64"*)
src="arm64"
;;
*)
src=""
;;
esac
# If $src is not empty, let's process the asset
if [ ! -z "$src" ]; then
# 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=true
SOURCE_FILENAME=
EOT
echo "... conf/$src.src updated"
else
echo "... asset ignored"
fi
done
#=================================================
# 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@v3
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@v4
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

3
.gitignore vendored
View file

@ -1,3 +0,0 @@
*.swp
*.swo

View file

@ -1,33 +1,39 @@
<!--
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.
-->
# Wekan for YunoHost
[![Integration level](https://dash.yunohost.org/integration/wekan.svg)](https://dash.yunohost.org/appci/app/wekan) ![](https://ci-apps.yunohost.org/ci/badges/wekan.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/wekan.maintain.svg)
[![Install Wekan with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=wekan)
[![Integration level](https://dash.yunohost.org/integration/wekan.svg)](https://dash.yunohost.org/appci/app/wekan) ![Working status](https://ci-apps.yunohost.org/ci/badges/wekan.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/wekan.maintain.svg)
> *This package allows you to install Wekan quickly and simply on a YunoHost server.
[![Install Wekan with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=wekan)
*[Lire ce readme en français.](./README_fr.md)*
> *This package allows you to install Wekan 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
Wekan is an open-source kanban board (task manager and organizer)
**Shipped version:** 4.09
WeKan is an completely Open Source and Free software collaborative kanban board.
**Shipped version:** 7.18~ynh1
**Demo:** https://demo.sandstorm.io/appdemo/m86q05rdvj14yvn78ghaxynqz7u2svw6rnttptxx49g1785cdv1h
## Screenshots
![](screenshot.jpg)
![Screenshot of Wekan](./doc/screenshots/screenshot.jpg)
## Status
## Disclaimers / important information
- This app **only works on x86, 64bits architecture** ! In particular, it won't work on 32 bit machines or ARM. See the discussion [here](https://github.com/YunoHost-Apps/wekan_ynh/issues/1#issuecomment-401612500).
- There is currently **no SSO integration** though it might be integrated at some point in the app, now that it's supported in Meteor/Wekan. In the meantime, users can create accounts (in fact, they can create infinite number of accounts) manually, and need to login manually specifically in Wekan.
## Infos
**Package by:** ljf & Aleks
**Categories:** Productivity, Task
## Configuration
* There is currently **no SSO integration** though it might be integrated at some point in the app, now that it's supported in Meteor/Wekan. In the meantime, users can create accounts (in fact, they can create infinite number of accounts) manually, and need to login manually specifically in Wekan.
* This app **only works on x86, 64bits architecture**! In particular, it won't work on 32 bit machines or ARM. See the discussion [here](https://github.com/YunoHost-Apps/wekan_ynh/issues/1#issuecomment-401612500).
* YunoHost users with more than one email address can't login to wekan using ldap. For example first YunoHost user has severals email addresses: root@domain; admin@domain; webmaster@domain; postmaster@domain, etc... Workaround: remove all mail aliases of the user you want to connect, connect one time on wekan, recreate the aliases of the YunoHost user.
## Configuration:
As LDAP authentification is enabled by default, Wekan admins correspond to the permission `Wekan Admin`. The user you choose during installation is member of this group.
To add an admin account, you can:
@ -40,38 +46,24 @@ If you have disable ldap authentication, first registered user will be admin, an
**Private/Public mode:** In private mode, only authorized YunoHost members can access to the Wekan.
## Documentation
## Documentation and resources
* Official documentation: https://github.com/wekan/wekan/wiki
* Official app website: <https://wekan.github.io>
* Official admin documentation: <https://github.com/wekan/wekan/wiki>
* Upstream app code repository: <https://github.com/wekan/wekan>
* YunoHost Store: <https://apps.yunohost.org/app/wekan>
* Report a bug: <https://github.com/YunoHost-Apps/wekan_ynh/issues>
## YunoHost specific features
#### Multi-user support
LDAP is supported but HTTP auth is still not supported
#### Supported architectures
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/wekan%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/wekan/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/wekan%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/wekan/)
## Links
* Report a bug: https://github.com/YunoHost-Apps/wekan_ynh/issues
* App website: https://wekan.github.io/
* Upstream app repository: https://github.com/wekan/wekan
* YunoHost website: https://yunohost.org/
---
Developer info
----------------
## Developer info
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/wekan_ynh/tree/testing).
To try the testing branch, please proceed like that.
```
``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/wekan_ynh/tree/testing --debug
or
sudo yunohost app upgrade wekan -u https://github.com/YunoHost-Apps/wekan_ynh/tree/testing --debug
```
**More info regarding app packaging:** <https://yunohost.org/packaging_apps>

69
README_fr.md Normal file
View file

@ -0,0 +1,69 @@
<!--
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.
-->
# Wekan pour YunoHost
[![Niveau dintégration](https://dash.yunohost.org/integration/wekan.svg)](https://dash.yunohost.org/appci/app/wekan) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/wekan.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/wekan.maintain.svg)
[![Installer Wekan avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=wekan)
*[Read this readme in english.](./README.md)*
> *Ce package vous permet dinstaller Wekan 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 densemble
WeKan est une application de tableau kanban collaborative.
**Version incluse :** 7.18~ynh1
**Démo :** https://demo.sandstorm.io/appdemo/m86q05rdvj14yvn78ghaxynqz7u2svw6rnttptxx49g1785cdv1h
## Captures décran
![Capture décran de Wekan](./doc/screenshots/screenshot.jpg)
## Avertissements / informations importantes
* Il n'y a actuellement **pas d'intégration SSO**, bien qu'elle puisse être intégrée à un moment donné dans l'application, maintenant qu'elle est supportée par Meteor/Wekan. En attendant, les utilisateurs peuvent créer des comptes (en fait, ils peuvent créer un nombre infini de comptes) manuellement, et doivent se connecter manuellement spécifiquement dans Wekan.
* Cette application **ne fonctionne que sur une architecture x86, 64bits** ! En particulier, elle ne fonctionnera pas sur les machines 32 bits ou ARM. Voir la discussion [ici] (https://github.com/YunoHost-Apps/wekan_ynh/issues/1#issuecomment-401612500).
* Les utilisateurs de YunoHost ayant plus d'une adresse e-mail ne peuvent pas se connecter à wekan en utilisant ldap. Par exemple, le premier utilisateur de YunoHost a plusieurs adresses e-mail : root@domain ; admin@domain ; webmaster@domain ; postmaster@domain, etc.... Solution : supprimez tous les alias de messagerie de l'utilisateur que vous voulez connecter, connectez-vous une fois sur wekan, recréez les alias de l'utilisateur YunoHost.
## Configuration :
L'authentification LDAP étant activée par défaut, les admins de Wekan correspondent à la permission `Wekan Admin`. L'utilisateur que vous choisissez lors de l'installation est membre de ce groupe.
Pour ajouter un compte admin, vous pouvez :
- [avec le webadmin] allez dans Utilisateurs > Groupes et permissions > Ajouter l'utilisateur à la permission `Wekan Admin`.
- [ou avec la ligne de commande] `yunohost user permission update wekan.admin -a the_user_to_add`.
Tous les autres utilisateurs de YunhoHost peuvent accéder avec l'authentification LDAP.
Si vous avez désactivé l'authentification LDAP, le premier utilisateur enregistré sera l'administrateur, et les suivants seront des utilisateurs normaux. Si vous voulez d'autres administrateurs, vous pouvez changer leur permission à admin dans le panneau d'administration de Wekan.
**Mode privé/public:** En mode privé, seuls les membres autorisés de YunoHost peuvent accéder au Wekan.
## Documentations et ressources
* Site officiel de lapp : <https://wekan.github.io>
* Documentation officielle de ladmin : <https://github.com/wekan/wekan/wiki>
* Dépôt de code officiel de lapp : <https://github.com/wekan/wekan>
* YunoHost Store: <https://apps.yunohost.org/app/wekan>
* Signaler un bug : <https://github.com/YunoHost-Apps/wekan_ynh/issues>
## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/wekan_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit.
``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/wekan_ynh/tree/testing --debug
ou
sudo yunohost app upgrade wekan -u https://github.com/YunoHost-Apps/wekan_ynh/tree/testing --debug
```
**Plus dinfos sur le packaging dapplications :** <https://yunohost.org/packaging_apps>

View file

@ -1,9 +1,9 @@
;; Test complet
; Manifest
domain="domain.tld" (DOMAIN)
path="/path" (PATH)
admin="john" (USER)
is_public=1 (PUBLIC|public=1|private=0)
domain="domain.tld"
path="/path"
is_public=1
admin="john"
; Checks
pkg_linter=1
setup_sub_dir=1
@ -12,28 +12,12 @@
setup_private=1
setup_public=1
upgrade=1
# 3.79~ynh2
upgrade=1 from_commit=2843d504bcdb0402939f87ebeeda3417de02a9e4
# 3.95~ynh1
upgrade=1 from_commit=46f4b540cb99090a3fe1d35828094dbbfb34b692
# 3.95~ynh1
upgrade=1 from_commit=3cd252289f4fd138879872658762f4c6ae415cc4
# 6.30~ynh1 / Mongo 4.4 ; 5.0
upgrade=1 from_commit=19d250f0c09d4f8dad4343a86a5d20672853221a
backup_restore=1
multi_instance=1
# This test is no longer necessary since the version 2.7 (PR: https://github.com/YunoHost/yunohost/pull/304), you can still do it if your app could be installed with this version.
# incorrect_path=1
port_already_use=0
change_url=1
;;; Levels
# If the level 5 (Package linter) is forced to 1. Please add justifications here.
Level 5=auto
;;; Options
Email=ljf+ynh-wekan@reflexlibre.net
Notification=down
;;; Upgrade options
; commit=2843d504bcdb0402939f87ebeeda3417de02a9e4
name=3.79~ynh2
; commit=46f4b540cb99090a3fe1d35828094dbbfb34b692
name=3.95~ynh1
; commit=3cd252289f4fd138879872658762f4c6ae415cc4
name=3.95~ynh1

149
conf/.env
View file

@ -3,6 +3,10 @@
# The Node Environnement
NODE_ENV=production
# Writable path for temporary saving attachments during migration to Meteor-Files
# Create directory wekan-uploads
WRITABLE_PATH=__FINALPATH__
# The path to NODEJS
__YNH_NODE_LOAD_PATH__
#---------------------------------------------
@ -16,22 +20,29 @@ MONGO_URL=mongodb://__DB_USER__:__DB_PWD__@127.0.0.1:27017/__DB_NAME__
# Production: https://example.com/wekan
# Local: http://localhost:2000
# ipaddress=$(ifdata -pa eth0)
ROOT_URL=https://__DOMAIN____PATH__
ROOT_URL='https://__DOMAIN____PATH__'
#---------------------------------------------
# Working email IS NOT REQUIRED to use Wekan.
# https://github.com/wekan/wekan/wiki/Adding-users
# https://github.com/wekan/wekan/wiki/Troubleshooting-Mail
# https://github.com/wekan/wekan-mongodb/blob/master/docker-compose.yml
MAIL_URL='smtp://localhost:25/'
MAIL_URL='smtp://__MAIN_DOMAIN__:25/'
MAIL_FROM='Wekan Support <wekan@__DOMAIN__>'
# Currently MAIL_SERVICE is not in use.
#MAIL_SERVICE=Outlook365
#MAIL_SERVICE_USER=firstname.lastname@hotmail.com
#MAIL_SERVICE_PASSWORD=SecretPassword
#---------------------------------------------
#KADIRA_OPTIONS_ENDPOINT=http://127.0.0.1:11011
#---------------------------------------------
# This is local port where Wekan Node.js runs, same as below on Caddyfile settings.
PORT=__PORT__
#---------------------------------------------
# Wekan Export Board works when WITH_API=true.
# If you disable Wekan API with false, Export Board does not work.
# ==== NUMBER OF SEARCH RESULTS PER PAGE BY DEFAULT ====
#RESULTS_PER_PAGE=20
#---------------------------------------------
# Wekan Board works when WITH_API=true.
# If you disable Wekan API with false, Board does not work.
WITH_API='true'
#---------------------------------------------------------------
# ==== PASSWORD BRUTE FORCE PROTECTION ====
@ -44,15 +55,15 @@ WITH_API='true'
#ACCOUNTS_LOCKOUT_UNKNOWN_USERS_LOCKOUT_PERIOD=60
#ACCOUNTS_LOCKOUT_UNKNOWN_USERS_FAILURE_WINDOW=15
#---------------------------------------------------------------
# ==== ACCOUNT OPTIONS ====
# https://docs.meteor.com/api/accounts-multi.html#AccountsCommon-config
# Defaults below. Uncomment to change. wekan/server/accounts-common.js
# - ACCOUNTS_COMMON_LOGIN_EXPIRATION_IN_DAYS=90
#---------------------------------------------------------------
# ==== RICH TEXT EDITOR IN CARD COMMENTS ====
# https://github.com/wekan/wekan/pull/2560
RICHER_CARD_COMMENT_EDITOR=true
#---------------------------------------------------------------
# ==== MOUSE SCROLL ====
# https://github.com/wekan/wekan/issues/2949
SCROLLINERTIA=0
SCROLLAMOUNT=auto
#---------------------------------------------------------------
# ==== CARD OPENED, SEND WEBHOOK MESSAGE ====
CARD_OPENED_WEBHOOK_ENABLED=false
#---------------------------------------------------------------
@ -75,26 +86,26 @@ CARD_OPENED_WEBHOOK_ENABLED=false
# disable the feature by setting this variable to "NONE" or
# change the pattern to any valid regex. i.e. '|' delimited
# activityType names.
# a) Example
# a) Example
#BIGEVENTS_PATTERN=due
# b) All
#BIGEVENTS_PATTERN=received|start|due|end
# c) Disabled
BIGEVENTS_PATTERN=NONE
#---------------------------------------------------------------
# ==== EMAIL DUE DATE NOTIFICATION =====
# ==== EMAIL DUE DATE NOTIFICATION =====
# https://github.com/wekan/wekan/pull/2536
# System timelines will be showing any user modification for
# dueat startat endat receivedat, also notification to
# the watchers and if any card is due, about due or past due.
#
# Notify due days, default is None.
#
# Notify due days, default is None.
#NOTIFY_DUE_DAYS_BEFORE_AND_AFTER=2,0
# it will notify user 2 days before due day and on the due day
#
#
# Notify due at hour of day. Default every morning at 8am. Can be 0-23.
# If env variable has parsing error, use default. Notification sent to watchers.
# NOTIFY_DUE_AT_HOUR_OF_DAY=8
#NOTIFY_DUE_AT_HOUR_OF_DAY=8
#-----------------------------------------------------------------
# ==== EMAIL NOTIFICATION TIMEOUT, ms =====
# Defaut: 30000 ms = 30s
@ -120,6 +131,7 @@ BIGEVENTS_PATTERN=NONE
# The option that allows matomo to retrieve the username:
# Example: MATOMO_WITH_USERNAME=true
#MATOMO_WITH_USERNAME='false'
#---------------------------------------------
# Enable browser policy and allow one trusted URL that can have iframe that has Wekan embedded inside.
# Setting this to false is not recommended, it also disables all other browser policy protections
# and allows all iframing etc. See wekan/server/policy.js
@ -132,6 +144,9 @@ TRUSTED_URL=''
# Example: WEBHOOKS_ATTRIBUTES=cardId,listId,oldListId,boardId,comment,user,card,commentId
WEBHOOKS_ATTRIBUTES=''
#---------------------------------------------
# OAUTH2 ORACLE on premise identity manager OIM
#ORACLE_OIM_ENABLED=true
#---------------------------------------------
# ==== OAUTH2 AZURE ====
# https://github.com/wekan/wekan/wiki/Azure
# 1) Register the application with Azure. Make sure you capture
@ -139,23 +154,36 @@ WEBHOOKS_ATTRIBUTES=''
# 2) Configure the environment variables. This differs slightly
# by installation type, but make sure you have the following:
#OAUTH2_ENABLED=true
#
# Optional OAuth2 CA Cert, see https://github.com/wekan/wekan/issues/3299
#OAUTH2_CA_CERT=ABCD1234
#
# Use OAuth2 ADFS additional changes. Also needs OAUTH2_ENABLED=true setting.
#OAUTH2_ADFS_ENABLED=false
#
# OAuth2 docs: https://github.com/wekan/wekan/wiki/OAuth2
# OAuth2 login style: popup or redirect.
#OAUTH2_LOGIN_STYLE=redirect
#
# Application GUID captured during app registration:
#OAUTH2_CLIENT_ID=xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx
#
# Secret key generated during app registration:
#OAUTH2_SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
#OAUTH2_SERVER_URL=https://login.microsoftonline.com/
#OAUTH2_AUTH_ENDPOINT=/oauth2/v2.0/authorize
#OAUTH2_USERINFO_ENDPOINT=https://graph.microsoft.com/oidc/userinfo
#OAUTH2_TOKEN_ENDPOINT=/oauth2/v2.0/token
#
# The claim name you want to map to the unique ID field:
#OAUTH2_ID_MAP=email
#
# The claim name you want to map to the username field:
#OAUTH2_USERNAME_MAP=email
#
# The claim name you want to map to the full name field:
#OAUTH2_FULLNAME_MAP=name
#
# The claim name you want to map to the email field:
#OAUTH2_EMAIL_MAP=email
#-----------------------------------------------------------------
@ -177,30 +205,43 @@ WEBHOOKS_ATTRIBUTES=''
# https://github.com/wekan/wekan/wiki/OAuth2
# Enable the OAuth2 connection
#OAUTH2_ENABLED=true
#
# OAuth2 login style: popup or redirect.
#OAUTH2_LOGIN_STYLE=redirect
#
# OAuth2 Client ID.
#OAUTH2_CLIENT_ID=abcde12345
#
# OAuth2 Secret.
#OAUTH2_SECRET=54321abcde
#
# OAuth2 Server URL.
#OAUTH2_SERVER_URL=https://chat.example.com
#
# OAuth2 Authorization Endpoint.
#OAUTH2_AUTH_ENDPOINT=/oauth/authorize
#
# OAuth2 Userinfo Endpoint.
#OAUTH2_USERINFO_ENDPOINT=/oauth/userinfo
#
# OAuth2 Token Endpoint.
#OAUTH2_TOKEN_ENDPOINT=/oauth/token
#
# OAUTH2 ID Token Whitelist Fields.
#OAUTH2_ID_TOKEN_WHITELIST_FIELDS=[]
#
# OAUTH2 Request Permissions.
#OAUTH2_REQUEST_PERMISSIONS='openid profile email'
#
# OAuth2 ID Mapping
#OAUTH2_ID_MAP=
#
# OAuth2 Username Mapping
#OAUTH2_USERNAME_MAP=
#
# OAuth2 Fullname Mapping
#OAUTH2_FULLNAME_MAP=
#
# OAuth2 Email Mapping
#OAUTH2_EMAIL_MAP=
#---------------------------------------------
@ -216,10 +257,49 @@ LDAP_PORT=389
# example : LDAP_HOST=localhost
#LDAP_HOST=
LDAP_HOST=localhost
#
#-----------------------------------------------------------------
# ==== LDAP AD Simple Auth ====
#
# Set to true, if you want to connect with Active Directory by Simple Authentication.
# When using AD Simple Auth, LDAP_BASEDN is not needed.
#
# Example:
#LDAP_AD_SIMPLE_AUTH=true
#
# === LDAP User Authentication ===
#
# a) Option to login to the LDAP server with the user's own username and password, instead of
# an administrator key. Default: false (use administrator key).
#
# b) When using AD Simple Auth, set to true, when login user is used for binding,
# and LDAP_BASEDN is not needed.
#
# Example:
#LDAP_USER_AUTHENTICATION=true
#
# Which field is used to find the user for the user authentication. Default: uid.
#LDAP_USER_AUTHENTICATION_FIELD=uid
#
# === LDAP Default Domain ===
#
# a) In case AD SimpleAuth is configured, the default domain is appended to the given
# loginname for creating the correct username for the bind request to AD.
#
# b) The default domain of the ldap it is used to create email if the field is not map
# correctly with the LDAP_SYNC_USER_DATA_FIELDMAP
#
# Example :
#LDAP_DEFAULT_DOMAIN=mydomain.com
#
#-----------------------------------------------------------------
# ==== LDAP BASEDN Auth ====
#
# LDAP_BASEDN : The base DN for the LDAP Tree
# example : LDAP_BASEDN=ou=user,dc=example,dc=org
#LDAP_BASEDN=
LDAP_BASEDN=dc=yunohost,dc=org
#---------------------------------------------
# LDAP_LOGIN_FALLBACK : Fallback on the default authentication method
# example : LDAP_LOGIN_FALLBACK=true
#LDAP_LOGIN_FALLBACK=false
@ -255,6 +335,7 @@ LDAP_AUTHENTIFICATION=false
# LDAP_AUTHENTIFICATION_PASSWORD : The password for the search user
# example : AUTHENTIFICATION_PASSWORD=admin
#LDAP_AUTHENTIFICATION_PASSWORD=
#
# LDAP_LOG_ENABLED : Enable logs for the module
# example : LDAP_LOG_ENABLED=true
#LDAP_LOG_ENABLED=false
@ -268,6 +349,7 @@ LDAP_BACKGROUND_SYNC=true
# Leave this unset, so it uses default, and does not crash.
# https://github.com/wekan/wekan/issues/2354#issuecomment-515305722
LDAP_BACKGROUND_SYNC_INTERVAL=''
#
# LDAP_BACKGROUND_SYNC_KEEP_EXISTANT_USERS_UPDATED :
# example : LDAP_BACKGROUND_SYNC_KEEP_EXISTANT_USERS_UPDATED=true
#LDAP_BACKGROUND_SYNC_KEEP_EXISTANT_USERS_UPDATED=false
@ -279,16 +361,15 @@ LDAP_BACKGROUND_SYNC_IMPORT_NEW_USERS=true
# LDAP_ENCRYPTION : If using LDAPS
# example : LDAP_ENCRYPTION=ssl
#LDAP_ENCRYPTION=false
#
# LDAP_CA_CERT : The certification for the LDAPS server. Certificate needs to be included in this docker-compose.yml file.
# example : LDAP_CA_CERT=-----BEGIN CERTIFICATE-----MIIE+zCCA+OgAwIBAgIkAhwR/6TVLmdRY6hHxvUFWc0+Enmu/Hu6cj+G2FIdAgIC...-----END CERTIFICATE-----
#LDAP_CA_CERT=
#
# LDAP_REJECT_UNAUTHORIZED : Reject Unauthorized Certificate
# example : LDAP_REJECT_UNAUTHORIZED=true
#LDAP_REJECT_UNAUTHORIZED=false
# Option to login to the LDAP server with the user's own username and password, instead of an administrator key. Default: false (use administrator key).
#LDAP_USER_AUTHENTICATION=true
# Which field is used to find the user for the user authentication. Default: uid.
#LDAP_USER_AUTHENTICATION_FIELD=uid
#
# LDAP_USER_SEARCH_FILTER : Optional extra LDAP filters. Don't forget the outmost enclosing parentheses if needed
# example : LDAP_USER_SEARCH_FILTER=
#LDAP_USER_SEARCH_FILTER=
@ -300,7 +381,7 @@ LDAP_USER_SEARCH_SCOPE=sub
# LDAP_USER_SEARCH_FIELD : Which field is used to find the user
# example : LDAP_USER_SEARCH_FIELD=uid
#LDAP_USER_SEARCH_FIELD=
LDAP_USER_SEARCH_FIELD=uid
LDAP_USER_SEARCH_FIELD=uid,mail
# LDAP_SEARCH_PAGE_SIZE : Used for pagination (0=unlimited)
# example : LDAP_SEARCH_PAGE_SIZE=12345
#LDAP_SEARCH_PAGE_SIZE=0
@ -381,9 +462,6 @@ LDAP_SYNC_USER_DATA_FIELDMAP={"cn":"name"}
# example :
#LDAP_SYNC_GROUP_ROLES=
LDAP_SYNC_GROUP_ROLES=__APP__.admin
# LDAP_DEFAULT_DOMAIN : The default domain of the ldap it is used to create email if the field is not map correctly with the LDAP_SYNC_USER_DATA_FIELDMAP
# example :
#LDAP_DEFAULT_DOMAIN=
# Enable/Disable syncing of admin status based on ldap groups:
#LDAP_SYNC_ADMIN_STATUS=true
LDAP_SYNC_ADMIN_STATUS=true
@ -409,5 +487,26 @@ LDAP_SYNC_ADMIN_GROUPS=__APP__.admin
# example : LOGOUT_ON_MINUTES=55
#LOGOUT_ON_MINUTES=
#---------------------------------------------------------------------
# PASSWORD_LOGIN_ENABLED : Enable or not the password login form.
#PASSWORD_LOGIN_ENABLED=true
# PASSWORD_LOGIN_ENABLED : Enable or not the password login form.
#PASSWORD_LOGIN_ENABLED=true
#---------------------------------------------------------------------
#CAS_ENABLED=true
#CAS_BASE_URL=https://cas.example.com/cas
#CAS_LOGIN_URL=https://cas.example.com/login
#CAS_VALIDATE_URL=https://cas.example.com/cas/p3/serviceValidate
#---------------------------------------------------------------------
#SAML_ENABLED=true
#SAML_PROVIDER=
#SAML_ENTRYPOINT=
#SAML_ISSUER=
#SAML_CERT=
#SAML_IDPSLO_REDIRECTURL=
#SAML_PRIVATE_KEYFILE=
#SAML_PUBLIC_CERTFILE=
#SAML_IDENTIFIER_FORMAT=
#SAML_LOCAL_PROFILE_MATCH_ATTRIBUTE=
#SAML_ATTRIBUTES=
#---------------------------------------------------------------------
# Wait spinner to use
#WAIT_SPINNER=Bounce
#---------------------------------------------------------------------

6
conf/amd64.src Normal file
View file

@ -0,0 +1,6 @@
SOURCE_URL=https://github.com/wekan/wekan/releases/download/v7.18/wekan-7.18-amd64.zip
SOURCE_SUM=da865310d70de763fc0d410344e28a493691e461b5195fe97d16e89f3d0d7246
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=

View file

@ -1,9 +1,6 @@
# This is on YunoHost server just to avoid the file from disappearing
# Original source is https://releases.wekan.team/raspi3/wekan-4.09-arm64.zip
# YunoHost source is https://build.yunohost.org/apps/wekan-4.09-arm64.zip
SOURCE_URL=https://build.yunohost.org/apps/wekan-4.09-arm64.zip
SOURCE_SUM=1b81e1ae063bf2781d8a79a06f924f0cd5393815fe6e2ef688835fea48a255ec
SOURCE_URL=https://github.com/wekan/wekan/releases/download/v7.18/wekan-7.18-arm64.zip
SOURCE_SUM=6e384614e436147cbe4977ea8dd51f4e45487f455b23efe5e44d74ef6b69ceaf
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=wekan-4.09-arm64.zip
SOURCE_FILENAME=

View file

@ -1,34 +1,16 @@
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ {
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent;
}
proxy_pass http://127.0.0.1:__PORT__;
proxy_http_version 1.1;
client_max_body_size 100M;
proxy_set_header Accept-Encoding "";
# allow websockets
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
# preserve client IP
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
#proxy_buffering off;
# this setting allows the browser to cache the application in
# a way compatible with Meteor.
# on every applicaiton update the name of CSS and JS file is different,
# so they can be cache infinitely (here: 30 days)
# the root path MUST NOT be cached
if ($uri != '__PATH__')
{
expires 30d;
}
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
proxy_pass http://127.0.0.1:__PORT__;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
# preserve client IP
proxy_set_header X-Forwarded-For $remote_addr;
client_max_body_size 100M;
# Include SSOWAT user panel.
#include conf.d/yunohost_panel.conf.inc;
}

View file

@ -1,5 +1,5 @@
[Unit]
Description=Wekan, task board
Description=Wekan: task board
Wants=__MONGODB_SERVICENAME__.service
After=network.target __MONGODB_SERVICENAME__.service
@ -8,7 +8,7 @@ Type=simple
User=__APP__
Group=__APP__
EnvironmentFile=__FINALPATH__/.env
WorkingDirectory=__FINALPATH__
WorkingDirectory=__FINALPATH__/
ExecStart=__YNH_NODE__ __FINALPATH__/main.js
Restart=on-failure
#StartLimitInterval=86400

View file

@ -1,9 +0,0 @@
# This is on YunoHost server just to avoid the file from disappearing
# Original source is https://releases.wekan.team/wekan-4.09.zip
# YunoHost source is https://build.yunohost.org/apps/wekan-4.09.zip
SOURCE_URL=https://build.yunohost.org/apps/wekan-4.09.zip
SOURCE_SUM=e3dd35d138e393c7bc43816407dd424f03c2c86af8f07ec74893fae5ee05964a
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=wekan-4.09.zip

0
doc/.gitkeep Normal file
View file

1
doc/DESCRIPTION.md Normal file
View file

@ -0,0 +1 @@
WeKan is an completely Open Source and Free software collaborative kanban board.

1
doc/DESCRIPTION_fr.md Normal file
View file

@ -0,0 +1 @@
WeKan est une application de tableau kanban collaborative.

16
doc/DISCLAIMER.md Normal file
View file

@ -0,0 +1,16 @@
* There is currently **no SSO integration** though it might be integrated at some point in the app, now that it's supported in Meteor/Wekan. In the meantime, users can create accounts (in fact, they can create infinite number of accounts) manually, and need to login manually specifically in Wekan.
* This app **only works on x86, 64bits architecture**! In particular, it won't work on 32 bit machines or ARM. See the discussion [here](https://github.com/YunoHost-Apps/wekan_ynh/issues/1#issuecomment-401612500).
* YunoHost users with more than one email address can't login to wekan using ldap. For example first YunoHost user has severals email addresses: root@domain; admin@domain; webmaster@domain; postmaster@domain, etc... Workaround: remove all mail aliases of the user you want to connect, connect one time on wekan, recreate the aliases of the YunoHost user.
## Configuration:
As LDAP authentification is enabled by default, Wekan admins correspond to the permission `Wekan Admin`. The user you choose during installation is member of this group.
To add an admin account, you can:
- [with the webadmin] go to Users > Groups and permissions > Add the user to the permission `Wekan Admin`
- [or with the command line] `yunohost user permission update wekan.admin -a the_user_to_add`
All others YunhoHost user can access with LDAP authentication.
If you have disable ldap authentication, first registered user will be admin, and next ones normal users. If you want other admins too, you can change their permission to admin at Wekan Admin Panel.
**Private/Public mode:** In private mode, only authorized YunoHost members can access to the Wekan.

16
doc/DISCLAIMER_fr.md Normal file
View file

@ -0,0 +1,16 @@
* Il n'y a actuellement **pas d'intégration SSO**, bien qu'elle puisse être intégrée à un moment donné dans l'application, maintenant qu'elle est supportée par Meteor/Wekan. En attendant, les utilisateurs peuvent créer des comptes (en fait, ils peuvent créer un nombre infini de comptes) manuellement, et doivent se connecter manuellement spécifiquement dans Wekan.
* Cette application **ne fonctionne que sur une architecture x86, 64bits** ! En particulier, elle ne fonctionnera pas sur les machines 32 bits ou ARM. Voir la discussion [ici] (https://github.com/YunoHost-Apps/wekan_ynh/issues/1#issuecomment-401612500).
* Les utilisateurs de YunoHost ayant plus d'une adresse e-mail ne peuvent pas se connecter à wekan en utilisant ldap. Par exemple, le premier utilisateur de YunoHost a plusieurs adresses e-mail : root@domain ; admin@domain ; webmaster@domain ; postmaster@domain, etc.... Solution : supprimez tous les alias de messagerie de l'utilisateur que vous voulez connecter, connectez-vous une fois sur wekan, recréez les alias de l'utilisateur YunoHost.
## Configuration :
L'authentification LDAP étant activée par défaut, les admins de Wekan correspondent à la permission `Wekan Admin`. L'utilisateur que vous choisissez lors de l'installation est membre de ce groupe.
Pour ajouter un compte admin, vous pouvez :
- [avec le webadmin] allez dans Utilisateurs > Groupes et permissions > Ajouter l'utilisateur à la permission `Wekan Admin`.
- [ou avec la ligne de commande] `yunohost user permission update wekan.admin -a the_user_to_add`.
Tous les autres utilisateurs de YunhoHost peuvent accéder avec l'authentification LDAP.
Si vous avez désactivé l'authentification LDAP, le premier utilisateur enregistré sera l'administrateur, et les suivants seront des utilisateurs normaux. Si vous voulez d'autres administrateurs, vous pouvez changer leur permission à admin dans le panneau d'administration de Wekan.
**Mode privé/public:** En mode privé, seuls les membres autorisés de YunoHost peuvent accéder au Wekan.

0
doc/screenshots/.gitkeep Normal file
View file

View file

Before

Width:  |  Height:  |  Size: 123 KiB

After

Width:  |  Height:  |  Size: 123 KiB

View file

@ -4,65 +4,58 @@
"packaging_format": 1,
"description": {
"en": "Trello-like kanban",
"fr": "Un kanban similaire à Trello"
"fr": "Kanban similaire à Trello"
},
"version": "7.18~ynh1",
"url": "https://wekan.github.io",
"upstream": {
"license": "MIT",
"website": "https://wekan.github.io",
"demo": "https://demo.sandstorm.io/appdemo/m86q05rdvj14yvn78ghaxynqz7u2svw6rnttptxx49g1785cdv1h",
"admindoc": "https://github.com/wekan/wekan/wiki",
"code": "https://github.com/wekan/wekan"
},
"version": "4.09~ynh2",
"url": "https://wekan.io",
"license": "MIT",
"maintainer": [
{
"name": "alexAubin",
"email": "alex.aubin@mailoo.org",
"url": "https://github.com/alexAubin/"
"name": "alexAubin",
"email": "alex.aubin@mailoo.org",
"url": "https://github.com/alexAubin/"
},
{
"name": "ljf"
}],
},
{
"name": "yalh76"
}
],
"requirements": {
"yunohost": ">= 3.8"
"yunohost": ">= 11.2"
},
"multi_instance": true,
"services": [
"nginx"
],
"arguments": {
"install" : [
"install": [
{
"name": "domain",
"type": "domain",
"ask": {
"en": "Choose a domain name for Wekan",
"fr": "Choisissez un nom de domaine pour Wekan"
},
"example": "example.com"
"type": "domain"
},
{
"name": "path",
"type": "path",
"ask": {
"en": "Choose a path for Wekan",
"fr": "Choisissez un chemin pour Wekan"
},
"example": "/wekan",
"default": "/wekan"
},
{
"name": "admin",
"type": "user",
"ask": {
"en": "Choose an admin user",
"fr": "Choisissez ladministrateur"
},
"example": "johndoe"
},
{
"name": "is_public",
"type": "boolean",
"ask": {
"en": "Is it a public application?",
"fr": "Est-ce une application publique ?"
},
"default": false
},
{
"name": "admin",
"type": "user"
}
]
}

View file

@ -1,18 +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
---
*If you have access to [App Continuous Integration for packagers](https://yunohost.org/#/packaging_apps_ci) you can provide a link to the package_check results like below, replacing '-NUM-' in this link by the PR number and USERNAME by your username on the ci-apps-dev. Or you provide a screenshot or a pastebin of the results*
[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/wekan_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/wekan_ynh%20PR-NUM-%20(USERNAME)/)

View file

@ -7,7 +7,7 @@
# dependencies used by the app
pkg_dependencies=""
nodejsversion=12.16.3
nodejs_version="14.21.3"
#=================================================
# PERSONAL HELPERS

View file

@ -6,9 +6,9 @@
# 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 ../settings/scripts/ynh_mongo_db
source ../settings/scripts/ynh_mongo_db__2
source /usr/share/yunohost/helpers
#=================================================
@ -16,7 +16,7 @@ source /usr/share/yunohost/helpers
#=================================================
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

@ -36,17 +36,18 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
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)..."
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
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
@ -80,23 +81,23 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression --message="Updating nginx web server configuration..."
ynh_script_progression --message="Updating NGINX web server configuration..."
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
# Change the path in the nginx config file
# Change the path in the NGINX config file
if [ $change_path -eq 1 ]
then
# Make a backup of the original nginx config file if modified
# Make a backup of the original NGINX config file if modified
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
# Set global variables for nginx helper
# Set global variables for NGINX helper
domain="$old_domain"
path_url="$new_path"
# Create a dedicated nginx config
# Create a dedicated NGINX config
ynh_add_nginx_config
fi
# Change the domain for nginx
# Change the domain for NGINX
if [ $change_domain -eq 1 ]
then
# Delete file checksum for the old conf file location
@ -134,7 +135,7 @@ fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading nginx web server..."
ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload

89
scripts/install Executable file → Normal file
View file

@ -7,9 +7,7 @@
#=================================================
source _common.sh
source ynh_detect_arch__2
source ynh_add_config
source ynh_mongo_db
source ynh_mongo_db__2
source /usr/share/yunohost/helpers
#=================================================
@ -28,8 +26,8 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
admin=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_IS_PUBLIC
admin=$YNH_APP_ARG_ADMIN
app=$YNH_APP_INSTANCE_NAME
@ -38,9 +36,8 @@ app=$YNH_APP_INSTANCE_NAME
#=================================================
ynh_script_progression --message="Validating installation parameters..."
architecture=$(ynh_detect_arch)
# Check machine architecture (in particular, we don't support ARM and 32bit machines)
if [ $architecture == "i386" ] || [ $architecture == "arm" ]
if [ $YNH_ARCH == "i386" ] || [ $YNH_ARCH == "armel" ] || [ $YNH_ARCH == "armhf" ] || [ $YNH_ARCH == "aarch64" ] || [ $YNH_ARCH == "arm64" ]
then
ynh_die --message="Sorry, but this app can only be installed on a x86, 64 bits machine :("
fi
@ -58,14 +55,13 @@ 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=is_public --value=$is_public
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# FIND AND OPEN A PORT
#=================================================
ynh_script_progression --message="Configuring firewall..."
ynh_script_progression --message="Finding an available port..."
# Find an available port
port=$(ynh_find_port --port=8095)
@ -77,17 +73,24 @@ ynh_app_setting_set --app=$app --key=port --value=$port
ynh_script_progression --message="Installing dependencies..."
ynh_install_app_dependencies $pkg_dependencies
ynh_install_nodejs --nodejs_version=$nodejsversion
ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_use_nodejs
ynh_install_mongo
ynh_mongo_test_if_first_run
#=================================================
# 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 MONGODB DATABASE
#=================================================
ynh_script_progression --message="Creating a MongoDB database..."
# Registering db name
db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
@ -100,60 +103,50 @@ 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
ynh_setup_source --dest_dir="$final_path" --source_id="$architecture"
ynh_setup_source --dest_dir="$final_path" --source_id="$YNH_ARCH"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:$app "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring nginx web server..."
ynh_script_progression --message="Configuring NGINX web server..."
# Create a dedicated nginx config
# 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
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a config file..."
main_domain=$(cat /etc/yunohost/current_host)
ynh_add_config --template=".env" --destination="$final_path/.env"
chmod 400 "$final_path/.env"
chown $app:$app "$final_path/.env"
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Configuring a systemd service..."
# Create a dedicated systemd config
ynh_add_systemd_config --others_var="mongodb_servicename ynh_node"
#=================================================
# MODIFY A CONFIG FILE
#=================================================
ynh_script_progression --message="Modifying a config file..."
# Create a dedicated .env config
ynh_add_config --template=".env" --destination="$final_path/.env"
ynh_add_systemd_config
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_script_progression --message="Securing files and directories..."
# Set strong right permissions to app files
chown -R $app: "$final_path"
chmod -R 640 "$final_path"
find "$final_path" -type d -print0 | xargs -0 chmod 750
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --description "Wekan daemon" --log_type "systemd"
yunohost service add $app --description="Wekan daemon"
#=================================================
# START SYSTEMD SERVICE
@ -161,7 +154,7 @@ yunohost service add $app --description "Wekan daemon" --log_type "systemd"
ynh_script_progression --message="Starting a systemd service..."
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Meteor APM: completed instrumenting the app"
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Enabling LDAP Background Sync"
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then
sleep 60
@ -170,20 +163,22 @@ fi
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring SSOwat..."
ynh_permission_create --permission="admin" --allowed "$admin"
ynh_script_progression --message="Configuring permissions..."
# Make app public if necessary
if [ $is_public -eq 1 ]
then
ynh_permission_update --permission "main" --add "visitors"
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
ynh_permission_update --permission="main" --add="visitors"
fi
ynh_permission_create --permission="admin" --allowed=$admin
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading nginx web server..."
ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload

View file

@ -7,7 +7,7 @@
#=================================================
source _common.sh
source ynh_mongo_db
source ynh_mongo_db__2
source /usr/share/yunohost/helpers
#=================================================
@ -29,10 +29,10 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
# 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..."
ynh_script_progression --message="Removing $app service integration..."
yunohost service remove $app
fi
@ -54,16 +54,6 @@ ynh_mongo_test_if_first_run
# Remove a database if it exists, along with the associated user
ynh_mongo_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_remove_mongo
#=================================================
# REMOVE APP MAIN DIR
#=================================================
@ -75,11 +65,21 @@ ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing nginx web server configuration..."
ynh_script_progression --message="Removing NGINX web server configuration..."
# Remove the dedicated nginx config
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..."
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
ynh_remove_nodejs
ynh_remove_mongo
#=================================================
# GENERIC FINALIZATION
#=================================================

View file

@ -6,9 +6,9 @@
# 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 ../settings/scripts/ynh_mongo_db
source ../settings/scripts/ynh_mongo_db__2
source /usr/share/yunohost/helpers
#=================================================
@ -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
@ -33,33 +33,18 @@ 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
mongo_version=$(ynh_app_setting_get --app=$app --key=mongo_version)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
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 "
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the nginx configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..."
ynh_restore_file --origin_path="$final_path"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
@ -69,14 +54,15 @@ ynh_script_progression --message="Recreating the dedicated system user..."
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# RESTORE USER RIGHTS
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring user rights..."
ynh_script_progression --message="Restoring the app main directory..."
# Restore permissions on app files
chown -R $app: "$final_path"
chmod -R 640 "$final_path"
find "$final_path" -type d -print0 | xargs -0 chmod 750
ynh_restore_file --origin_path="$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:$app "$final_path"
#=================================================
# SPECIFIC RESTORATION
@ -87,7 +73,7 @@ ynh_script_progression --message="Reinstalling dependencies..."
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
ynh_install_nodejs --nodejs_version=$nodejsversion
ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_use_nodejs
ynh_install_mongo
ynh_mongo_test_if_first_run
@ -107,21 +93,21 @@ ynh_mongo_restore_db --database="$db_name" < ./dump.bson
ynh_script_progression --message="Restoring the systemd configuration..."
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service
systemctl enable $app.service --quiet
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --description "Wekan daemon" --log_type "systemd"
yunohost service add $app --description="Wekan daemon"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..."
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Started Wekan, task board"
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Enabling LDAP Background Sync"
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then
sleep 60
@ -132,7 +118,7 @@ fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading nginx web server..."
ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload

View file

@ -7,10 +7,7 @@
#=================================================
source _common.sh
source ynh_package_version
source ynh_detect_arch__2
source ynh_add_config
source ynh_mongo_db
source ynh_mongo_db__2
source /usr/share/yunohost/helpers
#=================================================
@ -26,6 +23,7 @@ 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
port=$(ynh_app_setting_get --app=$app --key=port)
mongo_version=$(ynh_app_setting_get --app=$app --key=mongo_version)
#=================================================
# CHECK VERSION
@ -34,28 +32,6 @@ ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."
# If db_name doesn't exist, create it
if [ -z "$db_name" ]; then
db_name=$(ynh_sanitize_dbid --db_name=$app)
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
fi
#=================================================
# CHECK VERSION NUMBER
#=================================================
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then
sleep 60
fi
abort_if_up_to_date
# previous function is what defines 'version', more precisely the 'previous version'
previous_version="${version}"
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
@ -64,19 +40,13 @@ ynh_script_progression --message="Backing up the app before upgrading (may take
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# restore it if the upgrade fails
ynh_clean_check_starting
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# CHECK THE PATH
#=================================================
# Normalize the URL path syntax
path_url=$(ynh_normalize_url_path --path_url=$path_url)
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
@ -87,9 +57,9 @@ ynh_script_progression --message="Stopping a systemd service..."
ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd
#=================================================
# MANAGE UPGRADE FROM PREVIOUS VERSION
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Managing upgrade from previous version..."
ynh_script_progression --message="Ensuring downward compatibility..."
if ynh_version_gt "0.45-2" "${previous_version}" ; then
ynh_script_progression --message="Upgrading to 0.45-2..."
@ -139,42 +109,18 @@ then
fi
ynh_app_setting_delete --app=$app --key=is_public
ynh_permission_create --permission="admin"
fi
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..."
# Create a temporary directory
tmpdir="$(mktemp -d)"
# Backup the env file in the temp dir
cp -a "$final_path/.env" "$tmpdir/.env"
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
architecture=$(ynh_detect_arch)
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path" --source_id="$architecture"
#Copy the admin saved settings from tmp directory to final path
cp -a "$tmpdir/.env" "$final_path/.env"
# Remove the tmp directory securely
ynh_secure_remove --file="$tmpdir"
if ! ynh_permission_exists --permission="admin"; then
# Create the required permissions
ynh_permission_create --permission="admin" --allowed=$admin
fi
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading nginx web server configuration..."
# If mongo_version doesn't exist, create it
if [ -z "$mongo_version" ]; then
mongo_version="$(mongod --version | grep -oP 'db version v\K.{0,3}')"
ynh_app_setting_set --app=$app --key=mongo_version --value=$mongo_version
fi
# Create a dedicated nginx config
ynh_add_nginx_config
@ -200,39 +146,76 @@ ynh_script_progression --message="Making sure dedicated system user exists..."
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# MODIFY A CONFIG FILE
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Modifying a config file..."
# Create a dedicated .env config
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path" --source_id="$YNH_ARCH" --keep=".env"
fi
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:$app "$final_path"
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..."
ynh_install_app_dependencies $pkg_dependencies
ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_use_nodejs
ynh_install_mongo --mongo_version=$mongo_version
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..."
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# SPECIFIC UPGRADE
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Updating a configuration file..."
main_domain=$(cat /etc/yunohost/current_host)
ynh_add_config --template=".env" --destination="$final_path/.env"
chmod 400 "$final_path/.env"
chown $app:$app "$final_path/.env"
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Upgrading systemd configuration..."
# Create a dedicated systemd config
ynh_add_systemd_config --others_var="mongodb_servicename ynh_node"
ynh_add_systemd_config
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Securing files and directories..."
ynh_script_progression --message="Integrating service in YunoHost..."
# Set permissions on app files
chown -R $app: "$final_path"
chmod -R 640 "$final_path"
find "$final_path" -type d -print0 | xargs -0 chmod 750
yunohost service add $app --description="Wekan daemon"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..."
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Started Wekan, task board"
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Enabling LDAP Background Sync"
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then
sleep 60
@ -241,7 +224,7 @@ fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading nginx web server..."
ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload

View file

@ -1,140 +0,0 @@
#!/bin/bash
# Create a dedicated config file from a template
#
# examples:
# ynh_add_config --template=".env" --destination="$final_path/.env"
# ynh_add_config --template="../conf/.env" --destination="$final_path/.env"
# ynh_add_config --template="/etc/nginx/sites-available/default" --destination="etc/nginx/sites-available/mydomain.conf"
#
# usage: ynh_add_config --template="template" --destination="destination"
# | arg: -t, --template= - Template config file to use
# | arg: -d, --destination= - Destination of the config file
#
# The template can be by default the name of a file in the conf directory
# of a YunoHost Package, a relative path or an absolute path
# The helper will use the template $template to generate a config file
# $destination by replacing the following keywords with global variables
# that should be defined before calling this helper :
# __PATH__ by $path_url
# __NAME__ by $app
# __NAMETOCHANGE__ by $app
# __USER__ by $app
# __FINALPATH__ by $final_path
# __PHPVERSION__ by $YNH_PHP_VERSION
#
# And any dynamic variables that should be defined before calling this helper like:
# __DOMAIN__ by $domain
# __APP__ by $app
# __VAR_1__ by $var_1
# __VAR_2__ by $var_2
#
# The helper will verify the checksum and backup the destination file
# if it's different before applying the new template.
# And it will calculate and store the destination file checksum
# into the app settings when configuration is done.
#
#
ynh_add_config () {
# Declare an array to define the options of this helper.
local legacy_args=tdv
local -A args_array=( [t]=template= [d]=destination= )
local template
local destination
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
local template_path
if [ -f "../conf/$template" ]; then
template_path="../conf/$template"
elif [ -f "../settings/conf/$template" ]; then
template_path="../settings/conf/$template"
elif [ -f "$template" ]; then
template_path=$template
else
ynh_die --message="The provided template $template doesn't exist"
fi
ynh_backup_if_checksum_is_different --file="$destination"
cp "$template_path" "$destination"
ynh_replace_vars --file="$destination"
ynh_store_file_checksum --file="$destination"
}
# Replace variables in a file
#
# usage: ynh_replace_vars --file="file"
# | arg: -f, --file= - File where to replace variables
#
# The helper will replace the following keywords with global variables
# that should be defined before calling this helper :
# __PATH__ by $path_url
# __NAME__ by $app
# __NAMETOCHANGE__ by $app
# __USER__ by $app
# __FINALPATH__ by $final_path
# __PHPVERSION__ by $YNH_PHP_VERSION
#
# And any dynamic variables that should be defined before calling this helper like:
# __DOMAIN__ by $domain
# __APP__ by $app
# __VAR_1__ by $var_1
# __VAR_2__ by $var_2
#
#
ynh_replace_vars () {
# Declare an array to define the options of this helper.
local legacy_args=f
local -A args_array=( [f]=file= )
local file
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
# Replace specific YunoHost variables
if test -n "${path_url:-}"
then
# path_url_slash_less is path_url, or a blank value if path_url is only '/'
local path_url_slash_less=${path_url%/}
ynh_replace_string --match_string="__PATH__/" --replace_string="$path_url_slash_less/" --target_file="$file"
ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="$file"
fi
if test -n "${app:-}"; then
ynh_replace_string --match_string="__NAME__" --replace_string="$app" --target_file="$file"
ynh_replace_string --match_string="__NAMETOCHANGE__" --replace_string="$app" --target_file="$file"
ynh_replace_string --match_string="__USER__" --replace_string="$app" --target_file="$file"
fi
if test -n "${final_path:-}"; then
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$file"
fi
if test -n "${YNH_PHP_VERSION:-}"; then
ynh_replace_string --match_string="__PHPVERSION__" --replace_string="$YNH_PHP_VERSION" --target_file="$file"
fi
if test -n "${ynh_node_load_PATH:-}"; then
ynh_replace_string --match_string="__YNH_NODE_LOAD_PATH__" --replace_string="$ynh_node_load_PATH" --target_file="$file"
fi
# Replace others variables
# List other unique (__ __) variables in $file
local uniques_vars=( $(grep -o '__[A-Z0-9_]*__' $file | sort --unique | sed "s@__\([^.]*\)__@\L\1@g" ))
# Do the replacement
local delimit=@
for one_var in "${uniques_vars[@]}"
do
# Validate that one_var is indeed defined
test -n "${!one_var:-}" || ynh_die --message="\$$one_var wasn't initialized when trying to replace __${one_var^^}__ in $file"
# Escape delimiter in match/replace string
match_string="__${one_var^^}__"
match_string=${match_string//${delimit}/"\\${delimit}"}
replace_string="${!one_var}"
replace_string=${replace_string//${delimit}/"\\${delimit}"}
# Actually replace (sed is used instead of ynh_replace_string to avoid triggering an epic amount of debug logs)
sed --in-place "s${delimit}${match_string}${delimit}${replace_string}${delimit}g" "$file"
done
}

View file

@ -1,25 +0,0 @@
#!/bin/bash
# Check the architecture
#
# example: architecture=$(ynh_detect_arch)
#
# usage: ynh_detect_arch
#
# Requires YunoHost version 2.2.4 or higher.
ynh_detect_arch(){
local architecture
if [ -n "$(uname -m | grep arm64)" ] || [ -n "$(uname -m | grep aarch64)" ]; then
architecture="arm64"
elif [ -n "$(uname -m | grep 64)" ]; then
architecture="x86-64"
elif [ -n "$(uname -m | grep 86)" ]; then
architecture="i386"
elif [ -n "$(uname -m | grep arm)" ]; then
architecture="arm"
else
architecture="unknown"
fi
echo $architecture
}

349
scripts/ynh_mongo_db__2 Normal file
View file

@ -0,0 +1,349 @@
#!/bin/bash
readonly YNH_DEFAULT_MONGO_VERSION=4.4
# Declare the actual MongoDB version to use: 4.4 ; 5.0
# A packager willing to use another version of MongoDB can override the variable into its _common.sh.
YNH_MONGO_VERSION=${YNH_MONGO_VERSION:-$YNH_DEFAULT_MONGO_VERSION}
# Execute a mongo command
#
# example: ynh_mongo_exec --command='db.getMongo().getDBNames().indexOf("wekan")'
# example: ynh_mongo_exec --command="db.getMongo().getDBNames().indexOf(\"wekan\")"
#
# usage: ynh_mongo_exec [--username=username] [--password=password] [--authenticationdatabase=authenticationdatabase] [--database=database] [--host=host] [--port=port] --command="command" [--eval]
# | arg: -u, --username= - The user name to connect as
# | arg: -p, --password= - The user password
# | arg: -d, --authenticationdatabase= - The authenticationdatabase to connect to
# | arg: -d, --database= - The database to connect to
# | arg: -h, --host= - The host to connect to
# | arg: -P, --port= - The port to connect to
# | arg: -c, --command= - The command to evaluate
# | arg: -e, --eval - Evaluate instead of execute the command.
#
#
ynh_mongo_exec() {
# Declare an array to define the options of this helper.
local legacy_args=upadhPce
local -A args_array=( [u]=username= [p]=password= [a]=authenticationdatabase= [d]=database= [h]=host= [P]=port= [c]=command= [e]=eval )
local username
local password
local authenticationdatabase
local database
local host
local port
local command
local eval
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
username="${username:-}"
password="${password:-}"
authenticationdatabase="${authenticationdatabase:-}"
database="${database:-}"
host="${host:-}"
port="${port:-}"
eval=${eval:-0}
# If username is provided
if [ -n "$username" ]
then
username="--username=$username"
# If password is provided
if [ -n "$password" ]
then
password="--password=$password"
fi
# If authenticationdatabase is provided
if [ -n "$authenticationdatabase" ]
then
authenticationdatabase="--authenticationDatabase=$authenticationdatabase"
else
authenticationdatabase="--authenticationDatabase=admin"
fi
else
password=""
authenticationdatabase=""
fi
# If host is provided
if [ -n "$host" ]
then
host="--host=$host"
fi
# If port is provided
if [ -n "$port" ]
then
port="--port=$port"
fi
# If eval is not provided
if [ $eval -eq 0 ]
then
# If database is provided
if [ -n "$database" ]
then
database="use $database"
else
database=""
fi
mongosh --quiet $username $password $authenticationdatabase $host $port <<EOF
$database
${command}
quit()
EOF
else
# If database is provided
if [ -n "$database" ]
then
database="$database"
else
database=""
fi
mongosh --quiet $database $username $password $authenticationdatabase $host $port --eval="$command"
fi
}
# Drop a database
#
# [internal]
#
# If you intend to drop the database *and* the associated user,
# consider using ynh_mongo_remove_db instead.
#
# usage: ynh_mongo_drop_db --database=database
# | arg: -d, --database= - The database name to drop
#
#
ynh_mongo_drop_db() {
# Declare an array to define the options of this helper.
local legacy_args=d
local -A args_array=( [d]=database= )
local database
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
ynh_mongo_exec --database="$database" --command='db.runCommand({dropDatabase: 1})'
}
# Dump a database
#
# example: ynh_mongo_dump_db --database=wekan > ./dump.bson
#
# usage: ynh_mongo_dump_db --database=database
# | arg: -d, --database= - The database name to dump
# | ret: the mongodump output
#
#
ynh_mongo_dump_db() {
# Declare an array to define the options of this helper.
local legacy_args=d
local -A args_array=( [d]=database= )
local database
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
mongodump --quiet --db="$database" --archive
}
# Create a user
#
# [internal]
#
# usage: ynh_mongo_create_user --db_user=user --db_pwd=pwd --db_name=name
# | arg: -u, --db_user= - The user name to create
# | arg: -p, --db_pwd= - The password to identify user by
# | arg: -n, --db_name= - Name of the database to grant privilegies
#
#
ynh_mongo_create_user() {
# Declare an array to define the options of this helper.
local legacy_args=unp
local -A args_array=( [u]=db_user= [n]=db_name= [p]=db_pwd= )
local db_user
local db_name
local db_pwd
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
# Create the user and set the user as admin of the db
ynh_mongo_exec --database="$db_name" --command='db.createUser( { user: "'${db_user}'", pwd: "'${db_pwd}'", roles: [ { role: "readWrite", db: "'${db_name}'" } ] } );'
# Add clustermonitoring rights
ynh_mongo_exec --database="$db_name" --command='db.grantRolesToUser("'${db_user}'",[{ role: "clusterMonitor", db: "admin" }]);'
}
# Check if a mongo database exists
#
# usage: ynh_mongo_database_exists --database=database
# | arg: -d, --database= - The database for which to check existence
# | exit: Return 1 if the database doesn't exist, 0 otherwise
#
#
ynh_mongo_database_exists() {
# Declare an array to define the options of this helper.
local legacy_args=d
local -A args_array=([d]=database=)
local database
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
if [ $(ynh_mongo_exec --command='db.getMongo().getDBNames().indexOf("'${database}'")' --eval) -lt 0 ]
then
return 1
else
return 0
fi
}
# Restore a database
#
# example: ynh_mongo_restore_db --database=wekan < ./dump.bson
#
# usage: ynh_mongo_restore_db --database=database
# | arg: -d, --database= - The database name to restore
#
#
ynh_mongo_restore_db() {
# Declare an array to define the options of this helper.
local legacy_args=d
local -A args_array=( [d]=database= )
local database
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
mongorestore --quiet --db="$database" --archive
}
# Drop a user
#
# [internal]
#
# usage: ynh_mongo_drop_user --db_user=user --db_name=name
# | arg: -u, --db_user= - The user to drop
# | arg: -n, --db_name= - Name of the database
#
#
ynh_mongo_drop_user() {
# Declare an array to define the options of this helper.
local legacy_args=un
local -A args_array=( [u]=db_user= [n]=db_name= )
local db_user
local db_name
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
ynh_mongo_exec --database="$db_name" --command='db.dropUser("'$db_user'", {w: "majority", wtimeout: 5000})'
}
# Create a database, an user and its password. Then store the password in the app's config
#
# usage: ynh_mongo_setup_db --db_user=user --db_name=name [--db_pwd=pwd]
# | arg: -u, --db_user= - Owner of the database
# | arg: -n, --db_name= - Name of the database
# | arg: -p, --db_pwd= - Password of the database. If not provided, a password will be generated
#
# After executing this helper, the password of the created database will be available in $db_pwd
# It will also be stored as "mongopwd" into the app settings.
#
#
ynh_mongo_setup_db() {
# Declare an array to define the options of this helper.
local legacy_args=unp
local -A args_array=( [u]=db_user= [n]=db_name= [p]=db_pwd= )
local db_user
local db_name
db_pwd=""
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
local new_db_pwd=$(ynh_string_random) # Generate a random password
# If $db_pwd is not provided, use new_db_pwd instead for db_pwd
db_pwd="${db_pwd:-$new_db_pwd}"
# Create the user and grant access to the database
ynh_mongo_create_user --db_user="$db_user" --db_pwd="$db_pwd" --db_name="$db_name"
# Store the password in the app's config
ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd
}
# Remove a database if it exists, and the associated user
#
# usage: ynh_mongo_remove_db --db_user=user --db_name=name
# | arg: -u, --db_user= - Owner of the database
# | arg: -n, --db_name= - Name of the database
#
#
ynh_mongo_remove_db() {
# Declare an array to define the options of this helper.
local legacy_args=un
local -A args_array=( [u]=db_user= [n]=db_name= )
local db_user
local db_name
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
if ynh_mongo_database_exists --database=$db_name; then # Check if the database exists
ynh_mongo_drop_db --database=$db_name # Remove the database
else
ynh_print_warn --message="Database $db_name not found"
fi
# Remove mongo user if it exists
ynh_mongo_drop_user --db_user=$db_user --db_name=$db_name
}
# Install MongoDB and integrate MongoDB service in YunoHost
#
# usage: ynh_install_mongo [--mongo_version=mongo_version]
# | arg: -m, --mongo_version= - Version of MongoDB to install
#
#
ynh_install_mongo() {
# Declare an array to define the options of this helper.
local legacy_args=m
local -A args_array=([m]=mongo_version=)
local mongo_version
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
mongo_version="${mongo_version:-$YNH_MONGO_VERSION}"
ynh_print_info --message="Installing MongoDB Community Edition..."
ynh_install_extra_app_dependencies --repo="deb http://repo.mongodb.org/apt/debian buster/mongodb-org/$mongo_version main" --package="mongodb-org mongodb-org-server mongodb-org-tools mongodb-mongosh" --key="https://www.mongodb.org/static/pgp/server-$mongo_version.asc"
mongodb_servicename=mongod
# Make sure MongoDB is started and enabled
systemctl enable $mongodb_servicename --quiet
systemctl daemon-reload --quiet
ynh_systemd_action --service_name=$mongodb_servicename --action=restart --line_match="aiting for connections" --log_path="/var/log/mongodb/$mongodb_servicename.log"
# Integrate MongoDB service in YunoHost
yunohost service add $mongodb_servicename --description="MongoDB daemon" --log="/var/log/mongodb/$mongodb_servicename.log"
# Store mongo_version into the config of this app
ynh_app_setting_set --app=$app --key=mongo_version --value=$mongo_version
}
# Remove MongoDB
# Only remove the MongoDB service integration in YunoHost for now
# if MongoDB package as been removed
#
# usage: ynh_remove_mongo
#
#
ynh_remove_mongo() {
# Only remove the mongodb service if it is not installed.
if ! ynh_package_is_installed --package="mongodb*"
then
ynh_print_info --message="Removing MongoDB service..."
mongodb_servicename=mongod
# Remove the mongodb service
yunohost service remove $mongodb_servicename
ynh_secure_remove --file="/var/lib/mongodb"
ynh_secure_remove --file="/var/log/mongodb"
fi
}

View file

@ -1,27 +0,0 @@
#!/bin/bash
read_json () {
sudo python3 -c "import sys, json;print(json.load(open('$1'))['$2'])"
}
read_manifest () {
if [ -f '../manifest.json' ] ; then
read_json '../manifest.json' "$1"
else
read_json '../settings/manifest.json' "$1"
fi
}
abort_if_up_to_date () {
version=$(read_json "/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" 'version' 2> /dev/null || echo '20160501-7')
last_version=$(read_manifest 'version')
if [ "${version}" = "${last_version}" ]; then
ynh_script_progression --message="Up-to-date, nothing to do"
ynh_die "" 0
fi
}
ynh_version_gt ()
{
dpkg --compare-versions "$1" gt "$2"
}