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

Upgrading to CodiMD 2.3.2 (#57)

- Upgrade to 2.3.2
This commit is contained in:
Éric Gaspar 2021-05-11 13:56:01 +02:00 committed by GitHub
parent 32bf1df966
commit e58389104b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 121 additions and 168 deletions

View file

@ -1,34 +1,34 @@
# 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)
[![Install CodiMD with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=codimd)
[![Install CodiMD with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=codimd)
*[Lire ce readme en français.](./README_fr.md)*
> *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
CodiMD is a real-time collaborative word processing web service. It uses Markdown language.
**Shipped version:** 1.6.0
**Shipped version:** 2.3.2
## Screenshots
![](https://demo.codimd.org/screenshot.png)
![](https://raw.githubusercontent.com/hackmdio/codimd/develop/public/screenshot.png)
## Demo
* [Official demo](https://demo.codimd.org/)
* [Official demo]()
## Configuration
You can configure CodiMD by editing this file `/var/www/codimd/config.json` using the [documentation](https://github.com/codimd/server/blob/master/docs/configuration.md)
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://github.com/codimd/server/tree/master/docs/
* YunoHost documentation: https://yunohost.org/#/app_codimd
* Official documentation: https://hackmd.io/c/codimd-documentation
* YunoHost documentation: https://yunohost.org/en/app_codimd
## YunoHost specific features
@ -39,13 +39,13 @@ You can configure CodiMD by editing this file `/var/www/codimd/config.json` usin
#### Supported architectures
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/codimd%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/codimd/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/codimd%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/codimd/)
* 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/)
## Links
* Report a bug: https://github.com/YunoHost-Apps/codimd_ynh/issues
* Upstream app repository: https://github.com/codimd/server/
* Upstream app repository: https://github.com/hackmdio/codimd
* YunoHost website: https://yunohost.org/
---

View file

@ -1,34 +1,34 @@
# CodiMD pour YunoHost
[![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.png)](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)*
> *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, consultez [le guide](https://yunohost.org/install) pour apprendre comment l'installer.*
## Vue d'ensemble
CodiMD est un service web de traitement de texte collaboratif en temps réel. Il utilise le langage Markdown.
**Version incluse :** 1.6.0
**Version incluse :** 2.3.2
## Captures d'écran
![](https://demo.codimd.org/screenshot.png)
![](https://raw.githubusercontent.com/hackmdio/codimd/develop/public/screenshot.png)
## Démo
* [Démo officielle](https://demo.codimd.org/)
* [Démo officielle]()
## Configuration
Vous pouvez configurer CodiMD en modifiant le fichier `/var/www/codimd/config.json` et en vous aidant de la [documentation](https://github.com/codimd/server/blob/master/docs/configuration.md)
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)
## Documentation
* Documentation officielle : https://github.com/codimd/server/tree/master/docs/
* Documentation YunoHost : https://yunohost.org/#/app_codimd_fr
* Documentation officielle : https://hackmd.io/c/codimd-documentation
* Documentation YunoHost : https://yunohost.org/fr/app_codimd
## Caractéristiques spécifiques YunoHost
@ -39,13 +39,13 @@ Vous pouvez configurer CodiMD en modifiant le fichier `/var/www/codimd/config.js
#### Architectures supportées
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/codimd%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/codimd/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/codimd%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/codimd/)
* 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/codimd/server/
* Dépôt de l'application principale : https://github.com/hackmdio/codimd
* Site web YunoHost : https://yunohost.org/
---
@ -60,3 +60,9 @@ sudo yunohost app install https://github.com/YunoHost-Apps/codimd_ynh/tree/testi
ou
sudo yunohost app upgrade codimd -u https://github.com/YunoHost-Apps/codimd_ynh/tree/testing --debug
```
it.
```
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,8 +1,10 @@
var path = require('path');
const path = require('path')
const config = require('./lib/config')
module.exports = {
'config': path.resolve('config.json'),
config: path.resolve('config.js'),
'migrations-path': path.resolve('lib', 'migrations'),
'models-path': path.resolve('lib', 'models'),
'url': 'postgres://__DB_USER__:__DB_PASS__@localhost:5432/__DB_NAME__'
url: 'postgres://__DB_NAME__:__DB_PWD__@localhost:5432/__DB_NAME__'
}

View file

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

View file

@ -30,8 +30,8 @@
"addGoogleAnalytics": false
},
"db": {
"username": "__DB_USER__",
"password": "__DB_PASS__",
"username": "__DB_NAME__",
"password": "__DB_PWD__",
"database": "__DB_NAME__",
"host": "localhost",
"port": "5432",

View file

@ -17,9 +17,13 @@ location ^~ __PATH__/ {
proxy_set_header Upgrade $http_upgrade;
# setup for image upload
client_max_body_size 256M;
proxy_max_temp_file_size 1024M;
client_max_body_size 8192m;
proxy_max_temp_file_size 8192m;
# adjust proxy buffer setting
proxy_buffers 8 32k;
proxy_buffer_size 32k;
proxy_busy_buffers_size 64k;
proxy_read_timeout 300;
proxy_connect_timeout 300;

View file

@ -1,6 +1,6 @@
[Unit]
Description=CodiMD: collaborative Markdown notes
Documentation=https://github.com/codimd/server
Documentation=https://github.com/hackmdio/codimd
After=network.target postgresql.service
[Service]

View file

@ -6,14 +6,14 @@
"en": "Collaborative editor to work on notes written in Markdown",
"fr": "Éditeur collaboratif pour travailler sur des notes en Markdown"
},
"version": "1.6.0~ynh8",
"url": "https://github.com/codimd/server",
"version": "2.3.2~ynh1",
"url": "https://github.com/hackmdio/codimd",
"license": "AGPL-3.0-only",
"maintainer": {
"name": "liberodark"
"name": ""
},
"requirements": {
"yunohost": ">= 3.8.1"
"yunohost": ">= 4.1.8"
},
"multi_instance": true,
"services": [
@ -24,29 +24,17 @@
{
"name": "domain",
"type": "domain",
"ask": {
"en": "Choose a domain name for CodiMD",
"fr": "Choisissez un nom de domaine pour CodiMD"
},
"example": "domain.org"
},
{
"name": "path",
"type": "path",
"ask": {
"en": "Choose a path for CodiMD",
"fr": "Choisissez un chemin pour CodiMD"
},
"example": "/codimd",
"default": "/codimd"
},
{
"name": "is_public",
"type": "boolean",
"ask": {
"en": "Is it a public site?",
"fr": "Est-ce un site public ?"
},
"help": {
"en": "If enabled, CodiMD 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, CodiMD sera accessible aux personnes nayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin."

View file

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

@ -31,7 +31,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
port=$(ynh_app_setting_get --app=$app --key=port)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
@ -113,16 +113,15 @@ fi
ynh_backup_if_checksum_is_different --file="$final_path/config.json"
domain=$new_domain
path_url=$new_path
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_USER__" --replace_string="$db_user" --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_PASS__" --replace_string="$db_pwd" --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"
@ -135,7 +134,7 @@ ynh_store_file_checksum --file="$final_path/config.json"
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="HTTP Server listening"
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="HTTP Server listening"
#=================================================
# RELOAD NGINX

View file

@ -47,14 +47,13 @@ ynh_script_progression --message="Storing installation settings..." --weight=2
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# FIND AND OPEN A PORT
#=================================================
ynh_script_progression --message="Configuring firewall..." --weight=2
ynh_script_progression --message="Finding an available port..." --weight=2
# Find an available port
port=$(ynh_find_port --port=3000)
@ -65,13 +64,18 @@ ynh_app_setting_set --app=$app --key=port --value=$port
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=20
ynh_install_app_dependencies $pkg_dependencies
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
# Install Nodejs
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
# Install Yarn
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=2
# Create a system user
ynh_system_user_create --username=$app
#=================================================
# CREATE A POSTGRESQL DATABASE
@ -79,14 +83,10 @@ ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ st
ynh_script_progression --message="Creating a PostgreSQL database..." --weight=2
db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name
db_pwd=$(ynh_string_random --length=30)
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd
ynh_psql_test_if_first_run
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_psql_setup_db --db_user=$db_name --db_name=$db_name
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
@ -105,14 +105,6 @@ 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
#==============================================
@ -120,14 +112,24 @@ ynh_system_user_create --username=$app --home_dir=$final_path
#==============================================
ynh_script_progression --message="Building CodiMD... (this will take some time and resources!)" --weight=24
chown -R $app: $final_path
pushd "$final_path" || ynh_die
ynh_use_nodejs
bin/setup
ynh_exec_warn_less yarn run build
ynh_exec_warn_less 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
popd || ynh_die
#=================================================
# MODIFY A CONFIG FILE
#=================================================
ynh_script_progression --message="Modifying a config file..."
path=${path_url:1}
ynh_add_config --template="../conf/config.json.example" --destination="$final_path/config.json"
ynh_add_config --template="../conf/.sequelizerc.example" --destination="$final_path/.sequelizerc"
#=================================================
# SETUP SYSTEMD
#=================================================
@ -135,36 +137,8 @@ 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
#=================================================
# MODIFY A CONFIG FILE
#=================================================
ynh_script_progression --message="Modifying a config file..."
cp ../conf/config.json.example "$final_path/config.json"
# Main config File
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_USER__" --replace_string="$db_user" --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_PASS__" --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"
cp ../conf/.sequelizerc.example "$final_path/.sequelizerc"
# DB Config File
ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$final_path/.sequelizerc"
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/.sequelizerc"
ynh_replace_string --match_string="__DB_PASS__" --replace_string="$db_pwd" --target_file="$final_path/.sequelizerc"
ynh_store_file_checksum --file="$final_path/.sequelizerc"
#=================================================
# GENERIC FINALIZATION
#=================================================
@ -173,7 +147,9 @@ ynh_store_file_checksum --file="$final_path/.sequelizerc"
ynh_script_progression --message="Securing files and directories..."
# Set permissions to app files
chown -R $app:$app $final_path
chown -R $app: $final_path
chmod 600 $final_path/config.json
chmod 600 $final_path/.sequelizerc
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
@ -188,19 +164,17 @@ yunohost service add $app --description="Collaborative Markdown notes" --log="/v
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="HTTP Server listening"
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="HTTP Server listening"
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring SSOwat..." --weight=1
ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary or protect it
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"
ynh_permission_update --permission="main" --add="visitors"
fi
#=================================================

View file

@ -17,10 +17,9 @@ 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)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# STANDARD REMOVE

View file

@ -31,7 +31,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
@ -83,7 +83,7 @@ chown -R $app:$app $final_path
ynh_script_progression --message="Reinstalling dependencies..." --weight=7
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
# Install Nodejs
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
@ -120,7 +120,7 @@ yunohost service add $app --description="Collaborative Markdown notes" --log="/v
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="HTTP Server listening"
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="HTTP Server listening"
#=================================================
# GENERIC FINALIZATION

View file

@ -18,13 +18,11 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
port=$(ynh_app_setting_get --app=$app --key=port)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
#=================================================
# CHECK VERSION
@ -33,6 +31,18 @@ ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
@ -90,7 +100,7 @@ fi
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2
# Create a dedicated nginx config
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
@ -98,14 +108,11 @@ ynh_add_nginx_config
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=18
ynh_install_app_dependencies $pkg_dependencies
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
# Install Nodejs
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
# Install Yarn
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
#=================================================
# CREATE DEDICATED USER
#=================================================
@ -124,35 +131,12 @@ then
ynh_script_progression --message="Building CodiMD... (this will take some time and resources!)" --weight=16
pushd "$final_path" || ynh_die
ynh_use_nodejs
bin/setup
ynh_exec_warn_less yarn run build
ynh_exec_warn_less bin/setup
ynh_exec_warn_less ynh_npm run build
popd || ynh_die
fi
#=================================================
# MODIFY A CONFIG FILE
#=================================================
ynh_script_progression --message="Modifying a config file..." --weight=2
ynh_backup_if_checksum_is_different --file="$final_path/config.json"
cp ../conf/config.json.example "$final_path/config.json"
# Main config File
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_USER__" --replace_string="$db_user" --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_PASS__" --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"
# Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum --file="$final_path/config.json"
#=================================================
# SETUP SYSTEMD
#=================================================
@ -160,7 +144,6 @@ 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
ynh_add_systemd_config
@ -172,12 +155,12 @@ ynh_add_systemd_config
ynh_script_progression --message="Securing files and directories..." --weight=1
# Set permissions on app files
chown -R $app:$app $final_path
chown -R $app: $final_path
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=2
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Collaborative Markdown notes" --log="/var/log/$app/$app.log"
@ -186,7 +169,7 @@ yunohost service add $app --description="Collaborative Markdown notes" --log="/v
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="HTTP Server listening"
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="HTTP Server listening"
#=================================================
# RELOAD NGINX