Skip to content

Commit

Permalink
整合res-dockert+lua-template+nginx
Browse files Browse the repository at this point in the history
  • Loading branch information
supermy committed Jul 4, 2015
1 parent b3d5239 commit de9bbe7
Show file tree
Hide file tree
Showing 11 changed files with 57 additions and 7 deletions.
9 changes: 9 additions & 0 deletions web+app/README.log
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
2015-07-04
https://spring.io/guides/gs/spring-boot-docker/

http://192.168.59.103/java/rest/public/channel.html

http://192.168.59.103:32801/channel_auth/filter

http://192.168.59.103/channel-manage?page=0&start=0&size=15

2015-07-03
lua+template 与 spring-data-rest 完成整合;
http://192.168.59.103/channel-manage?page=0&start=0&size=15
Expand Down
3 changes: 2 additions & 1 deletion web+app/build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env bash
docker build -t supermy/docker-mynginx:2.1 mynginx
docker build -t supermy/docker-mytomcat:7 mytomcat
docker build -t supermy/docker-mytomcat:7 mytomcat
docker build -t supermy/docker-springboot springboot
9 changes: 8 additions & 1 deletion web+app/fig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
web:
image: supermy/docker-mynginx:2.1
links:
- springboot
- mytomcat1
- mytomcat2
- myredis
Expand Down Expand Up @@ -84,7 +85,6 @@ myredis:
ports:
- "6379:6379"


db:
image: supermy/docker-mysql:latest
environment:
Expand All @@ -103,3 +103,10 @@ dbinit:
command: -c "sleep 8; mysql -u java --password=java -h mysql javatest < /host/mysql/init.sql; exit 0"
links:
- db:mysql

springboot:
image: supermy/docker-springboot:latest
links:
- db:mysql
ports:
- "8080"
1 change: 1 addition & 0 deletions web+app/mynginx/b.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env bash
#docker build -t supermy/docker-mynginx:2.1 .

#http://192.168.59.103:8080/redisfoo
Expand Down
16 changes: 12 additions & 4 deletions web+app/mynginx/nginx.d/channel.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@
# index index.html index.htm index.jsp;
#
#}
location /channel-manage {
default_type "text/html";
content_by_lua_file /usr/local/nginx/conf/nginx.d/lua/channel-manage.lua;
}
location /channel-manage {
resolver 8.8.8.8; # use Google's open DNS server for an example

default_type "text/html";
content_by_lua_file /usr/local/nginx/conf/nginx.d/lua/channel-manage.lua;
}

location /springboot {
proxy_pass http://springboot/;
root /data/www;
index index.html index.htm index.jsp;
}
3 changes: 2 additions & 1 deletion web+app/mynginx/nginx.d/lua/channel-manage.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ end
local http = require "resty.http"

local httpc = http.new()
local res, err = httpc:request_uri("http://192.168.0.121:8080/channel_auth/filter?"..myargs, {
local res, err = httpc:request_uri("http://127.0.0.1/springboot/channel_auth/filter?"..myargs, {
--local res, err = httpc:request_uri("http://172.17.0.239:8080/channel_auth/filter?"..myargs, {
method = "GET",
body = myargs,
headers = {
Expand Down
5 changes: 5 additions & 0 deletions web+app/mynginx/nginx.d/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ http {
session_sticky;
}

upstream springboot {
server springboot:8080 weight=10;
session_sticky;
}


map $http_host $item_dynamic {
hostnames;
Expand Down
3 changes: 3 additions & 0 deletions web+app/mytomcat/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ COPY dbtest /home/dbtest
COPY lib-cluster/* /tomcat/lib/
COPY lib-webjars/* /tomcat/lib/

#COPY gs-accessing-data-rest-0.1.0.war /tomcat/webapps/rest.war




#优化运行环境
Expand Down
Binary file not shown.
15 changes: 15 additions & 0 deletions web+app/springboot/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM supermy/docker-jre:7
VOLUME /tmp
ADD gs-accessing-data-rest-0.1.0.war app.war
# spring-boot 按class生成时间进行加载没有解决

RUN bash -c 'touch /app.jar'
EXPOSE 8080

ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.war"]


#CMD ["java", "-cp", "/app/", "org.springframework.boot.loader.JarLauncher"]

#CMD java -jar spring-boot-restful-service.jar
#ADD build/spring-boot-restful-service.jar /data/spring-boot-restful-service.jar
Binary file not shown.

0 comments on commit de9bbe7

Please sign in to comment.