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

Merge pull request #4 from YunoHost-Apps/testing

Testing
This commit is contained in:
yalh76 2022-06-07 20:07:47 +02:00 committed by GitHub
commit 8b02f103dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 145 additions and 84 deletions

55
.github/ISSUE_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,55 @@
---
name: Bug report
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 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
*A clear and concise description of what the bug is.*
### 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 $app_id`*
### Steps to reproduce
- *If you performed a command from the CLI, the command itself is enough. For example:*
```sh
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 '...'*
4. *See error*
### 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
*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

@ -5,7 +5,7 @@ It shall NOT be edited by hand.
# Sutom for YunoHost
[![Integration level](https://dash.yunohost.org/integration/sutom.svg)](https://dash.yunohost.org/appci/app/sutom) ![](https://ci-apps.yunohost.org/ci/badges/sutom.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/sutom.maintain.svg)
[![Integration level](https://dash.yunohost.org/integration/sutom.svg)](https://dash.yunohost.org/appci/app/sutom) ![Working status](https://ci-apps.yunohost.org/ci/badges/sutom.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/sutom.maintain.svg)
[![Install Sutom with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=sutom)
*[Lire ce readme en français.](./README_fr.md)*
@ -18,30 +18,31 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
Jeu de lettres en ligne (et en français) basé sur Wordle. Le jeu se trouve à l'adresse https://sutom.nocle.fr
**Shipped version:** 1.0.0~ynh1
**Shipped version:** 1.0.0~ynh3
**Demo:** https://sutom.nocle.fr/
## Screenshots
![](./doc/screenshots/screenshot.png)
![Screenshot of Sutom](./doc/screenshots/screenshot.png)
## Documentation and resources
* Official app website: https://sutom.nocle.fr/
* Upstream app code repository: https://framagit.org/JonathanMM/sutom
* YunoHost documentation for this app: https://yunohost.org/app_sutom
* Report a bug: https://github.com/YunoHost-Apps/sutom_ynh/issues
* Official app website: <https://sutom.nocle.fr/>
* Upstream app code repository: <https://framagit.org/JonathanMM/sutom>
* YunoHost documentation for this app: <https://yunohost.org/app_sutom>
* Report a bug: <https://github.com/YunoHost-Apps/sutom_ynh/issues>
## Developer info
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/sutom_ynh/tree/testing).
To try the testing branch, please proceed like that.
```
``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/sutom_ynh/tree/testing --debug
or
sudo yunohost app upgrade sutom -u https://github.com/YunoHost-Apps/sutom_ynh/tree/testing --debug
```
**More info regarding app packaging:** https://yunohost.org/packaging_apps
**More info regarding app packaging:** <https://yunohost.org/packaging_apps>

View file

@ -1,10 +1,14 @@
<!--
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.
-->
# Sutom pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/sutom.svg)](https://dash.yunohost.org/appci/app/sutom) ![](https://ci-apps.yunohost.org/ci/badges/sutom.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/sutom.maintain.svg)
[![Niveau d'intégration](https://dash.yunohost.org/integration/sutom.svg)](https://dash.yunohost.org/appci/app/sutom) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/sutom.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/sutom.maintain.svg)
[![Installer Sutom avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=sutom)
*[Read this readme in english.](./README.md)*
*[Lire ce readme en français.](./README_fr.md)*
> *Ce package vous permet d'installer Sutom rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
@ -14,30 +18,31 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
Jeu de lettres en ligne (et en français) basé sur Wordle. Le jeu se trouve à l'adresse https://sutom.nocle.fr
**Version incluse :** 1.0.0~ynh1
**Version incluse :** 1.0.0~ynh3
**Démo :** https://sutom.nocle.fr/
## Captures d'écran
![](./doc/screenshots/screenshot.png)
![Capture d'écran de Sutom](./doc/screenshots/screenshot.png)
## Documentations et ressources
* Site officiel de l'app : https://sutom.nocle.fr/
* Dépôt de code officiel de l'app : https://framagit.org/JonathanMM/sutom
* Documentation YunoHost pour cette app : https://yunohost.org/app_sutom
* Signaler un bug : https://github.com/YunoHost-Apps/sutom_ynh/issues
* Site officiel de l'app : <https://sutom.nocle.fr/>
* Dépôt de code officiel de l'app : <https://framagit.org/JonathanMM/sutom>
* Documentation YunoHost pour cette app : <https://yunohost.org/app_sutom>
* Signaler un bug : <https://github.com/YunoHost-Apps/sutom_ynh/issues>
## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/sutom_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit.
```
``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/sutom_ynh/tree/testing --debug
ou
sudo yunohost app upgrade sutom -u https://github.com/YunoHost-Apps/sutom_ynh/tree/testing --debug
```
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps
**Plus d'infos sur le packaging d'applications :** <https://yunohost.org/packaging_apps>

View file

@ -11,9 +11,10 @@
setup_private=1
setup_public=1
upgrade=1
#upgrade=1 from_commit=CommitHash
# 1.0.0~ynh1
upgrade=1 from_commit=3203df977e8ab92fb24968adcabbcd901ab84785
backup_restore=1
multi_instance=0
multi_instance=1
change_url=1
;;; Options
Email=

View file

@ -1,6 +1,7 @@
SOURCE_URL=url of app's source
SOURCE_SUM=sha256 checksum
SOURCE_URL=https://framagit.org/JonathanMM/sutom/-/archive/05e6dfe28c1ebfebff4f22d99f68b2bbb2127569/sutom-05e6dfe28c1ebfebff4f22d99f68b2bbb2127569.tar.gz
SOURCE_SUM=7428b08b0ca8c20c75b804e555ac77815d399c73f154b62f4a4d098f3bc53916
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=
SOURCE_EXTRACT=true

View file

@ -1,5 +1,5 @@
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location ^~ __PATH__/ {
location __PATH__/ {
proxy_pass http://127.0.0.1:__PORT__/;
proxy_redirect off;
@ -12,8 +12,8 @@ location ^~ __PATH__/ {
proxy_http_version 1.1;
proxy_set_header Connection "upgrade";
proxy_set_header Upgrade $http_upgrade;
more_clear_input_headers 'Accept-Encoding';
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
more_clear_input_headers 'Accept-Encoding';
}

View file

@ -6,10 +6,11 @@ After=network.target
Type=simple
User=__APP__
Group=__APP__
WorkingDirectory=__FINALPATH__
Environment="PATH=__ENV_PATH__"
WorkingDirectory=__FINALPATH__/
Environment="__YNH_NODE_LOAD_PATH__"
Environment="SUTOM_PORT=__PORT__"
Environment="NODE_ENV=production"
ExecStart=__YNH_NPM__ start
ExecStart=__YNH_NPM__ run start:prod
Restart=always
# Sandboxing options to harden security

View file

@ -6,7 +6,7 @@
"en": "Wordle-based online word game",
"fr": "Jeu de lettres en ligne basé sur Wordle"
},
"version": "1.0.0~ynh1",
"version": "1.0.0~ynh3",
"url": "https://sutom.nocle.fr/",
"upstream": {
"license": "MIT",
@ -22,12 +22,12 @@
"requirements": {
"yunohost": ">= 4.3.0"
},
"multi_instance": false,
"multi_instance": true,
"services": [
"nginx"
],
"arguments": {
"install" : [
"install": [
{
"name": "domain",
"type": "domain"
@ -41,10 +41,6 @@
{
"name": "is_public",
"type": "boolean",
"help": {
"en": "If enabled, Sutom will be accessible by people who do not have an account. This can be changed later via the webadmin.",
"fr": "Si cette case est cochée, Sutom sera accessible aux personnes nayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin."
},
"default": true
}
]

View file

@ -4,8 +4,6 @@
# COMMON VARIABLES
#=================================================
version_commit=ded221c985ee6eabb4f1bbd6eb5a1ec0dacfc215
nodejs_version=16
#=================================================

View file

@ -15,7 +15,6 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_clean_setup () {
### Remove this function if there's nothing to clean before calling the remove script.
true
}
# Exit if an error occurs during the execution of the script

View file

@ -28,6 +28,8 @@ 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)
#=================================================
@ -38,6 +40,7 @@ ynh_script_progression --message="Backing up the app before changing its URL (ma
# 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"

View file

@ -14,8 +14,7 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_clean_setup () {
### Remove this function if there's nothing to clean before calling the remove script.
true
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
@ -57,7 +56,7 @@ ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_script_progression --message="Finding an available port..." --weight=1
# Find an available port
port=$(ynh_find_port --port=4000)
port=$(ynh_find_port --port=8095)
ynh_app_setting_set --app=$app --key=port --value=$port
#=================================================
@ -83,13 +82,7 @@ ynh_script_progression --message="Setting up source files..." --weight=1
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"
git clone https://framagit.org/JonathanMM/sutom "$final_path" --quiet
pushd "$final_path"
git reset --hard --quiet $version_commit
popd
ynh_setup_source --dest_dir="$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
@ -110,8 +103,9 @@ ynh_script_progression --message="Building Sutom... (this will take some time an
pushd "$final_path"
ynh_use_nodejs
ynh_exec_warn_less npm i -g npm
ynh_exec_warn_less npm install
ynh_exec_warn_less ynh_exec_as $app NODE_ENV=production $ynh_node_load_PATH $ynh_npm install --production
ynh_exec_warn_less ynh_exec_as $app NODE_ENV=production $ynh_node_load_PATH ./node_modules/.bin/tsc
ln -sf $final_path/public/js/mots/listeMotsProposables.js $final_path/public/js/mots/listeMotsProposables.9.D.js
popd
#=================================================
@ -119,11 +113,11 @@ popd
#=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=1
env_path="$PATH"
# Create a dedicated systemd config
ynh_add_systemd_config
#=================================================
# GENERIC FINALIZATION
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
@ -147,6 +141,8 @@ ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary
if [ $is_public -eq 1 ]
then
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
ynh_permission_update --permission="main" --add="visitors"
fi

View file

@ -41,13 +41,6 @@ ynh_script_progression --message="Stopping and removing the systemd service..."
# 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
#=================================================
@ -64,6 +57,13 @@ ynh_script_progression --message="Removing NGINX web server configuration..." --
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=1
ynh_remove_nodejs
#=================================================
# GENERIC FINALIZATION
#=================================================

View file

@ -15,8 +15,7 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_clean_setup () {
#### Remove this function if there's nothing to clean before calling the remove script.
true
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
@ -37,14 +36,15 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=1
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_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
@ -72,7 +72,7 @@ chown -R $app:www-data "$final_path"
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=6
# Install Nodejs
# Define and install dependencies
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
#=================================================

View file

@ -35,6 +35,7 @@ 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 () {
ynh_clean_check_starting
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
@ -73,18 +74,10 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Upgrading source files..." --weight=1
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --weight=1
# Download, check integrity, uncompress and patch the source from app.src
#ynh_setup_source --dest_dir="$final_path"
pushd $final_path
git fetch
#git checkout master
git reset --hard --quiet $version_commit
fi
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
@ -103,9 +96,10 @@ ynh_add_nginx_config
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=10
# Install Nodejs
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
#=================================================
# SPECIFIC UPGRADE
#==============================================
# INSTALL SUTOM
#==============================================
@ -113,8 +107,9 @@ ynh_script_progression --message="Building Sutom... (this will take some time an
pushd "$final_path"
ynh_use_nodejs
ynh_exec_warn_less npm i -g npm
ynh_exec_warn_less npm install
ynh_exec_warn_less ynh_exec_as $app NODE_ENV=production $ynh_node_load_PATH $ynh_npm install --production
ynh_exec_warn_less ynh_exec_as $app NODE_ENV=production $ynh_node_load_PATH ./node_modules/.bin/tsc
ln -sf $final_path/public/js/mots/listeMotsProposables.js $final_path/public/js/mots/listeMotsProposables.9.D.js
popd
#=================================================
@ -122,8 +117,6 @@ popd
#=================================================
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
env_path="$PATH"
# Create a dedicated systemd config
ynh_add_systemd_config

View file

@ -1,2 +0,0 @@
*~
*.sw[op]

View file

@ -1,2 +0,0 @@
*~
*.sw[op]