mirror of
https://github.com/YunoHost-Apps/trilium_ynh.git
synced 2024-10-01 13:34:49 +02:00
Use N to manage Node version
This commit is contained in:
parent
c2fe686915
commit
a34170f601
5 changed files with 23 additions and 5 deletions
|
@ -7,8 +7,9 @@ Type=simple
|
|||
User=__APP__
|
||||
Group=__APP__
|
||||
Environment=TRILIUM_DATA_DIR=/home/yunohost.app/__APP__
|
||||
Environment="NODE_ENV=production"
|
||||
WorkingDirectory=__FINALPATH__/
|
||||
ExecStart=node __FINALPATH__/src/www
|
||||
ExecStart=__YNH_NODE__ __FINALPATH__/src/www
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
|
@ -106,10 +106,14 @@ usermod -d $final_path $app 2>&1
|
|||
#=================================================
|
||||
ynh_script_progression --message="Installing Node.js packages ..." --weight=45
|
||||
|
||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=10
|
||||
ynh_use_nodejs
|
||||
node_PATH=$nodejs_path:$(sudo -u $app sh -c 'echo $PATH')
|
||||
|
||||
pushd $final_path || ynh_die
|
||||
chown -R $app:$app $final_path
|
||||
sudo -u $app touch $final_path/.yarnrc
|
||||
sudo -u $app yarnpkg --cache-folder $final_path/yarn-cache --use-yarnrc $final_path/.yarnrc install 2>&1
|
||||
sudo -u $app PATH=$node_PATH yarn --cache-folder $final_path/yarn-cache --use-yarnrc $final_path/.yarnrc install 2>&1
|
||||
chown -R root:root $final_path
|
||||
popd || ynh_die
|
||||
|
||||
|
@ -119,7 +123,7 @@ popd || ynh_die
|
|||
ynh_script_progression --message="Configuring a systemd service..." --weight=1
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
ynh_add_systemd_config -v ynh_node
|
||||
|
||||
#=================================================
|
||||
# ADD A CONFIGURATION
|
||||
|
|
|
@ -66,6 +66,13 @@ ynh_script_progression --message="Removing NGINX web server configuration..." --
|
|||
# Remove the dedicated NGINX config
|
||||
ynh_remove_nginx_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE NODE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing Node.js version..." --weight=1
|
||||
|
||||
ynh_remove_nodejs
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC REMOVE
|
||||
#=================================================
|
||||
|
|
|
@ -95,6 +95,8 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=40
|
|||
ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
|
||||
|
||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=10
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEMD
|
||||
#=================================================
|
||||
|
|
|
@ -98,10 +98,14 @@ usermod -d $final_path $app 2>&1
|
|||
#=================================================
|
||||
ynh_script_progression --message="Installing Node.js packages ..." --weight=1
|
||||
|
||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=10
|
||||
ynh_use_nodejs
|
||||
node_PATH=$nodejs_path:$(sudo -u $app sh -c 'echo $PATH')
|
||||
|
||||
pushd $final_path || ynh_die
|
||||
chown -R $app:$app $final_path
|
||||
sudo -u $app touch $final_path/.yarnrc
|
||||
sudo -u $app yarnpkg --cache-folder $final_path/yarn-cache --use-yarnrc $final_path/.yarnrc install 2>&1
|
||||
sudo -u $app PATH=$node_PATH yarn --cache-folder $final_path/yarn-cache --use-yarnrc $final_path/.yarnrc install 2>&1
|
||||
chown -R root:root $final_path
|
||||
popd || ynh_die
|
||||
|
||||
|
@ -111,7 +115,7 @@ popd || ynh_die
|
|||
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
ynh_add_systemd_config -v ynh_node
|
||||
|
||||
#=================================================
|
||||
# UPDATE A CONFIG FILE
|
||||
|
|
Loading…
Reference in a new issue