谷粒商城上生产准备(五十)
作者:互联网
378-382 上线准备工作
这几集中感觉最麻烦的就是修改上线脚本,头皮发麻,而且雷神也有遗漏的地方,个人总结了一下大约有下面几点:
1.把redis,数据库,zipkin等等地址修改为上线地址
2.把数据库的密码为123456
3.把所有的服务端口改成8080
4.配置文件里面的地址也要修改,如redssion和es的
5.雷神把所有配置都在文件中,不用配置中心了,我个人还用了,要把数据同步一下,配置中心的namespace也要修改
在写Dockerfile那节,因为我有nexus,把common上传到了私服上,可以每个模块都可以单独打包。
clean package -Dmaven.test.skip=true
下面是dockerfile和k8s的资源清单
FROM java:8
EXPOSE 8080
VOLUME /tmp
ADD target/*.jar /app.jar
RUN bash -c 'touch /app.jar'
ENTRYPOINT ["java","-jar","/app.jar","--spring.profiles.active=prod"]
kind: Deployment
apiVersion: apps/v1
metadata:
name: gulimall-ware
namespace: gulimall
labels:
app: gulimall-ware
spec:
replicas: 1
selector:
matchLabels:
app: gulimall-ware
template:
metadata:
labels:
app: gulimall-ware
spec:
containers:
- name: gulimall-ware
image: $REGISTRY/$DOCKERHUB_NAMESPACE/$APP_NAME:$TAG_NAME
ports:
- containerPort: 8080
protocol: TCP
resources:
limits:
cpu: 1000m
memory: 1000Mi
requests:
cpu: 10m
memory: 10Mi
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
imagePullPolicy: IfNotPresent
restartPolicy: Always
terminationGracePeriodSeconds: 30
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 25%
maxSurge: 25%
revisionHistoryLimit: 10
progressDeadlineSeconds: 600
---
kind: Service
apiVersion: v1
metadata:
name: gulimall-ware
namespace: gulimall
labels:
app: gulimall-ware
spec:
ports:
- name: http
protocol: TCP
port: 8080
targetPort: 8080
nodePort: 20011
selector:
app: gulimall-ware
type: NodePort
sessionAffinity: None
标签:8080,name,app,jar,谷粒,gulimall,ware,商城,五十 来源: https://www.cnblogs.com/dalianpai/p/13563585.html