Upload
wouter-schoot
View
237
Download
0
Embed Size (px)
Citation preview
Jelastic Exception Twente08-10-2015Wouter Schoot
1
Even voorstellen...@WouterSchoot Sinds 2010 @ Oxilion "Disclaimer"
2
Programma Over Jelastic Wat kan Jelastic API Over Docker en Jelastic Live demo
Duurt ongeveer een half uur.
Vragen? Gerust tussendoor maar opsparen mag ook :-)
3
Wat is Jelastic Platform-as-a-Service
Sinds 2010, begonnen als "Java Elastic" Pay-as-you-grow Gebruikt containertechnologie van Parallels Rekent in cloudlets (100MHz / 128MB RAM) Automatisch schalen (horizontaal / verticaal) Eenvoudig deployen van je applicatie API
4
Ondersteuning voor talen Java
Via Glassfish, Tomcat, Jetty, e.d. PHP (5.3 t/m 5.6)
Via Apache (mod_php) of nginx (php-fpm) Python (2.7, 3.3 & 3.4) Node.JS (v0.10 & v0.12) Ruby MySQL/MariaDB/PostgreSQL (Mongo|Couch)DB, Memcached, Redis (.Net) Proxy/load balancing dmv Apache, Nginx, HA Proxy of Varnish
5
Containers
6
Autoscaling (verticaal)
7
Autoscaling (horizontaal)
8
Deployen & OTAP
Clonen van je environment
Incl. build/deploy tooling
9
Ook ondersteuning voor Linux VPS (Windows VPS) Docker
10
Docker binnen Jelastic Support aanwezig sinds maart 2015 Gebruik van eigen (private) Docker hub’s mogelijk Maakt een Jelastic environment van je docker image Koppel je Docker containers aan elkaar
11
Docker en Jelastic samen Live migration van Docker containers Verticaal schalen Volledig geïsoleerde containers Verdeling van Docker containers over het cluster voor zowel
performance als high availability Mogelijkheid tot het hibernaten van Docker containers bij rust
12
Verbinden
13
APIJelastic API follows REST principles. REST API determines a set of functions which can be requested by a developer, who then receives a response. The interaction is performed via HTTP protocol.
14
#!/usr/bin/pythonimport sys, string, requestsimport json, random, ConfigParser
config = ConfigParser.RawConfigParser()config.read('jelastic.ini')
jelastic_url = 'https://app.groundctrl.nl/1.0/'login_uri = 'users/authentication/rest/signin'login_url = jelastic_url + login_uriappid = '1dd8d191d38fff45e62564fcf67fdcd6'user = config.get('auth', 'username')password = config.get('auth', 'password')
data = { 'appid': appid, 'login': user, 'password': password}
r = requests.get(login_url, params=data)session = json.loads(r.text)[u'session']
create_env_url = 'environment/environment/rest/createenvironment'shortdomain = 'exceptiontwente-' + ''.join(random.choice(string.ascii_lowercase) for x in range(6))
15
nodes = [{ 'nodeType': 'apache2', 'extip': False, 'count': 2, 'fixedCloudlets': 2, 'flexibleCloudlets': 8},{ 'nodeType': 'mysql5', 'extip': False, 'count': 1, 'fixedCloudlets': 2, 'flexibleCloudlets': 8}]
env = { 'shortdomain': shortdomain, 'ishaenabled': False, 'engine': 'php5.6'}
params = { 'appid': appid, 'session': session, 'actionkey': 'createenv', 'env': json.dumps(env), 'nodes': json.dumps(nodes)}
16
print requests.get(jelastic_url + create_env_url, params=params).text
requests.get( jelastic_url + 'users/authentication/rest/signout', params={ 'appid': appid, 'session': session})
## Execute
$ ./create_env_apache_mysql.py | python -m json.tool{ "response": { "appid": "544c4a4e39dcb6c8221e914415fce4d0", "creatorAppid": "77047754c838ee6badea32b5afab1882", "date": "2015-10-07 02:37:04", "env": { "appid": "544c4a4e39dcb6c8221e914415fce4d0", "contexts": [], "creatorUid": 701, "domain": "exceptiontwente-delcde.groundctrl.nl", "engine": { "id": 28, "keyword": "php5.6", "name": "PHP 5.6", "type": "php", "vcsSupport": true, "version": "5.6.10"[[...]]
17
Live demo & probeer het uit!Registreer jezelf op https://app.groundctrl.nl
18