Search in sources :

Example 1 with Volume

use of mesosphere.marathon.client.model.v2.Volume in project pravega by pravega.

the class BookkeeperService method createBookieApp.

private App createBookieApp() {
    App app = new App();
    app.setId(this.id);
    app.setCpus(cpu);
    app.setMem(mem);
    app.setInstances(instances);
    app.setConstraints(setConstraint("hostname", "UNIQUE"));
    app.setContainer(new Container());
    app.getContainer().setType(CONTAINER_TYPE);
    app.getContainer().setDocker(new Docker());
    app.getContainer().getDocker().setImage(IMAGE_PATH + "/nautilus/bookkeeper:" + PRAVEGA_VERSION);
    Collection<Volume> volumeCollection = new ArrayList<>();
    volumeCollection.add(createVolume("/bk", "mnt", "RW"));
    // TODO: add persistent volume  (see issue https://github.com/pravega/pravega/issues/639)
    app.getContainer().setVolumes(volumeCollection);
    app.setPorts(Arrays.asList(BK_PORT));
    app.setRequirePorts(true);
    // set env
    String zk = zkUri.getHost() + ":" + ZKSERVICE_ZKPORT;
    Map<String, Object> map = new HashMap<>();
    map.put("ZK_URL", zk);
    map.put("ZK", zk);
    map.put("bookiePort", String.valueOf(BK_PORT));
    map.put("DLOG_EXTRA_OPTS", "-Xms512m");
    app.setEnv(map);
    // healthchecks
    List<HealthCheck> healthCheckList = new ArrayList<>();
    healthCheckList.add(setHealthCheck(300, "TCP", false, 60, 20, 0, BK_PORT));
    app.setHealthChecks(healthCheckList);
    return app;
}
Also used : App(mesosphere.marathon.client.model.v2.App) Container(mesosphere.marathon.client.model.v2.Container) Docker(mesosphere.marathon.client.model.v2.Docker) Volume(mesosphere.marathon.client.model.v2.Volume) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) HealthCheck(mesosphere.marathon.client.model.v2.HealthCheck)

Example 2 with Volume

use of mesosphere.marathon.client.model.v2.Volume in project pravega by pravega.

the class MarathonBasedService method createVolume.

Volume createVolume(final String containerPath, final String hostPath, final String mode) {
    LocalVolume v = new LocalVolume();
    v.setContainerPath(containerPath);
    v.setHostPath(hostPath);
    v.setMode(mode);
    return v;
}
Also used : LocalVolume(mesosphere.marathon.client.model.v2.LocalVolume)

Aggregations

ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 App (mesosphere.marathon.client.model.v2.App)1 Container (mesosphere.marathon.client.model.v2.Container)1 Docker (mesosphere.marathon.client.model.v2.Docker)1 HealthCheck (mesosphere.marathon.client.model.v2.HealthCheck)1 LocalVolume (mesosphere.marathon.client.model.v2.LocalVolume)1 Volume (mesosphere.marathon.client.model.v2.Volume)1