mirror of
https://github.com/YunoHost-Apps/petrolette_ynh.git
synced 2024-09-03 19:56:26 +02:00
Dev (#1)
* update to use env config port * use port name for http_port * use specific $home value to avoid right error
This commit is contained in:
parent
8fd1533f7e
commit
4b9a142196
11 changed files with 53 additions and 62 deletions
|
@ -54,7 +54,7 @@ Please send your pull request to the [testing branch](https://github.com/YunoHos
|
|||
|
||||
To try the testing branch, please proceed like that.
|
||||
```
|
||||
sudo yunohost app install https://github.com/oiseauroch/petrolette_ynh/tree/dev --debug
|
||||
sudo yunohost app install https://github.com/Yunohost-Apps/petrolette_ynh/tree/dev --debug
|
||||
or
|
||||
sudo yunohost app upgrade petrolette -u https://github.com/oiseauroch/petrolette_ynh/tree/dev --debug
|
||||
sudo yunohost app upgrade petrolette -u https://github.com/Yunohost-Apps/petrolette_ynh/tree/dev --debug
|
||||
```
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Whiteboard pour YunoHost
|
||||
# Petrolette pour YunoHost
|
||||
|
||||
[![Niveau d'intégration](https://dash.yunohost.org/integration/petrolette.svg)](https://dash.yunohost.org/appci/app/petrolette) ![](https://ci-apps.yunohost.org/ci/badges/petrolette.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/petrolette.maintain.svg)
|
||||
[![Installer Whitebophir avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=petrolette)
|
||||
|
@ -49,7 +49,7 @@ Merci de faire vos pull request sur la [branche dev](https://github.com/oiseauro
|
|||
|
||||
Pour essayer la branche testing, procédez comme suit.
|
||||
```
|
||||
sudo yunohost app install https://github.com/oiseauroch/petrolette/tree/dev --debug
|
||||
sudo yunohost app install https://github.com/Yunohost-Apps/petrolette/tree/dev --debug
|
||||
ou
|
||||
sudo yunohost app upgrade whitebophir -u https://github.com/oiseauroch/petrolette_ynh/tree/dev --debug
|
||||
sudo yunohost app upgrade whitebophir -u https://github.com/Yunohost-Apps/petrolette_ynh/tree/dev --debug
|
||||
```
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
is_public=1 (PUBLIC|public=1|private=0)
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=1
|
||||
setup_sub_dir=0
|
||||
setup_root=1
|
||||
setup_nourl=0
|
||||
setup_private=1
|
||||
|
@ -18,11 +18,3 @@
|
|||
multi_instance=1
|
||||
port_already_use=0
|
||||
change_url=0
|
||||
;;; Options
|
||||
Email=
|
||||
Notification=none
|
||||
;;; Upgrade options
|
||||
; commit=CommitHash
|
||||
name=Name and date of the commit.
|
||||
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666&
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
SOURCE_URL=https://framagit.org/yphil/petrolette/-/archive/e122e90dfca6db7f288c510941655522582895b4/petrolette-e122e90dfca6db7f288c510941655522582895b4.tar.gz
|
||||
SOURCE_SUM=26914cb6a84d97fe88d0e06a39e926da7233d2beb9389e52641ac6a6cdb5d598
|
||||
SOURCE_URL=https://framagit.org/yphil/petrolette/-/archive/80f2c901ba4b40a12d664c7e567532ba5ea6157f/petrolette-80f2c901ba4b40a12d664c7e567532ba5ea6157f.tar.gz
|
||||
SOURCE_SUM=0fc5c6bc6f850c8e348faa5c0defd25ecf7ec1e35dda3c804f201c818f867649
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
|
|
|
@ -4,7 +4,7 @@ After=network.target
|
|||
|
||||
[Service]
|
||||
Type=simple
|
||||
Environment="PORT=__PORT__"
|
||||
Environment="PTL_PORT_HTTP=__PORT__"
|
||||
Environment="__YNH_NODE_LOAD_PATH__"
|
||||
User=__APP__
|
||||
Group=__APP__
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
"email": "tobias.ollive@oiseauroch.fr"
|
||||
}],
|
||||
"requirements": {
|
||||
"yunohost": ">= 4.0.0"
|
||||
"yunohost": ">= 4.1.0"
|
||||
},
|
||||
"multi_instance": true,
|
||||
"services": [
|
||||
|
@ -25,30 +25,16 @@
|
|||
{
|
||||
"name": "domain",
|
||||
"type": "domain",
|
||||
"ask": {
|
||||
"en": "Choose a domain for Petrolette",
|
||||
"fr": "Choisissez un domaine pour Petrolette"
|
||||
},
|
||||
"example": "domain.org"
|
||||
},
|
||||
{
|
||||
"name": "path",
|
||||
"type": "path",
|
||||
"ask": {
|
||||
"en": "choose a path",
|
||||
"fr": "Choisissez un chemin"
|
||||
},
|
||||
"example": "petrolette",
|
||||
"default": "/"
|
||||
},
|
||||
{
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"ask": {
|
||||
"en": "Is it a public application?",
|
||||
"fr": "Cette application doit-elle être publique ?"
|
||||
},
|
||||
"default": true
|
||||
"default": true,
|
||||
"help" : {
|
||||
"fr" : "Cette page sera accessible par n'importe qui. En revanche, la configuration reste personnelle",
|
||||
"en" : "The page will be accessible by anyone."
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -37,12 +37,6 @@ datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
|||
#=================================================
|
||||
ynh_print_info --message="Declaring files to be backed up..."
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE APP MAIN DIR
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="$final_path"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
|
|
@ -24,7 +24,7 @@ ynh_abort_if_errors
|
|||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||
#=================================================
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url=$YNH_APP_ARG_PATH
|
||||
path_url="/"
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
@ -57,7 +57,9 @@ ynh_script_progression --message="Finding an available port..."
|
|||
|
||||
# Find an available port
|
||||
port=$(ynh_find_port --port=8001)
|
||||
https_port=$(ynh_find_port --port=8002)
|
||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||
ynh_app_setting_set --app=$app --key=https_port --value=$https_port
|
||||
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
|
@ -81,7 +83,7 @@ ynh_setup_source --dest_dir="$final_path"
|
|||
ynh_script_progression --message="Configuring nginx web server..."
|
||||
|
||||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
|
@ -97,17 +99,23 @@ ynh_system_user_create --username=$app --home_dir=$final_path
|
|||
ynh_script_progression --message="Installing application using node..."
|
||||
|
||||
pushd $final_path
|
||||
# use custom home value to avoid bower storing values in root and have right errors
|
||||
TMP_HOME=$HOME
|
||||
HOME=$(pwd)
|
||||
ynh_use_nodejs
|
||||
ynh_npm install
|
||||
HOME=$TMP_HOME
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
# SECURE FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
|
||||
|
||||
chown -R $app:$app $final_path
|
||||
chmod -R o-rwx $final_path
|
||||
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
|
|
|
@ -16,8 +16,6 @@ ynh_script_progression --message="Loading installation settings..."
|
|||
|
||||
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)
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -52,12 +52,30 @@ test ! -d $final_path \
|
|||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RESTORE MAINDIR
|
||||
# SPECIFIC RESTORATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app main directory..." --weight=5
|
||||
# REINSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
|
||||
|
||||
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
|
||||
|
||||
#=================================================
|
||||
# REINSTALL PETROLLETTE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reinstalling the app ..." --weight=5
|
||||
|
||||
ynh_setup_source --dest_dir="$final_path"
|
||||
|
||||
pushd $final_path
|
||||
TMP_HOME=$HOME
|
||||
HOME=$(pwd)
|
||||
ynh_use_nodejs
|
||||
ynh_npm install
|
||||
HOME=$TMP_HOME
|
||||
popd
|
||||
|
||||
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
|
@ -74,15 +92,6 @@ ynh_system_user_create --username=$app
|
|||
chown -R $app:$app $final_path
|
||||
chmod -R o-rwx $final_path
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
|
||||
|
||||
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
|
||||
ynh_remove_nodejs
|
||||
#=================================================
|
||||
# RESTORE SYSTEMD
|
||||
#=================================================
|
||||
|
@ -96,7 +105,7 @@ systemctl enable $app.service --quiet
|
|||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||
|
||||
yunohost service add $app --description="The news reader that doesn't know you " --log="/home/yunohost.app/${app}/storage/logs/petrollette.log"
|
||||
yunohost service add $app --description="The news reader that doesn't know you" --log="/home/yunohost.app/${app}/storage/logs/petrolette.log"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
|
|
|
@ -18,9 +18,9 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
#admin_email=$(ynh_app_setting_get --app=$app --key=admin_email)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
https_port=$(ynh_app_setting_get --app=$app --key=https_port)
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
|
@ -84,8 +84,11 @@ ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
|
|||
ynh_script_progression --message="Upgrading the app..." --weight=5
|
||||
|
||||
pushd $final_path
|
||||
ynh_use_nodejs
|
||||
ynh_npm update --production
|
||||
TMP_HOME=$HOME
|
||||
HOME=$(pwd)
|
||||
ynh_use_nodejs
|
||||
ynh_npm install
|
||||
HOME=$TMP_HOME
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
|
@ -112,6 +115,7 @@ ynh_add_systemd_config
|
|||
|
||||
# Set permissions on app files
|
||||
chown -R $app:$app $final_path
|
||||
chmod -R o-rwx $final_path
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
|
|
Loading…
Reference in a new issue