mirror of
https://github.com/YunoHost-Apps/dato_ynh.git
synced 2024-09-03 18:16:33 +02:00
Move sources to sources/
This commit is contained in:
parent
1dd9e2dd04
commit
184a376603
5 changed files with 28 additions and 17 deletions
|
@ -6,9 +6,9 @@ After=network.target
|
||||||
Type=simple
|
Type=simple
|
||||||
User=__APP__
|
User=__APP__
|
||||||
Group=__APP__
|
Group=__APP__
|
||||||
WorkingDirectory=__INSTALL_DIR__/
|
WorkingDirectory=__INSTALL_DIR__/sources/
|
||||||
Environment=NODE_ENV=production
|
Environment=NODE_ENV=production
|
||||||
Environment=NODE_CONFIG_DIR=__INSTALL_DIR__/config
|
Environment=NODE_CONFIG_DIR=__INSTALL_DIR__/config/
|
||||||
Environment="__YNH_NODE_LOAD_PATH__"
|
Environment="__YNH_NODE_LOAD_PATH__"
|
||||||
ExecStart=__YNH_NPM__ start
|
ExecStart=__YNH_NPM__ start
|
||||||
StandardOutput=syslog
|
StandardOutput=syslog
|
||||||
|
|
|
@ -17,8 +17,7 @@ bool_to_str() {
|
||||||
}
|
}
|
||||||
|
|
||||||
dato_setup_config_files() {
|
dato_setup_config_files() {
|
||||||
# create config directory (if it doesn't exist yet)
|
mkdir -p "$install_dir/config/"
|
||||||
[ -d "$install_dir/config/" ] || mkdir "$install_dir/config/"
|
|
||||||
|
|
||||||
# setup public dato config
|
# setup public dato config
|
||||||
ynh_add_config --template="public.js" --destination="$install_dir/config/public.js"
|
ynh_add_config --template="public.js" --destination="$install_dir/config/public.js"
|
||||||
|
|
|
@ -28,17 +28,17 @@ ynh_install_nodejs --nodejs_version="$nodejs_version"
|
||||||
ynh_script_progression --message="Setting up source files..." --weight=2
|
ynh_script_progression --message="Setting up source files..." --weight=2
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
ynh_setup_source --dest_dir="$install_dir"
|
ynh_setup_source --dest_dir="$install_dir/sources"
|
||||||
|
|
||||||
chmod -R o-rwx "$install_dir"
|
chmod -R o-rwx "$install_dir/sources"
|
||||||
chown -R "$app:www-data" "$install_dir"
|
chown -R "$app:www-data" "$install_dir/sources"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BUILD NODE DEPENDENCIES
|
# BUILD NODE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Building node dependencies..." --weight=90
|
ynh_script_progression --message="Building node dependencies..." --weight=90
|
||||||
|
|
||||||
pushd "$install_dir"
|
pushd "$install_dir/sources"
|
||||||
ynh_use_nodejs
|
ynh_use_nodejs
|
||||||
ynh_exec_warn_less ynh_exec_as "$app" "$ynh_node_load_PATH" "$ynh_npm" install --loglevel warn
|
ynh_exec_warn_less ynh_exec_as "$app" "$ynh_node_load_PATH" "$ynh_npm" install --loglevel warn
|
||||||
popd
|
popd
|
||||||
|
@ -62,7 +62,7 @@ if [[ $autosynchronize == true ]]; then
|
||||||
ynh_script_progression --message="Customizing couch config..." --weight=2
|
ynh_script_progression --message="Customizing couch config..." --weight=2
|
||||||
|
|
||||||
# make sure that couchdb has CORS enabled and that it accepts requests from dato domain
|
# make sure that couchdb has CORS enabled and that it accepts requests from dato domain
|
||||||
ynh_add_config --template="../conf/couch.ini" --destination="/opt/couchdb/etc/local.d/$app.ini"
|
ynh_add_config --template="couch.ini" --destination="/opt/couchdb/etc/local.d/$app.ini"
|
||||||
|
|
||||||
# restart couchdb service so that it takes into consideration the changes
|
# restart couchdb service so that it takes into consideration the changes
|
||||||
yunohost service restart couchdb
|
yunohost service restart couchdb
|
||||||
|
@ -110,8 +110,8 @@ fi
|
||||||
# SECURE FILES AND DIRECTORIES
|
# SECURE FILES AND DIRECTORIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
[ -d "$install_dir/dist" ] || mkdir "$install_dir/dist"
|
mkdir -p "$install_dir/sources/dist"
|
||||||
chown -R $app:$app $install_dir/dist $install_dir/global $install_dir/config
|
chown -R "$app:$app" "$install_dir/sources/dist" "$install_dir/config"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SYSTEM CONFIGURATION
|
# SYSTEM CONFIGURATION
|
||||||
|
|
|
@ -26,8 +26,8 @@ ynh_restore_file --origin_path="$install_dir"
|
||||||
chmod -R o-rwx "$install_dir"
|
chmod -R o-rwx "$install_dir"
|
||||||
chown -R "$app:www-data" "$install_dir"
|
chown -R "$app:www-data" "$install_dir"
|
||||||
|
|
||||||
mkdir -p "$install_dir/dist"
|
mkdir -p "$install_dir/sources/dist"
|
||||||
chown -R "$app:$app" "$install_dir/dist" "$install_dir/global" "$install_dir/config"
|
chown -R "$app:$app" "$install_dir/sources/dist" "$install_dir/sources/global" "$install_dir/config"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE VARIOUS FILES
|
# RESTORE VARIOUS FILES
|
||||||
|
|
|
@ -14,6 +14,18 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd"
|
ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||||
|
|
||||||
|
# Cleanup legacy install dir
|
||||||
|
if [ ! -d "$install_dir/sources" ]; then
|
||||||
|
mkdir "$install_dir/sources"
|
||||||
|
find . -mindepth 1 -maxdepth 1 ! -name "sources" -exec mv -t "$install_dir/sources" "{}" +
|
||||||
|
mv "$install_dir/sources/config" "$install_dir"
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPGRADE DEPENDENCIES
|
# UPGRADE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -27,13 +39,13 @@ ynh_install_nodejs --nodejs_version="$nodejs_version"
|
||||||
ynh_script_progression --message="Upgrading source files..." --weight=3
|
ynh_script_progression --message="Upgrading source files..." --weight=3
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep="config/public.js config/private.js"
|
ynh_setup_source --dest_dir="$install_dir/sources" --full_replace=1
|
||||||
|
|
||||||
chmod -R o-rwx "$install_dir"
|
chmod -R o-rwx "$install_dir"
|
||||||
chown -R "$app:www-data" "$install_dir"
|
chown -R "$app:www-data" "$install_dir"
|
||||||
|
|
||||||
mkdir "$install_dir/dist"
|
mkdir -p "$install_dir/sources/dist"
|
||||||
chown -R "$app:$app" "$install_dir/dist" "$install_dir/global" "$install_dir/config"
|
chown -R "$app:$app" "$install_dir/sources/dist" "$install_dir/sources/global" "$install_dir/config"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC UPGRADE
|
# SPECIFIC UPGRADE
|
||||||
|
@ -42,7 +54,7 @@ chown -R "$app:$app" "$install_dir/dist" "$install_dir/global" "$install_dir/con
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Building node dependencies..." --weight=20
|
ynh_script_progression --message="Building node dependencies..." --weight=20
|
||||||
|
|
||||||
pushd "$install_dir"
|
pushd "$install_dir/sources"
|
||||||
ynh_use_nodejs
|
ynh_use_nodejs
|
||||||
ynh_exec_warn_less ynh_exec_as "$app" "$ynh_node_load_PATH" "$ynh_npm" install --loglevel warn
|
ynh_exec_warn_less ynh_exec_as "$app" "$ynh_node_load_PATH" "$ynh_npm" install --loglevel warn
|
||||||
popd
|
popd
|
||||||
|
|
Loading…
Add table
Reference in a new issue