From 71d420c22e5e7e428a3a772e9fe6800f193e70b9 Mon Sep 17 00:00:00 2001 From: tanghc Date: Tue, 20 Oct 2020 17:02:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81docker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-build.sh | 2 +- docker-entrypoint.sh | 17 +++++++++-------- dockerfile | 2 +- sop-gateway/pom.xml | 18 ------------------ .../java/com/gitee/sop/test/AllInOneTest.java | 10 ++++++++-- 5 files changed, 19 insertions(+), 30 deletions(-) diff --git a/docker-build.sh b/docker-build.sh index de4d00f7..e9aa01f0 100644 --- a/docker-build.sh +++ b/docker-build.sh @@ -9,4 +9,4 @@ docker build -t gitee.com/sop . image_id=`docker images gitee.com/sop --format "{{.ID}}" | awk '{print $1}'` # 运行镜像 -docker run --name sop -p 8081:8081 -p 8082:8082 -p 8083:8083 -p 2222:2222 -d $image_id \ No newline at end of file +docker run --name sop -p 8081:8081 -p 8082:8082 -p 8083:8083 -p 8087:8087 -p 2222:2222 -d $image_id \ No newline at end of file diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 38cd1aee..09a61bbe 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -2,11 +2,12 @@ JAVA_OPTS="-Xms128m -Xmx128m" -CONF="--mysql.host=10.1.30.120:3306 --register.url=10.1.30.110:8848" - -nohup java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /sop/sop-gateway/sop-gateway.jar $CONF --logging.file.path=/sop/sop-gateway/log > /dev/null 2>&1 & -nohup java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /sop/sop-admin/sop-admin.jar $CONF --logging.file.path=/sop/sop-admin/log > /dev/null 2>&1 & -nohup java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /sop/sop-website/sop-website.jar $CONF --logging.file.path=/sop/sop-website/log > /dev/null 2>&1 & -nohup java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /sop/sop-auth/sop-auth.jar $CONF --logging.file.path=/sop/sop-auth/log > /dev/null 2>&1 & -nohup java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /sop/sop-story/sop-story.jar $CONF --logging.file.path=/sop/sop-story/log > /dev/null 2>&1 & - +# mysql, nacos配置 +CONF="--mysql.host=10.1.30.110:3306 --register.url=10.1.30.110:8848" + +java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /sop/sop-gateway/sop-gateway.jar $CONF --logging.file.path=/sop/sop-gateway/log & +java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /sop/sop-admin/sop-admin.jar $CONF --logging.file.path=/sop/sop-admin/log & +java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /sop/sop-website/sop-website.jar $CONF --logging.file.path=/sop/sop-website/log & +java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /sop/sop-auth/sop-auth.jar $CONF --logging.file.path=/sop/sop-auth/log & +# 最后一条没有& +java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /sop/sop-story/sop-story.jar $CONF --logging.file.path=/sop/sop-story/log \ No newline at end of file diff --git a/dockerfile b/dockerfile index 8630eec2..9c0e7fc0 100644 --- a/dockerfile +++ b/dockerfile @@ -5,7 +5,7 @@ VOLUME /sop ADD sop-gateway/target/*.jar sop/sop-gateway/sop-gateway.jar ADD sop-admin/sop-admin-server/target/*.jar sop/sop-admin/sop-admin.jar ADD sop-website/target/*.jar sop/sop-website/sop-website.jar -ADD sop-auth/target/*.jar sop/sop-website/sop-auth.jar +ADD sop-auth/target/*.jar sop/sop-auth/sop-auth.jar ADD sop-example/sop-story/target/*.jar sop/sop-story/sop-story.jar COPY docker-entrypoint.sh /usr/local/bin/ diff --git a/sop-gateway/pom.xml b/sop-gateway/pom.xml index 8fa2a919..97eed025 100644 --- a/sop-gateway/pom.xml +++ b/sop-gateway/pom.xml @@ -95,24 +95,6 @@ true - diff --git a/sop-test/src/test/java/com/gitee/sop/test/AllInOneTest.java b/sop-test/src/test/java/com/gitee/sop/test/AllInOneTest.java index 78e9a3d3..1cdeb28e 100644 --- a/sop-test/src/test/java/com/gitee/sop/test/AllInOneTest.java +++ b/sop-test/src/test/java/com/gitee/sop/test/AllInOneTest.java @@ -23,7 +23,7 @@ import java.util.Optional; */ public class AllInOneTest extends TestBase { - String url = "http://localhost:8081"; + String url = "http://10.1.30.120:8081"; String appId = "2019032617262200001"; String privateKey = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCXJv1pQFqWNA/++OYEV7WYXwexZK/J8LY1OWlP9X0T6wHFOvxNKRvMkJ5544SbgsJpVcvRDPrcxmhPbi/sAhdO4x2PiPKIz9Yni2OtYCCeaiE056B+e1O2jXoLeXbfi9fPivJZkxH/tb4xfLkH3bA8ZAQnQsoXA0SguykMRZntF0TndUfvDrLqwhlR8r5iRdZLB6F8o8qXH6UPDfNEnf/K8wX5T4EB1b8x8QJ7Ua4GcIUqeUxGHdQpzNbJdaQvoi06lgccmL+PHzminkFYON7alj1CjDN833j7QMHdPtS9l7B67fOU/p2LAAkPMtoVBfxQt9aFj7B8rEhGCz02iJIBAgMBAAECggEARqOuIpY0v6WtJBfmR3lGIOOokLrhfJrGTLF8CiZMQha+SRJ7/wOLPlsH9SbjPlopyViTXCuYwbzn2tdABigkBHYXxpDV6CJZjzmRZ+FY3S/0POlTFElGojYUJ3CooWiVfyUMhdg5vSuOq0oCny53woFrf32zPHYGiKdvU5Djku1onbDU0Lw8w+5tguuEZ76kZ/lUcccGy5978FFmYpzY/65RHCpvLiLqYyWTtaNT1aQ/9pw4jX9HO9NfdJ9gYFK8r/2f36ZE4hxluAfeOXQfRC/WhPmiw/ReUhxPznG/WgKaa/OaRtAx3inbQ+JuCND7uuKeRe4osP2jLPHPP6AUwQKBgQDUNu3BkLoKaimjGOjCTAwtp71g1oo+k5/uEInAo7lyEwpV0EuUMwLA/HCqUgR4K9pyYV+Oyb8d6f0+Hz0BMD92I2pqlXrD7xV2WzDvyXM3s63NvorRooKcyfd9i6ccMjAyTR2qfLkxv0hlbBbsPHz4BbU63xhTJp3Ghi0/ey/1HQKBgQC2VsgqC6ykfSidZUNLmQZe3J0p/Qf9VLkfrQ+xaHapOs6AzDU2H2osuysqXTLJHsGfrwVaTs00ER2z8ljTJPBUtNtOLrwNRlvgdnzyVAKHfOgDBGwJgiwpeE9voB1oAV/mXqSaUWNnuwlOIhvQEBwekqNyWvhLqC7nCAIhj3yvNQKBgQCqYbeec56LAhWP903Zwcj9VvG7sESqXUhIkUqoOkuIBTWFFIm54QLTA1tJxDQGb98heoCIWf5x/A3xNI98RsqNBX5JON6qNWjb7/dobitti3t99v/ptDp9u8JTMC7penoryLKK0Ty3bkan95Kn9SC42YxaSghzqkt+uvfVQgiNGQKBgGxU6P2aDAt6VNwWosHSe+d2WWXt8IZBhO9d6dn0f7ORvcjmCqNKTNGgrkewMZEuVcliueJquR47IROdY8qmwqcBAN7Vg2K7r7CPlTKAWTRYMJxCT1Hi5gwJb+CZF3+IeYqsJk2NF2s0w5WJTE70k1BSvQsfIzAIDz2yE1oPHvwVAoGAA6e+xQkVH4fMEph55RJIZ5goI4Y76BSvt2N5OKZKd4HtaV+eIhM3SDsVYRLIm9ZquJHMiZQGyUGnsvrKL6AAVNK7eQZCRDk9KQz+0GKOGqku0nOZjUbAu6A2/vtXAaAuFSFx1rUQVVjFulLexkXR3KcztL1Qu2k5pB6Si0K/uwQ="; @@ -112,10 +112,16 @@ public class AllInOneTest extends TestBase { */ public void testJSR303() { Client client = new Client(url, appId, privateKey); + Map headers = new HashMap<>(8); + headers.put("accept-language", "zh-CN"); Client.RequestBuilder requestBuilder = new Client.RequestBuilder() .method("goods.add") .version("1.0") - .bizContent(new BizContent().add("goods_name", "iphone6").add("goods_remark", "iphone6").add("goods_comment", "1")) + .header(headers) + .bizContent(new BizContent() + .add("goods_name", "iphone6") + .add("goods_remark", "iphone6") + .add("goods_comment", "1")) .httpMethod(HttpTool.HTTPMethod.POST) .callback((requestInfo, responseData) -> { System.out.println(responseData);