1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/codimd_ynh.git synced 2024-09-03 18:16:32 +02:00
codimd_ynh/scripts/install

79 lines
2.7 KiB
Text
Raw Normal View History

2018-11-21 16:11:09 +01:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
2020-05-21 12:49:24 +02:00
source _common.sh
2018-11-21 16:11:09 +01:00
source /usr/share/yunohost/helpers
#=================================================
2020-05-21 12:49:24 +02:00
# INSTALL DEPENDENCIES
#=================================================
2020-05-21 12:49:24 +02:00
ynh_script_progression --message="Installing dependencies..." --weight=20
2019-03-13 16:48:29 +01:00
2020-05-21 12:49:24 +02:00
# Install Nodejs
2020-05-29 22:31:43 +02:00
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
2018-11-21 16:35:21 +01:00
2018-11-21 19:24:30 +01:00
#=================================================
2019-03-13 16:48:29 +01:00
# DOWNLOAD, CHECK AND UNPACK SOURCE
2018-11-21 19:24:30 +01:00
#=================================================
2020-05-21 12:49:24 +02:00
ynh_script_progression --message="Setting up source files..." --weight=2
2018-11-21 19:24:30 +01:00
ynh_setup_source --dest_dir=$install_dir
2020-05-21 12:49:24 +02:00
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
chmod +x $install_dir/app.js
2021-06-13 10:41:28 +02:00
2020-05-21 12:49:24 +02:00
#=================================================
# NGINX CONFIGURATION
#=================================================
2020-10-12 22:05:07 +02:00
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
2020-05-21 12:49:24 +02:00
ynh_add_nginx_config
2018-11-21 16:11:09 +01:00
ynh_add_systemd_config
yunohost service add $app --description="Collaborative Markdown notes" --log="/var/log/$app/$app.log"
2018-11-21 16:11:09 +01:00
#=================================================
# ADD A CONFIGURATION
2018-11-21 16:11:09 +01:00
#=================================================
2022-03-08 11:45:16 +01:00
ynh_script_progression --message="Modifying a config file..." --weight=1
2018-11-21 16:11:09 +01:00
ynh_add_config --template="config.json.example" --destination="$install_dir/config.json"
ynh_add_config --template=".sequelizerc.example" --destination="$install_dir/.sequelizerc"
chmod 600 $install_dir/config.json
chmod 600 $install_dir/.sequelizerc
2021-06-13 10:11:00 +02:00
2021-05-08 15:31:11 +02:00
#=================================================
# SPECIFIC SETUP
2019-03-13 16:46:11 +01:00
#=================================================
# INSTALL CODIMD
2018-11-21 16:11:09 +01:00
#=================================================
ynh_script_progression --message="Building CodiMD... (this will take some time and resources!)" --weight=24
2018-11-21 16:11:09 +01:00
pushd $install_dir
ynh_use_nodejs
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH bin/setup
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm run build
popd
2018-11-21 16:11:09 +01:00
#=================================================
2019-11-28 02:05:34 +01:00
# START SYSTEMD SERVICE
2018-11-21 16:11:09 +01:00
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=2
2019-03-13 16:48:29 +01:00
# Start a systemd service
2021-05-08 12:13:28 +02:00
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="HTTP Server listening"
2018-11-21 16:11:09 +01:00
2019-11-28 02:05:34 +01:00
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last