Revision 1277fb19

b/.gitignore
18 18
.project
19 19
.pydevproject
20 20
.settings/
21

  
21
settings.d/*-local.conf
b/settings.d/00-admins.conf
1
# -*- coding: utf-8 -*-
2

  
3
# Copyright 2011 GRNET S.A. All rights reserved.
4
# 
5
# Redistribution and use in source and binary forms, with or
6
# without modification, are permitted provided that the following
7
# conditions are met:
8
# 
9
#   1. Redistributions of source code must retain the above
10
#      copyright notice, this list of conditions and the following
11
#      disclaimer.
12
# 
13
#   2. Redistributions in binary form must reproduce the above
14
#      copyright notice, this list of conditions and the following
15
#      disclaimer in the documentation and/or other materials
16
#      provided with the distribution.
17
# 
18
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
19
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
22
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
25
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
# POSSIBILITY OF SUCH DAMAGE.
30
# 
31
# The views and conclusions contained in the software and
32
# documentation are those of the authors and should not be
33
# interpreted as representing official policies, either expressed
34
# or implied, of GRNET S.A.
35
# 
36
# -*- coding: utf-8 -*-
37

  
38
#
39
# Admin names and email addresses
40
##################################
41

  
42
ADMINS = (
43
    # ('Your Name', 'your_email@domain.com'),
44
)
45

  
46
MANAGERS = ADMINS
b/settings.d/00-apps.conf
1
# -*- coding: utf-8 -*-
2

  
3
# Copyright 2011 GRNET S.A. All rights reserved.
4
# 
5
# Redistribution and use in source and binary forms, with or
6
# without modification, are permitted provided that the following
7
# conditions are met:
8
# 
9
#   1. Redistributions of source code must retain the above
10
#      copyright notice, this list of conditions and the following
11
#      disclaimer.
12
# 
13
#   2. Redistributions in binary form must reproduce the above
14
#      copyright notice, this list of conditions and the following
15
#      disclaimer in the documentation and/or other materials
16
#      provided with the distribution.
17
# 
18
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
19
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
22
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
25
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
# POSSIBILITY OF SUCH DAMAGE.
30
# 
31
# The views and conclusions contained in the software and
32
# documentation are those of the authors and should not be
33
# interpreted as representing official policies, either expressed
34
# or implied, of GRNET S.A.
35
# 
36
# -*- coding: utf-8 -*-
37

  
38
#
39
# Core Django settings
40
##################################
41

  
42
INSTALLED_APPS = (
43
    'django.contrib.contenttypes',
44
    'django.contrib.sessions',
45
    'django.contrib.sites',
46
    'django.contrib.messages',
47
    'django.contrib.admin',
48
    # 'django.contrib.admindocs',
49
    'synnefo.aai',
50
    'synnefo.api',
51
    'synnefo.ui',
52
    'synnefo.db',
53
    'synnefo.ganeti',
54
    'synnefo.logic',
55
    'synnefo.invitations',
56
    'south'
57
)
58

  
59
SESSION_ENGINE = "django.contrib.sessions.backends.cache"
60

  
61
# List of callables that know how to import templates from various sources.
62
TEMPLATE_LOADERS = (
63
    'django.template.loaders.filesystem.Loader',
64
    'django.template.loaders.app_directories.Loader',
65
#     'django.template.loaders.eggs.Loader',
66
)
67

  
68
TEMPLATE_CONTEXT_PROCESSORS = (
69
    'django.core.context_processors.request',
70
    'django.core.context_processors.i18n',
71
    'django.contrib.auth.context_processors.auth',
72
)
73

  
74
MIDDLEWARE_CLASSES = (
75
    'django.contrib.sessions.middleware.SessionMiddleware',
76
    'synnefo.aai.middleware.SynnefoAuthMiddleware',
77
    'synnefo.api.middleware.ApiAuthMiddleware',
78
    'django.middleware.locale.LocaleMiddleware',
79
    'django.middleware.common.CommonMiddleware',
80
    'django.contrib.messages.middleware.MessageMiddleware'
81
)
82

  
83
ROOT_URLCONF = 'synnefo.urls'
84

  
85
TEMPLATE_DIRS = (
86
    # Put strings here, like "/home/html/django_templates"
87
    # or "C:/www/django/templates".
88
    # Always use forward slashes, even on Windows.
89
    # Don't forget to use absolute paths, not relative paths.
90
)
91

  
92
LANGUAGES = (
93
  ('el', u'Ελληνικά'),
94
  ('en', 'English'),
95
)
96

  
97
# Local time zone for this installation. Choices can be found here:
98
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
99
# although not all choices may be available on all operating systems.
100
# On Unix systems, a value of None will cause Django to use the same
101
# timezone as the operating system.
102
# If running in a Windows environment this must be set to the same as your
103
# system time zone.
104
TIME_ZONE = 'UTC'   # Warning: The API depends on the TIME_ZONE being UTC
105

  
b/settings.d/00-deploy.conf
1
# -*- coding: utf-8 -*-
2

  
3
# Copyright 2011 GRNET S.A. All rights reserved.
4
# 
5
# Redistribution and use in source and binary forms, with or
6
# without modification, are permitted provided that the following
7
# conditions are met:
8
# 
9
#   1. Redistributions of source code must retain the above
10
#      copyright notice, this list of conditions and the following
11
#      disclaimer.
12
# 
13
#   2. Redistributions in binary form must reproduce the above
14
#      copyright notice, this list of conditions and the following
15
#      disclaimer in the documentation and/or other materials
16
#      provided with the distribution.
17
# 
18
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
19
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
22
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
25
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
# POSSIBILITY OF SUCH DAMAGE.
30
# 
31
# The views and conclusions contained in the software and
32
# documentation are those of the authors and should not be
33
# interpreted as representing official policies, either expressed
34
# or implied, of GRNET S.A.
35
# 
36
# -*- coding: utf-8 -*-
37

  
38
#
39
# Deployment
40
##################################
41

  
42
DEBUG = True
43
TEMPLATE_DEBUG = DEBUG
44

  
45
# Top-level URL for deployment. Numerous other URLs depend on this.
46
APP_INSTALL_URL = "https://www.okeanos.grnet.gr"
47

  
48
# Make this unique, and don't share it with anybody.
49
SECRET_KEY = 'ly6)mw6a7x%n)-e#zzk4jo6f2=uqu!1o%)2-(7lo+f9yd^k^bg'
b/settings.d/00-site.conf
1
# -*- coding: utf-8 -*-
2

  
3
# Copyright 2011 GRNET S.A. All rights reserved.
4
# 
5
# Redistribution and use in source and binary forms, with or
6
# without modification, are permitted provided that the following
7
# conditions are met:
8
# 
9
#   1. Redistributions of source code must retain the above
10
#      copyright notice, this list of conditions and the following
11
#      disclaimer.
12
# 
13
#   2. Redistributions in binary form must reproduce the above
14
#      copyright notice, this list of conditions and the following
15
#      disclaimer in the documentation and/or other materials
16
#      provided with the distribution.
17
# 
18
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
19
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
22
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
25
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
# POSSIBILITY OF SUCH DAMAGE.
30
# 
31
# The views and conclusions contained in the software and
32
# documentation are those of the authors and should not be
33
# interpreted as representing official policies, either expressed
34
# or implied, of GRNET S.A.
35
# 
36
# -*- coding: utf-8 -*-
37

  
38
#
39
# Site-specific Django conf
40
##################################
41

  
42
# Language code for this installation. All choices can be found here:
43
# http://www.i18nguy.com/unicode/language-identifiers.html
44
LANGUAGE_CODE = 'en-us'
45

  
46
# FIXME?
47
SITE_ID = 1
48

  
49
# If you set this to False, Django will make some optimizations so as not
50
# to load the internationalization machinery.
51
USE_I18N = True
52

  
53
# If you set this to False, Django will not format dates, numbers and
54
# calendars according to the current locale
55
USE_L10N = True
56

  
57
# Absolute path to the directory that holds media.
58
# Example: "/home/media/media.lawrence.com/"
59
MEDIA_ROOT = ''
60

  
61
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
62
# trailing slash if there is a path component (optional in other cases).
63
# Examples: "http://media.lawrence.com", "http://example.com/media/"
64
MEDIA_URL = ''
65

  
66
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
67
# trailing slash.
68
# Examples: "http://foo.com/media/", "/media/".
69
ADMIN_MEDIA_PREFIX = '/media/'
b/settings.d/10-backend.conf
1
# -*- coding: utf-8 -*-
2

  
3
# Copyright 2011 GRNET S.A. All rights reserved.
4
# 
5
# Redistribution and use in source and binary forms, with or
6
# without modification, are permitted provided that the following
7
# conditions are met:
8
# 
9
#   1. Redistributions of source code must retain the above
10
#      copyright notice, this list of conditions and the following
11
#      disclaimer.
12
# 
13
#   2. Redistributions in binary form must reproduce the above
14
#      copyright notice, this list of conditions and the following
15
#      disclaimer in the documentation and/or other materials
16
#      provided with the distribution.
17
# 
18
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
19
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
22
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
25
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
# POSSIBILITY OF SUCH DAMAGE.
30
# 
31
# The views and conclusions contained in the software and
32
# documentation are those of the authors and should not be
33
# interpreted as representing official policies, either expressed
34
# or implied, of GRNET S.A.
35
# 
36
# -*- coding: utf-8 -*-
37

  
38
#
39
# Ganeti backend configuration
40
###################################
41

  
42
# The RAPI endpoint and associated credentials to use
43
# for talking to the Ganeti backend.
44
GANETI_MASTER_IP = "62.217.120.78"
45
GANETI_CLUSTER_INFO = (GANETI_MASTER_IP, 5080, "synnefo", "ocean!")
46

  
47
# This prefix gets used when determining the instance names
48
# of Synnefo VMs at the Ganeti backend.
49
# The dash must always appear in the name!
50
BACKEND_PREFIX_ID = "snf-"
b/settings.d/10-database.conf
1
# -*- coding: utf-8 -*-
2

  
3
# Copyright 2011 GRNET S.A. All rights reserved.
4
# 
5
# Redistribution and use in source and binary forms, with or
6
# without modification, are permitted provided that the following
7
# conditions are met:
8
# 
9
#   1. Redistributions of source code must retain the above
10
#      copyright notice, this list of conditions and the following
11
#      disclaimer.
12
# 
13
#   2. Redistributions in binary form must reproduce the above
14
#      copyright notice, this list of conditions and the following
15
#      disclaimer in the documentation and/or other materials
16
#      provided with the distribution.
17
# 
18
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
19
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
22
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
25
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
# POSSIBILITY OF SUCH DAMAGE.
30
# 
31
# The views and conclusions contained in the software and
32
# documentation are those of the authors and should not be
33
# interpreted as representing official policies, either expressed
34
# or implied, of GRNET S.A.
35
# 
36
# -*- coding: utf-8 -*-
37

  
38
#
39
# Database settings
40
####################
41

  
42
PROJECT_PATH = os.path.dirname(os.path.abspath(__file__)) + '/'
43

  
44
DATABASES = {
45
    'default': {
46
        # 'postgresql_psycopg2', 'postgresql','mysql', 'sqlite3' or 'oracle'
47
        'ENGINE': 'sqlite3',
48
         # ATTENTION: This *must* be the absolute path if using sqlite3.
49
         # See: http://docs.djangoproject.com/en/dev/ref/settings/#name
50
        'NAME': os.path.join(PROJECT_PATH, 'database.sqlite'),
51
        'USER': '',                      # Not used with sqlite3.
52
        'PASSWORD': '',                  # Not used with sqlite3.
53
        # Set to empty string for localhost. Not used with sqlite3.
54
        'HOST': '',
55
        # Set to empty string for default. Not used with sqlite3.
56
        'PORT': '',
57
    }
58
}
59

  
60
if DATABASES['default']['ENGINE'].endswith('mysql'):
61
    DATABASES['default']['OPTIONS'] = {
62
        'init_command': 'SET storage_engine=INNODB',
63
    }
b/settings.d/15-queues.conf
1
# -*- coding: utf-8 -*-
2

  
3
# Copyright 2011 GRNET S.A. All rights reserved.
4
# 
5
# Redistribution and use in source and binary forms, with or
6
# without modification, are permitted provided that the following
7
# conditions are met:
8
# 
9
#   1. Redistributions of source code must retain the above
10
#      copyright notice, this list of conditions and the following
11
#      disclaimer.
12
# 
13
#   2. Redistributions in binary form must reproduce the above
14
#      copyright notice, this list of conditions and the following
15
#      disclaimer in the documentation and/or other materials
16
#      provided with the distribution.
17
# 
18
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
19
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
22
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
25
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
# POSSIBILITY OF SUCH DAMAGE.
30
# 
31
# The views and conclusions contained in the software and
32
# documentation are those of the authors and should not be
33
# interpreted as representing official policies, either expressed
34
# or implied, of GRNET S.A.
35
# 
36
# -*- coding: utf-8 -*-
37

  
38
#
39
# Queues, exchanges and bindings for AMQP
40
###########################################
41

  
42
# Rabbit work queue endpoint
43
RABBIT_HOST = "62.217.120.67:5672"
44
RABBIT_USERNAME = "okeanos"
45
RABBIT_PASSWORD = "0k3@n0s"
46
RABBIT_VHOST = "/"
47

  
48
EXCHANGE_GANETI = "ganeti"  # Messages from Ganeti
49
EXCHANGE_CRON = "cron"      # Messages from periodically triggered tasks
50
EXCHANGE_API = "api"        # Messages from the REST API
51
EXCHANGES = (EXCHANGE_GANETI, EXCHANGE_CRON, EXCHANGE_API)
52

  
53
QUEUE_GANETI_EVENTS = "events"
54
QUEUE_CRON_CREDITS = "credits"
55
QUEUE_EMAIL = "email"
56
QUEUE_RECONC = "reconciliation"
57
QUEUE_DEBUG = "debug"       # Debug queue, retrieves all messages
58
QUEUES = (QUEUE_GANETI_EVENTS, QUEUE_CRON_CREDITS, QUEUE_EMAIL, QUEUE_RECONC)
59

  
60
BINDINGS_DEBUG = [
61
    # Queue         # Exchange          # RouteKey  # Handler
62
    (QUEUE_DEBUG,   EXCHANGE_GANETI,    '#',        'dummy_proc'),
63
    (QUEUE_DEBUG,   EXCHANGE_CRON,      '#',        'dummy_proc'),
64
    (QUEUE_DEBUG,   EXCHANGE_API,       '#',        'dummy_proc'),
65
]
66

  
67
BINDINGS = [
68
    # Queue                 # Exchange          # RouteKey            # Handler
69
    (QUEUE_GANETI_EVENTS,   EXCHANGE_GANETI,    'ganeti.*.event.op',  'update_db'),
70
    (QUEUE_GANETI_EVENTS,   EXCHANGE_GANETI,    'ganeti.*.event.net', 'update_net'),
71
    (QUEUE_CRON_CREDITS,    EXCHANGE_CRON,      '*.credits.*',        'update_credits'),
72
    (QUEUE_EMAIL,           EXCHANGE_API,       '*.email.*',          'send_email'),
73
    (QUEUE_EMAIL,           EXCHANGE_CRON,      '*.email.*',          'send_email'),
74
    (QUEUE_RECONC,          EXCHANGE_CRON,      'reconciliation.*',   'trigger_status_update'),
75
]
76

  
77
def fix_amqp_settings(backend_prefix):
78
    """Configure AMQP-specific settings
79

  
80
    Configure AMQP-specific settings based on backend_prefix.
81
    This function *must* be called later in settings.py, with
82
    BACKEND_PREFIX_ID as argument.
83

  
84
    """
85
    global DB_HANDLER_KEY_OP, DB_HANDLER_KEY_NET, BINDINGS, QUEUES
86

  
87
    prefix = backend_prefix.split('-')[0]
88
    # notifications of type "ganeti-op-status"
89
    DB_HANDLER_KEY_OP ='ganeti.%s.event.op' % prefix 
90
    # notifications of type "ganeti-net-status"
91
    DB_HANDLER_KEY_NET ='ganeti.%s.event.net' % prefix
92
    BINDINGS[0] = ("events-%s-op" % prefix, EXCHANGE_GANETI, DB_HANDLER_KEY_OP, 'update_db')
93
    BINDINGS[1] = ("events-%s-net" % prefix, EXCHANGE_GANETI, DB_HANDLER_KEY_NET, 'update_net')
94
    QUEUES += ("events-%s-op" % prefix, "events-%s-net" % prefix)
95

  
96
# Fix up the AMQP-specific settings based on BACKEND_PREFIX_ID
97
# Make sure to call it again, if you modify it at some later point
98
fix_amqp_settings(BACKEND_PREFIX_ID)
b/settings.d/20-api.conf
1
# -*- coding: utf-8 -*-
2

  
3
# Copyright 2011 GRNET S.A. All rights reserved.
4
# 
5
# Redistribution and use in source and binary forms, with or
6
# without modification, are permitted provided that the following
7
# conditions are met:
8
# 
9
#   1. Redistributions of source code must retain the above
10
#      copyright notice, this list of conditions and the following
11
#      disclaimer.
12
# 
13
#   2. Redistributions in binary form must reproduce the above
14
#      copyright notice, this list of conditions and the following
15
#      disclaimer in the documentation and/or other materials
16
#      provided with the distribution.
17
# 
18
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
19
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
22
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
25
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
# POSSIBILITY OF SUCH DAMAGE.
30
# 
31
# The views and conclusions contained in the software and
32
# documentation are those of the authors and should not be
33
# interpreted as representing official policies, either expressed
34
# or implied, of GRNET S.A.
35
# 
36
# -*- coding: utf-8 -*-
37

  
38
#
39
# API configuration
40
#####################
41

  
42
# The API implementation needs to accept and return absolute references
43
# to its resources. Thus, it needs to know its public URL.
44
API_ROOT_URL = APP_INSTALL_URL + '/api'
45

  
46
# The API will return HTTP Bad Request if the ?changes-since
47
# parameter refers to a point in time more than POLL_LIMIT seconds ago.
48
POLL_LIMIT = 3600
49

  
50
#
51
# Network Configuration
52
#
53

  
54
# Synnefo assigns this link id to NICs connected on the public network.
55
# An IP pool should be associated with this link by the Ganeti administrator.
56
GANETI_PUBLIC_LINK = 'snf_public'
57
# This link id is assigned to NICs that should be isolated from anything else
58
# (e.g., right before the NIC gets deleted).
59
# This value is also hardcoded in a fixture in db/fixtures/initial_data.json.
60
GANETI_NULL_LINK = 'snf_null'
61
#
62
# The pool of private network links to use is
63
# $GANETI_LINK_PREFIX{1..$GANETI_MAX_LINK_NUMBER}.
64
#
65
# The prefix to use for private network links.
66
GANETI_LINK_PREFIX = 'prv'
67
# The number of private network links to use.
68
GANETI_MAX_LINK_NUMBER = 100
69
# Firewalling
70
GANETI_FIREWALL_ENABLED_TAG = 'synnefo:network:0:enabled'
71
GANETI_FIREWALL_DISABLED_TAG = 'synnefo:network:0:disabled'
72
GANETI_FIREWALL_PROTECTED_TAG = 'synnefo:network:0:protected'
73

  
74
# our REST API would prefer to be explicit about trailing slashes
75
APPEND_SLASH = False
b/settings.d/30-ui.conf
1
# -*- coding: utf-8 -*-
2

  
3
# Copyright 2011 GRNET S.A. All rights reserved.
4
# 
5
# Redistribution and use in source and binary forms, with or
6
# without modification, are permitted provided that the following
7
# conditions are met:
8
# 
9
#   1. Redistributions of source code must retain the above
10
#      copyright notice, this list of conditions and the following
11
#      disclaimer.
12
# 
13
#   2. Redistributions in binary form must reproduce the above
14
#      copyright notice, this list of conditions and the following
15
#      disclaimer in the documentation and/or other materials
16
#      provided with the distribution.
17
# 
18
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
19
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
22
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
25
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
# POSSIBILITY OF SUCH DAMAGE.
30
# 
31
# The views and conclusions contained in the software and
32
# documentation are those of the authors and should not be
33
# interpreted as representing official policies, either expressed
34
# or implied, of GRNET S.A.
35
# 
36
# -*- coding: utf-8 -*-
37

  
38
#
39
# UI settings
40
###################
41

  
42
# UI requests to the API layer time out after that many milliseconds
43
TIMEOUT = 10 * 1000
44

  
45
# A list of suggested server tags (server metadata keys)
46
DEFAULT_KEYWORDS = ["OS", "Role", "Location", "Owner"]
47

  
48
# A list of allowed icons for OS Images
49
IMAGE_ICONS = ["redhat", "ubuntu", "debian", "windows", "gentoo", "archlinux",
50
               "centos", "fedora", "freebsd", "netbsd", "openbsd", "slackware",
51
               "suse"]
b/settings.d/40-aai.conf
1
# -*- coding: utf-8 -*-
2

  
3
# Copyright 2011 GRNET S.A. All rights reserved.
4
# 
5
# Redistribution and use in source and binary forms, with or
6
# without modification, are permitted provided that the following
7
# conditions are met:
8
# 
9
#   1. Redistributions of source code must retain the above
10
#      copyright notice, this list of conditions and the following
11
#      disclaimer.
12
# 
13
#   2. Redistributions in binary form must reproduce the above
14
#      copyright notice, this list of conditions and the following
15
#      disclaimer in the documentation and/or other materials
16
#      provided with the distribution.
17
# 
18
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
19
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
22
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
25
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
# POSSIBILITY OF SUCH DAMAGE.
30
# 
31
# The views and conclusions contained in the software and
32
# documentation are those of the authors and should not be
33
# interpreted as representing official policies, either expressed
34
# or implied, of GRNET S.A.
35
# 
36
# -*- coding: utf-8 -*-
37

  
38
#
39
# AAI configuration
40
#####################
41

  
42
# Shibboleth-enabled path under the APP_INSTALL_URL.
43
LOGIN_PATH = "/login"
44

  
45
# Set the expiration time of newly created auth tokens
46
# to be this many hours after their creation time.
47
AUTH_TOKEN_DURATION = 30 * 24
48

  
49
# Enable receiving a temporary auth token (using the ?test URL parameter) that
50
# bypasses the authentication mechanism.
51
#
52
# WARNING, ACHTUNG, README, etc: DO NOT ENABLE THIS ON DEPLOYED VERSIONS!
53
#
54
BYPASS_AUTHENTICATION = False
b/settings.d/50-invitations.conf
1
# -*- coding: utf-8 -*-
2

  
3
# Copyright 2011 GRNET S.A. All rights reserved.
4
# 
5
# Redistribution and use in source and binary forms, with or
6
# without modification, are permitted provided that the following
7
# conditions are met:
8
# 
9
#   1. Redistributions of source code must retain the above
10
#      copyright notice, this list of conditions and the following
11
#      disclaimer.
12
# 
13
#   2. Redistributions in binary form must reproduce the above
14
#      copyright notice, this list of conditions and the following
15
#      disclaimer in the documentation and/or other materials
16
#      provided with the distribution.
17
# 
18
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
19
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
22
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
25
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
# POSSIBILITY OF SUCH DAMAGE.
30
# 
31
# The views and conclusions contained in the software and
32
# documentation are those of the authors and should not be
33
# interpreted as representing official policies, either expressed
34
# or implied, of GRNET S.A.
35
# 
36
# -*- coding: utf-8 -*-
37

  
38
# Max number of invitations allowed per user
39
MAX_INVITATIONS = 20
40

  
41
# Key to encrypt X-Auth-Token with when sending invitations
42
INVITATION_ENCR_KEY = '8d342f6e7a0366c632978a80257019af'
43

  
44
# Days for which an invitation is active
45
INVITATION_VALID_DAYS = 30
46

  
47
# SMTP server to use when sending out emails
48
SMTP_SERVER="127.0.0.1"
49

  
50
# The address to use in the From: field when sending out emails
51
SYSTEM_EMAIL_ADDR="noreply@grnet.gr"
b/settings.d/60-reconciliation.conf
1
# -*- coding: utf-8 -*-
2

  
3
# Copyright 2011 GRNET S.A. All rights reserved.
4
# 
5
# Redistribution and use in source and binary forms, with or
6
# without modification, are permitted provided that the following
7
# conditions are met:
8
# 
9
#   1. Redistributions of source code must retain the above
10
#      copyright notice, this list of conditions and the following
11
#      disclaimer.
12
# 
13
#   2. Redistributions in binary form must reproduce the above
14
#      copyright notice, this list of conditions and the following
15
#      disclaimer in the documentation and/or other materials
16
#      provided with the distribution.
17
# 
18
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
19
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
22
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
25
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
# POSSIBILITY OF SUCH DAMAGE.
30
# 
31
# The views and conclusions contained in the software and
32
# documentation are those of the authors and should not be
33
# interpreted as representing official policies, either expressed
34
# or implied, of GRNET S.A.
35
# 
36
# -*- coding: utf-8 -*-
37

  
38
#
39
# Reconciliations
40
###################
41

  
42
# Minutes between reconciliations
43
RECONCILIATION_MIN = 30
44

  
b/settings.d/90-tests.conf
1
# -*- coding: utf-8 -*-
2

  
3
# Copyright 2011 GRNET S.A. All rights reserved.
4
# 
5
# Redistribution and use in source and binary forms, with or
6
# without modification, are permitted provided that the following
7
# conditions are met:
8
# 
9
#   1. Redistributions of source code must retain the above
10
#      copyright notice, this list of conditions and the following
11
#      disclaimer.
12
# 
13
#   2. Redistributions in binary form must reproduce the above
14
#      copyright notice, this list of conditions and the following
15
#      disclaimer in the documentation and/or other materials
16
#      provided with the distribution.
17
# 
18
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
19
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
22
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
25
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
# POSSIBILITY OF SUCH DAMAGE.
30
# 
31
# The views and conclusions contained in the software and
32
# documentation are those of the authors and should not be
33
# interpreted as representing official policies, either expressed
34
# or implied, of GRNET S.A.
35
# 
36
# -*- coding: utf-8 -*-
37

  
38
#
39
# Special unit test mode
40
#########################
41

  
42
# A quick-n-dirty way which sets settings.TEST
43
# if we're running unit tests.
44
import sys
45
TEST = False
46
if len(sys.argv) >= 2:
47
    if os.path.basename(sys.argv[0]) == 'manage.py' and \
48
        (sys.argv[1] == 'test' or sys.argv[1] == 'hudson'):
49
            TEST = True
b/settings.d/99-snf-dispatcher.conf
1
# -*- coding: utf-8 -*-
2

  
3
# Copyright 2011 GRNET S.A. All rights reserved.
4
# 
5
# Redistribution and use in source and binary forms, with or
6
# without modification, are permitted provided that the following
7
# conditions are met:
8
# 
9
#   1. Redistributions of source code must retain the above
10
#      copyright notice, this list of conditions and the following
11
#      disclaimer.
12
# 
13
#   2. Redistributions in binary form must reproduce the above
14
#      copyright notice, this list of conditions and the following
15
#      disclaimer in the documentation and/or other materials
16
#      provided with the distribution.
17
# 
18
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
19
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
22
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
25
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
# POSSIBILITY OF SUCH DAMAGE.
30
# 
31
# The views and conclusions contained in the software and
32
# documentation are those of the authors and should not be
33
# interpreted as representing official policies, either expressed
34
# or implied, of GRNET S.A.
35
# 
36
# -*- coding: utf-8 -*-
37

  
38
#
39
# Logic dispatcher
40
###################
41

  
42
# Logic dispatcher settings
43
DISPATCHER_LOG_FILE = "/var/log/synnefo/dispatcher.log"
44

  
b/settings.d/99-snf-ganeti-eventd.conf
1
# -*- coding: utf-8 -*-
2

  
3
# Copyright 2011 GRNET S.A. All rights reserved.
4
# 
5
# Redistribution and use in source and binary forms, with or
6
# without modification, are permitted provided that the following
7
# conditions are met:
8
# 
9
#   1. Redistributions of source code must retain the above
10
#      copyright notice, this list of conditions and the following
11
#      disclaimer.
12
# 
13
#   2. Redistributions in binary form must reproduce the above
14
#      copyright notice, this list of conditions and the following
15
#      disclaimer in the documentation and/or other materials
16
#      provided with the distribution.
17
# 
18
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
19
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
22
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
25
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
# POSSIBILITY OF SUCH DAMAGE.
30
# 
31
# The views and conclusions contained in the software and
32
# documentation are those of the authors and should not be
33
# interpreted as representing official policies, either expressed
34
# or implied, of GRNET S.A.
35
# 
36
# -*- coding: utf-8 -*-
37

  
38
#
39
# ganeti-eventd
40
###################
41

  
42
# Configuration for ganeti-eventd, the Ganeti notification daemon
43
GANETI_EVENTD_LOG_FILE = "/var/log/synnefo/ganeti-eventd.log"
44
GANETI_EVENTD_PID_FILE = "/var/run/synnefo/ganeti-eventd.pid"
b/settings.py.dist
1
# -*- coding: utf-8 -*-
2

  
3
# Django settings for synnefo project.
4
import os
5

  
6
PROJECT_PATH = os.path.dirname(os.path.abspath(__file__)) + '/'
7

  
8
DEBUG = True
9
TEMPLATE_DEBUG = DEBUG
10

  
11
# A quick-n-dirty way to know if we're running unit tests
12
import sys
13
TEST = False
14
if len(sys.argv) >= 2:
15
    if os.path.basename(sys.argv[0]) == 'manage.py' and \
16
        (sys.argv[1] == 'test' or sys.argv[1] == 'hudson'):
17
            TEST = True
18

  
19
ADMINS = (
20
    # ('Your Name', 'your_email@domain.com'),
21
)
22

  
23
MANAGERS = ADMINS
24

  
25
DATABASES = {
26
    'default': {
27
        # 'postgresql_psycopg2', 'postgresql','mysql', 'sqlite3' or 'oracle'
28
        'ENGINE': 'sqlite3',
29
         # ATTENTION: This *must* be the absolute path if using sqlite3.
30
         # See: http://docs.djangoproject.com/en/dev/ref/settings/#name
31
        'NAME': PROJECT_PATH + 'database.sqlite',
32
        'USER': '',                      # Not used with sqlite3.
33
        'PASSWORD': '',                  # Not used with sqlite3.
34
        # Set to empty string for localhost. Not used with sqlite3.
35
        'HOST': '',
36
        # Set to empty string for default. Not used with sqlite3.
37
        'PORT': '',
38
    }
39
}
40

  
41
if DATABASES['default']['ENGINE'].endswith('mysql'):
42
    DATABASES['default']['OPTIONS'] = {
43
        'init_command': 'SET storage_engine=INNODB',
44
    }
45

  
46
SESSION_ENGINE = "django.contrib.sessions.backends.cache"
47

  
48
# Local time zone for this installation. Choices can be found here:
49
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
50
# although not all choices may be available on all operating systems.
51
# On Unix systems, a value of None will cause Django to use the same
52
# timezone as the operating system.
53
# If running in a Windows environment this must be set to the same as your
54
# system time zone.
55
TIME_ZONE = 'UTC'   # Warning: API depends on the TIME_ZONE being UTC
56

  
57
# Language code for this installation. All choices can be found here:
58
# http://www.i18nguy.com/unicode/language-identifiers.html
59
LANGUAGE_CODE = 'en-us'
60

  
61
SITE_ID = 1
62

  
63
# If you set this to False, Django will make some optimizations so as not
64
# to load the internationalization machinery.
65
USE_I18N = True
66

  
67
# If you set this to False, Django will not format dates, numbers and
68
# calendars according to the current locale
69
USE_L10N = True
70

  
71
# Absolute path to the directory that holds media.
72
# Example: "/home/media/media.lawrence.com/"
73
MEDIA_ROOT = ''
74

  
75
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
76
# trailing slash if there is a path component (optional in other cases).
77
# Examples: "http://media.lawrence.com", "http://example.com/media/"
78
MEDIA_URL = ''
79

  
80
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
81
# trailing slash.
82
# Examples: "http://foo.com/media/", "/media/".
83
ADMIN_MEDIA_PREFIX = '/media/'
84

  
85
# our REST API would prefer to be explicit about trailing slashes
86
APPEND_SLASH = False
87

  
88
# Make this unique, and don't share it with anybody.
89
SECRET_KEY = 'ly6)mw6a7x%n)-e#zzk4jo6f2=uqu!1o%)2-(7lo+f9yd^k^bg'
90

  
91
# List of callables that know how to import templates from various sources.
92
TEMPLATE_LOADERS = (
93
    'django.template.loaders.filesystem.Loader',
94
    'django.template.loaders.app_directories.Loader',
95
#     'django.template.loaders.eggs.Loader',
96
)
97

  
98
TEMPLATE_CONTEXT_PROCESSORS = (
99
    'django.core.context_processors.request',
100
    'django.core.context_processors.i18n',
101
    'django.contrib.auth.context_processors.auth',
102
)
103

  
104
MIDDLEWARE_CLASSES = (
105
    'django.contrib.sessions.middleware.SessionMiddleware',
106
    'synnefo.aai.middleware.SynnefoAuthMiddleware',
107
    'synnefo.api.middleware.ApiAuthMiddleware',
108
    'django.middleware.locale.LocaleMiddleware',
109
    'django.middleware.common.CommonMiddleware',
110
    'django.contrib.messages.middleware.MessageMiddleware'
111
)
112

  
113
ROOT_URLCONF = 'synnefo.urls'
114

  
115
TEMPLATE_DIRS = (
116
    # Put strings here, like "/home/html/django_templates"
117
    # or "C:/www/django/templates".
118
    # Always use forward slashes, even on Windows.
119
    # Don't forget to use absolute paths, not relative paths.
120
)
121

  
122
INSTALLED_APPS = (
123
    'django.contrib.contenttypes',
124
    'django.contrib.sessions',
125
    'django.contrib.sites',
126
    'django.contrib.messages',
127
    'django.contrib.admin',
128
    # 'django.contrib.admindocs',
129
    'synnefo.aai',
130
    'synnefo.api',
131
    'synnefo.ui',
132
    'synnefo.db',
133
    'synnefo.ganeti',
134
    'synnefo.logic',
135
    'synnefo.invitations',
136
    'south'
137
)
138

  
139
# The RAPI endpoint and associated credentials to use
140
# for talking to the Ganeti backend.
141
GANETI_MASTER_IP = "62.217.120.78"
142
GANETI_CLUSTER_INFO = (GANETI_MASTER_IP, 5080, "synnefo", "ocean!")
143

  
144
# This prefix gets used when determining the instance names
145
# of Synnefo VMs at the Ganeti backend.
146
# The dash must always appear in the name!
147
BACKEND_PREFIX_ID = "snf-"
148

  
149
LANGUAGES = (
150
  ('el', u'Ελληνικά'),
151
  ('en', 'English'),
152
)
153

  
154
# needed for django. this is the class that implements the User system.
155
# We use this to allow users to add stuff for themselves (about, image etc)
156
#http://docs.djangoproject.com/en/dev/topics/auth/#auth-profiles
157
AUTH_PROFILE_MODULE = 'synnefo.OceanUser'
158

  
159
# API requests from the GUI time out after that many seconds.
160
TIMEOUT = 10 * 1000
161

  
162
# The API will return HTTP Bad Request if the ?changes-since
163
# parameter refers to a point in time more than POLL_LIMIT seconds ago.
164
POLL_LIMIT = 3600
165

  
166
# Configuration for ganeti-eventd, the Ganeti notification daemon
167
GANETI_EVENTD_LOG_FILE = "/var/log/synnefo/ganeti-eventd.log"
168
GANETI_EVENTD_PID_FILE = "/var/run/synnefo/ganeti-eventd.pid"
169

  
170
# Rabbit work queue endpoint
171
RABBIT_HOST = "62.217.120.67:5672"
172
RABBIT_USERNAME = "okeanos"
173
RABBIT_PASSWORD = "0k3@n0s"
174
RABBIT_VHOST = "/"
175

  
176
#
177
# Queues, exchanges and bindings for AMQP
178
#
179
EXCHANGE_GANETI = "ganeti"  # Messages from Ganeti
180
EXCHANGE_CRON = "cron"      # Messages from periodically triggered tasks
181
EXCHANGE_API = "api"        # Messages from the Rest API
182
EXCHANGES = (EXCHANGE_GANETI, EXCHANGE_CRON, EXCHANGE_API)
183

  
184
QUEUE_GANETI_EVENTS = "events"
185
QUEUE_CRON_CREDITS = "credits"
186
QUEUE_EMAIL = "email"
187
QUEUE_RECONC = "reconciliation"
188
QUEUE_DEBUG = "debug"       # Debug queue, retrieves all messages
189
QUEUES = (QUEUE_GANETI_EVENTS, QUEUE_CRON_CREDITS, QUEUE_EMAIL, QUEUE_RECONC)
190

  
191
BINDINGS_DEBUG = [
192
    # Queue         # Exchange          # RouteKey  # Handler
193
    (QUEUE_DEBUG,   EXCHANGE_GANETI,    '#',        'dummy_proc'),
194
    (QUEUE_DEBUG,   EXCHANGE_CRON,      '#',        'dummy_proc'),
195
    (QUEUE_DEBUG,   EXCHANGE_API,       '#',        'dummy_proc'),
196
]
197

  
198
BINDINGS = [
199
    # Queue                 # Exchange          # RouteKey            #Handler
200
    (QUEUE_GANETI_EVENTS,   EXCHANGE_GANETI,    'ganeti.*.event.op',  'update_db'),
201
    (QUEUE_GANETI_EVENTS,   EXCHANGE_GANETI,    'ganeti.*.event.net', 'update_net'),
202
    (QUEUE_CRON_CREDITS,    EXCHANGE_CRON,      '*.credits.*',        'update_credits'),
203
    (QUEUE_EMAIL,           EXCHANGE_API,       '*.email.*',          'send_email'),
204
    (QUEUE_EMAIL,           EXCHANGE_CRON,      '*.email.*',          'send_email'),
205
    (QUEUE_RECONC,          EXCHANGE_CRON,      'reconciliation.*',   'trigger_status_update'),
206
]
207

  
208
def fix_amqp_settings(backend_prefix):
209
    """Configure AMQP-specific settings
210

  
211
    Configure AMQP-specific settings based on backend_prefix.
212
    This function *must* be called later in settings.py, with
213
    BACKEND_PREFIX_ID as argument.
214

  
215
    """
216
    global DB_HANDLER_KEY_OP, DB_HANDLER_KEY_NET, BINDINGS, QUEUES
217

  
218
    prefix = backend_prefix.split('-')[0]
219
    DB_HANDLER_KEY_OP ='ganeti.%s.event.op' % prefix    # notifications of type "ganeti-op-status"
220
    DB_HANDLER_KEY_NET ='ganeti.%s.event.net' % prefix  # notifications of type "ganeti-net-status"
221
    BINDINGS[0] = ("events-%s-op" % prefix, EXCHANGE_GANETI, DB_HANDLER_KEY_OP, 'update_db')
222
    BINDINGS[1] = ("events-%s-net" % prefix, EXCHANGE_GANETI, DB_HANDLER_KEY_NET, 'update_net')
223
    QUEUES += ("events-%s-op" % prefix, "events-%s-net" % prefix)
224

  
225
# Fix up the AMQP-specific settings based on BACKEND_PREFIX_ID
226
# Make sure to call it again, if you modify it at some later point
227
fix_amqp_settings(BACKEND_PREFIX_ID)
228

  
229
# Logic dispatcher settings
230
DISPATCHER_LOG_FILE = "/var/log/synnefo/dispatcher.log"
231

  
232
# The API implementation needs to accept and return absolute references
233
# to its resources. Thus, it needs to know its public URL.
234
API_ROOT_URL = 'http://127.0.0.1:8000/api/'
235

  
236
APP_INSTALL_URL = "https://login.okeanos.grnet.gr/okeanos"
237

  
238
LOGIN_PATH = "/login"
239

  
240
# Number of hours during which a user token is active
241
# ACHTUNG: The test token distributed in db/initial_data.json will cease to
242
#          work after this many hours after 2011/05/10
243
AUTH_TOKEN_DURATION = 30 * 24
244

  
245
# Minutes between reconciliations
246
RECONCILIATION_MIN = 30
247

  
248
# Max number of invitations allowed per user
249
MAX_INVITATIONS = 20
250

  
251
# Key to encrypt X-Auth-Token with when sending invitations
252
INVITATION_ENCR_KEY = '8d342f6e7a0366c632978a80257019af'
253

  
254
# Days for which an invitation is active
255
INVITATION_VALID_DAYS = 30
256

  
257
# SMTP server to use when sending out emails
258
SMTP_SERVER="127.0.0.1"
259

  
260
# The address to use in the From: field when sending out emails
261
SYSTEM_EMAIL_ADDR="noreply@grnet.gr"
262

  
263
# Enable receiving a temporary auth token (using the ?test URL parameter) that
264
# bypasses the authentication mechanism
265
#
266
# WARNING, ACHTUNG, README, etc: DO NOT ENABLE THIS ON DEPLOYED VERSIONS!
267
#
268
BYPASS_AUTHENTICATION = False
269

  
270
#
271
# Network Configuration
272
#
273
# Synnefo assigns this link id to NICs connected on the public network.
274
# An IP pool should be associated with this link by the Ganeti administrator.
275
GANETI_PUBLIC_LINK = 'snf_public'
276
# This link id is assigned to NICs that should be isolated from anything else
277
# (e.g., right before the NIC gets deleted).
278
# This value is also hardcoded in a fixture in db/fixtures/initial_data.json.
279
GANETI_NULL_LINK = 'snf_null'
280
#
281
# The pool of private network links to use is
282
# $GANETI_LINK_PREFIX{1..$GANETI_MAX_LINK_NUMBER}.
283
#
284
# The prefix to use for private network links.
285
GANETI_LINK_PREFIX = 'prv'
286
# The number of private network links to use.
287
GANETI_MAX_LINK_NUMBER = 100
288

  
289
GANETI_FIREWALL_ENABLED_TAG = 'synnefo:network:0:enabled'
290
GANETI_FIREWALL_DISABLED_TAG = 'synnefo:network:0:disabled'
291
GANETI_FIREWALL_PROTECTED_TAG = 'synnefo:network:0:protected'
292

  
293
# A list of suggested server tags (server metadata keys)
294
DEFAULT_KEYWORDS = ["OS", "Role", "Location", "Owner"]
295

  
296
# A list of allowed icons for OS Images
297
IMAGE_ICONS = ["redhat", "ubuntu", "debian", "windows", "gentoo", "archlinux",
298
               "centos", "fedora", "freebsd", "netbsd", "openbsd", "slackware",
299
               "suse"]
1
# Copyright 2011 GRNET S.A. All rights reserved.
2
# 
3
# Redistribution and use in source and binary forms, with or
4
# without modification, are permitted provided that the following
5
# conditions are met:
6
# 
7
#   1. Redistributions of source code must retain the above
8
#      copyright notice, this list of conditions and the following
9
#      disclaimer.
10
# 
11
#   2. Redistributions in binary form must reproduce the above
12
#      copyright notice, this list of conditions and the following
13
#      disclaimer in the documentation and/or other materials
14
#      provided with the distribution.
15
# 
16
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
17
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
20
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
24
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
26
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27
# POSSIBILITY OF SUCH DAMAGE.
28
# 
29
# The views and conclusions contained in the software and
30
# documentation are those of the authors and should not be
31
# interpreted as representing official policies, either expressed
32
# or implied, of GRNET S.A.
33

  
34
import os.path
35
import glob
36

  
37
conffiles = glob.glob(os.path.join(os.path.dirname(__file__),
38
                      'settings.d', '*.conf'))
39
conffiles.sort()
40
for f in conffiles:
41
    execfile(os.path.abspath(f))

Also available in: Unified diff