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.
|
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
|
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
|
||||||
|
|
||||||
[](https://dash.yunohost.org/appci/app/petrolette)  
|
[](https://dash.yunohost.org/appci/app/petrolette)  
|
||||||
[](https://install-app.yunohost.org/?app=petrolette)
|
[](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.
|
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
|
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)
|
is_public=1 (PUBLIC|public=1|private=0)
|
||||||
; 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
|
||||||
|
@ -18,11 +18,3 @@
|
||||||
multi_instance=1
|
multi_instance=1
|
||||||
port_already_use=0
|
port_already_use=0
|
||||||
change_url=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_URL=https://framagit.org/yphil/petrolette/-/archive/80f2c901ba4b40a12d664c7e567532ba5ea6157f/petrolette-80f2c901ba4b40a12d664c7e567532ba5ea6157f.tar.gz
|
||||||
SOURCE_SUM=26914cb6a84d97fe88d0e06a39e926da7233d2beb9389e52641ac6a6cdb5d598
|
SOURCE_SUM=0fc5c6bc6f850c8e348faa5c0defd25ecf7ec1e35dda3c804f201c818f867649
|
||||||
SOURCE_SUM_PRG=sha256sum
|
SOURCE_SUM_PRG=sha256sum
|
||||||
SOURCE_FORMAT=tar.gz
|
SOURCE_FORMAT=tar.gz
|
||||||
SOURCE_IN_SUBDIR=true
|
SOURCE_IN_SUBDIR=true
|
||||||
|
|
|
@ -4,7 +4,7 @@ After=network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
Environment="PORT=__PORT__"
|
Environment="PTL_PORT_HTTP=__PORT__"
|
||||||
Environment="__YNH_NODE_LOAD_PATH__"
|
Environment="__YNH_NODE_LOAD_PATH__"
|
||||||
User=__APP__
|
User=__APP__
|
||||||
Group=__APP__
|
Group=__APP__
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
"email": "tobias.ollive@oiseauroch.fr"
|
"email": "tobias.ollive@oiseauroch.fr"
|
||||||
}],
|
}],
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 4.0.0"
|
"yunohost": ">= 4.1.0"
|
||||||
},
|
},
|
||||||
"multi_instance": true,
|
"multi_instance": true,
|
||||||
"services": [
|
"services": [
|
||||||
|
@ -25,30 +25,16 @@
|
||||||
{
|
{
|
||||||
"name": "domain",
|
"name": "domain",
|
||||||
"type": "domain",
|
"type": "domain",
|
||||||
"ask": {
|
|
||||||
"en": "Choose a domain for Petrolette",
|
|
||||||
"fr": "Choisissez un domaine pour Petrolette"
|
|
||||||
},
|
|
||||||
"example": "domain.org"
|
"example": "domain.org"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "path",
|
|
||||||
"type": "path",
|
|
||||||
"ask": {
|
|
||||||
"en": "choose a path",
|
|
||||||
"fr": "Choisissez un chemin"
|
|
||||||
},
|
|
||||||
"example": "petrolette",
|
|
||||||
"default": "/"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "is_public",
|
"name": "is_public",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"ask": {
|
"default": true,
|
||||||
"en": "Is it a public application?",
|
"help" : {
|
||||||
"fr": "Cette application doit-elle être publique ?"
|
"fr" : "Cette page sera accessible par n'importe qui. En revanche, la configuration reste personnelle",
|
||||||
},
|
"en" : "The page will be accessible by anyone."
|
||||||
"default": true
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,12 +37,6 @@ datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Declaring files to be backed up..."
|
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
|
# BACKUP THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -24,7 +24,7 @@ ynh_abort_if_errors
|
||||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
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
|
||||||
|
@ -57,7 +57,9 @@ ynh_script_progression --message="Finding an available port..."
|
||||||
|
|
||||||
# Find an available port
|
# Find an available port
|
||||||
port=$(ynh_find_port --port=8001)
|
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=port --value=$port
|
||||||
|
ynh_app_setting_set --app=$app --key=https_port --value=$https_port
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
|
@ -97,17 +99,23 @@ ynh_system_user_create --username=$app --home_dir=$final_path
|
||||||
ynh_script_progression --message="Installing application using node..."
|
ynh_script_progression --message="Installing application using node..."
|
||||||
|
|
||||||
pushd $final_path
|
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_use_nodejs
|
||||||
ynh_npm install
|
ynh_npm install
|
||||||
|
HOME=$TMP_HOME
|
||||||
popd
|
popd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SECURE FILES AND DIRECTORIES
|
# SECURE FILES AND DIRECTORIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
|
||||||
chown -R $app:$app $final_path
|
chown -R $app:$app $final_path
|
||||||
chmod -R o-rwx $final_path
|
chmod -R o-rwx $final_path
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -16,8 +16,6 @@ ynh_script_progression --message="Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
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)
|
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"
|
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"
|
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
|
# RECREATE THE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -74,15 +92,6 @@ ynh_system_user_create --username=$app
|
||||||
chown -R $app:$app $final_path
|
chown -R $app:$app $final_path
|
||||||
chmod -R o-rwx $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
|
# RESTORE SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -96,7 +105,7 @@ systemctl enable $app.service --quiet
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
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
|
# START SYSTEMD SERVICE
|
||||||
|
|
|
@ -18,9 +18,9 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
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)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||||
|
https_port=$(ynh_app_setting_get --app=$app --key=https_port)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK VERSION
|
# CHECK VERSION
|
||||||
|
@ -84,8 +84,11 @@ ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
|
||||||
ynh_script_progression --message="Upgrading the app..." --weight=5
|
ynh_script_progression --message="Upgrading the app..." --weight=5
|
||||||
|
|
||||||
pushd $final_path
|
pushd $final_path
|
||||||
ynh_use_nodejs
|
TMP_HOME=$HOME
|
||||||
ynh_npm update --production
|
HOME=$(pwd)
|
||||||
|
ynh_use_nodejs
|
||||||
|
ynh_npm install
|
||||||
|
HOME=$TMP_HOME
|
||||||
popd
|
popd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -112,6 +115,7 @@ ynh_add_systemd_config
|
||||||
|
|
||||||
# Set permissions on app files
|
# Set permissions on app files
|
||||||
chown -R $app:$app $final_path
|
chown -R $app:$app $final_path
|
||||||
|
chmod -R o-rwx $final_path
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
|
|
Loading…
Add table
Reference in a new issue