diff --git a/.gitignore b/.gitignore index 5f19aaf..7c4bc8d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,45 @@ *.class -.classpath -.project + +### Eclipse template +*.pydevproject +.metadata +.gradle +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties .settings/ +.loadpath + +# Eclipse Core +.project + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# CDT-specific +.cproject + +# JDT-specific (Eclipse Java Development Tools) +.classpath + +# Java annotation processor (APT) +.factorypath + +# PDT-specific +.buildpath + +# sbteclipse plugin +.target + +# TeXlipse plugin +.texlipse target/ @@ -23,3 +61,51 @@ desktop.ini # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* +### JetBrains template +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio + +*.iml + +## Directory-based project format: +.idea/ +# if you remove the above rule, at least ignore the following: + +# User-specific stuff: +# .idea/workspace.xml +# .idea/tasks.xml +# .idea/dictionaries + +# Sensitive or high-churn files: +# .idea/dataSources.ids +# .idea/dataSources.xml +# .idea/sqlDataSources.xml +# .idea/dynamic.xml +# .idea/uiDesigner.xml + +# Gradle: +# .idea/gradle.xml +# .idea/libraries + +# Mongo Explorer plugin: +# .idea/mongoSettings.xml + +## File-based project format: +*.ipr +*.iws + +## Plugin-specific files: + +# IntelliJ +/out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties + diff --git a/README.md b/README.md index 832cfbe..97fbec5 100644 --- a/README.md +++ b/README.md @@ -20,18 +20,44 @@ You may find it easier to view the different applications by running them from a To do this, open three CMD windows (Windows) or three Terminal windows (MacOS, Linux) and arrange so you can view them conveniently. - 1. In each window, change to the directory where you cloned the demo. + 1. In each window, change to the directory where you cloned the demo and then to the folder containing the relevant service. 1. In the first window, build the application using `mvn clean package` - 1. In the same window run: `java -jar target/microservice-demo-0.0.1-SNAPSHOT.jar registration` - 1. Switch to the second window and run: `java -jar target/microservice-demo-0.0.1-SNAPSHOT.jar accounts` - 1. In the third window run: `java -jar target/microservice-demo-0.0.1-SNAPSHOT.jar web` + 1. In the same window run: `spring-boot:run` + 1. Switch to the second window and run: `spring-boot:run` + 1. In the third window run: `spring-boot:run` 1. In your favorite browser open the same two links: [http://localhost:1111](http://localhost:1111) and [http://localhost:3333](http://localhost:3333) You should see servers being registered in the log output of the first (registration) window. As you interact you should logging in the second and third windows. - 1. In a new window, run up a second account-server using HTTP port 2223: - * `java -jar target/microservice-demo-0.0.1-SNAPSHOT.jar accounts 2223` - 1. Allow it to register itself - 1. Kill the first account-server and see the web-server switch to using the new account-server - no loss of service. +## Using Docker +You may want to run the services in Docker containers. The following instructions will help you run the demo using three containers on a single host: +To use this instructions you should have docker installed and a host running the Docker deamon. + +- change directory to the root directory of the project +- run `mvn clean package` + +Step 1 - build the docker images: +- to create the image for the discovery service run: `docker build -t spring-cloud-demo-discovery discovery-service` +- to create the image for the account service run: `docker build -t spring-cloud-demo-account account-service` +- to create the image for the web service run: `docker build -t spring-cloud-demo-web web-service` + +Step 2 - create a network for the containers +- run: `docker network create spring-cloud-demo` + +Step 3 - run the containers: +In 3 different terminal windows run the following commands +- to run the container for the discovery service run: `docker run -it --net=spring-cloud-demo -p 1111:1111 --name discovery --hostname=discovery spring-cloud-demo-discovery` +- to run the container for the account service run: `docker run -it --net=spring-cloud-demo --name account --hostname=account spring-cloud-demo-account` +- to run the container for the web service run: `docker run -it --net=spring-cloud-demo -p 80:3333 --name web --hostname=web spring-cloud-demo-web` + +Step 4 - use the application using your browser: +- find the ip of the host machine. to do so type `docker-machine ls` and find the ip of the host you are using. +- browse [http://your-host-ip](http://your-host-ip) to access the web service +- browse [http://your-host-ip:1111](http://your-host-ip:1111) to access the discovery service console + +Step 5 - run another account service and check the load balancing and failover: +- to run the container for the account service run: `docker run -it --net=spring-cloud-demo --name account-2 --hostname=account-2 spring-cloud-demo-account` +- browse [http://your-host-ip](http://your-host-ip) to access the web service +- browse [http://your-host-ip:1111](http://your-host-ip:1111) to access the discovery service console diff --git a/account-service/Dockerfile b/account-service/Dockerfile new file mode 100644 index 0000000..7b5b7c2 --- /dev/null +++ b/account-service/Dockerfile @@ -0,0 +1,4 @@ +FROM java:8 +COPY target/microservice-demo-accounts-0.0.1-SNAPSHOT.jar /usr/src/microservice-demo-accounts-0.0.1-SNAPSHOT.jar +WORKDIR /usr/src +CMD java -jar -Dspring.profiles.active=docker microservice-demo-accounts-0.0.1-SNAPSHOT.jar \ No newline at end of file diff --git a/account-service/pom.xml b/account-service/pom.xml new file mode 100644 index 0000000..d0857c9 --- /dev/null +++ b/account-service/pom.xml @@ -0,0 +1,61 @@ + + 4.0.0 + org.springframework.samples.service.service + microservice-demo-accounts + 0.0.1-SNAPSHOT + jar + + + org.springframework.samples.service.service + microservice-demo-parent + 0.0.1-SNAPSHOT + + + + io.pivotal.microservices.services.accounts.AccountsServer + + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + + + org.springframework.data + spring-data-commons + + + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + + + org.hsqldb + hsqldb + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + + diff --git a/src/main/java/io/pivotal/microservices/accounts/Account.java b/account-service/src/main/java/io/pivotal/microservices/accounts/Account.java similarity index 100% rename from src/main/java/io/pivotal/microservices/accounts/Account.java rename to account-service/src/main/java/io/pivotal/microservices/accounts/Account.java diff --git a/src/main/java/io/pivotal/microservices/accounts/AccountNotFoundException.java b/account-service/src/main/java/io/pivotal/microservices/accounts/AccountNotFoundException.java similarity index 100% rename from src/main/java/io/pivotal/microservices/accounts/AccountNotFoundException.java rename to account-service/src/main/java/io/pivotal/microservices/accounts/AccountNotFoundException.java diff --git a/src/main/java/io/pivotal/microservices/accounts/AccountRepository.java b/account-service/src/main/java/io/pivotal/microservices/accounts/AccountRepository.java similarity index 100% rename from src/main/java/io/pivotal/microservices/accounts/AccountRepository.java rename to account-service/src/main/java/io/pivotal/microservices/accounts/AccountRepository.java diff --git a/src/main/java/io/pivotal/microservices/accounts/AccountsController.java b/account-service/src/main/java/io/pivotal/microservices/accounts/AccountsController.java similarity index 100% rename from src/main/java/io/pivotal/microservices/accounts/AccountsController.java rename to account-service/src/main/java/io/pivotal/microservices/accounts/AccountsController.java diff --git a/src/main/java/io/pivotal/microservices/accounts/AccountsWebApplication.java b/account-service/src/main/java/io/pivotal/microservices/accounts/AccountsWebApplication.java similarity index 100% rename from src/main/java/io/pivotal/microservices/accounts/AccountsWebApplication.java rename to account-service/src/main/java/io/pivotal/microservices/accounts/AccountsWebApplication.java diff --git a/src/main/java/io/pivotal/microservices/accounts/HomeController.java b/account-service/src/main/java/io/pivotal/microservices/accounts/HomeController.java similarity index 100% rename from src/main/java/io/pivotal/microservices/accounts/HomeController.java rename to account-service/src/main/java/io/pivotal/microservices/accounts/HomeController.java diff --git a/src/main/java/io/pivotal/microservices/services/accounts/AccountsServer.java b/account-service/src/main/java/io/pivotal/microservices/services/accounts/AccountsServer.java similarity index 100% rename from src/main/java/io/pivotal/microservices/services/accounts/AccountsServer.java rename to account-service/src/main/java/io/pivotal/microservices/services/accounts/AccountsServer.java diff --git a/src/main/resources/accounts-server.yml b/account-service/src/main/resources/accounts-server.yml similarity index 80% rename from src/main/resources/accounts-server.yml rename to account-service/src/main/resources/accounts-server.yml index 8db91d0..ab705eb 100644 --- a/src/main/resources/accounts-server.yml +++ b/account-service/src/main/resources/accounts-server.yml @@ -2,8 +2,6 @@ spring: application: name: accounts-service # Service registers under this name - freemarker: - enabled: false # Ignore Eureka dashboard FreeMarker templates thymeleaf: cache: false # Allow Thymeleaf templates to be reloaded at runtime prefix: classpath:/accounts-server/templates/ # Trailing / mandatory @@ -22,6 +20,17 @@ eureka: # HTTP Server server: port: 2222 # HTTP (Tomcat) port + + + +--- +spring: + profiles: docker +# Discovery Server Access +eureka: + client: + serviceUrl: + defaultZone: http://discovery:1111/eureka/ diff --git a/src/main/resources/accounts-server/templates/error.html b/account-service/src/main/resources/accounts-server/templates/error.html similarity index 100% rename from src/main/resources/accounts-server/templates/error.html rename to account-service/src/main/resources/accounts-server/templates/error.html diff --git a/src/main/resources/accounts-server/templates/footer.html b/account-service/src/main/resources/accounts-server/templates/footer.html similarity index 100% rename from src/main/resources/accounts-server/templates/footer.html rename to account-service/src/main/resources/accounts-server/templates/footer.html diff --git a/src/main/resources/accounts-server/templates/header.html b/account-service/src/main/resources/accounts-server/templates/header.html similarity index 100% rename from src/main/resources/accounts-server/templates/header.html rename to account-service/src/main/resources/accounts-server/templates/header.html diff --git a/src/main/resources/accounts-server/templates/index.html b/account-service/src/main/resources/accounts-server/templates/index.html similarity index 100% rename from src/main/resources/accounts-server/templates/index.html rename to account-service/src/main/resources/accounts-server/templates/index.html diff --git a/src/main/resources/db-config.properties b/account-service/src/main/resources/db-config.properties similarity index 100% rename from src/main/resources/db-config.properties rename to account-service/src/main/resources/db-config.properties diff --git a/src/main/resources/logback.xml b/account-service/src/main/resources/logback.xml similarity index 100% rename from src/main/resources/logback.xml rename to account-service/src/main/resources/logback.xml diff --git a/src/main/resources/public/extlink.png b/account-service/src/main/resources/public/extlink.png similarity index 100% rename from src/main/resources/public/extlink.png rename to account-service/src/main/resources/public/extlink.png diff --git a/src/main/resources/public/pivotal-logo-600.png b/account-service/src/main/resources/public/pivotal-logo-600.png similarity index 100% rename from src/main/resources/public/pivotal-logo-600.png rename to account-service/src/main/resources/public/pivotal-logo-600.png diff --git a/src/main/resources/public/pws-header-logo_new.png b/account-service/src/main/resources/public/pws-header-logo_new.png similarity index 100% rename from src/main/resources/public/pws-header-logo_new.png rename to account-service/src/main/resources/public/pws-header-logo_new.png diff --git a/src/main/resources/public/spring-trans.png b/account-service/src/main/resources/public/spring-trans.png similarity index 100% rename from src/main/resources/public/spring-trans.png rename to account-service/src/main/resources/public/spring-trans.png diff --git a/src/main/resources/public/styles.css b/account-service/src/main/resources/public/styles.css similarity index 100% rename from src/main/resources/public/styles.css rename to account-service/src/main/resources/public/styles.css diff --git a/src/main/resources/testdb/data.sql b/account-service/src/main/resources/testdb/data.sql similarity index 100% rename from src/main/resources/testdb/data.sql rename to account-service/src/main/resources/testdb/data.sql diff --git a/src/main/resources/testdb/schema.sql b/account-service/src/main/resources/testdb/schema.sql similarity index 100% rename from src/main/resources/testdb/schema.sql rename to account-service/src/main/resources/testdb/schema.sql diff --git a/src/test/java/io/pivotal/microservices/accounts/AbstractAccountControllerTests.java b/account-service/src/test/java/io/pivotal/microservices/accounts/AbstractAccountControllerTests.java similarity index 100% rename from src/test/java/io/pivotal/microservices/accounts/AbstractAccountControllerTests.java rename to account-service/src/test/java/io/pivotal/microservices/accounts/AbstractAccountControllerTests.java diff --git a/src/test/java/io/pivotal/microservices/accounts/AccountsControllerIntegrationTests.java b/account-service/src/test/java/io/pivotal/microservices/accounts/AccountsControllerIntegrationTests.java similarity index 100% rename from src/test/java/io/pivotal/microservices/accounts/AccountsControllerIntegrationTests.java rename to account-service/src/test/java/io/pivotal/microservices/accounts/AccountsControllerIntegrationTests.java diff --git a/src/test/java/io/pivotal/microservices/accounts/AccountsControllerTests.java b/account-service/src/test/java/io/pivotal/microservices/accounts/AccountsControllerTests.java similarity index 100% rename from src/test/java/io/pivotal/microservices/accounts/AccountsControllerTests.java rename to account-service/src/test/java/io/pivotal/microservices/accounts/AccountsControllerTests.java diff --git a/discovery-service/Dockerfile b/discovery-service/Dockerfile new file mode 100644 index 0000000..181538c --- /dev/null +++ b/discovery-service/Dockerfile @@ -0,0 +1,4 @@ +FROM java:8 +COPY target/microservice-demo-discovery-0.0.1-SNAPSHOT.jar /usr/src/microservice-demo-discovery-0.0.1-SNAPSHOT.jar +WORKDIR /usr/src +CMD java -jar microservice-demo-discovery-0.0.1-SNAPSHOT.jar \ No newline at end of file diff --git a/discovery-service/pom.xml b/discovery-service/pom.xml new file mode 100644 index 0000000..dd9320d --- /dev/null +++ b/discovery-service/pom.xml @@ -0,0 +1,19 @@ + + 4.0.0 + org.springframework.samples.service.service + microservice-demo-discovery + 0.0.1-SNAPSHOT + jar + + + org.springframework.samples.service.service + microservice-demo-parent + 0.0.1-SNAPSHOT + + + + io.pivotal.microservices.services.registration.RegistrationServer + + + diff --git a/discovery-service/src/main/java/io/pivotal/microservices/services/Main.java b/discovery-service/src/main/java/io/pivotal/microservices/services/Main.java new file mode 100644 index 0000000..afb5525 --- /dev/null +++ b/discovery-service/src/main/java/io/pivotal/microservices/services/Main.java @@ -0,0 +1,33 @@ +package io.pivotal.microservices.services; + + +import io.pivotal.microservices.services.registration.RegistrationServer; + + +import org.springframework.boot.SpringApplication; + +/** + * Allow the servers to be invoke from the command-line. The jar is built with + * this as the Main-Class in the jar's MANIFEST.MF. + * + * @author Paul Chapman + */ +public class Main { + + public static void main(String[] args) { + + if (args.length > 0) + System.setProperty("server.port", args[1]); + + + SpringApplication.run(RegistrationServer.class, args); + + + } + + protected static void usage() { + System.out.println("Usage: java -jar ... [server-port]"); + System.out.println(" where server-name is 'registration', " + + "'accounts' or 'web' and server-port > 1024"); + } +} diff --git a/src/main/java/io/pivotal/microservices/services/registration/RegistrationServer.java b/discovery-service/src/main/java/io/pivotal/microservices/services/registration/RegistrationServer.java similarity index 100% rename from src/main/java/io/pivotal/microservices/services/registration/RegistrationServer.java rename to discovery-service/src/main/java/io/pivotal/microservices/services/registration/RegistrationServer.java diff --git a/discovery-service/src/main/resources/logback.xml b/discovery-service/src/main/resources/logback.xml new file mode 100644 index 0000000..b07aea8 --- /dev/null +++ b/discovery-service/src/main/resources/logback.xml @@ -0,0 +1,26 @@ + + + + + + true + + + + + + + + ${PID}: %-5level %logger{0} - %msg%n + + + + + + + + + + + diff --git a/discovery-service/src/main/resources/public/extlink.png b/discovery-service/src/main/resources/public/extlink.png new file mode 100644 index 0000000..aff0446 Binary files /dev/null and b/discovery-service/src/main/resources/public/extlink.png differ diff --git a/discovery-service/src/main/resources/public/pivotal-logo-600.png b/discovery-service/src/main/resources/public/pivotal-logo-600.png new file mode 100644 index 0000000..8b2593d Binary files /dev/null and b/discovery-service/src/main/resources/public/pivotal-logo-600.png differ diff --git a/discovery-service/src/main/resources/public/pws-header-logo_new.png b/discovery-service/src/main/resources/public/pws-header-logo_new.png new file mode 100644 index 0000000..ce35f11 Binary files /dev/null and b/discovery-service/src/main/resources/public/pws-header-logo_new.png differ diff --git a/discovery-service/src/main/resources/public/spring-trans.png b/discovery-service/src/main/resources/public/spring-trans.png new file mode 100644 index 0000000..bdb7792 Binary files /dev/null and b/discovery-service/src/main/resources/public/spring-trans.png differ diff --git a/discovery-service/src/main/resources/public/styles.css b/discovery-service/src/main/resources/public/styles.css new file mode 100644 index 0000000..55553cd --- /dev/null +++ b/discovery-service/src/main/resources/public/styles.css @@ -0,0 +1,39 @@ +/* - - - - - - - - - - - * + Local Styles + * - - - - - - - - - - - */ + +body { + font-family: helvetica; + font-size: 13pt; +} + +.navbar, .navbar > a { + font-family: helvetica; + font-size: 15pt; +} + +ul.openlist li { + margin-bottom: 1em; +} + +a { + font-family: helvetica; +} + +code { + background-color: white; + border-radius: 0px; + color: #80A080; + font-size: 100%; + font-family: monospace; + padding: 0px; + white-space: nowrap; +} + +footer { + margin-top: 3em; + border-top: 1px black solid; + text-align: center; + color:#6DB33F; /* Spring Green */ + font-style: italic; +} \ No newline at end of file diff --git a/src/main/resources/registration-server.yml b/discovery-service/src/main/resources/registration-server.yml similarity index 62% rename from src/main/resources/registration-server.yml rename to discovery-service/src/main/resources/registration-server.yml index 41de252..31485db 100644 --- a/src/main/resources/registration-server.yml +++ b/discovery-service/src/main/resources/registration-server.yml @@ -9,7 +9,3 @@ eureka: server: port: 1111 # HTTP (Tomcat) port -# Discovery Server Dashboard uses FreeMarker. Don't want Thymeleaf templates -spring: - thymeleaf: - enabled: false # Disable Thymeleaf \ No newline at end of file diff --git a/pom.xml b/pom.xml index 27f7dc4..b60307a 100644 --- a/pom.xml +++ b/pom.xml @@ -2,20 +2,22 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.springframework.samples.service.service - microservice-demo + microservice-demo-parent 0.0.1-SNAPSHOT - jar + pom org.springframework.cloud spring-cloud-starter-parent Angel.SR3 + + + web-service + discovery-service + account-service + - - - io.pivotal.microservices.services.Main - @@ -35,11 +37,6 @@ spring-boot-starter-thymeleaf - - - org.springframework.data - spring-data-commons - @@ -47,17 +44,6 @@ spring-boot-starter-test - - - org.springframework.boot - spring-boot-starter-data-jpa - - - - - org.hsqldb - hsqldb - @@ -65,12 +51,13 @@ spring-cloud-starter + - + org.springframework.cloud spring-cloud-starter-eureka-server - + diff --git a/src/main/java/io/pivotal/microservices/services/Main.java b/src/main/java/io/pivotal/microservices/services/Main.java deleted file mode 100644 index 38d452a..0000000 --- a/src/main/java/io/pivotal/microservices/services/Main.java +++ /dev/null @@ -1,58 +0,0 @@ -package io.pivotal.microservices.services; - -import io.pivotal.microservices.services.accounts.AccountsServer; -import io.pivotal.microservices.services.registration.RegistrationServer; -import io.pivotal.microservices.services.web.WebServer; - -import org.springframework.boot.SpringApplication; - -/** - * Allow the servers to be invoke from the command-line. The jar is built with - * this as the Main-Class in the jar's MANIFEST.MF. - * - * @author Paul Chapman - */ -public class Main { - - public static void main(String[] args) { - - String serverName = "NO-VALUE"; - - switch (args.length) { - case 2: - // Optionally set the HTTP port to listen on, overrides - // value in the -server.yml file - System.setProperty("server.port", args[1]); - // Fall through into .. - - case 1: - serverName = args[0].toLowerCase(); - break; - - default: - usage(); - return; - } - - // Tell server to look for -server.properties or - // -server.yml (this app. uses YAML) - System.setProperty("spring.config.name", serverName + "-server"); - - if (serverName.equals("registration")) { - SpringApplication.run(RegistrationServer.class, args); - } else if (serverName.equals("accounts")) { - SpringApplication.run(AccountsServer.class, args); - } else if (serverName.equals("web")) { - SpringApplication.run(WebServer.class, args); - } else { - System.out.println("Unknown server type: " + serverName); - usage(); - } - } - - protected static void usage() { - System.out.println("Usage: java -jar ... [server-port]"); - System.out.println(" where server-name is 'registration', " - + "'accounts' or 'web' and server-port > 1024"); - } -} diff --git a/web-service/Dockerfile b/web-service/Dockerfile new file mode 100644 index 0000000..1bb2cdc --- /dev/null +++ b/web-service/Dockerfile @@ -0,0 +1,4 @@ +FROM java:8 +COPY target/microservice-demo-web-0.0.1-SNAPSHOT.jar /usr/src/microservice-demo-web-0.0.1-SNAPSHOT.jar +WORKDIR /usr/src +CMD java -jar -Dspring.profiles.active=docker microservice-demo-web-0.0.1-SNAPSHOT.jar \ No newline at end of file diff --git a/web-service/pom.xml b/web-service/pom.xml new file mode 100644 index 0000000..f90e4b3 --- /dev/null +++ b/web-service/pom.xml @@ -0,0 +1,19 @@ + + 4.0.0 + org.springframework.samples.service.service + microservice-demo-web + 0.0.1-SNAPSHOT + jar + + + org.springframework.samples.service.service + microservice-demo-parent + 0.0.1-SNAPSHOT + + + + io.pivotal.microservices.services.web.WebServer + + + diff --git a/web-service/src/main/java/io/pivotal/microservices/services/Main.java b/web-service/src/main/java/io/pivotal/microservices/services/Main.java new file mode 100644 index 0000000..9b444a5 --- /dev/null +++ b/web-service/src/main/java/io/pivotal/microservices/services/Main.java @@ -0,0 +1,29 @@ +package io.pivotal.microservices.services; + + +import io.pivotal.microservices.services.web.WebServer; + +import org.springframework.boot.SpringApplication; + +/** + * Allow the servers to be invoke from the command-line. The jar is built with + * this as the Main-Class in the jar's MANIFEST.MF. + * + * @author Paul Chapman + */ +public class Main { + + public static void main(String[] args) { + + if (args.length > 0) + System.setProperty("server.port", args[1]); + + + SpringApplication.run(WebServer.class, args); + + } + + protected static void usage() { + System.out.println("Usage: java -jar ... [server-port]"); + } +} diff --git a/src/main/java/io/pivotal/microservices/services/web/Account.java b/web-service/src/main/java/io/pivotal/microservices/services/web/Account.java similarity index 100% rename from src/main/java/io/pivotal/microservices/services/web/Account.java rename to web-service/src/main/java/io/pivotal/microservices/services/web/Account.java diff --git a/src/main/java/io/pivotal/microservices/services/web/HomeController.java b/web-service/src/main/java/io/pivotal/microservices/services/web/HomeController.java similarity index 100% rename from src/main/java/io/pivotal/microservices/services/web/HomeController.java rename to web-service/src/main/java/io/pivotal/microservices/services/web/HomeController.java diff --git a/src/main/java/io/pivotal/microservices/services/web/SearchCriteria.java b/web-service/src/main/java/io/pivotal/microservices/services/web/SearchCriteria.java similarity index 100% rename from src/main/java/io/pivotal/microservices/services/web/SearchCriteria.java rename to web-service/src/main/java/io/pivotal/microservices/services/web/SearchCriteria.java diff --git a/src/main/java/io/pivotal/microservices/services/web/WebAccountsController.java b/web-service/src/main/java/io/pivotal/microservices/services/web/WebAccountsController.java similarity index 98% rename from src/main/java/io/pivotal/microservices/services/web/WebAccountsController.java rename to web-service/src/main/java/io/pivotal/microservices/services/web/WebAccountsController.java index 224687e..432505d 100644 --- a/src/main/java/io/pivotal/microservices/services/web/WebAccountsController.java +++ b/web-service/src/main/java/io/pivotal/microservices/services/web/WebAccountsController.java @@ -1,6 +1,6 @@ package io.pivotal.microservices.services.web; -import io.pivotal.microservices.accounts.Account; + import java.util.List; import java.util.logging.Logger; diff --git a/src/main/java/io/pivotal/microservices/services/web/WebAccountsService.java b/web-service/src/main/java/io/pivotal/microservices/services/web/WebAccountsService.java similarity index 97% rename from src/main/java/io/pivotal/microservices/services/web/WebAccountsService.java rename to web-service/src/main/java/io/pivotal/microservices/services/web/WebAccountsService.java index d90d691..45fbb90 100644 --- a/src/main/java/io/pivotal/microservices/services/web/WebAccountsService.java +++ b/web-service/src/main/java/io/pivotal/microservices/services/web/WebAccountsService.java @@ -1,6 +1,6 @@ package io.pivotal.microservices.services.web; -import io.pivotal.microservices.accounts.Account; + import java.util.Arrays; import java.util.List; diff --git a/src/main/java/io/pivotal/microservices/services/web/WebServer.java b/web-service/src/main/java/io/pivotal/microservices/services/web/WebServer.java similarity index 100% rename from src/main/java/io/pivotal/microservices/services/web/WebServer.java rename to web-service/src/main/java/io/pivotal/microservices/services/web/WebServer.java diff --git a/web-service/src/main/resources/logback.xml b/web-service/src/main/resources/logback.xml new file mode 100644 index 0000000..b07aea8 --- /dev/null +++ b/web-service/src/main/resources/logback.xml @@ -0,0 +1,26 @@ + + + + + + true + + + + + + + + ${PID}: %-5level %logger{0} - %msg%n + + + + + + + + + + + diff --git a/web-service/src/main/resources/public/extlink.png b/web-service/src/main/resources/public/extlink.png new file mode 100644 index 0000000..aff0446 Binary files /dev/null and b/web-service/src/main/resources/public/extlink.png differ diff --git a/web-service/src/main/resources/public/pivotal-logo-600.png b/web-service/src/main/resources/public/pivotal-logo-600.png new file mode 100644 index 0000000..8b2593d Binary files /dev/null and b/web-service/src/main/resources/public/pivotal-logo-600.png differ diff --git a/web-service/src/main/resources/public/pws-header-logo_new.png b/web-service/src/main/resources/public/pws-header-logo_new.png new file mode 100644 index 0000000..ce35f11 Binary files /dev/null and b/web-service/src/main/resources/public/pws-header-logo_new.png differ diff --git a/web-service/src/main/resources/public/spring-trans.png b/web-service/src/main/resources/public/spring-trans.png new file mode 100644 index 0000000..bdb7792 Binary files /dev/null and b/web-service/src/main/resources/public/spring-trans.png differ diff --git a/web-service/src/main/resources/public/styles.css b/web-service/src/main/resources/public/styles.css new file mode 100644 index 0000000..55553cd --- /dev/null +++ b/web-service/src/main/resources/public/styles.css @@ -0,0 +1,39 @@ +/* - - - - - - - - - - - * + Local Styles + * - - - - - - - - - - - */ + +body { + font-family: helvetica; + font-size: 13pt; +} + +.navbar, .navbar > a { + font-family: helvetica; + font-size: 15pt; +} + +ul.openlist li { + margin-bottom: 1em; +} + +a { + font-family: helvetica; +} + +code { + background-color: white; + border-radius: 0px; + color: #80A080; + font-size: 100%; + font-family: monospace; + padding: 0px; + white-space: nowrap; +} + +footer { + margin-top: 3em; + border-top: 1px black solid; + text-align: center; + color:#6DB33F; /* Spring Green */ + font-style: italic; +} \ No newline at end of file diff --git a/src/main/resources/web-server.yml b/web-service/src/main/resources/web-server.yml similarity index 79% rename from src/main/resources/web-server.yml rename to web-service/src/main/resources/web-server.yml index ada91d0..e3f6a01 100644 --- a/src/main/resources/web-server.yml +++ b/web-service/src/main/resources/web-server.yml @@ -2,8 +2,6 @@ spring: application: name: web-service # Identify this application - freemarker: - enabled: false # Ignore Eureka dashboard FreeMarker templates thymeleaf: cache: false # Allow Thymeleaf templates to be reloaded at runtime prefix: classpath:/web-server/templates/ # Trailing / mandatory @@ -22,3 +20,16 @@ eureka: # HTTP Server server: port: 3333 # HTTP (Tomcat) port + +--- + + +spring: + profiles: docker + +# Discovery Server Access +eureka: + client: + serviceUrl: + defaultZone: http://discovery:1111/eureka/ + diff --git a/src/main/resources/web-server/templates/account.html b/web-service/src/main/resources/web-server/templates/account.html similarity index 100% rename from src/main/resources/web-server/templates/account.html rename to web-service/src/main/resources/web-server/templates/account.html diff --git a/src/main/resources/web-server/templates/accountSearch.html b/web-service/src/main/resources/web-server/templates/accountSearch.html similarity index 100% rename from src/main/resources/web-server/templates/accountSearch.html rename to web-service/src/main/resources/web-server/templates/accountSearch.html diff --git a/src/main/resources/web-server/templates/accounts.html b/web-service/src/main/resources/web-server/templates/accounts.html similarity index 100% rename from src/main/resources/web-server/templates/accounts.html rename to web-service/src/main/resources/web-server/templates/accounts.html diff --git a/src/main/resources/web-server/templates/empty.html b/web-service/src/main/resources/web-server/templates/empty.html similarity index 100% rename from src/main/resources/web-server/templates/empty.html rename to web-service/src/main/resources/web-server/templates/empty.html diff --git a/src/main/resources/web-server/templates/error.html b/web-service/src/main/resources/web-server/templates/error.html similarity index 100% rename from src/main/resources/web-server/templates/error.html rename to web-service/src/main/resources/web-server/templates/error.html diff --git a/src/main/resources/web-server/templates/footer.html b/web-service/src/main/resources/web-server/templates/footer.html similarity index 100% rename from src/main/resources/web-server/templates/footer.html rename to web-service/src/main/resources/web-server/templates/footer.html diff --git a/src/main/resources/web-server/templates/header.html b/web-service/src/main/resources/web-server/templates/header.html similarity index 100% rename from src/main/resources/web-server/templates/header.html rename to web-service/src/main/resources/web-server/templates/header.html diff --git a/src/main/resources/web-server/templates/index.html b/web-service/src/main/resources/web-server/templates/index.html similarity index 100% rename from src/main/resources/web-server/templates/index.html rename to web-service/src/main/resources/web-server/templates/index.html