From ef3c3b08a5e9f23bceedb3828aa46dce0c941389 Mon Sep 17 00:00:00 2001 From: Adrien Beudin Date: Thu, 28 Nov 2013 17:44:39 +0100 Subject: [PATCH] first commit --- conf/config | 124 +++++++++++++++++++++++++++++++++++++++++++++ conf/logging | 48 ++++++++++++++++++ conf/nginx.conf | 8 +++ conf/radicale.wsgi | 4 ++ conf/uwsgi_params | 15 ++++++ manifest.json | 33 ++++++++++++ scripts/install | 48 ++++++++++++++++++ 7 files changed, 280 insertions(+) create mode 100644 conf/config create mode 100644 conf/logging create mode 100644 conf/nginx.conf create mode 100644 conf/radicale.wsgi create mode 100644 conf/uwsgi_params create mode 100644 manifest.json create mode 100755 scripts/install diff --git a/conf/config b/conf/config new file mode 100644 index 0000000..71a7e9f --- /dev/null +++ b/conf/config @@ -0,0 +1,124 @@ +[server] +# CalDAV server hostnames separated by a comma +# IPv4 syntax: address:port +# IPv6 syntax: [address]:port +# IPv6 adresses are configured to only allow IPv6 connections +hosts = 127.0.0.1:5232 +# Daemon flag +daemon = False +# File storing the PID in daemon mode +pid = +# SSL flag, enable HTTPS protocol +ssl = False +# SSL certificate path +certificate = /etc/apache2/ssl/server.crt +# SSL private key +key = /etc/apache2/ssl/server.key +# Reverse DNS to resolve client address in logs +dns_lookup = True +# Root URL of Radicale (starting and ending with a slash) +base_prefix = / +# Message displayed in the client when a password is needed +realm = Radicale - Password Required lol + + +[encoding] +# Encoding for responding requests +request = utf-8 +# Encoding for storing local collections +stock = utf-8 + + +[auth] +# Authentication method +# Value: None | htpasswd | IMAP | LDAP | PAM | courier | http +type = LDAP + +# Usernames used for public collections, separated by a comma +public_users = public +# Usernames used for private collections, separated by a comma +private_users = private +# Htpasswd filename +htpasswd_filename = /etc/radicale/users +# Htpasswd encryption method +# Value: plain | sha1 | crypt +htpasswd_encryption = crypt + +# LDAP server URL, with protocol and port +ldap_url = ldap://localhost:389/ +# LDAP base path +ldap_base = ou=users,dc=yunohost,dc=org +# LDAP login attribute +ldap_attribute = uid +# LDAP filter string +# placed as X in a query of the form (&(...)X) +# example: (objectCategory=Person)(objectClass=User)(memberOf=cn=calenderusers,ou=users,dc=example,dc=org) +# leave empty if no additional filter is needed +ldap_filter = objectClass=inetOrgPerson +# LDAP dn for initial login, used if LDAP server does not allow anonymous searches +# Leave empty if searches are anonymous +ldap_binddn = +# LDAP password for initial login, used with ldap_binddn +ldap_password = +# LDAP scope of the search +ldap_scope = OneLevel + +# IMAP Configuration +imap_hostname = localhost +imap_port = 143 +imap_ssl = False + +# PAM group user should be member of +pam_group_membership = + +# Path to the Courier Authdaemon socket +courier_socket = + +# HTTP authentication request URL endpoint +http_url = +# POST parameter to use for username +http_user_parameter = +# POST parameter to use for password +http_password_parameter = + + +[rights] +# Rights management method +# Value: None | owner_only | owner_write | from_file +type = owner_only + +# File for rights management from_file +file = ~/.config/radicale/rights + + +[storage] +# Storage backend +# Value: filesystem | database +type = database + +# Folder for storing local collections, created if not present +filesystem_folder = ~/.config/radicale/collections + +# Database URL for SQLAlchemy +# dialect+driver://user:password@host/dbname[?key=value..] +# For example: sqlite:///var/db/radicale.db, postgresql://user:password@localhost/radicale +# See http://docs.sqlalchemy.org/en/rel_0_8/core/engines.html#sqlalchemy.create_engine +database_url = sqlite:///var/lib/radicale/radicale.db + + +[logging] +# Logging configuration file +# If no config is given, simple information is printed on the standard output +# For more information about the syntax of the configuration file, see: +# http://docs.python.org/library/logging.config.html +config = /etc/radicale/logging +# Set the default logging level to debug +debug = False +# Store all environment variables (including those set in the shell) +full_environment = False + + +# Additional HTTP headers +#[headers] +#Access-Control-Allow-Origin = * + diff --git a/conf/logging b/conf/logging new file mode 100644 index 0000000..c8ef46c --- /dev/null +++ b/conf/logging @@ -0,0 +1,48 @@ +# Loggers, handlers and formatters keys + +[loggers] +# Loggers names, main configuration slots +keys = root + +[handlers] +# Logging handlers, defining logging output methods +keys = console,file + +[formatters] +# Logging formatters +keys = simple,full + + +# Loggers + +[logger_root] +# Root logger +level = DEBUG +handlers = console,file + + +# Handlers + +[handler_console] +# Console handler +class = StreamHandler +level = INFO +args = (sys.stdout,) +formatter = simple + +[handler_file] +# File handler +class = FileHandler +args = ('/var/log/radicale',) +formatter = full + + +# Formatters + +[formatter_simple] +# Simple output format +format = %(message)s + +[formatter_full] +# Full output format +format = %(asctime)s - %(levelname)s: %(message)s diff --git a/conf/nginx.conf b/conf/nginx.conf new file mode 100644 index 0000000..086aa51 --- /dev/null +++ b/conf/nginx.conf @@ -0,0 +1,8 @@ +location PATHTOCHANGE { + alias ALIASTOCHANGE + if ($scheme = http) { + rewrite ^ https://$server_name$request_uri? permanent; + } + include uwsgi_params; + uwsgi_pass unix:///tmp/uwsgi.sock; +} diff --git a/conf/radicale.wsgi b/conf/radicale.wsgi new file mode 100644 index 0000000..88f30cb --- /dev/null +++ b/conf/radicale.wsgi @@ -0,0 +1,4 @@ +#!/usr/bin/env python +import radicale +radicale.log.start() +application = radicale.Application() diff --git a/conf/uwsgi_params b/conf/uwsgi_params new file mode 100644 index 0000000..2a45908 --- /dev/null +++ b/conf/uwsgi_params @@ -0,0 +1,15 @@ +uwsgi_param QUERY_STRING $query_string; +uwsgi_param REQUEST_METHOD $request_method; +uwsgi_param CONTENT_TYPE $content_type; +uwsgi_param CONTENT_LENGTH $content_length; + +uwsgi_param REQUEST_URI $request_uri; +uwsgi_param PATH_INFO $document_uri; +uwsgi_param DOCUMENT_ROOT $document_root; +uwsgi_param SERVER_PROTOCOL $server_protocol; +uwsgi_param HTTPS $https if_not_empty; + +uwsgi_param REMOTE_ADDR $remote_addr; +uwsgi_param REMOTE_PORT $remote_port; +uwsgi_param SERVER_PORT $server_port; +uwsgi_param SERVER_NAME $server_name; diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..07518ed --- /dev/null +++ b/manifest.json @@ -0,0 +1,33 @@ +{ + "name": "Radicale", + "id": "radicale", + "description": { + "en": "CalDAV (calendar) and CardDAV (contact) server solution", + "fr": "Serveur CalDAV et CardDAV" + }, + "developer": { + "name": "beudbeud", + "email": "beudbeud@beudibox.fr", + "url": "http://radicale.org" + }, + "multi_instance": "false", + "arguments": { + "install" : [ + { + "name": "domain", + "ask": { + "en": "Choose a domain for Roundcube" + }, + "example": "domain.org" + }, + { + "name": "path", + "ask": { + "en": "Choose a path for Radicale" + }, + "example": "/sync", + "default": "/sync" + } + ] + } +} diff --git a/scripts/install b/scripts/install new file mode 100755 index 0000000..eaa7a5f --- /dev/null +++ b/scripts/install @@ -0,0 +1,48 @@ +#!/bin/bash + +# Retrieve arguments +domain=$1 +path=$2 + +# Check domain/path availability +#sudo yunohost app checkurl $domain$path -a radicale +#if [[ ! $? -eq 0 ]]; then +# exit 1 +#fi + +# Check pip installation +dpkg -l | grep python-pip > /dev/null 2>&1 +if [ $? = 1 ]; +then + sudo apt-get install python-pip -y +fi + +dpkg -l | grep python-virtualenv > /dev/null 2>&1 +if [ $? = 1 ]; +then + sudo apt-get install python-virtualenv -y +fi + +# Init virtualenv +sudo virtualenv /usr/local/radicale +source /usr/local/radicale/bin/activate + +# Install uwsgi +sudo pip install uwsgi==1.9.20 + +# Install radiace +sudo pip install radicale==0.8 + +# Set permissions to radicale directory +#sudo chown -R www-data: $final_path +# +## 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/radicale.conf +# +## Reload Nginx and regenerate SSOwat conf +#sudo service nginx reload +#sudo yunohost app ssowatconf + +