Skip to content

Commit

Permalink
docker部署
Browse files Browse the repository at this point in the history
  • Loading branch information
lyj8330328 committed Jan 2, 2019
1 parent c947400 commit fd777c8
Show file tree
Hide file tree
Showing 15 changed files with 345 additions and 73 deletions.
28 changes: 28 additions & 0 deletions leyou-api-gateway/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,32 @@
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>

<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>1.2.0</version>
<configuration>
<imageName>192.168.19.122:5000/${project.artifactId}:${project.version}</imageName>
<baseImage>jdk1.8</baseImage>
<entryPoint>["java", "‐jar", "/${project.build.finalName}.jar"]</entryPoint>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
<dockerHost>http:192.168.191.122:2375</dockerHost>
</configuration>
</plugin>
</plugins>
</build>
</project>
11 changes: 11 additions & 0 deletions leyou-authentication/leyou-authentication-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,15 @@
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.xx.webapps.api.main.WebappsApiBidMain</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -1,60 +1,60 @@
package com.leyou.auth.test;

import com.leyou.auth.entity.UserInfo;
import com.leyou.auth.utils.JwtUtils;
import com.leyou.auth.utils.RsaUtils;
import org.junit.Before;
import org.junit.Test;

import java.security.PrivateKey;
import java.security.PublicKey;
import java.util.Date;

/**
* @Author: 98050
* @Time: 2018-10-23 20:58
* @Feature: JWT测试
*/
public class JwtTest {

private static final String pubKeyPath = "G:\\tmp\\rsa\\rsa.pub";

private static final String priKeyPath = "G:\\tmp\\rsa\\rsa.pri";

private PublicKey publicKey;

private PrivateKey privateKey;

@Test
public void testRsa() throws Exception {
RsaUtils.generateKey(pubKeyPath, priKeyPath, "234");
}

@Before
public void testGetRsa() throws Exception {
this.publicKey = RsaUtils.getPublicKey(pubKeyPath);
this.privateKey = RsaUtils.getPrivateKey(priKeyPath);
}

@Test
public void testGenerateToken() throws Exception {
// 生成token
String token = JwtUtils.generateToken(new UserInfo(20L, "jack"), privateKey, 5);
System.out.println("token = " + token);
}

@Test
public void testParseToken() throws Exception {
String token = "eyJhbGciOiJSUzI1NiJ9.eyJpZCI6MjAsInVzZXJuYW1lIjoiamFjayIsImV4cCI6MTU0MDMwMjU4MX0.KFGDe8V8TwLl5xGqM1brPV50JXf3Z6G4cXPIeYxsqaeeol06BnXNNsyLAbUSrFxloUf-hQqO41O1OrtERllU-JfZXs6MA6rTBSfpar2MJRSZyDGKqfBpPoRED3yZv8oFuzI_94GONqsipmGyQFqWUkhTf9k0tZ5LPRvvGl9tkvc";

// 解析token
UserInfo user = JwtUtils.getInfoFromToken(token, publicKey);
System.out.println("id: " + user.getId());
System.out.println("userName: " + user.getUsername());
}

@Test
public void date(){
System.out.println(new Date());
}
}
//package com.leyou.auth.test;
//
//import com.leyou.auth.entity.UserInfo;
//import com.leyou.auth.utils.JwtUtils;
//import com.leyou.auth.utils.RsaUtils;
//import org.junit.Before;
//import org.junit.Test;
//
//import java.security.PrivateKey;
//import java.security.PublicKey;
//import java.util.Date;
//
///**
// * @Author: 98050
// * @Time: 2018-10-23 20:58
// * @Feature: JWT测试
// */
//public class JwtTest {
//
// private static final String pubKeyPath = "G:\\tmp\\rsa\\rsa.pub";
//
// private static final String priKeyPath = "G:\\tmp\\rsa\\rsa.pri";
//
// private PublicKey publicKey;
//
// private PrivateKey privateKey;
//
// @Test
// public void testRsa() throws Exception {
// RsaUtils.generateKey(pubKeyPath, priKeyPath, "234");
// }
//
// @Before
// public void testGetRsa() throws Exception {
// this.publicKey = RsaUtils.getPublicKey(pubKeyPath);
// this.privateKey = RsaUtils.getPrivateKey(priKeyPath);
// }
//
// @Test
// public void testGenerateToken() throws Exception {
// // 生成token
// String token = JwtUtils.generateToken(new UserInfo(20L, "jack"), privateKey, 5);
// System.out.println("token = " + token);
// }
//
// @Test
// public void testParseToken() throws Exception {
// String token = "eyJhbGciOiJSUzI1NiJ9.eyJpZCI6MjAsInVzZXJuYW1lIjoiamFjayIsImV4cCI6MTU0MDMwMjU4MX0.KFGDe8V8TwLl5xGqM1brPV50JXf3Z6G4cXPIeYxsqaeeol06BnXNNsyLAbUSrFxloUf-hQqO41O1OrtERllU-JfZXs6MA6rTBSfpar2MJRSZyDGKqfBpPoRED3yZv8oFuzI_94GONqsipmGyQFqWUkhTf9k0tZ5LPRvvGl9tkvc";
//
// // 解析token
// UserInfo user = JwtUtils.getInfoFromToken(token, publicKey);
// System.out.println("id: " + user.getId());
// System.out.println("userName: " + user.getUsername());
// }
//
// @Test
// public void date(){
// System.out.println(new Date());
// }
//}
28 changes: 28 additions & 0 deletions leyou-cart/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,32 @@
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>

