you and your containers: strumenti di automazione in cloud - gabriele provinciali, fabrizio marini...

14
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | You and your containers: strumenti di automazione in Cloud Fabrizio Marini & Gabriele Provinciali ROME 24-25 MARCH 2017

Upload: codemotion

Post on 05-Apr-2017

22 views

Category:

Technology


0 download

TRANSCRIPT

Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |

You and your containers: strumenti di automazione in Cloud

Fabrizio Marini & Gabriele Provinciali

ROME 24-25 MARCH 2017

Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |

• Da Maggio 2006:– 256 gare portate a termine

– Run, Triathlon, Swim, Bike• 18 - Marathon– 42,195km - Personal Best 3h:21:11

• 60 - Half Marathon – 21,097km - Personal Best 1h:28:46

• 03 - Half Ironman– 1,9km swim + 90km bike + 21,097km run– Personal Best 5h:37:59

• "We all have dreams. But in order to make dreams come into reality, it takes an awful lot of determination, dedication, self-discipline, and effort.“ - Jesse Owens

Qualcosa su di me ...

April 1996 – February 2003Founder / Owner / Partner

February 2003 - December 2008Systems Engineer Principal

December 2008 – TodayMaster Principal Sales Consultant

www.linkedin.com/in/fabriziomarini

www.fabriziomarini.com

Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |

Cosa hanno in comune?

Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |

Maven & “UBER” Jar

<dependency> <groupId>fish.payara.extras</groupId> <artifactId>payara-micro</artifactId> <version>4.1.152.1</version> <type>jar</type></dependency>

<dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-core</artifactId> <version>${tomcat.version}</version> </dependency>

Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |

Si ... ma che devo fare?• mvn archetype:generate -DarchetypeArtifactId=maven-archetype-webapp -

DarchetypeGroupId=org.apache.maven.archetypes -DinteractiveMode=false -DgroupId=com.example.codemotion -DartifactId=codemotion-app -DarchetypeVersion=1.0• mvn clean compile• mvn package• java -jar codemotion-app-1.0-SNAPSHOT-jar-with-dependencies.jar

Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |

Esempio di Main per lo Uber Jar di Tomcat Embeddedpublic class Main {

public static final Optional<String> PORT = Optional.ofNullable(System.getenv("PORT"));

public static final Optional<String> HOSTNAME = Optional.ofNullable(System.getenv("HOSTNAME"));

public static void main(String[] args) throws Exception {

String contextPath = "/" ;

String appBase = ".";

Tomcat tomcat = new Tomcat();

tomcat.setPort(Integer.valueOf(PORT.orElse("8080") ));

tomcat.setHostname(HOSTNAME.orElse("localhost"));

tomcat.getHost().setAppBase(appBase);

tomcat.addWebapp(contextPath, appBase);

tomcat.start();

tomcat.getServer().await();

}

}

Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |

Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |

Ok in locale ... ma nel “Cloud” come si fa?

• Devo creare un container• Imparare come accederci ... magari in ssh• Configurarlo• Installare un JDK• Impostare variabili ambientali (i.e Port)• Caricare e far partire l’applicazione• Impostare un indirizzo pubblico• Impostare un bilanciatore• Avere la possibilità di scalare ed aggiungere nodi e ram

Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |

Oracle Application Container Cloud Services - ACCS• 1° Click scelgo il tipo di container (java, Node.js, PHP ...)

Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |

Oracle Application Container Cloud Services - ACCS• 2° Click faccio l’upload di uno zip che contiene Uber Jar + manifest.json

{ "runtime":{ "majorVersion": "8" }, "command": "java -jar codemotion.jar", "release": { "build": "1", "commit": "1", "version": "1" }, "notes": “Codemotion demo" }

Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |

Oracle Application Container Cloud Services - ACCS• Aspetto e poi provo il tutto cliccando sul link pubblico che mi viene fornito ...

Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |

Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |

Non ho maltrattato HW per preparare questa Demo

https://developer.oracle.com/

https://cloud.oracle.com/tryit