2-advanced/dubbo-samples-seata/deploy/All.yml (344 lines of code) (raw):
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Namespace
apiVersion: v1
kind: Namespace
metadata:
name: dubbo-demo
---
apiVersion: v1
kind: Namespace
metadata:
name: dubbo-system
---
# Seata-Mysql
apiVersion: v1
kind: ConfigMap
metadata:
name: seata-mysql-init
namespace: dubbo-demo
data:
# Set the properties you want to override, properties not set here will be using the default values
# check application.properties inside dubbo-admin project for the keys supported
dubbo-biz.sql: |
DROP TABLE IF EXISTS `storage_tbl`;
CREATE TABLE `storage_tbl`
(
`id` int(11) NOT NULL AUTO_INCREMENT,
`commodity_code` varchar(255) DEFAULT NULL,
`count` int(11) DEFAULT 0,
PRIMARY KEY (`id`),
UNIQUE KEY (`commodity_code`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8;
DROP TABLE IF EXISTS `order_tbl`;
CREATE TABLE `order_tbl`
(
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` varchar(255) DEFAULT NULL,
`commodity_code` varchar(255) DEFAULT NULL,
`count` int(11) DEFAULT 0,
`money` int(11) DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8;
DROP TABLE IF EXISTS `account_tbl`;
CREATE TABLE `account_tbl`
(
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` varchar(255) DEFAULT NULL,
`money` int(11) DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8;
undo-log.sql: |
CREATE TABLE `undo_log`
(
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`branch_id` bigint(20) NOT NULL,
`xid` varchar(100) NOT NULL,
`context` varchar(128) NOT NULL,
`rollback_info` longblob NOT NULL,
`log_status` int(11) NOT NULL,
`log_created` datetime NOT NULL,
`log_modified` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `ux_undo_log` (`xid`,`branch_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: seata-mysql-pv-volume
namespace: dubbo-demo
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/data"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: seata-mysql-pv-claim
namespace: dubbo-demo
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: seata-mysql
namespace: dubbo-demo
spec:
selector:
matchLabels:
app: seata-mysql
strategy:
type: Recreate
template:
metadata:
labels:
app: seata-mysql
spec:
containers:
- image: mysql:5.7
name: seata-mysql
env:
- name: MYSQL_DATABASE
value: seata-demo
- name: MYSQL_ROOT_PASSWORD
value: helloworld
ports:
- containerPort: 3306
name: mysql
volumeMounts:
- name: seata-mysql-persistent-storage
mountPath: /var/lib/mysql
- name: seata-mysql-init
mountPath: /docker-entrypoint-initdb.d
volumes:
- name: seata-mysql-persistent-storage
persistentVolumeClaim:
claimName: seata-mysql-pv-claim
- name: seata-mysql-init
configMap:
name: seata-mysql-init
---
apiVersion: v1
kind: Service
metadata:
name: seata-mysql
namespace: dubbo-demo
spec:
ports:
- port: 3306
selector:
app: seata-mysql
clusterIP: None
---
# Seata Server
apiVersion: apps/v1
kind: Deployment
metadata:
name: seata-server
namespace: dubbo-demo
spec:
replicas: 1
selector:
matchLabels:
app: seata-server
template:
metadata:
labels:
app: seata-server
spec:
containers:
- name: seata-server
image: seataio/seata-server:latest
imagePullPolicy: Always
ports:
- name: seata-server
containerPort: 8091
protocol: TCP
env:
- name: SEATA_PORT
value: "8091"
- name: STORE_MODE
value: "file"
---
apiVersion: v1
kind: Service
metadata:
name: seata-server
namespace: dubbo-demo
spec:
ports:
- port: 8091
selector:
app: seata-server
clusterIP: None
---
# Nacos
apiVersion: apps/v1
kind: Deployment
metadata:
name: nacos
namespace: dubbo-system
spec:
replicas: 1
selector:
matchLabels:
app: nacos
template:
metadata:
labels:
app: nacos
spec:
containers:
- name: consumer
image: nacos/nacos-server:v2.1.2
imagePullPolicy: Always
resources:
requests:
memory: "2Gi"
cpu: "500m"
ports:
- containerPort: 8848
name: client
- containerPort: 9848
name: client-rpc
env:
- name: NACOS_SERVER_PORT
value: "8848"
- name: NACOS_APPLICATION_PORT
value: "8848"
- name: PREFER_HOST_MODE
value: "hostname"
- name: MODE
value: "standalone"
- name: NACOS_AUTH_ENABLE
value: "true"
---
# Account
apiVersion: apps/v1
kind: Deployment
metadata:
name: seata-account
namespace: dubbo-demo
spec:
replicas: 1
selector:
matchLabels:
app: seata-account
template:
metadata:
labels:
app: seata-account
spec:
containers:
- name: seata-account
image: apache/dubbo-demo:dubbo-samples-seata-account_0.0.1
imagePullPolicy: Always
ports:
- name: dubbo
containerPort: 20881
protocol: TCP
- name: qos
containerPort: 20991
protocol: TCP
env:
- name: JAVA_TOOL_OPTIONS
value: -Dnacos.address=nacos.dubbo-system.svc -Dmysql.address=seata-mysql -Dseata.address=seata-server
---
# Business
apiVersion: apps/v1
kind: Deployment
metadata:
name: seata-business
namespace: dubbo-demo
spec:
replicas: 1
selector:
matchLabels:
app: seata-business
template:
metadata:
labels:
app: seata-business
spec:
containers:
- name: seata-business
image: apache/dubbo-demo:dubbo-samples-seata-business_0.0.1
imagePullPolicy: Always
ports:
- name: dubbo
containerPort: 20882
protocol: TCP
- name: qos
containerPort: 20992
protocol: TCP
env:
- name: JAVA_TOOL_OPTIONS
value: -Dnacos.address=nacos.dubbo-system.svc -Dmysql.address=seata-mysql -Dseata.address=seata-server
---
# Order
apiVersion: apps/v1
kind: Deployment
metadata:
name: seata-order
namespace: dubbo-demo
spec:
replicas: 1
selector:
matchLabels:
app: seata-order
template:
metadata:
labels:
app: seata-order
spec:
containers:
- name: seata-order
image: apache/dubbo-demo:dubbo-samples-seata-order_0.0.1
imagePullPolicy: Always
ports:
- name: dubbo
containerPort: 20883
protocol: TCP
- name: qos
containerPort: 20993
protocol: TCP
env:
- name: JAVA_TOOL_OPTIONS
value: -Dnacos.address=nacos.dubbo-system.svc -Dmysql.address=seata-mysql -Dseata.address=seata-server
---
# Storage
apiVersion: apps/v1
kind: Deployment
metadata:
name: seata-storage
namespace: dubbo-demo
spec:
replicas: 1
selector:
matchLabels:
app: seata-storage
template:
metadata:
labels:
app: seata-storage
spec:
containers:
- name: seata-storage
image: apache/dubbo-demo:dubbo-samples-seata-storage_0.0.1
imagePullPolicy: Always
ports:
- name: dubbo
containerPort: 20884
protocol: TCP
- name: qos
containerPort: 20994
protocol: TCP
env:
- name: JAVA_TOOL_OPTIONS
value: -Dnacos.address=nacos.dubbo-system.svc -Dmysql.address=seata-mysql -Dseata.address=seata-server
---