From 6c98bcad864c7d91c3afff802781d036796eed93 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 8 Oct 2019 18:17:54 +0200 Subject: [PATCH] Add full_domain_app --- full_domain_app_ynh/conf/index.html | 5 +++++ full_domain_app_ynh/conf/nginx.conf | 3 +++ full_domain_app_ynh/manifest.json | 29 +++++++++++++++++++++++++++++ full_domain_app_ynh/scripts/install | 26 ++++++++++++++++++++++++++ full_domain_app_ynh/scripts/remove | 13 +++++++++++++ 5 files changed, 76 insertions(+) create mode 100644 full_domain_app_ynh/conf/index.html create mode 100644 full_domain_app_ynh/conf/nginx.conf create mode 100644 full_domain_app_ynh/manifest.json create mode 100644 full_domain_app_ynh/scripts/install create mode 100644 full_domain_app_ynh/scripts/remove diff --git a/full_domain_app_ynh/conf/index.html b/full_domain_app_ynh/conf/index.html new file mode 100644 index 0000000..a3188ab --- /dev/null +++ b/full_domain_app_ynh/conf/index.html @@ -0,0 +1,5 @@ + + + This is a dummy app to test the full domain app + + diff --git a/full_domain_app_ynh/conf/nginx.conf b/full_domain_app_ynh/conf/nginx.conf new file mode 100644 index 0000000..d704ea3 --- /dev/null +++ b/full_domain_app_ynh/conf/nginx.conf @@ -0,0 +1,3 @@ +location / { + alias /var/www/FOLDER; +} diff --git a/full_domain_app_ynh/manifest.json b/full_domain_app_ynh/manifest.json new file mode 100644 index 0000000..200c809 --- /dev/null +++ b/full_domain_app_ynh/manifest.json @@ -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" + } + ] + } +} diff --git a/full_domain_app_ynh/scripts/install b/full_domain_app_ynh/scripts/install new file mode 100644 index 0000000..c436dac --- /dev/null +++ b/full_domain_app_ynh/scripts/install @@ -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 diff --git a/full_domain_app_ynh/scripts/remove b/full_domain_app_ynh/scripts/remove new file mode 100644 index 0000000..63c428e --- /dev/null +++ b/full_domain_app_ynh/scripts/remove @@ -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