Skip to content

Commit

Permalink
Merge pull request #14 from kkrishna/master
Browse files Browse the repository at this point in the history
Here are the change list
  • Loading branch information
ridv authored Aug 9, 2016
2 parents 92c87df + 94bc499 commit 7cb13a4
Show file tree
Hide file tree
Showing 27 changed files with 1,201 additions and 983 deletions.
5 changes: 2 additions & 3 deletions docs/dev-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ Use the fat jar generated with all the dependencies.
> Marathon supports custom executor and you can specify a shell script (compose_executor.sh).
```
COMPOSE_JAR_NAME=<path to jar file>/docker-compose-executor-0.0.1-SNAPSHOT-jar-with-dependencies.jar
COMPOSE_CLASS_NAME=com.paypal.mesos.executor.App
java -cp ${COMPOSE_JAR_NAME} ${COMPOSE_CLASS_NAME}
COMPOSE_JAR_NAME=<path to jar file>/docker-compose-executor_0.0.1.jar
java -jar ${COMPOSE_JAR_NAME}
```
> Create a new marathon app
```
Expand Down
16 changes: 10 additions & 6 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,26 @@ Marathon
http://192.168.33.7:8080/
```

Create a marathon app
send a http post request to v2/apps
Create a marathon app by sending a JSON payload via HTTP to Marathon's app endpoint (192.168.33.7:8080/v2/apps)

```
{
"id": "docker-compose-demo",
"cmd": "echo hello world",
"cpus": 1.0,
"mem": 64.0,
"ports":[0,0,0],
"ports":[0],
"instances": 1,
"executor":"/home/vagrant/aurora/examples/vagrant/docker-compose-executor.sh",
"executor":"/vagrant/examples/vagrant/docker-compose-executor.sh",
"labels": {
"fileName": "web-app/docker-compose.yml"
"fileName": "sample-app/docker-compose.yml"
},
"uris":["https://dl.dropboxusercontent.com/u/26009359/web-app.zip"]
"uris":["https://dl.bintray.com/rdelvalle/mesos-compose-executor/sample-app.tar.gz"]
}
```

Using the curl command, a docker compose job can be created on Marathon as follows:
```
$ curl -H "Content-Type: application/json" -X POST -d '{"id":"docker-compose-demo","cmd":"echo hello world","cpus":1.0,"mem":64.0,"ports":[0],"instances":1,"executor":"/vagrant/examples/vagrant/docker-compose-executor.sh","labels":{"fileName":"sample-app/docker-compose.yml"},"uris":["https://dl.bintray.com/rdelvalle/mesos-compose-executor/sample-app.tar.gz"]}' http://192.168.33.7:8080/v2/apps
```

5 changes: 2 additions & 3 deletions examples/vagrant/docker-compose-executor.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
COMPOSE_JAR_NAME=/home/vagrant/marathon/target/docker-compose-executor-0.0.1-SNAPSHOT-jar-with-dependencies.jar
COMPOSE_CLASS_NAME=com.paypal.mesos.executor.App
java -cp ${COMPOSE_JAR_NAME} ${COMPOSE_CLASS_NAME}
COMPOSE_JAR_NAME=/home/vagrant/marathon/target/docker-compose-executor_0.0.1.jar
java -jar ${COMPOSE_JAR_NAME}
32 changes: 18 additions & 14 deletions examples/vagrant/provision-dev-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
echo deb https://apt.dockerproject.org/repo ubuntu-trusty main > /etc/apt/sources.list.d/docker.list
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E56151BF
echo deb http://repos.mesosphere.com/ubuntu trusty main > /etc/apt/sources.list.d/mesosphere.list

apt-get update -q --fix-missing
apt-get -qy install software-properties-common
Expand All @@ -37,7 +39,7 @@ apt-get -y install \
zookeeperd \
python-pip \
maven \
build-essential \
build-essential \
autoconf \
automake \
ca-certificates \
Expand Down Expand Up @@ -66,26 +68,26 @@ apt-get -y install \
update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java

