From 1aec759209b20e23b4e8a3f887b41682ec8629f9 Mon Sep 17 00:00:00 2001 From: mbugeia Date: Sun, 20 Jul 2014 14:09:41 +0200 Subject: [PATCH] Init des fichiers d'install L'installation fonctionne mais l'authentification ldap non --- conf/config.php | 73 +++++++++++++++++++++++++++++++++++++++++++++++++ conf/nginx.conf | 20 ++++++++++++++ manifest.json | 46 +++++++++++++++---------------- scripts/install | 44 +++++++++++++++++++++++++++++ scripts/remove | 13 +++++++++ 5 files changed, 173 insertions(+), 23 deletions(-) create mode 100644 conf/config.php create mode 100644 conf/nginx.conf diff --git a/conf/config.php b/conf/config.php new file mode 100644 index 0000000..0d6a7be --- /dev/null +++ b/conf/config.php @@ -0,0 +1,73 @@ + Applications -> Developer applications) +define('GITHUB_CLIENT_ID', ''); + +// GitHub client secret key (Copy it from your settings -> Applications -> Developer applications) +define('GITHUB_CLIENT_SECRET', ''); diff --git a/conf/nginx.conf b/conf/nginx.conf new file mode 100644 index 0000000..25d520c --- /dev/null +++ b/conf/nginx.conf @@ -0,0 +1,20 @@ +location PATHTOCHANGE { + alias ALIASTOCHANGE; + if ($scheme = http) { + rewrite ^ https://$server_name$request_uri? permanent; + } + index index.php; + try_files $uri $uri/ /index.php?$args; + location ~ [^/]\.php(/|$) { + fastcgi_split_path_info ^(.+?\.php)(/.*)$; + fastcgi_pass unix:/var/run/php5-fpm.sock; + fastcgi_index index.php; + include fastcgi_params; + fastcgi_param AUTH_USER $remote_user; + fastcgi_param PATH_INFO $fastcgi_path_info; + } + + + # Include SSOWAT user panel. + include conf.d/yunohost_panel.conf.inc; +} \ No newline at end of file diff --git a/manifest.json b/manifest.json index 0704da9..c4f75e5 100644 --- a/manifest.json +++ b/manifest.json @@ -1,34 +1,34 @@ { - name Kanboard, - id kanboard, - description { - en Kanboard is a simple visual task board web application, - fr Kanboard est une application web de management de tâches simples + "name": "Kanboard", + "id": "kanboard", + "description": { + "en": "Kanboard is a simple visual task board web application", + "fr": "Kanboard est une application web de management de tâches simples" }, - developer { - name mbugeia, - email , - url + "developer": { + "name": "mbugeia", + "email": "", + "url": "http://kanboard.net/" }, - multi_instance true, - arguments { - install [ + "multi_instance": "true", + "arguments": { + "install" : [ { - name domain, - ask { - en Choose a domain for Kanboard, - fr Choisissez un domaine pour Kanboard + "name": "domain", + "ask": { + "en": "Choose a domain for Kanboard", + "fr": "Choisissez un domaine pour Kanboard" }, - example domain.org + "example": "domain.org" }, { - name path, - ask { - en Choose a path for Kanboard, - fr Choisissez un chemin pour Kanboard + "name": "path", + "ask": { + "en": "Choose a path for Kanboard", + "fr": "Choisissez un chemin pour Kanboard" }, - example kanboard, - default kanboard + "example": "/kanboard", + "default": "/kanboard" } ] } diff --git a/scripts/install b/scripts/install index e69de29..57d3aa1 100644 --- a/scripts/install +++ b/scripts/install @@ -0,0 +1,44 @@ +#!/bin/bash + +# Retrieve arguments +domain=$1 +path=$2 + +# Check domain/path availability +sudo yunohost app checkurl $domain$path -a kanboard +if [[ ! $? -eq 0 ]]; then + exit 1 +fi + +# Generate random password +db_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d 'A-Za-z0-9' | sed -n 's/\(.\{24\}\).*/\1/p') + +# Use 'kanboard' as database name and user +db_user=kanboard + +# Initialize database and store mysql password for upgrade +sudo yunohost app initdb $db_user -p $db_pwd +sudo yunohost app setting kanboard mysqlpwd -v $db_pwd + + +final_path=/var/www/kanboard +sudo mkdir -p $final_path +sudo cp -a ../sources/* $final_path + +sudo cp ../conf/config.php $final_path +sudo sed -i "s/yunopdw/$db_pwd/g" $final_path/config.php +sudo sed -i "s/yunouser/$db_user/g" $final_path/config.php + +# Set permissions to data directory +sudo chown -R www-data:www-data $final_path/data + + +# Modify Nginx configuration file and copy it to Nginx conf directory +sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf* +sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf* +sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/kanboard.conf + + +# Reload Nginx and regenerate SSOwat conf +sudo service nginx reload +sudo yunohost app ssowatconf \ No newline at end of file diff --git a/scripts/remove b/scripts/remove index e69de29..16bf0cc 100644 --- a/scripts/remove +++ b/scripts/remove @@ -0,0 +1,13 @@ +#!/bin/bash + +db_user=kanboard +db_name=kanboard +root_pwd=$(sudo cat /etc/yunohost/mysql) +domain=$(sudo yunohost app setting kanboard domain) + +mysql -u root -p$root_pwd -e "DROP DATABASE $db_name ; DROP USER $db_user@localhost ;" +sudo rm -rf /var/www/kanboard +sudo rm -f /etc/nginx/conf.d/$domain.d/kanboard.conf + +sudo service nginx reload +sudo yunohost app ssowatconf \ No newline at end of file