Statistics
| Branch: | Tag: | Revision:

root / snf-cyclades-app / synnefo / app_settings / default / api.py @ bda47e03

History | View | Annotate | Download (6 kB)

1 1277fb19 Vangelis Koukis
# -*- coding: utf-8 -*-
2 1277fb19 Vangelis Koukis
#
3 1277fb19 Vangelis Koukis
# API configuration
4 1277fb19 Vangelis Koukis
#####################
5 1277fb19 Vangelis Koukis
6 de470b1e Kostas Papadimitriou
7 de470b1e Kostas Papadimitriou
DEBUG = False
8 de470b1e Kostas Papadimitriou
9 07d104d8 Kostas Papadimitriou
# Top-level URL for deployment. Numerous other URLs depend on this.
10 22a882a1 Georgios D. Tsoukalas
CYCLADES_BASE_URL = "https://compute.example.synnefo.org/compute/"
11 1277fb19 Vangelis Koukis
12 1277fb19 Vangelis Koukis
# The API will return HTTP Bad Request if the ?changes-since
13 1277fb19 Vangelis Koukis
# parameter refers to a point in time more than POLL_LIMIT seconds ago.
14 1277fb19 Vangelis Koukis
POLL_LIMIT = 3600
15 1277fb19 Vangelis Koukis
16 bda47e03 Christos Stavrakakis
# Astakos groups that have access to '/admin' views.
17 bda47e03 Christos Stavrakakis
ADMIN_STATS_PERMITTED_GROUPS = ["admin-stats"]
18 bda47e03 Christos Stavrakakis
19 1277fb19 Vangelis Koukis
#
20 1277fb19 Vangelis Koukis
# Network Configuration
21 1277fb19 Vangelis Koukis
#
22 1277fb19 Vangelis Koukis
23 3aecadc8 Christos Stavrakakis
# CYCLADES_DEFAULT_SERVER_NETWORKS setting contains a list of networks to
24 3aecadc8 Christos Stavrakakis
# connect a newly created server to, *if the user has not* specified them
25 3aecadc8 Christos Stavrakakis
# explicitly in the POST /server API call.
26 3aecadc8 Christos Stavrakakis
# Each member of the list may be a network UUID, a tuple of network UUIDs,
27 3aecadc8 Christos Stavrakakis
# "SNF:ANY_PUBLIC_IPV4" [any public network with an IPv4 subnet defined],
28 3aecadc8 Christos Stavrakakis
# "SNF:ANY_PUBLIC_IPV6 [any public network with only an IPV6 subnet defined],
29 3aecadc8 Christos Stavrakakis
#  or "SNF:ANY_PUBLIC" [any public network].
30 3aecadc8 Christos Stavrakakis
#
31 3aecadc8 Christos Stavrakakis
# Access control and quota policy are enforced, just as if the user had
32 3aecadc8 Christos Stavrakakis
# specified the value of CYCLADES_DEFAULT_SERVER_NETWORKS in the content
33 3aecadc8 Christos Stavrakakis
# of the POST /call, after processing of "SNF:*" directives."
34 3aecadc8 Christos Stavrakakis
CYCLADES_DEFAULT_SERVER_NETWORKS = ["SNF:ANY_PUBLIC"]
35 3aecadc8 Christos Stavrakakis
36 3aecadc8 Christos Stavrakakis
# This setting contains a list of networks which every new server
37 3aecadc8 Christos Stavrakakis
# will be forced to connect to, regardless of the contents of the POST
38 3aecadc8 Christos Stavrakakis
# /servers call, or the value of CYCLADES_DEFAULT_SERVER_NETWORKS.
39 3aecadc8 Christos Stavrakakis
# Its format is identical to that of CYCLADES_DEFAULT_SERVER_NETWORKS.
40 3aecadc8 Christos Stavrakakis
41 3aecadc8 Christos Stavrakakis
# WARNING: No access control or quota policy are enforced.
42 3aecadc8 Christos Stavrakakis
# The server will get all IPv4/IPv6 addresses needed to connect to the
43 3aecadc8 Christos Stavrakakis
# networks specified in CYCLADES_FORCED_SERVER_NETWORKS, regardless
44 3aecadc8 Christos Stavrakakis
# of the state of the floating IP pool of the user, and without
45 3aecadc8 Christos Stavrakakis
# allocating any floating IPs."
46 3aecadc8 Christos Stavrakakis
CYCLADES_FORCED_SERVER_NETWORKS = ["SNF:ANY_PUBLIC_IPV6"]
47 9446e7e5 Christos Stavrakakis
48 6eed1ede Christos Stavrakakis
# Maximum allowed network size for private networks.
49 6eed1ede Christos Stavrakakis
MAX_CIDR_BLOCK = 22
50 839e2bd0 Christos Stavrakakis
51 b7d38981 Dimitris Aragiorgis
# Default settings used by network flavors
52 b7d38981 Dimitris Aragiorgis
DEFAULT_MAC_PREFIX = 'aa:00:0'
53 b7d38981 Dimitris Aragiorgis
DEFAULT_BRIDGE = 'br0'
54 839e2bd0 Christos Stavrakakis
55 b7d38981 Dimitris Aragiorgis
# Network flavors that users are allowed to create through API requests
56 b7d38981 Dimitris Aragiorgis
API_ENABLED_NETWORK_FLAVORS = ['MAC_FILTERED']
57 b7d38981 Dimitris Aragiorgis
58 b7d38981 Dimitris Aragiorgis
# Settings for IP_LESS_ROUTED network:
59 b7d38981 Dimitris Aragiorgis
# -----------------------------------
60 b7d38981 Dimitris Aragiorgis
# In this case VMCs act as routers that forward the traffic to/from VMs, based
61 b7d38981 Dimitris Aragiorgis
# on the defined routing table($DEFAULT_ROUTING_TABLE) and ip rules, that
62 b7d38981 Dimitris Aragiorgis
# exist in every node, implenting an IP-less routed and proxy-arp setup.
63 b7d38981 Dimitris Aragiorgis
DEFAULT_ROUTING_TABLE = 'snf_public'
64 b7d38981 Dimitris Aragiorgis
65 b7d38981 Dimitris Aragiorgis
# Settings for MAC_FILTERED network:
66 839e2bd0 Christos Stavrakakis
# ------------------------------------------
67 839e2bd0 Christos Stavrakakis
# All networks of this type are bridged to the same bridge. Isolation between
68 839e2bd0 Christos Stavrakakis
# networks is achieved by assigning a unique MAC-prefix to each network and
69 839e2bd0 Christos Stavrakakis
# filtering packets via ebtables.
70 b7d38981 Dimitris Aragiorgis
DEFAULT_MAC_FILTERED_BRIDGE = 'prv0'
71 839e2bd0 Christos Stavrakakis
72 e6a42a96 Christos Stavrakakis
73 b2791a77 Christos Stavrakakis
# Firewalling. Firewall tags should contain '%d' to be filled with the NIC
74 d0545590 Christos Stavrakakis
# ID.
75 d0545590 Christos Stavrakakis
GANETI_FIREWALL_ENABLED_TAG = 'synnefo:network:%s:protected'
76 d0545590 Christos Stavrakakis
GANETI_FIREWALL_DISABLED_TAG = 'synnefo:network:%s:unprotected'
77 d0545590 Christos Stavrakakis
GANETI_FIREWALL_PROTECTED_TAG = 'synnefo:network:%s:limited'
78 1277fb19 Vangelis Koukis
79 9b5b718a Giorgos Verigakis
# The default firewall profile that will be in effect if no tags are defined
80 9b5b718a Giorgos Verigakis
DEFAULT_FIREWALL_PROFILE = 'DISABLED'
81 9b5b718a Giorgos Verigakis
82 5dd9d123 Christos Stavrakakis
# Fixed mapping of user VMs to a specific backend.
83 68a81d58 Olga Brani
# e.g. BACKEND_PER_USER = {'example@synnefo.org': 2}
84 5dd9d123 Christos Stavrakakis
BACKEND_PER_USER = {}
85 5dd9d123 Christos Stavrakakis
86 ce55f211 Kostas Papadimitriou
87 5391d6b5 Giorgos Verigakis
# URL templates for the stat graphs.
88 5391d6b5 Giorgos Verigakis
# The API implementation replaces '%s' with the encrypted backend id.
89 5391d6b5 Giorgos Verigakis
# FIXME: For now we do not encrypt the backend id.
90 68a81d58 Olga Brani
CPU_BAR_GRAPH_URL = 'http://stats.synnefo.org/%s/cpu-bar.png'
91 68a81d58 Olga Brani
CPU_TIMESERIES_GRAPH_URL = 'http://stats.synnefo.org/%s/cpu-ts.png'
92 68a81d58 Olga Brani
NET_BAR_GRAPH_URL = 'http://stats.synnefo.org/%s/net-bar.png'
93 68a81d58 Olga Brani
NET_TIMESERIES_GRAPH_URL = 'http://stats.synnefo.org/%s/net-ts.png'
94 c738c935 Giorgos Verigakis
95 c738c935 Giorgos Verigakis
# Recommended refresh period for server stats
96 c738c935 Giorgos Verigakis
STATS_REFRESH_PERIOD = 60
97 fc443bcd Giorgos Verigakis
98 fc443bcd Giorgos Verigakis
# The maximum number of file path/content pairs that can be supplied on server
99 fc443bcd Giorgos Verigakis
# build
100 fc443bcd Giorgos Verigakis
MAX_PERSONALITY = 5
101 fc443bcd Giorgos Verigakis
102 fc443bcd Giorgos Verigakis
# The maximum size, in bytes, for each personality file
103 fc443bcd Giorgos Verigakis
MAX_PERSONALITY_SIZE = 10240
104 c909cbbd Giorgos Verigakis
105 6ef51e9f Giorgos Verigakis
106 e407f159 Ilias Tsitsimpis
# Authentication URL of the astakos instance to be used for user management
107 e407f159 Ilias Tsitsimpis
ASTAKOS_AUTH_URL = 'https://accounts.example.synnefo.org/identity/v2.0'
108 30e0ed74 Christos Stavrakakis
109 28c41829 Christos Stavrakakis
# Tune the size of the Astakos http client connection pool
110 28c41829 Christos Stavrakakis
# This limit the number of concurrent requests to Astakos.
111 b0c95903 Giorgos Korfiatis
CYCLADES_ASTAKOSCLIENT_POOLSIZE = 50
112 28c41829 Christos Stavrakakis
113 30e0ed74 Christos Stavrakakis
# Key for password encryption-decryption. After changing this setting, synnefo
114 30e0ed74 Christos Stavrakakis
# will be unable to decrypt all existing Backend passwords. You will need to
115 0224049a Christos Stavrakakis
# store again the new password by using 'snf-manage backend-modify'.
116 0224049a Christos Stavrakakis
# SECRET_ENCRYPTION_KEY may up to 32 bytes. Keys bigger than 32 bytes are not
117 0224049a Christos Stavrakakis
# supported.
118 28c41829 Christos Stavrakakis
SECRET_ENCRYPTION_KEY = "Password Encryption Key"
119 a682eaea Kostas Papadimitriou
120 a682eaea Kostas Papadimitriou
# Astakos service token
121 a682eaea Kostas Papadimitriou
# The token used for astakos service api calls (e.g. api to retrieve user email
122 a682eaea Kostas Papadimitriou
# using a user uuid)
123 49c0d427 Kostas Papadimitriou
CYCLADES_SERVICE_TOKEN = ''
124 02f0cf8a Kostas Papadimitriou
125 d328a525 Christos Stavrakakis
# Template to use to build the FQDN of VMs. The setting will be formated with
126 d328a525 Christos Stavrakakis
# the id of the VM. If set to 'None' the first public IPv4 or IPv6 address
127 d328a525 Christos Stavrakakis
# of the VM will be used.
128 d328a525 Christos Stavrakakis
CYCLADES_SERVERS_FQDN = 'snf-%(id)s.vm.example.synnefo.org'
129 2522e489 Christos Stavrakakis
130 2522e489 Christos Stavrakakis
# Description of applied port forwarding rules (DNAT) for Cyclades VMs. This
131 2522e489 Christos Stavrakakis
# setting contains a mapping from the port of each VM to a tuple contaning the
132 2522e489 Christos Stavrakakis
# destination IP/hostname and the new port: (host, port). Instead of a tuple a
133 2522e489 Christos Stavrakakis
# python callable object may be used which must return such a tuple. The caller
134 2522e489 Christos Stavrakakis
# will pass to the callable the following positional arguments, in the
135 2522e489 Christos Stavrakakis
# following order:
136 2522e489 Christos Stavrakakis
# * server_id: The ID of the VM in the DB
137 2522e489 Christos Stavrakakis
# * ip_address: The IPv4 address of the public VM NIC
138 2522e489 Christos Stavrakakis
# * fqdn: The FQDN of the VM
139 2522e489 Christos Stavrakakis
# * user: The UUID of the owner of the VM
140 2522e489 Christos Stavrakakis
#
141 2522e489 Christos Stavrakakis
# Here is an example describing the mapping of the SSH port of all VMs to
142 2522e489 Christos Stavrakakis
# the external address 'gate.example.synnefo.org' and port 60000+server_id.
143 2522e489 Christos Stavrakakis
# e.g. iptables -t nat -A prerouting -d gate.example.synnefo.org \
144 2522e489 Christos Stavrakakis
# --dport (61000 + $(VM_ID)) -j DNAT --to-destination $(VM_IP):22
145 2522e489 Christos Stavrakakis
#CYCLADES_PORT_FORWARDING = {
146 2522e489 Christos Stavrakakis
#    22: lambda ip_address, server_id, fqdn, user:
147 2522e489 Christos Stavrakakis
#               ("gate.example.synnefo.org", 61000 + server_id),
148 2522e489 Christos Stavrakakis
#}
149 2522e489 Christos Stavrakakis
CYCLADES_PORT_FORWARDING = {}