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

Merge pull request #40 from ericgaspar/sub-folder

Sub folder install
This commit is contained in:
lapineige 2020-07-06 17:53:04 +02:00 committed by GitHub
commit 50727498f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 76 additions and 37 deletions

View file

@ -39,7 +39,7 @@ Vous pouvez configurer CodiMD en modifiant le fichier `/var/www/codimd/config.js
#### Architectures supportées
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/codimd%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/codimd/)
* 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/)
## Liens

View file

@ -1,7 +1,7 @@
;; Test complet
; Manifest
domain="domain.tld" (DOMAIN)
path="/" (PATH)
path="/path" (PATH)
admin="john" (USER)
is_public=1 (PUBLIC|public=1|private=0)
; Checks
@ -15,7 +15,7 @@
backup_restore=1
multi_instance=1
port_already_use=1
change_url=0
change_url=1
;;; Levels
Level 5=auto
;;; Options

View file

@ -3,6 +3,7 @@
"protocolUseSSL": true,
"domain": "__DOMAIN__",
"port": "__PORT__",
"urlPath": "__PATH__",
"loglevel": "info",
"useCDN": false,
"allowGravatar": false,

View file

@ -1,25 +1,25 @@
location ^~ / {
# Force usage of https
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent;
}
location ^~ __PATH__/ {
proxy_pass http://127.0.0.1:__PORT__;
proxy_pass http://127.0.0.1:__PORT__/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
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 256M;
proxy_max_temp_file_size 1024M;
proxy_read_timeout 300;
proxy_connect_timeout 300;
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
more_clear_input_headers 'Accept-Encoding';
}

View file

@ -6,7 +6,7 @@
"en": "Collaborative editor to work on notes written in Markdown",
"fr": "Éditeur collaboratif pour travailler sur des notes en Markdown"
},
"version": "1.6.0~ynh3",
"version": "1.6.0~ynh4",
"url": "https://github.com/codimd/server",
"license": "AGPL-3.0-only",
"maintainer": {
@ -28,7 +28,17 @@
"en": "Choose a domain name for CodiMD",
"fr": "Choisissez un nom de domaine pour CodiMD"
},
"example": "codimd.domain.org"
"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",

View file

@ -29,6 +29,9 @@ 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)
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)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
@ -101,6 +104,29 @@ then
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi
#=================================================
# SPECIFIC MODIFICATIONS
#=================================================
# CONFIGURE CODIMD
#=================================================
ynh_backup_if_checksum_is_different --file="$final_path/config.json"
domain=$new_domain
path_url=$new_path
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="__APP__" --replace_string="$app" --target_file="$final_path/config.json"
ynh_store_file_checksum --file="$final_path/config.json"
#=================================================
# GENERIC FINALISATION
#=================================================

View file

@ -24,7 +24,7 @@ ynh_abort_if_errors
#=================================================
domain=$YNH_APP_ARG_DOMAIN
path_url="/"
path_url=$YNH_APP_ARG_PATH
is_public=$YNH_APP_ARG_IS_PUBLIC
app=$YNH_APP_INSTANCE_NAME
@ -143,25 +143,26 @@ ynh_add_systemd_config
#=================================================
ynh_script_progression --message="Modifying a config file..."
# Main config File
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="../conf/config.json.example"
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="../conf/config.json.example"
ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="../conf/config.json.example"
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="../conf/config.json.example"
ynh_replace_string --match_string="__DB_PASS__" --replace_string="$db_pwd" --target_file="../conf/config.json.example"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../conf/config.json.example"
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"
# DB Config File
ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="../conf/.sequelizerc.example"
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="../conf/.sequelizerc.example"
ynh_replace_string --match_string="__DB_PASS__" --replace_string="$db_pwd" --target_file="../conf/.sequelizerc.example"
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"
#=================================================

View file

@ -139,16 +139,17 @@ ynh_script_progression --message="Modifying a config file..." --weight=2
ynh_backup_if_checksum_is_different --file="$final_path/config.json"
# Main config File
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="../conf/config.json.example"
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="../conf/config.json.example"
ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="../conf/config.json.example"
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="../conf/config.json.example"
ynh_replace_string --match_string="__DB_PASS__" --replace_string="$db_pwd" --target_file="../conf/config.json.example"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../conf/config.json.example"
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"