1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/codimd_ynh.git synced 2024-09-03 18:16:32 +02:00
* Upgrade to version 2.4.1
This commit is contained in:
Éric Gaspar 2021-06-21 11:48:25 +02:00 committed by GitHub
parent e58389104b
commit 0d58e34697
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 151 additions and 195 deletions

View file

@ -1,6 +1,6 @@
--- ---
name: Bug report 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.* 1. *Read this whole template first.*
2. *Determine if you are on the right place:* 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!* - *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 CodiMD itself. Refer to its documentation or repository for help.* - *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.*
- *If you have a doubt, post here, we will figure it out together.* - *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.* 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.* *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 / ...* - Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...*
- YunoHost version: x.x.x - YunoHost version: x.x.x
- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...* - 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: - If yes, please explain:
- Using, or trying to install package version/branch: - Using, or trying to install package version/branch:
- If upgrading, current package version: *can be found in the admin, or with `yunohost app info codimd`* - 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:* - *If you performed a command from the CLI, the command itself is enough. For example:*
```sh ```sh
sudo yunohost app install codimd sudo yunohost app install the_app
``` ```
- *If you used the webadmin, please perform the equivalent command from the CLI first.* - *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:* - *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 '...'* 3. *Scroll down to '...'*
4. *See error* 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.* *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** ### 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.*
*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.* *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,3 +1,8 @@
<!--
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.
-->
# CodiMD for YunoHost # CodiMD for YunoHost
[![Integration level](https://dash.yunohost.org/integration/codimd.svg)](https://dash.yunohost.org/appci/app/codimd) ![](https://ci-apps.yunohost.org/ci/badges/codimd.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/codimd.maintain.svg) [![Integration level](https://dash.yunohost.org/integration/codimd.svg)](https://dash.yunohost.org/appci/app/codimd) ![](https://ci-apps.yunohost.org/ci/badges/codimd.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/codimd.maintain.svg)
@ -5,50 +10,40 @@
*[Lire ce readme en français.](./README_fr.md)* *[Lire ce readme en français.](./README_fr.md)*
> *This package allows you to install CodiMD quickly and simply on a YunoHost server. > *This package allows you to install CodiMD 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.* If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Overview ## Overview
CodiMD is a real-time collaborative word processing web service. It uses Markdown language.
**Shipped version:** 2.3.2 Collaborative editor to work on notes written in Markdown
**Shipped version:** 2.4.1~ynh1
## Screenshots ## Screenshots
![](https://raw.githubusercontent.com/hackmdio/codimd/develop/public/screenshot.png) ![](./doc/screenshots/screenshot.png)
## Demo ## Disclaimers / important information
* [Official demo]() ### Multi-user support
## Configuration
You can configure CodiMD by editing this file `/var/www/codimd/config.json` using the [documentation](https://hackmd.io/c/codimd-documentation/%2Fs%2Fcodimd-configuration)
## Documentation
* Official documentation: https://hackmd.io/c/codimd-documentation
* YunoHost documentation: https://yunohost.org/en/app_codimd
## YunoHost specific features
#### Multi-user support
* Is LDAP supported? **Yes** * Is LDAP supported? **Yes**
* Can the app be used by multiple users? **Yes** * Can the app be used by multiple users? **Yes**
#### Supported architectures ### Configuration
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/codimd.svg)](https://ci-apps.yunohost.org/ci/apps/codimd/) You can configure CodiMD by editing this file `/var/www/codimd/config.json` using the [documentation](https://hackmd.io/c/codimd-documentation/%2Fs%2Fcodimd-configuration)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/codimd.svg)](https://ci-apps-arm.yunohost.org/ci/apps/codimd/)
## Links ## Documentation and resources
* Report a bug: https://github.com/YunoHost-Apps/codimd_ynh/issues * Official app website: https://hackmd.io/
* Upstream app repository: https://github.com/hackmdio/codimd * Official user documentation: https://hackmd.io/c/codimd-documentation/%2Fs%2Fcodimd-documentation#User-Guides
* YunoHost website: https://yunohost.org/ * Official admin documentation: https://hackmd.io/c/codimd-documentation/%2Fs%2Fcodimd-documentation#Administration-Guides
* Upstream app code repository: https://github.com/hackmdio/codimd
--- * YunoHost documentation for this app: https://yunohost.org/app_codimd
* Report a bug: https://github.com/YunoHost-Apps/codimd_ynh/issues
## Developer info ## Developer info
@ -60,3 +55,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/codimd_ynh/tree/testi
or or
sudo yunohost app upgrade codimd -u https://github.com/YunoHost-Apps/codimd_ynh/tree/testing --debug sudo yunohost app upgrade codimd -u https://github.com/YunoHost-Apps/codimd_ynh/tree/testing --debug
``` ```
**More info regarding app packaging:** https://yunohost.org/packaging_apps

View file

@ -3,52 +3,43 @@
[![Niveau d'intégration](https://dash.yunohost.org/integration/codimd.svg)](https://dash.yunohost.org/appci/app/codimd) ![](https://ci-apps.yunohost.org/ci/badges/codimd.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/codimd.maintain.svg) [![Niveau d'intégration](https://dash.yunohost.org/integration/codimd.svg)](https://dash.yunohost.org/appci/app/codimd) ![](https://ci-apps.yunohost.org/ci/badges/codimd.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/codimd.maintain.svg)
[![Installer CodiMD avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=codimd) [![Installer CodiMD avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=codimd)
*[Read this readme in english.](./README.md)* *[Read this readme in english.](./README.md)*
*[Lire ce readme en français.](./README_fr.md)*
> *Ce package vous permet d'installer CodiMD rapidement et simplement sur un serveur YunoHost. > *Ce package vous permet d'installer CodiMD 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 ## Vue d'ensemble
CodiMD est un service web de traitement de texte collaboratif en temps réel. Il utilise le langage Markdown.
**Version incluse :** 2.3.2 Éditeur collaboratif pour travailler sur des notes en Markdown
**Version incluse :** 2.4.1~ynh1
## Captures d'écran ## Captures d'écran
![](https://raw.githubusercontent.com/hackmdio/codimd/develop/public/screenshot.png) ![](./doc/screenshots/screenshot.png)
## Démo ## Avertissements / informations importantes
* [Démo officielle]() ### Multi-user support
## Configuration * Is LDAP supported? **Yes**
* Can the app be used by multiple users? **Yes**
Vous pouvez configurer CodiMD en modifiant le fichier `/var/www/codimd/config.json` et en vous aidant de la [documentation](https://hackmd.io/c/codimd-documentation/%2Fs%2Fcodimd-configuration) ### Configuration
## Documentation You can configure CodiMD by editing this file `/var/www/codimd/config.json` using the [documentation](https://hackmd.io/c/codimd-documentation/%2Fs%2Fcodimd-configuration)
* Documentation officielle : https://hackmd.io/c/codimd-documentation ## Documentations et ressources
* Documentation YunoHost : https://yunohost.org/fr/app_codimd
## Caractéristiques spécifiques YunoHost * Site officiel de l'app : https://hackmd.io/
* Documentation officielle utilisateur : https://hackmd.io/c/codimd-documentation/%2Fs%2Fcodimd-documentation#User-Guides
#### Support multi-utilisateur * Documentation officielle de l'admin : https://hackmd.io/c/codimd-documentation/%2Fs%2Fcodimd-documentation#Administration-Guides
* Dépôt de code officiel de l'app : https://github.com/hackmdio/codimd
* L'authentification LDAP est-elle prise en charge ? **Oui** * Documentation YunoHost pour cette app : https://yunohost.org/app_codimd
* L'application peut-elle être utilisée par plusieurs utilisateurs ? **Oui** * Signaler un bug : https://github.com/YunoHost-Apps/codimd_ynh/issues
#### Architectures supportées
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/codimd.svg)](https://ci-apps.yunohost.org/ci/apps/codimd/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/codimd.svg)](https://ci-apps-arm.yunohost.org/ci/apps/codimd/)
## Liens
* Signaler un bug : https://github.com/YunoHost-Apps/codimd_ynh/issues
* Dépôt de l'application principale : https://github.com/hackmdio/codimd
* Site web YunoHost : https://yunohost.org/
---
## Informations pour les développeurs ## Informations pour les développeurs
@ -60,9 +51,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/codimd_ynh/tree/testi
ou ou
sudo yunohost app upgrade codimd -u https://github.com/YunoHost-Apps/codimd_ynh/tree/testing --debug sudo yunohost app upgrade codimd -u https://github.com/YunoHost-Apps/codimd_ynh/tree/testing --debug
``` ```
it.
``` **Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps
sudo yunohost app install https://github.com/YunoHost-Apps/codimd_ynh/tree/testing --debug
ou
sudo yunohost app upgrade codimd -u https://github.com/YunoHost-Apps/codimd_ynh/tree/testing --debug
```

View file

@ -1,20 +1,19 @@
;; Test complet ;; Test complet
; Manifest ; Manifest
domain="domain.tld" (DOMAIN) domain="domain.tld"
path="/path" (PATH) path="/path"
admin="john" (USER) admin="john"
is_public=1 (PUBLIC|public=1|private=0) is_public=1
; Checks ; Checks
pkg_linter=1 pkg_linter=1
setup_sub_dir=1 setup_sub_dir=0
setup_root=1 setup_root=1
setup_nourl=0 setup_nourl=0
setup_private=1 setup_private=1
setup_public=1 setup_public=1
upgrade=1 upgrade=1
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=0
port_already_use=1
change_url=1 change_url=1
;;; Options ;;; Options
Email= Email=

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://github.com/hackmdio/codimd/archive/refs/tags/2.3.2.tar.gz SOURCE_URL=https://github.com/hackmdio/codimd/archive/refs/tags/2.4.1.tar.gz
SOURCE_SUM=aa1134ed283aec23e99ae3557541e183f342031e6728d1045ec5c3b2d32b2e5f SOURCE_SUM=3bf516ca447aefc2c3ca9f94c76eeb1d1a14d4a0e24dca044b87ea89f1acdf73
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true

View file

@ -1,4 +1,4 @@
location ^~ __PATH__/ { location / {
# Force usage of https # Force usage of https
if ($scheme = http) { if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent; rewrite ^ https://$server_name$request_uri? permanent;

View file

@ -8,12 +8,14 @@ Type=simple
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__
WorkingDirectory=__FINALPATH__ WorkingDirectory=__FINALPATH__
Environment="PATH=__ENV_PATH__"
Environment="NODE_ENV=production" Environment="NODE_ENV=production"
ExecStart=__YNH_NPM__ start --production Environment="__YNH_NODE_LOAD_PATH__"
ExecStart=__YNH_NODE__ app.js
Restart=always Restart=always
PrivateTmp=true PrivateTmp=true
PrivateDevices=true PrivateDevices=true
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

8
doc/DISCLAIMER.md Normal file
View file

@ -0,0 +1,8 @@
### Multi-user support
* Is LDAP supported? **Yes**
* Can the app be used by multiple users? **Yes**
### Configuration
You can configure CodiMD by editing this file `/var/www/codimd/config.json` using the [documentation](https://hackmd.io/c/codimd-documentation/%2Fs%2Fcodimd-configuration)

Binary file not shown.

After

Width:  |  Height:  |  Size: 358 KiB

View file

@ -6,16 +6,23 @@
"en": "Collaborative editor to work on notes written in Markdown", "en": "Collaborative editor to work on notes written in Markdown",
"fr": "Éditeur collaboratif pour travailler sur des notes en Markdown" "fr": "Éditeur collaboratif pour travailler sur des notes en Markdown"
}, },
"version": "2.3.2~ynh1", "version": "2.4.1~ynh1",
"url": "https://github.com/hackmdio/codimd", "url": "https://github.com/hackmdio/codimd",
"upstream": {
"license": "AGPL-3.0-only",
"website": "https://hackmd.io/",
"admindoc": "https://hackmd.io/c/codimd-documentation/%2Fs%2Fcodimd-documentation#Administration-Guides",
"userdoc": "https://hackmd.io/c/codimd-documentation/%2Fs%2Fcodimd-documentation#User-Guides",
"code": "https://github.com/hackmdio/codimd"
},
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
"maintainer": { "maintainer": {
"name": "" "name": ""
}, },
"requirements": { "requirements": {
"yunohost": ">= 4.1.8" "yunohost": ">= 4.2.4"
}, },
"multi_instance": true, "multi_instance": false,
"services": [ "services": [
"nginx" "nginx"
], ],
@ -26,12 +33,6 @@
"type": "domain", "type": "domain",
"example": "domain.org" "example": "domain.org"
}, },
{
"name": "path",
"type": "path",
"example": "/codimd",
"default": "/codimd"
},
{ {
"name": "is_public", "name": "is_public",
"type": "boolean", "type": "boolean",

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

@ -5,9 +5,9 @@
#================================================= #=================================================
# dependencies used by the app # dependencies used by the app
pkg_dependencies="postgresql apt-transport-https" pkg_dependencies="postgresql apt-transport-https libssl-dev"
nodejs_version=12 nodejs_version=11
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS

View file

@ -17,7 +17,7 @@ old_domain=$YNH_APP_OLD_DOMAIN
old_path=$YNH_APP_OLD_PATH old_path=$YNH_APP_OLD_PATH
new_domain=$YNH_APP_NEW_DOMAIN new_domain=$YNH_APP_NEW_DOMAIN
new_path=$YNH_APP_NEW_PATH path_url="/"
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -60,12 +60,6 @@ then
change_domain=1 change_domain=1
fi fi
change_path=0
if [ "$old_path" != "$new_path" ]
then
change_path=1
fi
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
#================================================= #=================================================
@ -82,18 +76,6 @@ ynh_script_progression --message="Updating NGINX web server configuration..." --
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
# 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
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
# Set global variables for nginx helper
domain="$old_domain"
path_url="$new_path"
# 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 ] if [ $change_domain -eq 1 ]
then then
@ -110,21 +92,9 @@ fi
# CONFIGURE CODIMD # CONFIGURE CODIMD
#================================================= #=================================================
ynh_backup_if_checksum_is_different --file="$final_path/config.json" path=${path_url:1}
domain=new_domain
domain=$new_domain ynh_add_config --template="../conf/config.json.example" --destination="$final_path/config.json"
path_url=${path_url:1}
cp ../conf/config.json.example "$final_path/config.json"
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/config.json"
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/config.json"
ynh_replace_string --match_string="__PATH__" --replace_string="${path_url:1}" --target_file="$final_path/config.json"
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/config.json"
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/config.json"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$final_path/config.json"
ynh_store_file_checksum --file="$final_path/config.json"
#================================================= #=================================================
# GENERIC FINALISATION # GENERIC FINALISATION

View file

@ -24,7 +24,7 @@ ynh_abort_if_errors
#================================================= #=================================================
domain=$YNH_APP_ARG_DOMAIN domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH path_url="/"
is_public=$YNH_APP_ARG_IS_PUBLIC is_public=$YNH_APP_ARG_IS_PUBLIC
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -75,7 +75,7 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_script_progression --message="Configuring system user..." --weight=2 ynh_script_progression --message="Configuring system user..." --weight=2
# Create a system user # Create a system user
ynh_system_user_create --username=$app ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# CREATE A POSTGRESQL DATABASE # CREATE A POSTGRESQL DATABASE
@ -97,6 +97,10 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# 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=$final_path ynh_setup_source --dest_dir=$final_path
chmod 755 "$final_path"
#chmod -R o-rwx "$final_path"
chown -R $app: "$final_path"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
@ -112,14 +116,11 @@ ynh_add_nginx_config
#============================================== #==============================================
ynh_script_progression --message="Building CodiMD... (this will take some time and resources!)" --weight=24 ynh_script_progression --message="Building CodiMD... (this will take some time and resources!)" --weight=24
chown -R $app: $final_path pushd $final_path
pushd "$final_path" || ynh_die
ynh_use_nodejs ynh_use_nodejs
ynh_exec_warn_less bin/setup ynh_exec_as $app env $ynh_node_load_PATH bin/setup
ynh_exec_as $app env $ynh_node_load_PATH npm update
ynh_exec_as $app env $ynh_node_load_PATH npm run build ynh_exec_as $app env $ynh_node_load_PATH npm run build
popd || ynh_die popd
#================================================= #=================================================
# MODIFY A CONFIG FILE # MODIFY A CONFIG FILE
@ -129,28 +130,18 @@ ynh_script_progression --message="Modifying a config file..."
path=${path_url:1} path=${path_url:1}
ynh_add_config --template="../conf/config.json.example" --destination="$final_path/config.json" ynh_add_config --template="../conf/config.json.example" --destination="$final_path/config.json"
ynh_add_config --template="../conf/.sequelizerc.example" --destination="$final_path/.sequelizerc" ynh_add_config --template="../conf/.sequelizerc.example" --destination="$final_path/.sequelizerc"
chmod 600 $final_path/config.json
chmod 600 $final_path/.sequelizerc
chmod +x $final_path/app.js
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
#================================================= #=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=1 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 ynh_add_systemd_config
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_script_progression --message="Securing files and directories..."
# Set permissions to app files
chown -R $app: $final_path
chmod 600 $final_path/config.json
chmod 600 $final_path/.sequelizerc
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST
#================================================= #=================================================

View file

@ -66,6 +66,14 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
@ -95,6 +103,10 @@ then
ynh_secure_remove --file="$tmpdir" ynh_secure_remove --file="$tmpdir"
fi fi
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
@ -113,14 +125,6 @@ ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
# Install Nodejs # Install Nodejs
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app
#================================================= #=================================================
# SPECIFIC UPGRADE # SPECIFIC UPGRADE
#============================================== #==============================================
@ -142,21 +146,9 @@ fi
#================================================= #=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=2 ynh_script_progression --message="Configuring a systemd service..." --weight=2
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"
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config ynh_add_systemd_config
#=================================================
# 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 # INTEGRATE SERVICE IN YUNOHOST
#================================================= #=================================================