Skip to content

Commit

Permalink
完善docker
Browse files Browse the repository at this point in the history
  • Loading branch information
fangp committed May 25, 2018
1 parent 655a99e commit f9728db
Show file tree
Hide file tree
Showing 21 changed files with 6,729 additions and 403 deletions.
2 changes: 1 addition & 1 deletion api-gateway/src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ ADD api-gateway-1.0-SNAPSHOT.jar app.jar
ADD wait-for-it.sh /wait-for-it.sh
#RUN bash -c 'touch /app.jar'
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
EXPOSE 21000
EXPOSE 18000
4 changes: 2 additions & 2 deletions api-gateway/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ spring:
application:
name: api-gateway
server:
port: 21000
port: 18000
zuul:
routes:
main-data:
Expand All @@ -26,7 +26,7 @@ security:
oauth2:
resource:
jwt:
key-uri: http://${AUTH_CENTER_HOST:localhost}:${AUTH_CENTER_PORT:21001}/auth/oauth/token_key
key-uri: http://${AUTH_CENTER_HOST:localhost}:${AUTH_CENTER_PORT:18001}/auth/oauth/token_key
id: ${spring.application.name}
serviceId: ${spring.application.name}
management:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ ADD auth-center-provider-1.0-SNAPSHOT.jar app.jar
ADD wait-for-it.sh /wait-for-it.sh
#RUN bash -c 'touch /app.jar'
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
EXPOSE 21001
EXPOSE 18001
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ security:
/oauth/deleteToken, /backReferer
server:
context-path: /auth
port: 21001
port: 18001
spring:
cloud:
consul:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<div class="field item">
<div class="ui left icon input">
<i class="user icon"></i>
<input id="username" name="username" placeholder="邮箱地址">
<input id="username" name="username" placeholder="用户名">
</div>
</div>
<div class="field item">
Expand Down
35 changes: 17 additions & 18 deletions docker-compose/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
image: auth-center-provider
restart: always
ports:
- '21001:21001'
- '18001:18001'
depends_on:
- 'consul'
- 'mysql'
Expand All @@ -26,27 +26,27 @@ services:
image: api-gateway
restart: always
ports:
- '21000:21000'
- '18000:18000'
depends_on:
- 'consul'
- 'auth-center'
command: ['./wait-for-it.sh', 'auth-center:21001', '-', 'python', 'app.py']
command: ['./wait-for-it.sh', 'auth-center:18001', '-', 'python', 'app.py']
environment:
- CONSUL_HOST=consul
- CONSUL_PORT=8500
- AUTH_CENTER_HOST=auth-center
- AUTH_CENTER_PORT=21001
- AUTH_CENTER_PORT=18001
main-data:
image: main-data-provider
restart: always
ports:
- '21003:21003'
- '18002:18002'
depends_on:
- 'consul'
- 'auth-center'
- 'mysql'
- 'redis'
command: ['./wait-for-it.sh', 'auth-center:21001', '-', 'python', 'app.py']
command: ['./wait-for-it.sh', 'auth-center:18001', '-', 'python', 'app.py']
environment:
- CONSUL_HOST=consul
- CONSUL_PORT=8500
Expand All @@ -55,7 +55,7 @@ services:
- MYSQL_HOST=mysql
- MYSQL_PORT=3306
- AUTH_CENTER_HOST=auth-center
- AUTH_CENTER_PORT=21001
- AUTH_CENTER_PORT=18001
mysql:
build: ./mysql
ports:
Expand All @@ -65,17 +65,16 @@ services:
restart: always
ports:
- '6379:6379'
web-app:
image: web-app
node-app:
image: node-app
ports:
- '8080:8080'
- '8080:8080'
depends_on:
- 'auth-center'
- 'api-gateway'
- 'auth-center'
- 'api-gateway'
environment:
- AJAX_HOST=api-gateway
- AJAX_PORT=21000
- BASE_HOST=web-app
- BASE_PORT=8080
- AUTH_HOST=auth-center
- AUTH_PORT='21001/auth'
- HOST=node-app
- PORT=8080
- BASE_URL=http://192.168.99.100:8080
- SERVER_URL=http://192.168.99.100:18000
- AUTH_URL=http://192.168.99.100:18001/auth
100 changes: 28 additions & 72 deletions docker-compose/mysql/schema.sql

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion main-data/main-data-provider/src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ ADD main-data-provider-1.0-SNAPSHOT.jar app.jar
ADD wait-for-it.sh /wait-for-it.sh
#RUN bash -c 'touch /app.jar'
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
EXPOSE 21003
EXPOSE 18002
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ security:
oauth2:
resource:
jwt:
key-uri: http://${AUTH_CENTER_HOST:localhost}:${AUTH_CENTER_PORT:21001}/auth/oauth/token_key
key-uri: http://${AUTH_CENTER_HOST:localhost}:${AUTH_CENTER_PORT:18001}/auth/oauth/token_key
id: ${spring.application.name}
serviceId: ${spring.application.name}
# mybatis 配置
Expand All @@ -60,4 +60,4 @@ mybatis:
logging:
file: logs/main-data.log
server:
port: 21003
port: 18002
1 change: 0 additions & 1 deletion web-app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ FROM node:8.0.0
ADD . /app/
WORKDIR /app
RUN npm install
RUN npm rebuild node-sass --force
EXPOSE 8080
CMD ["npm", "start"]
8 changes: 7 additions & 1 deletion web-app/build/webpack.dev.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ const portfinder = require('portfinder')

const HOST = process.env.HOST
const PORT = process.env.PORT && Number(process.env.PORT)
const AUTH_URL = process.env.AUTH_URL || 'http://127.0.0.1:18001/auth'
const BASE_URL = process.env.BASE_URL || 'http://127.0.0.1:8080'
const SERVER_URL = process.env.SERVER_URL || 'http://127.0.0.1:18000'

const devWebpackConfig = merge(baseWebpackConfig, {
module: {
Expand Down Expand Up @@ -46,7 +49,10 @@ const devWebpackConfig = merge(baseWebpackConfig, {
},
plugins: [
new webpack.DefinePlugin({
'process.env': require('../config/dev.env')
'process.env': require('../config/dev.env'),
'process.env.AUTH_URL': JSON.stringify(AUTH_URL),
'process.env.BASE_URL': JSON.stringify(BASE_URL),
'process.env.SERVER_URL': JSON.stringify(SERVER_URL)
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update.
Expand Down
Loading

0 comments on commit f9728db

Please sign in to comment.