1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/crabfit_ynh.git synced 2024-09-03 18:16:21 +02:00

Merge pull request #3 from YunoHost-Apps/testing

Testing
This commit is contained in:
oiseauroch 2024-04-01 22:20:19 +02:00 committed by GitHub
commit e431b54dec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 158 additions and 207 deletions

5
ALL_README.md Normal file
View file

@ -0,0 +1,5 @@
# All available README files by language
- [Read the README in English](README.md)
- [Irakurri README euskaraz](README_eu.md)
- [Lire le README en français](README_fr.md)

View file

@ -1,85 +1,58 @@
# Packaging an app, starting from this example
* Copy this app before working on it, using the ['Use this template'](https://github.com/YunoHost/example_ynh/generate) button on the Github repo.
* Edit the `manifest.toml` with app specific info.
* Edit the `install`, `upgrade`, `remove`, `backup` and `restore` scripts, and any relevant conf files in `conf/`.
* Using the [script helpers documentation.](https://yunohost.org/packaging_apps_helpers)
* Edit the `change_url` and `config` scripts too, or remove them if you have no use of them
* Add a `LICENSE` file for the package. NB: this LICENSE file is not meant to necessarily be the LICENSE of the upstream app - it is only the LICENSE you want this package's code to published with ;). We recommend to use [the AGPL-3](https://www.gnu.org/licenses/agpl-3.0.txt).
* Edit `doc/DISCLAIMER*.md`
* The `README.md` files are to be automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
---
<!-- <!--
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator 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. It shall NOT be edited by hand.
--> -->
# Example app for YunoHost # Crab Fit for YunoHost
[![Integration level](https://dash.yunohost.org/integration/example.svg)](https://dash.yunohost.org/appci/app/example) ![Working status](https://ci-apps.yunohost.org/ci/badges/example.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/example.maintain.svg) [![Integration level](https://dash.yunohost.org/integration/crabfit.svg)](https://dash.yunohost.org/appci/app/crabfit) ![Working status](https://ci-apps.yunohost.org/ci/badges/crabfit.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/crabfit.maintain.svg)
[![Install Example app with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=example)
*[Lire ce readme en français.](./README_fr.md)* [![Install Crab Fit with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=crabfit)
> *This package allows you to install Example app quickly and simply on a YunoHost server. *[Read this README in other languages.](./ALL_README.md)*
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
> *This package allows you to install Crab Fit 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 ## Overview
Some long and extensive description of what the app is and does, lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Crab Fit helps you fit your event around everyone's schedules.
Simply create an event above and send the link to everyone that is participating.
Results update live and you will be able to see a heat-map of when everyone is free.
### Features ## Features
- Ut enim ad minim veniam, quis nostrud exercitation ullamco ; - Click and slide to select multiple time slots at once.
- Laboris nisi ut aliquip ex ea commodo consequat ; - Editable using a one-time password
- Duis aute irure dolor in reprehenderit in voluptate ;
- Velit esse cillum dolore eu fugiat nulla pariatur ;
- Excepteur sint occaecat cupidatat non proident, sunt in culpa."
**Shipped version:** 1.0~ynh1 **Shipped version:** 1.0~ynh2
**Demo:** https://demo.example.com **Demo:** <https://crab.fit>
## Screenshots ## Screenshots
![Screenshot of Example app](./doc/screenshots/example.jpg) ![Screenshot of Crab Fit](./doc/screenshots/main.png)
## Disclaimers / important information
* Any known limitations, constrains or stuff not working, such as (but not limited to):
* requiring a full dedicated domain ?
* architectures not supported ?
* not-working single-sign on or LDAP integration ?
* the app requires an important amount of RAM / disk / .. to install or to work properly
* etc...
* Other infos that people should be aware of, such as:
* any specific step to perform after installing (such as manually finishing the install, specific admin credentials, ...)
* how to configure / administrate the application if it ain't obvious
* upgrade process / specificities / things to be aware of ?
* security considerations ?
## Documentation and resources ## Documentation and resources
* Official app website: <https://example.com> - Official app website: <https://crab.fit>
* Official user documentation: <https://yunohost.org/apps> - Official user documentation: <https://github.com/GRA0007/crab.fit>
* Official admin documentation: <https://yunohost.org/packaging_apps> - Official admin documentation: <https://github.com/GRA0007/crab.fit>
* Upstream app code repository: <https://some.forge.com/example/example> - Upstream app code repository: <https://github.com/GRA0007/crab.fit>
* YunoHost documentation for this app: <https://yunohost.org/app_example> - YunoHost Store: <https://apps.yunohost.org/app/crabfit>
* Report a bug: <https://github.com/YunoHost-Apps/example_ynh/issues> - Report a bug: <https://github.com/YunoHost-Apps/crabfit_ynh/issues>
## Developer info ## Developer info
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/example_ynh/tree/testing). Please send your pull request to the [`testing` branch](https://github.com/YunoHost-Apps/crabfit_ynh/tree/testing).
To try the testing branch, please proceed like that. To try the `testing` branch, please proceed like that:
``` bash ```bash
sudo yunohost app install https://github.com/YunoHost-Apps/example_ynh/tree/testing --debug sudo yunohost app install https://github.com/YunoHost-Apps/crabfit_ynh/tree/testing --debug
or or
sudo yunohost app upgrade example -u https://github.com/YunoHost-Apps/example_ynh/tree/testing --debug sudo yunohost app upgrade crabfit -u https://github.com/YunoHost-Apps/crabfit_ynh/tree/testing --debug
``` ```
**More info regarding app packaging:** <https://yunohost.org/packaging_apps> **More info regarding app packaging:** <https://yunohost.org/packaging_apps>

58
README_eu.md Normal file
View file

@ -0,0 +1,58 @@
<!--
Ohart ongi: README hau automatikoki sortu da <https://github.com/YunoHost/apps/tree/master/tools/readme_generator>ri esker
EZ editatu eskuz.
-->
# Crab Fit YunoHost-erako
[![Integrazio maila](https://dash.yunohost.org/integration/crabfit.svg)](https://dash.yunohost.org/appci/app/crabfit) ![Funtzionamendu egoera](https://ci-apps.yunohost.org/ci/badges/crabfit.status.svg) ![Mantentze egoera](https://ci-apps.yunohost.org/ci/badges/crabfit.maintain.svg)
[![Instalatu Crab Fit YunoHost-ekin](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=crabfit)
*[Irakurri README hau beste hizkuntzatan.](./ALL_README.md)*
> *Pakete honek Crab Fit YunoHost zerbitzari batean azkar eta zailtasunik gabe instalatzea ahalbidetzen dizu.*
> *YunoHost ez baduzu, kontsultatu [gida](https://yunohost.org/install) nola instalatu ikasteko.*
## Aurreikuspena
Crab Fit helps you fit your event around everyone's schedules.
Simply create an event above and send the link to everyone that is participating.
Results update live and you will be able to see a heat-map of when everyone is free.
## Features
- Click and slide to select multiple time slots at once.
- Editable using a one-time password
**Paketatutako bertsioa:** 1.0~ynh2
**Demoa:** <https://crab.fit>
## Pantaila-argazkiak
![Crab Fit(r)en pantaila-argazkia](./doc/screenshots/main.png)
## Dokumentazioa eta baliabideak
- Aplikazioaren webgune ofiziala: <https://crab.fit>
- Erabiltzaileen dokumentazio ofiziala: <https://github.com/GRA0007/crab.fit>
- Administratzaileen dokumentazio ofiziala: <https://github.com/GRA0007/crab.fit>
- Jatorrizko aplikazioaren kode-gordailua: <https://github.com/GRA0007/crab.fit>
- YunoHost Denda: <https://apps.yunohost.org/app/crabfit>
- Eman errore baten berri: <https://github.com/YunoHost-Apps/crabfit_ynh/issues>
## Garatzaileentzako informazioa
Bidali `pull request`a [`testing` abarrera](https://github.com/YunoHost-Apps/crabfit_ynh/tree/testing).
`testing` abarra probatzeko, ondorengoa egin:
```bash
sudo yunohost app install https://github.com/YunoHost-Apps/crabfit_ynh/tree/testing --debug
edo
sudo yunohost app upgrade crabfit -u https://github.com/YunoHost-Apps/crabfit_ynh/tree/testing --debug
```
**Informazio gehiago aplikazioaren paketatzeari buruz:** <https://yunohost.org/packaging_apps>

View file

@ -1,73 +1,58 @@
<!-- <!--
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator Nota bene: ce README est automatiquement généré par <https://github.com/YunoHost/apps/tree/master/tools/readme_generator>
It shall NOT be edited by hand. Il NE doit PAS être modifié à la main.
--> -->
# Exemple d'app pour YunoHost # Crab Fit pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/example.svg)](https://dash.yunohost.org/appci/app/example) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/example.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/example.maintain.svg) [![Niveau dintégration](https://dash.yunohost.org/integration/crabfit.svg)](https://dash.yunohost.org/appci/app/crabfit) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/crabfit.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/crabfit.maintain.svg)
[![Installer Example app avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=example)
*[Read this readme in english.](./README.md)* [![Installer Crab Fit avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=crabfit)
> *Ce package vous permet d'installer Example app rapidement et simplement sur un serveur YunoHost. *[Lire le README dans d'autres langues.](./ALL_README.md)*
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
## Vue d'ensemble > *Ce package vous permet dinstaller Crab Fit rapidement et simplement sur un serveur YunoHost.*
> *Si vous navez pas YunoHost, consultez [ce guide](https://yunohost.org/install) pour savoir comment linstaller et en profiter.*
Some long and extensive description of what the app is and does, lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ## Vue densemble
### Features Crab Fit vous aide à adapter votre événement aux horaires de chacun·e.
Créez simplement un événement ci-dessus et envoyez le lien à tous les participant·e·s.
Les résultats sont mis à jour en direct et vous pourrez voir une carte thermique montrant quand tout le monde est libre.
- Ut enim ad minim veniam, quis nostrud exercitation ullamco ; ## Fonctionnalités
- Laboris nisi ut aliquip ex ea commodo consequat ;
- Duis aute irure dolor in reprehenderit in voluptate ; - Glisser votre souris pour sélectionner un interval de temps
- Velit esse cillum dolore eu fugiat nulla pariatur ; - Modifiable après coup à l'aide d'un mot de passe à usage unique
- Excepteur sint occaecat cupidatat non proident, sunt in culpa."
**Version incluse :** 1.0~ynh1 **Version incluse:** 1.0~ynh2
**Démo :** https://demo.example.com **Démo:** <https://crab.fit>
## Captures d'écran ## Captures décran
![Capture d'écran de Example app](./doc/screenshots/example.jpg) ![Capture décran de Crab Fit](./doc/screenshots/main.png)
## Avertissements / informations importantes
* Any known limitations, constrains or stuff not working, such as (but not limited to):
* requiring a full dedicated domain ?
* architectures not supported ?
* not-working single-sign on or LDAP integration ?
* the app requires an important amount of RAM / disk / .. to install or to work properly
* etc...
* Other infos that people should be aware of, such as:
* any specific step to perform after installing (such as manually finishing the install, specific admin credentials, ...)
* how to configure / administrate the application if it ain't obvious
* upgrade process / specificities / things to be aware of ?
* security considerations ?
## Documentations et ressources ## Documentations et ressources
* Site officiel de l'app : <https://example.com> - Site officiel de lapp: <https://crab.fit>
* Documentation officielle utilisateur : <https://yunohost.org/apps> - Documentation officielle utilisateur: <https://github.com/GRA0007/crab.fit>
* Documentation officielle de l'admin : <https://yunohost.org/packaging_apps> - Documentation officielle de ladmin: <https://github.com/GRA0007/crab.fit>
* Dépôt de code officiel de l'app : <https://some.forge.com/example/example> - Dépôt de code officiel de lapp: <https://github.com/GRA0007/crab.fit>
* Documentation YunoHost pour cette app : <https://yunohost.org/app_example> - YunoHost Store: <https://apps.yunohost.org/app/crabfit>
* Signaler un bug : <https://github.com/YunoHost-Apps/example_ynh/issues> - Signaler un bug: <https://github.com/YunoHost-Apps/crabfit_ynh/issues>
## Informations pour les développeurs ## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/example_ynh/tree/testing). Merci de faire vos pull request sur la [branche `testing`](https://github.com/YunoHost-Apps/crabfit_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit. Pour essayer la branche `testing`, procédez comme suit:
``` bash ```bash
sudo yunohost app install https://github.com/YunoHost-Apps/example_ynh/tree/testing --debug sudo yunohost app install https://github.com/YunoHost-Apps/crabfit_ynh/tree/testing --debug
ou ou
sudo yunohost app upgrade example -u https://github.com/YunoHost-Apps/example_ynh/tree/testing --debug sudo yunohost app upgrade crabfit -u https://github.com/YunoHost-Apps/crabfit_ynh/tree/testing --debug
``` ```
**Plus d'infos sur le packaging d'applications :** <https://yunohost.org/packaging_apps> **Plus dinfos sur le packaging dapplications:** <https://yunohost.org/packaging_apps>

View file

@ -1,4 +1,3 @@
Crab Fit helps you fit your event around everyone's schedules. Crab Fit helps you fit your event around everyone's schedules.
Simply create an event above and send the link to everyone that is participating. Simply create an event above and send the link to everyone that is participating.
Results update live and you will be able to see a heat-map of when everyone is free. Results update live and you will be able to see a heat-map of when everyone is free.

View file

@ -1,2 +0,0 @@
- Needs a dedicated domain
- Temporarily downloads and compile cargo for the backend installation

View file

@ -1,2 +0,0 @@
- Nécessite un domaine dédié
- Télécharge et compile temporairement un cargo et le backend

View file

@ -2,10 +2,10 @@ packaging_format = 2
id = "crabfit" id = "crabfit"
name = "Crab Fit" name = "Crab Fit"
description.en = "Enter your availability to find a time that works for everyone! " description.en = "Enter your availability to find a time that works for everyone"
description.fr = "Trouver un temps correspondant à tout le monde en rentrant vos disponibilités" description.fr = "Trouver un temps correspondant à tout le monde en rentrant vos disponibilités"
version = "1.0~ynh1" version = "1.0~ynh2"
maintainers = ["limaanto"] maintainers = ["limaanto"]
@ -18,7 +18,7 @@ userdoc = "https://github.com/GRA0007/crab.fit"
code = "https://github.com/GRA0007/crab.fit" code = "https://github.com/GRA0007/crab.fit"
[integration] [integration]
yunohost = ">= 11.1.21" yunohost = ">= 11.2"
architectures = "all" architectures = "all"
multi_instance = true multi_instance = true
ldap = false ldap = false
@ -43,16 +43,22 @@ ram.runtime = "100M"
sha256 = "cc87276d26242a90f32f1462319f0cff35c576f6c438cc20e68601f26701b33b" sha256 = "cc87276d26242a90f32f1462319f0cff35c576f6c438cc20e68601f26701b33b"
[resources.system_user] [resources.system_user]
[resources.install_dir] [resources.install_dir]
[resources.permissions] [resources.permissions]
main.url = "/" main.url = "/"
api.url = "/api"
api.allowed = "visitors"
api.auth_header = false
api.show_tile = false
[resources.ports] [resources.ports]
main.default = 3000 main.default = 3000
api.default = 3001 api.default = 3001
[resources.apt] [resources.apt]
packages = "postgresql pkg-config libssl-dev" packages = "postgresql, pkg-config, libssl-dev"
[resources.database] [resources.database]
type = "postgresql" type = "postgresql"

View file

@ -15,11 +15,6 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
ynh_print_info --message="Declaring files to be backed up..." ynh_print_info --message="Declaring files to be backed up..."
### N.B. : the following 'ynh_backup' calls are only a *declaration* of what needs
### to be backuped and not an actual copy of any file. The actual backup that
### creates and fill the archive with the files happens in the core after this
### script is called. Hence ynh_backups calls takes basically 0 seconds to run.
#================================================= #=================================================
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
@ -53,9 +48,6 @@ ynh_backup --src_path="/etc/systemd/system/${app}-back.service"
#================================================= #=================================================
ynh_print_info --message="Backing up the POSTGRES database..." ynh_print_info --message="Backing up the POSTGRES database..."
### (However, things like Postgres dumps *do* take some time to run, though the
### copy of the generated dump to the archive still happens later)
ynh_psql_dump_db --database="$db_name" > db.sql ynh_psql_dump_db --database="$db_name" > db.sql
#================================================= #=================================================

View file

@ -18,6 +18,7 @@ ynh_script_progression --message="Setting up source files..." --weight=1
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" ynh_setup_source --dest_dir="$install_dir"
chown -R $app:$app "$install_dir" chown -R $app:$app "$install_dir"
chmod -R o-rwx "$install_dir" chmod -R o-rwx "$install_dir"
@ -49,11 +50,11 @@ ynh_script_progression --message="Adding configuration files..." --weight=1
# Replace the default .env.local with our own # Replace the default .env.local with our own
rm $install_dir/frontend/.env.local rm $install_dir/frontend/.env.local
ynh_add_config --template="../conf/front.env" --destination="$install_dir/frontend/.env.local" ynh_add_config --template="front.env" --destination="$install_dir/frontend/.env.local"
chmod 400 "$install_dir/frontend/.env.local" chmod 400 "$install_dir/frontend/.env.local"
chown $app:$app "$install_dir/frontend/.env.local" chown $app:$app "$install_dir/frontend/.env.local"
ynh_add_config --template="../conf/back.env" --destination="$install_dir/api/.env" ynh_add_config --template="back.env" --destination="$install_dir/api/.env"
chmod 400 "$install_dir/api/.env" chmod 400 "$install_dir/api/.env"
chown $app:$app "$install_dir/api/.env" chown $app:$app "$install_dir/api/.env"
@ -61,12 +62,14 @@ chown $app:$app "$install_dir/api/.env"
# BUILD BACKEND # BUILD BACKEND
#================================================= #=================================================
ynh_script_progression --message="Building crabfit backend..." --weight=10 ynh_script_progression --message="Building crabfit backend..." --weight=10
build_backend build_backend
#================================================= #=================================================
# BUILD FRONTEND # BUILD FRONTEND
#================================================= #=================================================
ynh_script_progression --message="Building crabfit frontend..." --weight=2 ynh_script_progression --message="Building crabfit frontend..." --weight=2
build_frontend build_frontend
#================================================= #=================================================

View file

@ -16,8 +16,6 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
# This should be a symetric version of what happens in the install script
# 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`)
ynh_script_progression --message="Removing $app service integration..." --weight=1 ynh_script_progression --message="Removing $app service integration..." --weight=1
yunohost service remove "${app}-back" yunohost service remove "${app}-back"
@ -28,6 +26,7 @@ ynh_remove_systemd_config --service="${app}-front"
ynh_secure_remove --file="/etc/systemd/system/$app.target" ynh_secure_remove --file="/etc/systemd/system/$app.target"
ynh_remove_nginx_config ynh_remove_nginx_config
ynh_remove_logrotate ynh_remove_logrotate
ynh_secure_remove --file="/var/log/$app" ynh_secure_remove --file="/var/log/$app"

View file

@ -19,6 +19,7 @@ ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_use_nodejs ynh_use_nodejs
ynh_restore_file --origin_path="$install_dir" ynh_restore_file --origin_path="$install_dir"
chown -R $app:$app "$install_dir" chown -R $app:$app "$install_dir"
chmod -R o-rwx "$install_dir" chmod -R o-rwx "$install_dir"

View file

@ -9,52 +9,6 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
# Settings are automatically loaded as bash variables
# in every app script context, therefore typically these will exist:
# - $domain
# - $path
# - $language
# - $install_dir
# - $port
# ...
# In the context of upgrade,
# - resources are automatically provisioned / updated / deleted (depending on existing resources)
# - a safety backup is automatically created by the core and will be restored if the upgrade fails
### This helper will compare the version of the currently installed app and the version of the upstream package.
### $upgrade_type can have 2 different values
### - UPGRADE_APP if the upstream app version has changed
### - UPGRADE_PACKAGE if only the YunoHost package has changed
### ynh_check_app_version_changed will stop the upgrade if the app is up to date.
### UPGRADE_APP should be used to upgrade the core app only if there's an upgrade to do.
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
#ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
#
# N.B. : the followings setting migrations snippets are provided as *EXAMPLES*
# of what you may want to do in some cases (e.g. a setting was not defined on
# some legacy installs and you therefore want to initiaze stuff during upgrade)
#
# 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
# If install_dir doesn't exist, create it
#if [ -z "$install_dir" ]; then
# install_dir=/var/www/$app
# ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
#fi
#================================================= #=================================================
# STOP SYSTEMD SERVICE # STOP SYSTEMD SERVICE
#================================================= #=================================================
@ -68,17 +22,13 @@ ynh_systemd_action --service_name="${app}-back" --action="stop" --log_path="/var
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Upgrading source files..." --weight=1
if [ "$upgrade_type" == "UPGRADE_APP" ] # Download, check integrity, uncompress and patch the source from app.src
then ynh_setup_source --dest_dir="$install_dir"
ynh_script_progression --message="Upgrading source files..." --weight=1
# Download, check integrity, uncompress and patch the source from app.src chown -R $app:$app "$install_dir"
ynh_setup_source --dest_dir="$install_dir" chmod -R o-rwx "$install_dir"
chown -R $app:$app "$install_dir"
chmod -R o-rwx "$install_dir"
fi
ynh_install_nodejs --nodejs_version=$nodejs_version ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_use_nodejs ynh_use_nodejs
@ -88,13 +38,11 @@ ynh_use_nodejs
#================================================= #=================================================
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
# This should be a literal copypasta of what happened in the install's "System configuration" section
# Create a dedicated NGINX config using the conf/nginx.conf template # Create a dedicated NGINX config using the conf/nginx.conf template
ynh_add_nginx_config ynh_add_nginx_config
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_config --template="../conf/crabfit.target" --destination="/etc/systemd/system/$app.target" ynh_add_config --template="crabfit.target" --destination="/etc/systemd/system/$app.target"
ynh_add_systemd_config --service="${app}-front" --template="crabfit-front.service" ynh_add_systemd_config --service="${app}-front" --template="crabfit-front.service"
ynh_add_systemd_config --service="${app}-back" --template="crabfit-back.service" ynh_add_systemd_config --service="${app}-back" --template="crabfit-back.service"
@ -110,42 +58,28 @@ ynh_use_logrotate
#================================================= #=================================================
ynh_script_progression --message="Updating a configuration file..." --weight=1 ynh_script_progression --message="Updating a configuration file..." --weight=1
### Same as during install
###
### The file will automatically be backed-up if it's found to be manually modified (because
### ynh_add_config keeps track of the file's checksum)
# Replace the default .env.local with our own # Replace the default .env.local with our own
rm $install_dir/frontend/.env.local rm $install_dir/frontend/.env.local
ynh_add_config --template="../conf/front.env" --destination="$install_dir/frontend/.env.local" ynh_add_config --template="front.env" --destination="$install_dir/frontend/.env.local"
chmod 400 "$install_dir/frontend/.env.local" chmod 400 "$install_dir/frontend/.env.local"
chown $app:$app "$install_dir/frontend/.env.local" chown $app:$app "$install_dir/frontend/.env.local"
ynh_add_config --template="../conf/back.env" --destination="$install_dir/api/.env" ynh_add_config --template="back.env" --destination="$install_dir/api/.env"
chmod 400 "$install_dir/api/.env" chmod 400 "$install_dir/api/.env"
chown $app:$app "$install_dir/api/.env" chown $app:$app "$install_dir/api/.env"
### For more complex cases where you want to replace stuff using regexes, #=================================================
### you shoud rely on ynh_replace_string (which is basically a wrapper for sed) # BUILD BACKEND
### When doing so, you also need to manually call ynh_store_file_checksum #=================================================
### ynh_script_progression --message="Building crabfit backend..." --weight=10
### ynh_replace_string --match_string="match_string" --replace_string="replace_string" --target_file="$install_dir/some_config_file" build_backend
### ynh_store_file_checksum --file="$install_dir/some_config_file"
if [ "$upgrade_type" == "UPGRADE_APP" ] #=================================================
then # BUILD FRONTEND
#================================================= #=================================================
# BUILD BACKEND ynh_script_progression --message="Building crabfit frontend..." --weight=2
#=================================================
ynh_script_progression --message="Building crabfit backend..." --weight=10
build_backend
#================================================= build_frontend
# BUILD FRONTEND
#=================================================
ynh_script_progression --message="Building crabfit frontend..." --weight=2
build_frontend
fi
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE