1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/distbin_ynh.git synced 2024-09-03 18:26:10 +02:00

Merge pull request #27 from YunoHost-Apps/ts-node

Ts node
This commit is contained in:
yalh76 2019-02-09 03:12:06 +01:00 committed by GitHub
commit de2ca440b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 29 additions and 15 deletions

View file

@ -5,7 +5,7 @@ PATH=__NODEJS_PATH__
PORT=__PORT__ PORT=__PORT__
# The directory where is store the database # The directory where is store the database
DB_DIR=__FINALPATH__/db DB_DIR=__FINALPATH__/distbin-db
# The external URL # The external URL
EXTERNAL_URL=https://__DOMAIN_URI__ EXTERNAL_URL=https://__DOMAIN_URI__

View file

@ -7,8 +7,8 @@ Type=simple
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__
EnvironmentFile=__FINALPATH__/.env EnvironmentFile=__FINALPATH__/.env
WorkingDirectory=__FINALPATH__/ 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' ExecStart=/bin/sh -c 'node ./dist/bin/server >> /var/log/__APP__/__APP__.log 2>&1'
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View file

@ -6,7 +6,7 @@
"en": "Distributed pastebin with ActivityPub.", "en": "Distributed pastebin with ActivityPub.",
"fr": "Pastebin distribué utilisant le protocole ActivityPub." "fr": "Pastebin distribué utilisant le protocole ActivityPub."
}, },
"version": "1.0~ynh3", "version": "1.0~ynh4",
"url": "https://example.com", "url": "https://example.com",
"license": "Apache-2.0", "license": "Apache-2.0",
"maintainer": { "maintainer": {

View file

@ -16,6 +16,7 @@ source /usr/share/yunohost/helpers
ynh_clean_setup () { ynh_clean_setup () {
### Remove this function if there's nothing to clean before calling the remove script. ### Remove this function if there's nothing to clean before calling the remove script.
read -p "Press any key..."
ynh_clean_check_starting ynh_clean_check_starting
} }
# Exit if an error occurs during the execution of the script # 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 ### - As well as the section "REINSTALL DEPENDENCIES" in the restore script
### - And the section "UPGRADE DEPENDENCIES" in the upgrade script ### - And the section "UPGRADE DEPENDENCIES" in the upgrade script
ynh_install_app_dependencies ca-certificates
ynh_install_nodejs 8 ynh_install_nodejs 8
#================================================= #=================================================
@ -176,7 +178,7 @@ chown -R "$app":"$app" "/var/log/$app"
# CREATE DB FOLDER # CREATE DB FOLDER
#================================================= #=================================================
mkdir -p "$final_path/db" mkdir -p "$final_path/distbin-db"
#================================================= #=================================================
# MAKE SETUP # MAKE SETUP
@ -185,12 +187,16 @@ mkdir -p "$final_path/db"
chown -R "$app":"$app" "$final_path" chown -R "$app":"$app" "$final_path"
pushd $final_path pushd $final_path
ynh_use_nodejs ynh_use_nodejs
sudo -u $app env PATH=$nodejs_path npm add hoek@^4.2.1 --save --production sudo -u $app env PATH=$PATH npm install --ignore-scripts
sudo -u $app env PATH=$nodejs_path npm install ts-node sudo -u $app env PATH=$PATH npm run build
sudo -u $app env PATH=$nodejs_path npm install --production cp package* dist/
sudo -u $app env PATH=$nodejs_path npm audit fix
popd popd
pushd $final_path/dist
sudo -u $app env PATH=$PATH npm install --ignore-scripts --production
popd
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
#================================================= #=================================================

View file

@ -93,7 +93,7 @@ chown -R $app:$app /var/log/$app
#================================================= #=================================================
# Define and install dependencies # Define and install dependencies
#ynh_install_app_dependencies ynh_install_app_dependencies ca-certificates
ynh_install_nodejs 8 ynh_install_nodejs 8
#================================================= #=================================================

View file

@ -101,7 +101,7 @@ ynh_add_nginx_config
# UPGRADE DEPENDENCIES # UPGRADE DEPENDENCIES
#================================================= #=================================================
#ynh_install_app_dependencies deb1 deb2 ynh_install_app_dependencies ca-certificates
ynh_install_nodejs 8 ynh_install_nodejs 8
#================================================= #=================================================
@ -124,7 +124,11 @@ ynh_system_user_create "$app" "$final_path"
# CREATE DB FOLDER # 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 # MAKE INSTALL
@ -133,9 +137,13 @@ mkdir -p "$final_path/db"
chown -R "$app":"$app" "$final_path" chown -R "$app":"$app" "$final_path"
pushd $final_path pushd $final_path
ynh_use_nodejs ynh_use_nodejs
sudo -u $app env PATH=$nodejs_path npm update --production sudo -u $app env PATH=$PATH npm install --ignore-scripts
sudo -u $app env PATH=$nodejs_path npm install --production sudo -u $app env PATH=$PATH npm run build
sudo -u $app env PATH=$nodejs_path npm audit fix cp package* dist/
popd
pushd $final_path/dist
sudo -u $app env PATH=$PATH npm install --ignore-scripts --production
popd popd
#================================================= #=================================================