readonly IP_ADDRESS=192.168.33.7

readonly MESOS_VERSION=0.25.0
readonly MESOS_VERSION=0.28.2-2.0.27
readonly MARATHON_VERSION=1.1.2-1.0.482


function install_mesos {
deb=mesos_${MESOS_VERSION}-0.2.70.ubuntu1404_amd64.deb
wget -c http://downloads.mesosphere.io/master/ubuntu/14.04/$deb
dpkg --install $deb
}
apt-get -y install mesos=${MESOS_VERSION}.ubuntu1404
}

function install_marathon {
sudo pip install docker-compose
sudo dpkg --purge marathon
wget -c https://dl.dropboxusercontent.com/u/26009359/marathon_0.11.1-1.0.432.ubuntu1404_amd64.deb
sudo dpkg --install marathon_0.11.1-1.0.432.ubuntu1404_amd64.deb
apt-get -y install marathon=${MARATHON_VERSION}.ubuntu1404
}

function install_docker_compose {
pip install docker-compose
}


function build_docker_compose_executor {
sudo mvn -f /home/vagrant/marathon/pom.xml clean package -U
sudo chmod 777 /home/vagrant/marathon/target/docker-compose-executor-0.0.1-SNAPSHOT-jar-with-dependencies.jar
mvn -f /home/vagrant/marathon/pom.xml clean package -U
chmod 777 /home/vagrant/marathon/target/docker-compose-executor_0.0.1.jar
}

function install_cluster_config {
Expand Down Expand Up @@ -148,6 +150,8 @@ EOF
}

install_mesos
install_marathon
install_docker_compose
prepare_sources
install_marathon
install_cluster_config
Expand Down
130 changes: 0 additions & 130 deletions examples/vagrant/provision-dev-cluster.sh_bak

This file was deleted.

60 changes: 28 additions & 32 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,60 +3,49 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.paypal.mesos</groupId>
<artifactId>docker-compose-executor</artifactId>
<version>0.0.1-SNAPSHOT</version>

<version>0.0.1</version>
<dependencies>

<dependency>
<groupId>org.apache.mesos</groupId>
<artifactId>mesos</artifactId>
<version>0.24.1</version>
<version>0.28.2</version>
</dependency>


<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>

<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>2.5.0</version>
</dependency>

<dependency>
<groupId>com.google.dagger</groupId>
<artifactId>dagger</artifactId>
<version>2.0</version>
</dependency>

<dependency>
<groupId>com.google.dagger</groupId>
<artifactId>dagger-compiler</artifactId>
<version>2.0</version>
<optional>true</optional>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.0</version>
</dependency>

<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.5</version>
</dependency>

<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.3.1</version>
</dependency>

<dependency>
<groupId>io.reactivex</groupId>
<artifactId>rxjava</artifactId>
Expand All @@ -67,18 +56,24 @@
<artifactId>commons-exec</artifactId>
<version>1.3</version>
</dependency>

<dependency>
<groupId>ro.fortsoft.pf4j</groupId>
<artifactId>pf4j</artifactId>
<version>0.13.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>




<build>
<outputDirectory>bin/classes</outputDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<version>3.5.1</version>
<dependencies>
<dependency>
<groupId>com.google.dagger</groupId>
Expand All @@ -95,11 +90,19 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.paypal.mesos.executor.App</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>

</descriptorRefs>
<finalName>docker-compose-executor_${project.version}</finalName>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<executions>
<execution>
Expand All @@ -113,17 +116,10 @@
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.paypal.mesos.executor.App</mainClass>
</manifest>
</archive>
</configuration>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
</plugins>
</plugins>
<finalName>${project.artifactId}_${project.version}</finalName>
</build>

</project>
Loading

0 comments on commit 7cb13a4

Please sign in to comment.