<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>1.2.0</version>
<configuration>
<imageName>192.168.19.122:5000/${project.artifactId}:${project.version}</imageName>
<baseImage>jdk1.8</baseImage>
<entryPoint>["java", "‐jar", "/${project.build.finalName}.jar"]</entryPoint>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
<dockerHost>http:192.168.191.122:2375</dockerHost>
</configuration>
</plugin>
</plugins>
</build>
</project>
6 changes: 0 additions & 6 deletions leyou-comments/leyou-comments-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,6 @@
<version>1.0.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.leyou.review</groupId>
<artifactId>leyou-review-interface</artifactId>
<version>1.0.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.leyou.comments</groupId>
<artifactId>leyou-comments-interface</artifactId>
Expand Down
28 changes: 28 additions & 0 deletions leyou-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,32 @@

</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>

<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>1.2.0</version>
<configuration>
<imageName>192.168.19.122:5000/${project.artifactId}:${project.version}</imageName>
<baseImage>jdk1.8</baseImage>
<entryPoint>["java", "‐jar", "/${project.build.finalName}.jar"]</entryPoint>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
<dockerHost>http:192.168.191.122:2375</dockerHost>
</configuration>
</plugin>
</plugins>
</build>

</project>
29 changes: 29 additions & 0 deletions leyou-config/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,33 @@
<artifactId>spring-cloud-stream-binder-rabbit</artifactId>
</dependency>
</dependencies>

<build>
<finalName>app</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!-- docker的maven插件,官网 https://github.com/spotify/docker-maven-plugin -->
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.4.13</version>
<configuration>
<imageName>192.168.19.122:5000/${project.artifactId}:${project.version}</imageName>
<baseImage>jdk1.8</baseImage>
<entryPoint>["java", "-jar","/${project.build.finalName}.jar"]</entryPoint>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
<dockerHost>http://192.168.19.122:2375</dockerHost>
</configuration>
</plugin>
</plugins>
</build>
</project>
27 changes: 27 additions & 0 deletions leyou-goods-web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,32 @@
</dependency>

</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>

<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>1.2.0</version>
<configuration>
<imageName>192.168.19.122:5000/${project.artifactId}:${project.version}</imageName>
<baseImage>jdk1.8</baseImage>
<entryPoint>["java", "‐jar", "/${project.build.finalName}.jar"]</entryPoint>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
<dockerHost>http:192.168.191.122:2375</dockerHost>
</configuration>
</plugin>
</plugins>
</build>

</project>
5 changes: 0 additions & 5 deletions leyou-order/leyou-order-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,6 @@
<version>1.0.0-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>com.leyou.seckill</groupId>
<artifactId>leyou-seckill</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
Expand Down
29 changes: 29 additions & 0 deletions leyou-registry/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,33 @@
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies>

<build>
<finalName>app</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!-- docker的maven插件,官网 https://github.com/spotify/docker-maven-plugin -->
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.4.13</version>
<configuration>
<imageName>192.168.19.122:5000/${project.artifactId}:${project.version}</imageName>
<baseImage>jdk1.8</baseImage>
<entryPoint>["java", "-jar","/${project.build.finalName}.jar"]</entryPoint>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
<dockerHost>http://192.168.19.122:2375</dockerHost>
</configuration>
</plugin>
</plugins>
</build>
</project>
2 changes: 1 addition & 1 deletion leyou-registry/src/main/resources/bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ spring:
name: registry
profile: dev
label: master
uri: http://127.0.0.1:10011
uri: http://192.168.19.122:10011
Loading

0 comments on commit fd777c8

Please sign in to comment.