mirror of
https://github.com/YunoHost-Apps/distbin_ynh.git
synced 2024-09-03 18:26:10 +02:00
commit
de2ca440b3
6 changed files with 29 additions and 15 deletions
|
@ -5,7 +5,7 @@ PATH=__NODEJS_PATH__
|
|||
PORT=__PORT__
|
||||
|
||||
# The directory where is store the database
|
||||
DB_DIR=__FINALPATH__/db
|
||||
DB_DIR=__FINALPATH__/distbin-db
|
||||
|
||||
# The external URL
|
||||
EXTERNAL_URL=https://__DOMAIN_URI__
|
||||
|
|
|
@ -7,8 +7,8 @@ Type=simple
|
|||
User=__APP__
|
||||
Group=__APP__
|
||||
EnvironmentFile=__FINALPATH__/.env
|
||||
WorkingDirectory=__FINALPATH__/
|
||||
ExecStart=/bin/sh -c '__FINALPATH__/node_modules/.bin/ts-node --project __FINALPATH__/tsconfig.json __FINALPATH__/bin/server.ts >> /var/log/__APP__/__APP__.log 2>&1'
|
||||
WorkingDirectory=__FINALPATH__
|
||||
ExecStart=/bin/sh -c 'node ./dist/bin/server >> /var/log/__APP__/__APP__.log 2>&1'
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"en": "Distributed pastebin with ActivityPub.",
|
||||
"fr": "Pastebin distribué utilisant le protocole ActivityPub."
|
||||
},
|
||||
"version": "1.0~ynh3",
|
||||
"version": "1.0~ynh4",
|
||||
"url": "https://example.com",
|
||||
"license": "Apache-2.0",
|
||||
"maintainer": {
|
||||
|
|
|
@ -16,6 +16,7 @@ source /usr/share/yunohost/helpers
|
|||
|
||||
ynh_clean_setup () {
|
||||
### Remove this function if there's nothing to clean before calling the remove script.
|
||||
read -p "Press any key..."
|
||||
ynh_clean_check_starting
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
|
@ -97,6 +98,7 @@ ynh_app_setting_set $app port $port
|
|||
### - As well as the section "REINSTALL DEPENDENCIES" in the restore script
|
||||
### - And the section "UPGRADE DEPENDENCIES" in the upgrade script
|
||||
|
||||
ynh_install_app_dependencies ca-certificates
|
||||
ynh_install_nodejs 8
|
||||
|
||||
#=================================================
|
||||
|
@ -176,7 +178,7 @@ chown -R "$app":"$app" "/var/log/$app"
|
|||
# CREATE DB FOLDER
|
||||
#=================================================
|
||||
|
||||
mkdir -p "$final_path/db"
|
||||
mkdir -p "$final_path/distbin-db"
|
||||
|
||||
#=================================================
|
||||
# MAKE SETUP
|
||||
|
@ -185,12 +187,16 @@ mkdir -p "$final_path/db"
|
|||
chown -R "$app":"$app" "$final_path"
|
||||
pushd $final_path
|
||||
ynh_use_nodejs
|
||||
sudo -u $app env PATH=$nodejs_path npm add hoek@^4.2.1 --save --production
|
||||
sudo -u $app env PATH=$nodejs_path npm install ts-node
|
||||
sudo -u $app env PATH=$nodejs_path npm install --production
|
||||
sudo -u $app env PATH=$nodejs_path npm audit fix
|
||||
sudo -u $app env PATH=$PATH npm install --ignore-scripts
|
||||
sudo -u $app env PATH=$PATH npm run build
|
||||
cp package* dist/
|
||||
popd
|
||||
|
||||
pushd $final_path/dist
|
||||
sudo -u $app env PATH=$PATH npm install --ignore-scripts --production
|
||||
popd
|
||||
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
|
|
|
@ -93,7 +93,7 @@ chown -R $app:$app /var/log/$app
|
|||
#=================================================
|
||||
|
||||
# Define and install dependencies
|
||||
#ynh_install_app_dependencies
|
||||
ynh_install_app_dependencies ca-certificates
|
||||
ynh_install_nodejs 8
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -101,7 +101,7 @@ ynh_add_nginx_config
|
|||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
|
||||
#ynh_install_app_dependencies deb1 deb2
|
||||
ynh_install_app_dependencies ca-certificates
|
||||
ynh_install_nodejs 8
|
||||
|
||||
#=================================================
|
||||
|
@ -124,7 +124,11 @@ ynh_system_user_create "$app" "$final_path"
|
|||
# CREATE DB FOLDER
|
||||
#=================================================
|
||||
|
||||
mkdir -p "$final_path/db"
|
||||
DIRECTORY="$final_path/db"
|
||||
#Move old db
|
||||
if [ -d "$DIRECTORY" ]; then
|
||||
mv "$final_path/db" "$final_path/distbin-db"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# MAKE INSTALL
|
||||
|
@ -133,9 +137,13 @@ mkdir -p "$final_path/db"
|
|||
chown -R "$app":"$app" "$final_path"
|
||||
pushd $final_path
|
||||
ynh_use_nodejs
|
||||
sudo -u $app env PATH=$nodejs_path npm update --production
|
||||
sudo -u $app env PATH=$nodejs_path npm install --production
|
||||
sudo -u $app env PATH=$nodejs_path npm audit fix
|
||||
sudo -u $app env PATH=$PATH npm install --ignore-scripts
|
||||
sudo -u $app env PATH=$PATH npm run build
|
||||
cp package* dist/
|
||||
popd
|
||||
|
||||
pushd $final_path/dist
|
||||
sudo -u $app env PATH=$PATH npm install --ignore-scripts --production
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
|
|
Loading…
Add table
Reference in a new issue