Add full_domain_app

This commit is contained in:
Alexandre Aubin 2019-10-08 18:17:54 +02:00
parent 43ac419886
commit 6c98bcad86
5 changed files with 76 additions and 0 deletions

View file

@ -0,0 +1,5 @@
<html>
<body>
This is a dummy app to test the full domain app
</body>
</html>

View file

@ -0,0 +1,3 @@
location / {
alias /var/www/FOLDER;
}

View file

@ -0,0 +1,29 @@
{
"name": "Full domain app",
"id": "full_domain_app",
"description": {
"en": "App to test the install of full domain apps"
},
"license": "GPL-3+",
"maintainer": {
"name": "Aleks",
"email": "alex.aubin@mailoo.org",
"url": "https://github.com/alexAubin/"
},
"requirements": {
"yunohost": ">> 3.0.0"
},
"multi_instance": true,
"arguments": {
"install" : [
{
"name": "domain",
"type": "domain",
"ask": {
"en": "Choose a domain"
},
"example": "domain.org"
}
]
}
}

View file

@ -0,0 +1,26 @@
set -eux
# Source app helpers
source /usr/share/yunohost/helpers
# Retrieve arguments
app=$YNH_APP_INSTANCE_NAME
domain=$YNH_APP_ARG_DOMAIN
path="/"
# Check domain/path availability
ynh_webpath_register $app $domain $path
# Add config for nginx
sed -i "s@FOLDER@$app/@g" ../conf/nginx.conf
cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
# Make directory for app web data
mkdir /var/www/$app
cp ../conf/index.html /var/www/$app
# Set the app as public
yunohost app setting $app unprotected_uris -v "/"
# Reload Nginx and regenerate SSOwat conf
systemctl reload nginx

View file

@ -0,0 +1,13 @@
set -eux
# Source app helpers
source /usr/share/yunohost/helpers
# Recover arguments
app=$YNH_APP_INSTANCE_NAME
domain=$(sudo yunohost app setting $app domain)
rm -rf /var/www/$app
rm /etc/nginx/conf.d/$domain.d/$app.conf
systemctl restart nginx