mirror of
https://github.com/YunoHost/test_apps.git
synced 2024-09-03 20:06:29 +02:00
46 lines
1.2 KiB
Text
46 lines
1.2 KiB
Text
set -eux
|
|
|
|
# Source app helpers
|
|
source /usr/share/yunohost/helpers
|
|
|
|
# Retrieve arguments
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
number=$YNH_APP_INSTANCE_NUMBER
|
|
domain=$YNH_APP_ARG_DOMAIN
|
|
path=$YNH_APP_ARG_PATH
|
|
is_public=$YNH_APP_ARG_IS_PUBLIC
|
|
|
|
# Check domain/path availability
|
|
ynh_webpath_register --app=$app --domain=$domain --path_url=$path
|
|
|
|
# Check folder availability
|
|
test ! -e "/var/www/$app/"
|
|
|
|
# Add config for nginx
|
|
sudo sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
|
|
sudo sed -i "s@FOLDER@$app/@g" ../conf/nginx.conf
|
|
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
|
|
|
# Make directory for app web data
|
|
sudo mkdir /var/www/$app
|
|
sudo cp ../conf/index.html /var/www/$app
|
|
|
|
if ! ynh_port_available 12345; then
|
|
echo "Ogod noez the port 12345 aint available!!"
|
|
exit 1
|
|
fi
|
|
|
|
# Create a dummy mysql db
|
|
db_user=$app
|
|
db_pwd="yoloswag42"
|
|
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_user --db_pwd=$db_pwd
|
|
|
|
# Other custom stuff
|
|
sudo cp ../sources/importantfile /etc/
|
|
|
|
# Set the app as public
|
|
[ $is_public -eq 0 ] || sudo yunohost app setting $app unprotected_uris -v "/"
|
|
|
|
# Reload Nginx and regenerate SSOwat conf
|
|
sudo service nginx reload
|
|
#sudo yunohost app ssowatconf
|