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

Merge pull request #10 from YunoHost-Apps/testing

Testing
This commit is contained in:
Éric Gaspar 2022-06-29 19:44:45 +02:00 committed by GitHub
commit e69a108084
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 261 additions and 390 deletions

View file

@ -1,6 +1,6 @@
---
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.
---
@ -8,28 +8,30 @@ about: Create a report to help us debug, it would be nice to fill the template a
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 HedgeDoc itself. Refer to its documentation or repository for help.*
- *If you have a doubt, post here, we will figure it out together.*
- *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*
- 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 luckysheet`*
- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`*
### Steps to reproduce
**To Reproduce**
*Steps to reproduce the behavior.*
- *If you performed a command from the CLI, the command itself is enough. For example:*
```sh
sudo yunohost app install luckysheet
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:*
@ -38,9 +40,16 @@ about: Create a report to help us debug, it would be nice to fill the template a
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)

View file

@ -1,6 +1,11 @@
<!--
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.
-->
# Luckysheet for YunoHost
[![Integration level](https://dash.yunohost.org/integration/luckysheet.svg)](https://dash.yunohost.org/appci/app/luckysheet) ![](https://ci-apps.yunohost.org/ci/badges/luckysheet.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/luckysheet.maintain.svg)
[![Integration level](https://dash.yunohost.org/integration/luckysheet.svg)](https://dash.yunohost.org/appci/app/luckysheet) ![Working status](https://ci-apps.yunohost.org/ci/badges/luckysheet.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/luckysheet.maintain.svg)
[![Install Luckysheet with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=luckysheet)
*[Lire ce readme en français.](./README_fr.md)*
@ -9,52 +14,36 @@
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Overview
Luckysheet is an online spreadsheet that is powerful, simple to configure, and completely open source.
**Shipped version:** 2.0.0
## Screenshot
**Shipped version:** 2.1.13~ynh1
![](https://raw.githubusercontent.com/mengshukeji/Luckysheet/master/docs/.vuepress/public/img/LuckysheetDemo.gif)
**Demo:** https://mengshukeji.github.io/LuckysheetDemo/
## Demo
## Screenshots
* [Official demo](https://mengshukeji.github.io/LuckysheetDemo/)
![Screenshot of Luckysheet](./doc/screenshots/screenshot.gif)
## Configuration
## Documentation and resources
## Documentation
* Official documentation: https://mengshukeji.github.io/LuckysheetDocs/guide/
* YunoHost documentation:
## YunoHost specific features
#### Multi-user support
* Is LDAP supported?
* Can the app be used by multiple users?
#### Supported architectures
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/luckysheet.svg)](https://ci-apps.yunohost.org/ci/apps/luckysheet/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/luckysheet.svg)](https://ci-apps-arm.yunohost.org/ci/apps/luckysheet/)
## Links
* Report a bug: https://github.com/YunoHost-Apps/luckysheet_ynh/issues
* Upstream app repository: https://github.com/mengshukeji/Luckysheet
* YunoHost website: https://yunohost.org/
---
* Official app website: <https://github.com/mengshukeji/Luckysheet>
* Official admin documentation: <https://mengshukeji.github.io/LuckysheetDocs/guide/>
* Upstream app code repository: <https://github.com/mengshukeji/Luckysheet>
* YunoHost documentation for this app: <https://yunohost.org/app_luckysheet>
* Report a bug: <https://github.com/YunoHost-Apps/luckysheet_ynh/issues>
## Developer info
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/luckysheet_ynh/tree/testing).
To try the testing branch, please proceed like that.
```
``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/luckysheet_ynh/tree/testing --debug
or
sudo yunohost app upgrade luckysheet -u https://github.com/YunoHost-Apps/luckysheet_ynh/tree/testing --debug
```
**More info regarding app packaging:** <https://yunohost.org/packaging_apps>

View file

@ -1,61 +1,49 @@
<!--
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.
-->
# Luckysheet pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/luckysheet.svg)](https://dash.yunohost.org/appci/app/luckysheet) ![](https://ci-apps.yunohost.org/ci/badges/luckysheet.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/luckysheet.maintain.svg)
[![Niveau d'intégration](https://dash.yunohost.org/integration/luckysheet.svg)](https://dash.yunohost.org/appci/app/luckysheet) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/luckysheet.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/luckysheet.maintain.svg)
[![Installer Luckysheet avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=luckysheet)
*[Read this readme in english.](./README.md)*
> *Ce package vous permet d'installer Luckysheet rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install) pour apprendre comment l'installer.*
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
## Vue d'ensemble
Luckysheet est une feuille de calcul en ligne, puissante, simple à configurer et complètement open source.
**Version incluse :** 2.0.0
**Version incluse :** 2.1.13~ynh1
**Démo :** https://mengshukeji.github.io/LuckysheetDemo/
## Captures d'écran
![](https://raw.githubusercontent.com/mengshukeji/Luckysheet/master/docs/.vuepress/public/img/LuckysheetDemo.gif)
![Capture d'écran de Luckysheet](./doc/screenshots/screenshot.gif)
## Démo
## Documentations et ressources
* [Démo officielle](https://mengshukeji.github.io/LuckysheetDemo/)
## Configuration
## Documentation
* Documentation officielle : https://mengshukeji.github.io/LuckysheetDocs/guide/
* Documentation YunoHost :
## Caractéristiques spécifiques YunoHost
#### Support multi-utilisateur
* L'authentification LDAP est-elle prise en charge ?
* L'application peut-elle être utilisée par plusieurs utilisateurs ?
#### Architectures supportées
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/luckysheet.svg)](https://ci-apps.yunohost.org/ci/apps/luckysheet/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/luckysheet.svg)](https://ci-apps-arm.yunohost.org/ci/apps/luckysheet/)
## Liens
* Signaler un bug : https://github.com/YunoHost-Apps/luckysheet_ynh/issues
* Dépôt de l'application principale : https://github.com/mengshukeji/Luckysheet
* Site web YunoHost : https://yunohost.org/
---
* Site officiel de l'app : <https://github.com/mengshukeji/Luckysheet>
* Documentation officielle de l'admin : <https://mengshukeji.github.io/LuckysheetDocs/guide/>
* Dépôt de code officiel de l'app : <https://github.com/mengshukeji/Luckysheet>
* Documentation YunoHost pour cette app : <https://yunohost.org/app_luckysheet>
* Signaler un bug : <https://github.com/YunoHost-Apps/luckysheet_ynh/issues>
## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/luckysheet_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit.
```
``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/luckysheet_ynh/tree/testing --debug
ou
sudo yunohost app upgrade luckysheet -u https://github.com/YunoHost-Apps/luckysheet_ynh/tree/testing --debug
```
**Plus d'infos sur le packaging d'applications :** <https://yunohost.org/packaging_apps>

View file

@ -1,9 +1,8 @@
;; 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
; Checks
pkg_linter=1
setup_sub_dir=1
@ -12,6 +11,8 @@
setup_private=1
setup_public=1
upgrade=1
# 2.0.0~ynh4
upgrade=1 from_commit=e381055bd0e6b6b862bdbec72945ec589d8128d7
backup_restore=1
multi_instance=0
port_already_use=1
@ -19,5 +20,3 @@
;;; Options
Email=
Notification=none
;;; Upgrade options
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666&

View file

@ -1,6 +1,7 @@
SOURCE_URL=https://github.com/mengshukeji/Luckysheet/archive/v2.0.0.tar.gz
SOURCE_SUM=697e79a4d033506074f8e0261ff94cee6e4360b7f0634cb9de53ae59edcec1fe
SOURCE_URL=https://github.com/mengshukeji/Luckysheet/archive/v2.1.13.tar.gz
SOURCE_SUM=9c996e1e2a47ca0bb37b17840f7ded82ed999899daf3bd620b07c154b71647f9
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=
SOURCE_EXTRACT=true

View file

@ -1,25 +1,16 @@
location ^~ __PATH__/ {
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ {
proxy_pass http://127.0.0.1:__PORT__/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
# Path to source
alias __FINALPATH__/live/;
proxy_http_version 1.1;
proxy_set_header Connection "upgrade";
proxy_set_header Upgrade $http_upgrade;
index index.html;
# setup for image upload
#client_max_body_size 256M;
#proxy_max_temp_file_size 1024M;
# Common parameter to increase upload size limit in conjunction with dedicated php-fpm file
#client_max_body_size 50M;
#proxy_read_timeout 300;
#proxy_connect_timeout 300;
try_files $uri $uri/ index.html;
# Include SSOWAT user panel.
#include conf.d/yunohost_panel.conf.inc;
#more_clear_input_headers 'Accept-Encoding';
include conf.d/yunohost_panel.conf.inc;
}

View file

@ -1,19 +0,0 @@
[Unit]
Description=Luckysheet: online spreadsheet
Documentation=https://github.com/mengshukeji/Luckysheet
After=network.target
[Service]
Type=simple
User=__APP__
Group=__APP__
WorkingDirectory=__FINALPATH__
Environment="PATH=__ENV_PATH__"
Environment="NODE_ENV=production"
ExecStart=__YNH_NPM__ run dev
Restart=always
PrivateTmp=true
PrivateDevices=true
[Install]
WantedBy=multi-user.target

0
doc/.gitkeep Normal file
View file

1
doc/DESCRIPTION.md Normal file
View file

@ -0,0 +1 @@
Luckysheet is an online spreadsheet that is powerful, simple to configure, and completely open source.

1
doc/DESCRIPTION_fr.md Normal file
View file

@ -0,0 +1 @@
Luckysheet est une feuille de calcul en ligne, puissante, simple à configurer et complètement open source.

0
doc/DISCLAIMER.md Normal file
View file

0
doc/DISCLAIMER_fr.md Normal file
View file

0
doc/screenshots/.gitkeep Normal file
View file

Binary file not shown.

After

Width:  |  Height:  |  Size: 394 KiB

View file

@ -6,14 +6,21 @@
"en": "Online spreadsheet that is powerful, simple to configure",
"fr": "Feuille de calcul en ligne, puissante, simple à configurer"
},
"version": "2.0.0~ynh4",
"version": "2.1.13~ynh1",
"url": "https://github.com/mengshukeji/Luckysheet",
"upstream": {
"license": "MIT",
"website": "https://github.com/mengshukeji/Luckysheet",
"demo": "https://mengshukeji.github.io/LuckysheetDemo/",
"admindoc": "https://mengshukeji.github.io/LuckysheetDocs/guide/",
"code": "https://github.com/mengshukeji/Luckysheet"
},
"license": "MIT",
"maintainer": {
"name": "eric_G"
},
"requirements": {
"yunohost": ">= 4.1.7"
"yunohost": ">= 4.3.0"
},
"multi_instance": false,
"services": [

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

@ -4,7 +4,7 @@
# COMMON VARIABLES
#=================================================
nodejs_version=14
nodejs_version=16
#=================================================
# PERSONAL HELPERS

View file

@ -6,6 +6,7 @@
# IMPORT GENERIC HELPERS
#=================================================
# 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
@ -14,7 +15,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
@ -48,14 +49,8 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# SPECIFIC BACKUP
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_backup --src_path="/etc/systemd/system/$app.service"
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info --message="Backup script completed for Luckysheet. (YunoHost will then actually copy those files to the archive)."
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -28,20 +28,23 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
# Add settings here as needed by your application
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 Luckysheet before changing its URL (may take a while)..." --weight=1
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
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
@ -65,13 +68,6 @@ fi
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
@ -103,14 +99,6 @@ fi
#=================================================
# GENERIC FINALISATION
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Serving files from: dist"
#=================================================
# RELOAD NGINX
#=================================================
@ -122,4 +110,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Change of URL completed for Luckysheet" --last
ynh_script_progression --message="Change of URL completed for $app" --last

View file

@ -50,15 +50,6 @@ ynh_app_setting_set --app=$app --key=path --value=$path_url
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# FIND AND OPEN A PORT
#=================================================
ynh_script_progression --message="Finding an available port..." --weight=2
# Find an available port
port=$(ynh_find_port --port=3000)
ynh_app_setting_set --app=$app --key=port --value=$port
#=================================================
# INSTALL DEPENDENCIES
#=================================================
@ -67,6 +58,14 @@ ynh_script_progression --message="Installing dependencies..." --weight=20
# Install Nodejs
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=3
# Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@ -74,7 +73,11 @@ ynh_script_progression --message="Setting up source files..." --weight=2
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
ynh_setup_source --dest_dir="$final_path/build"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# NGINX CONFIGURATION
@ -84,78 +87,50 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=3
# Create a system user
ynh_system_user_create --username=$app --home_dir=$final_path
#=================================================
# SPECIFIC SETUP
#==============================================
# INSTALL HEDGEDOC
#==============================================
ynh_script_progression --message="Building Luckysheet... (this will take some time and resources!)" --weight=20
pushd "$final_path" || ynh_die
#=================================================
# BUILD APP
#=================================================
ynh_script_progression --message="Building app... (this will take some time and resources!)" --weight=20
pushd "$final_path/build"
ynh_use_nodejs
ynh_exec_warn_less $ynh_npm install
ynh_exec_warn_less $ynh_npm install gulp -g
ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm install
ynh_npm install gulp -g
ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm run build
popd
popd || ynh_die
ynh_exec_as $app mv "$final_path/build/dist" "$final_path/live"
ynh_secure_remove --file="$final_path/build"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# MODIFY A CONFIG FILE
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..."
cp ../conf/config.example.js $final_path/src/config.js
ynh_add_config --template="../conf/config.example.js" --destination="$final_path/live/config.js"
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=1
ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service"
ynh_replace_string --match_string="__YNH_NPM__" --replace_string="$ynh_npm" --target_file="../conf/systemd.service"
ynh_add_systemd_config
chmod 400 "$final_path/live/config.js"
chown $app:$app "$final_path/live/config.js"
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_script_progression --message="Securing files and directories..." --weight=1
# Set permissions to app files
chown -R $app: $final_path
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Online spreadsheet like excel" --log="/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=2
# Start a systemd service
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Serving files from: dist"
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary or protect it
# 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
@ -170,4 +145,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of Luckysheet completed" --last
ynh_script_progression --message="Installation of $app completed" --last

View file

@ -17,41 +17,14 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
port=$(ynh_app_setting_get --app=$app --key=port)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST
#=================================================
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status $app >/dev/null
then
ynh_script_progression --message="Removing Luckysheet service..." --weight=1
yunohost service remove $app
fi
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
# Remove the dedicated systemd config
ynh_remove_systemd_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=1
ynh_remove_nodejs
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Removing Luckysheet main directory..." --weight=6
ynh_script_progression --message="Removing app main directory..." --weight=6
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
@ -61,9 +34,16 @@ ynh_secure_remove --file="$final_path"
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=5
# Remove the dedicated nginx config
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=1
ynh_remove_nodejs
#=================================================
# GENERIC FINALIZATION
#=================================================
@ -78,4 +58,4 @@ ynh_system_user_delete --username=$app
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of Luckysheet completed" --last
ynh_script_progression --message="Removal of $app completed" --last

View file

@ -6,6 +6,7 @@
# IMPORT GENERIC HELPERS
#=================================================
# 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
@ -22,7 +23,7 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading settings..." --weight=1
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
@ -35,71 +36,38 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=2
test ! -d $final_path || ynh_die --message="There is already a directory: $final_path "
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..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring Luckysheet main directory..." --weight=50
ynh_restore_file --origin_path="$final_path"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app
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..." --weight=1
ynh_script_progression --message="Restoring the app main directory..." --weight=50
# Restore permissions on app files
chown -R $app: $final_path
ynh_restore_file --origin_path="$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=7
ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1
# Install Nodejs
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
#=================================================
# RESTORE SYSTEMD
#=================================================
ynh_script_progression --message="Restoring the systemd configuration..." --weight=5
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Online spreadsheet like excel" --log="/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Serving files from: dist"
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# GENERIC FINALIZATION
@ -114,4 +82,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for Luckysheet" --last
ynh_script_progression --message="Restoration completed for $app" --last

View file

@ -19,7 +19,6 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
port=$(ynh_app_setting_get --app=$app --key=port)
#=================================================
# CHECK VERSION
@ -28,6 +27,23 @@ 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)..." --weight=20
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
ynh_clean_check_starting
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
@ -40,28 +56,29 @@ if ynh_legacy_permissions_exists; then
ynh_app_setting_delete --app=$app --key=is_public
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up Luckysheet before upgrading (may take a while)..." --weight=20
# 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..." --weight=1
yunohost service remove $app
fi
# 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
ynh_app_setting_delete --app=$app --key=port
ynh_remove_systemd_config
if [[ -d "$final_path/src/" ]]
then
mv $final_path/src/ $final_path/live/
fi
#=================================================
# STANDARD UPGRADE STEPS
# CREATE DEDICATED USER
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
ynh_systemd_action --service_name=$app --action=stop --log_path=systemd
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
@ -71,20 +88,13 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --weight=20
# Remove the app directory securely
ynh_secure_remove --file=$final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir=$final_path
ynh_setup_source --dest_dir="$final_path/build"
fi
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2
# Create a dedicated NGINX config
ynh_add_nginx_config
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# UPGRADE DEPENDENCIES
@ -95,64 +105,52 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=18
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
#=================================================
# CREATE DEDICATED USER
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# SPECIFIC UPGRADE
#==============================================
# INSTALL HEDGEDOC
#==============================================
#=================================================
# BUILD APP
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Building Luckysheet... (this will take some time and resources!)" --weight=20
ynh_script_progression --message="Building app... (this will take some time and resources!)" --weight=20
pushd "$final_path"
pushd "$final_path/build"
ynh_use_nodejs
$ynh_npm install
$ynh_npm install gulp -g
ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm install
ynh_npm install gulp -g
ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm run build
popd
tmpdir="$(mktemp -d)"
cp -af "$final_path/live/config.js" "$tmpdir/config.js"
ynh_secure_remove --file="$final_path/live"
mv "$final_path/build/dist" "$final_path/live"
cp -af "$tmpdir/config.js" "$final_path/live/config.js"
ynh_secure_remove --file="$tmpdir"
fi
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=2
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service"
ynh_replace_string --match_string="__YNH_NPM__" --replace_string="$ynh_npm" --target_file="../conf/systemd.service"
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Updating a configuration file..."
# Create a dedicated systemd config
ynh_add_systemd_config
ynh_add_config --template="../conf/config.example.js" --destination="$final_path/live/config.js"
chmod 400 "$final_path/live/config.js"
chown $app:$app "$final_path/live/config.js"
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_script_progression --message="Securing files and directories..." --weight=1
# Set permissions on app files
chown -R $app: $final_path
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --description="Online spreadsheet like excel" --log="/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Serving files from: dist"
#=================================================
# RELOAD NGINX
#=================================================
@ -164,4 +162,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of Luckysheet completed" --last
ynh_script_progression --message="Upgrade of $app completed" --last