穀粒商城上生產準備(五十)
阿新 • • 發佈:2020-08-26
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