Running Eureka under Jetty

369 views
Skip to first unread message

daniel....@gmail.com

unread,
Jun 6, 2013, 8:41:54 PM6/6/13
to eureka_...@googlegroups.com
Hi,

I'm at the point where I can build and deploy eureka in tomcat, run the demo, etc.
I wanted to wrap up my progress into a maven project so that it is easier than building, copying, etc, and other people will have it easier.
In my maven project I chose to use jetty-maven-plugin instead of tomcat because I am more familiar with it - I have tried tomcat6-maven-plugin but I haven't gotten it to work at all.
When I do a mvn clean install jetty:run in jetty I see that the server and client are working; again, I can run the demo with this.
However, my problem is I cannot view the page at http://localhost/eureka/
http://localhost/eureka/v2/apps/ returns an xml file, looks fine.
Would you happen to have any ideas on how I can get this page working with the below setup (tomcat plugin would be fine too)?
Sorry, I realize this might not have anything to do with Eureka and more to do with jetty/tomcat, but if we get this working then feel free to use it.

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<eureka.port>80</eureka.port>
<eureka.hostname>localhost</eureka.hostname>
<eureka.protocol>http://</eureka.protocol>
<eureka.baseUri>eureka/v2/</eureka.baseUri>
<eureka.serviceUrl.default>${eureka.protocol}${eureka.hostname}:${eureka.port}/${eureka.baseUri}</eureka.serviceUrl.default>
<eureka.version>1.1.97</eureka.version>
</properties>

<build>
<finalName>eureka-test-server</finalName>
<plugins>
<!-- <plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat6-maven-plugin</artifactId>
<version>2.1</version>
<configuration>
<warFile>${project.build.directory}/dependency-wars/eureka-server.war</warFile>
<path>/</path>
<port>${eureka.port}</port>
</configuration>
</plugin> -->
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<configuration>
<systemProperties>
<systemProperty>
<name>eureka.port</name>
<value>${eureka.port}</value>
</systemProperty>
<systemProperty>
<name>eureka.serviceUrl.default</name>
<value>${eureka.serviceUrl.default}</value>
</systemProperty>
<systemProperty>
<name>eureka.serviceUrl.defaultZone</name>
<value>${eureka.serviceUrl.default}</value>
</systemProperty>
<systemProperty>
<name>eureka.serviceUrl.default.defaultZone</name>
<value>${eureka.serviceUrl.default}</value>
</systemProperty>
</systemProperties>
<connectors>
<connector
implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
<port>${eureka.port}</port>
<maxIdleTime>60000</maxIdleTime>
</connector>
</connectors>
<webApp>
<contextPath>/</contextPath>
</webApp>
<contextHandlers>
<contextHandler implementation="org.eclipse.jetty.webapp.WebAppContext">
<war>${project.build.directory}/dependency-wars/eureka-server.war</war>
<contextPath>/eureka</contextPath>
</contextHandler>
</contextHandlers>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-eureka-server</id>
<phase>initialize</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/dependency-wars</outputDirectory>
<artifactItems>
<artifactItem>
<groupId>com.netflix.eureka</groupId>
<artifactId>eureka-server</artifactId>
<version>${eureka.version}</version>
<type>war</type>
<overWrite>true</overWrite>
<destFileName>eureka-server.war</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Justin Ryan

unread,
Jun 7, 2013, 12:09:18 AM6/7/13
to eureka_...@googlegroups.com
Did you investigate adding the following line to the build.gradle file:


apply plugin: 'jetty'

Gradle has a built-in jetty execution similar to Maven's jetty-maven-plugin. It requires a lot less XML, and since it could be part of the existing Eureka build system, there's less to setup. It's documentation can be found here: http://www.gradle.org/docs/current/userguide/jetty_plugin.html



--
You received this message because you are subscribed to the Google Groups "eureka_netflix" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eureka_netfli...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



daniel....@gmail.com

unread,
Jun 10, 2013, 1:01:16 PM6/10/13
to eureka_...@googlegroups.com
My problem with that is I don't want to build with gradle, because I'm behind a proxy at work and so gradle failed to install. Even if there's a way to set the proxy that gradle uses, I have learned not to trust doing anything through proxy. Also, more simply, I would prefer to skip the build step and download the maven artifact from nexus. Lastly, I could still run into the same problem with the gradle jetty plugin as with jetty-maven-plugin.
Reply all
Reply to author
Forward
0 new messages