Skip to content

Commit

Permalink
Update Dockerfile and
Browse files Browse the repository at this point in the history
  • Loading branch information
xia0ben committed Jun 6, 2017
1 parent 1ab5e0d commit 5c684ad
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 77 deletions.
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Use an official openjdk base image
FROM ubuntu:latest

# Set the working directory to /app
WORKDIR /app

# Copy the application and its configuration files
COPY . /app

# Get all required packages and install the project
RUN apt-get update \
&& apt-get install -y git default-jre default-jdk maven \
&& rm -rf /var/lib/apt/lists/* \
&& cd /app \
&& mvn initialize \
&& mvn clean install -Pwithoccinterface

# Make ports 8080 (http) and 8180 (https) available to the world outside this container
EXPOSE 8080
EXPOSE 8180

# Start the MartServer
CMD cd org.occiware.mart.war && mvn jetty:run-war
35 changes: 21 additions & 14 deletions doc/server.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@

## Quickstart with Docker

If you have Docker installed (if not, you can find how to do so [here](https://docs.docker.com/engine/installation/)), and don't want to mess with your pre-existing dev environment, you may prefer to check [the Docker build and run process](../org.occiware.mart.jetty/README.md).
If you have Docker installed (if not, you can find how to do so [here](https://docs.docker.com/engine/installation/)), you may want to create a docker container. To do so, simply execute the following commands :

``` bash
sudo docker build -t mart-server .
sudo docker run -p 8080:8080 mart-server
```

You may now start to play with your MartServer instance through the OCCInterface : **http://localhost:8080/occinterface/**.

## Build the application
Go to the application's directory and then:
Expand All @@ -25,7 +32,7 @@ The file pom.xml declare them via the plugin maven-install-plugin, if you need t
Note that the server use Model@Runtime from Clouddesigner libs, if you have designed your extension model and developped your own connector, you may update the file pom.xml.

## Start the server

Launch the server with an embedded jetty :

Two options :
Expand All @@ -34,21 +41,21 @@ Two options :
mvn exec:java</code>
</pre>

You can launch the server with an embedded jetty using occinterface integration :
You can launch the server with an embedded jetty using occinterface integration :
<pre>
<code>mvn clean install -Pwithoccinterface
cd org.occiware.mart.war
mvn jetty:run-war</code>
</pre>

Launch the server with an embedded tomcat :
Launch the server with an embedded tomcat :
<pre>
<code>mvn clean install -Pwithoccinterface
cd org.occiware.mart.war
mvn tomcat7:run-war</code>
</pre>

The http address to occinterface is by default : <b>http://yourserver:port/occinterface/</b>
The http address to occinterface is by default : <b>http://yourserver:port/occinterface/</b>
For example : <b>http://localhost:8080/occinterface/</b>

You may have a result like this one for jetty :
Expand Down Expand Up @@ -105,16 +112,16 @@ By default the server accept configuration file with name martserver.config loca
/user_home_directory/martserver.config

For now there is 4 parameters :

- server.port=8080
Where the port is between 1 and 9999 a good pratice to set the port is to assume that all port before 1000 are not ok. So you can choose a port like 1001.

- server.log.directory=/logging/application/logs
The directory where are located the application logs.

- server.protocol=http
The protocol, <b>http</b> and <b>https</b> support will be plan in a near future.

- server.https.port=8181


Expand Down Expand Up @@ -144,14 +151,14 @@ Like this:
> Host: localhost:8080
> User-Agent: curl/7.43.0
> accept: application/json
>
>
< HTTP/1.1 200 OK
< Date: Sat, 05 Nov 2016 09:48:55 GMT
< Server: OCCIWare MART Server v1.0 OCCI/1.2
< Content-Type: application/occi+json
< Accept: text/occi;application/json;application/occi+json;text/plain
< Transfer-Encoding: chunked
<
<
{
"actions" : [ {
"scheme" : "http://schemas.ogf.org/occi/infrastructure/network/action#",
Expand All @@ -176,12 +183,12 @@ Like this:
},
"type" : "string"
}
},
},
"scheme" : "http://schemas.ogf.org/occi/infrastructure/compute/action#",
"term" : "stop",
"title" : "Stop the system (graceful, acpioff or poweroff)"
}, {
...
}, {
...
</code>
</pre>

Expand Down
2 changes: 2 additions & 0 deletions martserver.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
server.port=8080
server.https.port=8180
17 changes: 0 additions & 17 deletions org.occiware.mart.jetty/Dockerfile

This file was deleted.

31 changes: 0 additions & 31 deletions org.occiware.mart.jetty/README.md

This file was deleted.

2 changes: 0 additions & 2 deletions org.occiware.mart.jetty/martserver.config

This file was deleted.

13 changes: 0 additions & 13 deletions org.occiware.mart.jetty/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,6 @@
<mainClass>org.occiware.mart.jetty.MartServer</mainClass>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>org.occiware.mart.jetty.MartServer</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>

</build>
Expand Down

0 comments on commit 5c684ad

Please sign in to comment.