Install backports only for jessie,Stop service before upgrade and backup

This commit is contained in:
anmol26s 2018-05-31 04:03:14 +05:30
parent 5f088b9db5
commit dc5b9f52cd
5 changed files with 50 additions and 13 deletions

View file

@ -34,6 +34,9 @@ final_path=$(ynh_app_setting_get "$app" final_path)
domain=$(ynh_app_setting_get "$app" domain)
db_name=$(ynh_app_setting_get "$app" psql_db)
# Stop Peertube for backup
systemctl stop "$app"
#=================================================
# STANDARD BACKUP STEPS
#=================================================
@ -73,3 +76,13 @@ ynh_backup "/etc/logrotate.d/$app"
#=================================================
ynh_backup "/etc/systemd/system/$app.service"
#=================================================
# RELOAD NGINX
#=================================================
systemctl reload nginx
systemctl enable "$app"
systemctl start "$app"
# App needs time to start
sleep 15

View file

@ -95,9 +95,12 @@ wget -nv https://github.com/yarnpkg/yarn/releases/download/v1.6.0/yarn_1.6.0_all
echo "96866d835da94a1f01a616f3d637c9100e826f65cb38a65e5d96ccf01ff6d692 yarn_1.6.0_all.deb" | sha256sum -c || ynh_die
dpkg -i yarn_1.6.0_all.deb
# add backports (required to install ffmpeg)
echo "deb http://httpredir.debian.org/debian jessie-backports main" | tee /etc/apt/sources.list.d/jessie-backports.list
ynh_package_update
# add backports for Debian Jessie (required to install ffmpeg)
if [ "$(lsb_release --codename --short)" == "jessie" ]; then
echo "deb http://httpredir.debian.org/debian jessie-backports main" | tee /etc/apt/sources.list.d/jessie-backports.list
ynh_package_update
fi
# install postgresql, ffmpeg, redis
ynh_install_app_dependencies postgresql ffmpeg redis-server redis-tools mailutils
@ -202,12 +205,16 @@ then
ynh_app_setting_set "$app" unprotected_uris "/"
fi
# Give permisiion to the final_path
chown -R "$app":"$app" "$final_path" "$datadir"
#=================================================
# SETUP SYSTEMD
#=================================================
# Create a dedicated systemd config
ynh_add_systemd_config
systemctl enable "$app"
systemctl start "$app"
#=================================================
@ -221,8 +228,6 @@ systemctl start "$app"
echo $admin_pass | NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production PATH="/opt/node_n/bin:$PATH" npm run reset-password -- -u root
)
# Give permisiion to the final_path
chown -R "$app":"$app" "$final_path" "$datadir"
#=================================================
# RELOAD NGINX

View file

@ -43,11 +43,16 @@ fi
#=================================================
# REMOVE DEPENDENCIES
#=================================================
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
ynh_remove_nodejs
# Remove yarn
sudo apt-get remove --purge -y yarn
# Delete backport from source.list
ynh_secure_remove /etc/apt/sources.list.d/jessie-backports.list
#=================================================
# REMOVE THE MYSQL DATABASE
#=================================================

View file

@ -98,9 +98,11 @@ wget -nv https://github.com/yarnpkg/yarn/releases/download/v1.6.0/yarn_1.6.0_all
echo "96866d835da94a1f01a616f3d637c9100e826f65cb38a65e5d96ccf01ff6d692 yarn_1.6.0_all.deb" | sha256sum -c || ynh_die
dpkg -i yarn_1.6.0_all.deb
# add backports (required to install ffmpeg)
echo "deb http://httpredir.debian.org/debian jessie-backports main" | tee /etc/apt/sources.list.d/jessie-backports.list
ynh_package_update
# add backports for Debian Jessie (required to install ffmpeg)
if [ "$(lsb_release --codename --short)" == "jessie" ]; then
echo "deb http://httpredir.debian.org/debian jessie-backports main" | tee /etc/apt/sources.list.d/jessie-backports.list
ynh_package_update
fi
# Define and install dependencies
ynh_install_app_dependencies postgresql ffmpeg redis-server redis-tools mailutils
@ -145,4 +147,7 @@ chown -R "$app":"$app" "$datadir"
#=================================================
systemctl reload nginx
service "$app" restart
systemctl enable "$app"
systemctl start "$app"
# App needs time to start
sleep 15

View file

@ -51,6 +51,9 @@ ynh_clean_setup () {
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
# Stop Peertube for upgrade
systemctl stop "$app"
#=================================================
# REMOVE APP MAIN DIR
#=================================================
@ -89,9 +92,11 @@ wget -nv https://github.com/yarnpkg/yarn/releases/download/v1.6.0/yarn_1.6.0_all
echo "96866d835da94a1f01a616f3d637c9100e826f65cb38a65e5d96ccf01ff6d692 yarn_1.6.0_all.deb" | sha256sum -c || ynh_die
dpkg -i yarn_1.6.0_all.deb
# add backports (required to install ffmpeg)
echo "deb http://httpredir.debian.org/debian jessie-backports main" | tee /etc/apt/sources.list.d/jessie-backports.list
ynh_package_update
# add backports for Debian Jessie (required to install ffmpeg)
if [ "$(lsb_release --codename --short)" == "jessie" ]; then
echo "deb http://httpredir.debian.org/debian jessie-backports main" | tee /etc/apt/sources.list.d/jessie-backports.list
ynh_package_update
fi
# install postgresql, ffmpeg, redis
ynh_install_app_dependencies postgresql ffmpeg redis-server redis-tools mailutils
@ -190,3 +195,7 @@ fi
#=================================================
systemctl reload nginx
systemctl enable "$app"
systemctl start "$app"
# App needs time to start
sleep 15