mirror of
https://github.com/YunoHost-Apps/pelican_ynh.git
synced 2024-09-03 19:46:35 +02:00
Update install
This commit is contained in:
parent
13e514f6dd
commit
ef3823a355
1 changed files with 16 additions and 64 deletions
|
@ -1,40 +1,20 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
# Source app helpers and functions
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# MANAGE SCRIPT FAILURE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Exit on command errors and treat unset variables as an error
|
# Exit on command errors and treat unset variables as an error
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
#=================================================
|
# Retrieve arguments
|
||||||
# GET MULTI-INSTANCES SPECIFIC VARIABLES
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
path=$YNH_APP_ARG_PATH
|
path=$YNH_APP_ARG_PATH
|
||||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||||
author=$YNH_APP_ARG_AUTHOR
|
author=$YNH_APP_ARG_AUTHOR
|
||||||
|
|
||||||
#=================================================
|
# Check domain/path availability
|
||||||
# CHECK DOMAIN/PATH AVAILABILITY & DESTDIR
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
sudo yunohost app checkurl "${domain}${path}" -a "$app" \
|
sudo yunohost app checkurl "${domain}${path}" -a "$app" \
|
||||||
|| exit 1
|
|| exit 1
|
||||||
|
|
||||||
|
@ -43,33 +23,24 @@ DESTDIR="/var/www/${app}"
|
||||||
"The destination directory '${DESTDIR}' already exists.\
|
"The destination directory '${DESTDIR}' already exists.\
|
||||||
You should safely delete it before installing this app."
|
You should safely delete it before installing this app."
|
||||||
|
|
||||||
#=================================================
|
# Store settings from manifest
|
||||||
# STORE SETTINGS FROM MANIFEST
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_app_setting_set $app domain $domain
|
ynh_app_setting_set $app domain $domain
|
||||||
ynh_app_setting_set $app path $path
|
ynh_app_setting_set $app path $path
|
||||||
ynh_app_setting_set $app is_public $is_public
|
ynh_app_setting_set $app is_public $is_public
|
||||||
ynh_app_setting_set $app author $author
|
ynh_app_setting_set $app author $author
|
||||||
|
|
||||||
#=================================================
|
# Install python dependencies
|
||||||
# SET SSOWAT RULES
|
sudo apt-get install -y python-pip python-virtualenv python-dev libldap2-dev libsasl2-dev libssl-dev
|
||||||
#=================================================
|
|
||||||
|
|
||||||
[[ $is_public -eq 1 ]] \
|
# Create the virtualenv
|
||||||
&& ynh_app_setting_set "$app" unprotected_uris "/"
|
virtualenv ${DESTDIR}
|
||||||
|
cd ${DESTDIR}
|
||||||
|
source bin/activate
|
||||||
|
|
||||||
#=================================================
|
# Install pelican
|
||||||
# INSTALL PIP/PELICAN/MARKDOWN PACKAGES
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
sudo apt-get install python-pip
|
|
||||||
pip install pelican markdown
|
pip install pelican markdown
|
||||||
|
|
||||||
#=================================================
|
# Configure Nginx
|
||||||
# COPY AND SET NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
nginx_conf="/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
nginx_conf="/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
||||||
sed -i "s@{PATH}@${path}@g" ../conf/nginx.conf
|
sed -i "s@{PATH}@${path}@g" ../conf/nginx.conf
|
||||||
sed -i "s@{LOCATION}@${path:-/}@g" ../conf/nginx.conf
|
sed -i "s@{LOCATION}@${path:-/}@g" ../conf/nginx.conf
|
||||||
|
@ -77,26 +48,7 @@ sed -i "s@{DESTDIR}@${DESTDIR}@g" ../conf/nginx.conf
|
||||||
sed -i "s@{POOLNAME}@${app}@g" ../conf/nginx.conf
|
sed -i "s@{POOLNAME}@${app}@g" ../conf/nginx.conf
|
||||||
sudo cp ../conf/nginx.conf "$nginx_conf"
|
sudo cp ../conf/nginx.conf "$nginx_conf"
|
||||||
|
|
||||||
#=================================================
|
sudo nginx -t && sudo service nginx reload
|
||||||
# COPY AND SET PHP-FPM CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
phpfpm_conf="/etc/php5/fpm/pool.d/${app}.conf"
|
[[ $is_public -eq 1 ]] \
|
||||||
sed -i "s@{POOLNAME}@${app}@g" ../conf/php-fpm.conf
|
&& ynh_app_setting_set "$app" unprotected_uris "/"
|
||||||
sed -i "s@{DESTDIR}@${DESTDIR}@g" ../conf/php-fpm.conf
|
|
||||||
sudo cp ../conf/php-fpm.conf "$phpfpm_conf"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RELOAD SERVICES
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
sudo systemctl reload php5-fpm
|
|
||||||
sudo systemctl reload nginx
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# POST-INSTALATION
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# cd ${DESTDIR}/www
|
|
||||||
# printf '\n"Default title"\n"${author}"\ny\n"${domain}"\n\n\n\n\n\n\n\n\n\n\n\n' | pelican-quickstart
|
|
||||||
# pelican -s pelicanconf.py
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue