# How to use this conf fi conf fi conf file:
# import os, admin; reload(admin); s = admin.Services('conf/deploy_project/', username=os.environ['USER']); h=s._hosts
#
# NOTE: admin.py doesn't do any firewalling in the context of running SMC in a project on localhost, so
#       changing the cassandra ports without changing how firewalls work isn't an issue.

# services

import json, os

# main port you connect to this through, so use https://cloud.sagemath.com/project_id/port/the_number_below
port       = 8400

# Cassandra ports
cassandra  = [port+1, port+2, port+3, port+4]
# nginx port
nginx = port+5
# hub ports
hub = [port+6, port+7, port+8, port+9]

project_id = str(json.loads(open("%s/info.json"%os.environ['SAGEMATHCLOUD']).read())['project_id'])
base_url   = '/%s/port/%s'%(project_id, port)


[cassandra] {'cluster_name':'salvus1', 'storage_port':cassandra[0], 'ssl_storage_port':cassandra[1], 'native_transport_port':cassandra[2], 'rpc_port':cassandra[3], 'thrift_framed_transport_size_in_mb':'39', 'MAX_HEAP_SIZE':'1G',  'HEAP_NEWSIZE':'128M', 'authenticator':'org.apache.cassandra.auth.PasswordAuthenticator', 'authorizer':'org.apache.cassandra.auth.CassandraAuthorizer'}
#{'read_request_timeout_in_ms':'60000', 'request_timeout_in_ms':'60000', 'range_request_timeout_in_ms':'60000'}
localhost {'seed':True, 'topology':'DC0:RAC0', 'initial_token':0}

[nginx] {'base_url':base_url, 'port':nginx}
localhost

[hub] {'base_url':base_url, 'keyspace':'salvus', 'local':'true'}
localhost {'id':'0', 'port':hub[0], 'proxy_port':hub[1]}
#localhost {'id':'1', 'port':hub[2], 'proxy_port':hub[3]}   # uncomment this to have 2 hubs, which improves testing of some features.

[snap] {'keyspace':'salvus', 'snap_interval':120, 'snap_dir':'/scratch/%s/snap'%os.environ['USER']}
localhost

[haproxy] {'sudo':False, 'base_url':base_url}
localhost {'insecure_testing_port':port, 'sitename':'localhost'}
