chore(project): 添加项目配置文件和忽略规则

- 添加 Babel 配置文件支持 ES6+ 语法转换
- 添加 ESLint 忽略规则和配置文件
- 添加 Git 忽略规则文件
- 添加 Travis CI 配置文件
- 添加 1.4.2 版本变更日志文件
- 添加 Helm 图表辅助模板文件
- 添加 Helm 忽略规则文件
This commit is contained in:
2026-03-27 17:36:48 +08:00
commit c2453d6434
1703 changed files with 277582 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
-- for AT mode you must to init this sql for you business database. the seata server not need it.
CREATE TABLE IF NOT EXISTS `undo_log`
(
`branch_id` BIGINT NOT NULL COMMENT 'branch transaction id',
`xid` VARCHAR(128) NOT NULL COMMENT 'global transaction id',
`context` VARCHAR(128) NOT NULL COMMENT 'undo_log context,such as serialization',
`rollback_info` LONGBLOB NOT NULL COMMENT 'rollback info',
`log_status` INT(11) NOT NULL COMMENT '0:normal status,1:defense status',
`log_created` DATETIME(6) NOT NULL COMMENT 'create datetime',
`log_modified` DATETIME(6) NOT NULL COMMENT 'modify datetime',
UNIQUE KEY `ux_undo_log` (`xid`, `branch_id`)
) ENGINE = InnoDB
AUTO_INCREMENT = 1
DEFAULT CHARSET = utf8 COMMENT ='AT transaction mode undo table';

View File

@@ -0,0 +1,19 @@
-- for AT mode you must to init this sql for you business database. the seata server not need it.
CREATE TABLE undo_log
(
id NUMBER(19) NOT NULL,
branch_id NUMBER(19) NOT NULL,
xid VARCHAR2(128) NOT NULL,
context VARCHAR2(128) NOT NULL,
rollback_info BLOB NOT NULL,
log_status NUMBER(10) NOT NULL,
log_created TIMESTAMP(0) NOT NULL,
log_modified TIMESTAMP(0) NOT NULL,
PRIMARY KEY (id),
CONSTRAINT ux_undo_log UNIQUE (xid, branch_id)
);
COMMENT ON TABLE undo_log IS 'AT transaction mode undo table';
-- Generate ID using sequence and trigger
CREATE SEQUENCE UNDO_LOG_SEQ START WITH 1 INCREMENT BY 1;

View File

@@ -0,0 +1,16 @@
-- for AT mode you must to init this sql for you business database. the seata server not need it.
CREATE TABLE IF NOT EXISTS public.undo_log
(
id SERIAL NOT NULL,
branch_id BIGINT NOT NULL,
xid VARCHAR(128) NOT NULL,
context VARCHAR(128) NOT NULL,
rollback_info BYTEA NOT NULL,
log_status INT NOT NULL,
log_created TIMESTAMP(0) NOT NULL,
log_modified TIMESTAMP(0) NOT NULL,
CONSTRAINT pk_undo_log PRIMARY KEY (id),
CONSTRAINT ux_undo_log UNIQUE (xid, branch_id)
);
CREATE SEQUENCE IF NOT EXISTS undo_log_id_seq INCREMENT BY 1 MINVALUE 1 ;

View File

@@ -0,0 +1,88 @@
transport {
# tcp, unix-domain-socket
type = "TCP"
#NIO, NATIVE
server = "NIO"
#enable heartbeat
heartbeat = true
# the client batch send request enable
enableClientBatchSendRequest = true
#thread factory for netty
threadFactory {
bossThreadPrefix = "NettyBoss"
workerThreadPrefix = "NettyServerNIOWorker"
serverExecutorThread-prefix = "NettyServerBizHandler"
shareBossWorker = false
clientSelectorThreadPrefix = "NettyClientSelector"
clientSelectorThreadSize = 1
clientWorkerThreadPrefix = "NettyClientWorkerThread"
# netty boss thread size
bossThreadSize = 1
#auto default pin or 8
workerThreadSize = "default"
}
shutdown {
# when destroy server, wait seconds
wait = 3
}
serialization = "seata"
compressor = "none"
}
service {
#transaction service group mapping
vgroupMapping.my_test_tx_group = "default"
#only support when registry.type=file, please don't set multiple addresses
default.grouplist = "127.0.0.1:8091"
#degrade, current not support
enableDegrade = false
#disable seata
disableGlobalTransaction = false
}
client {
rm {
asyncCommitBufferLimit = 10000
lock {
retryInterval = 10
retryTimes = 30
retryPolicyBranchRollbackOnConflict = true
}
reportRetryCount = 5
tableMetaCheckEnable = false
tableMetaCheckerInterval = 60000
reportSuccessEnable = false
sagaBranchRegisterEnable = false
sagaJsonParser = jackson
sagaRetryPersistModeUpdate = false
sagaCompensatePersistModeUpdate = false
}
tm {
commitRetryCount = 5
rollbackRetryCount = 5
defaultGlobalTransactionTimeout = 60000
degradeCheck = false
degradeCheckPeriod = 2000
degradeCheckAllowTimes = 10
}
undo {
dataValidation = true
onlyCareUpdateColumns = true
logSerialization = "jackson"
logTable = "undo_log"
compress {
enable = true
# allow zip, gzip, deflater, 7z, lz4, bzip2, default is zip
type = zip
# if rollback info size > threshold, then will be compress
# allow k m g t
threshold = 64k
}
}
loadBalance {
type = "RandomLoadBalance"
virtualNodes = 10
}
}
log {
exceptionRate = 100
}

View File

@@ -0,0 +1,91 @@
registry {
# file 、nacos 、eureka、redis、zk、consul、etcd3、sofa、custom
type = "file"
nacos {
application = "seata-server"
serverAddr = "127.0.0.1:8848"
group = "SEATA_GROUP"
namespace = ""
username = ""
password = ""
}
eureka {
serviceUrl = "http://localhost:8761/eureka"
weight = "1"
}
redis {
serverAddr = "localhost:6379"
db = "0"
password = ""
timeout = "0"
}
zk {
serverAddr = "127.0.0.1:2181"
sessionTimeout = 6000
connectTimeout = 2000
username = ""
password = ""
}
consul {
serverAddr = "127.0.0.1:8500"
aclToken = ""
}
etcd3 {
serverAddr = "http://localhost:2379"
}
sofa {
serverAddr = "127.0.0.1:9603"
region = "DEFAULT_ZONE"
datacenter = "DefaultDataCenter"
group = "SEATA_GROUP"
addressWaitTime = "3000"
}
file {
name = "file.conf"
}
custom {
name = ""
}
}
config {
# file、nacos 、apollo、zk、consul、etcd3、springCloudConfig、custom
type = "file"
nacos {
serverAddr = "127.0.0.1:8848"
namespace = ""
group = "SEATA_GROUP"
username = ""
password = ""
dataId = "seata.properties"
}
consul {
serverAddr = "127.0.0.1:8500"
aclToken = ""
}
apollo {
appId = "seata-server"
apolloMeta = "http://192.168.1.204:8801"
namespace = "application"
apolloAccesskeySecret = ""
}
zk {
serverAddr = "127.0.0.1:2181"
sessionTimeout = 6000
connectTimeout = 2000
username = ""
password = ""
nodePath = "/seata/seata.properties"
}
etcd3 {
serverAddr = "http://localhost:2379"
}
file {
name = "file.conf"
}
custom {
name = ""
}
}

View File

@@ -0,0 +1,64 @@
create table seata_state_machine_def
(
id varchar(32) not null,
name varchar(128) not null,
tenant_id varchar(32) not null,
app_name varchar(32) not null,
type varchar(20),
comment_ varchar(255),
ver varchar(16) not null,
gmt_create timestamp(3) not null,
status varchar(2) not null,
content clob(65536) inline length 2048,
recover_strategy varchar(16),
primary key(id)
);
create table seata_state_machine_inst
(
id varchar(128) not null,
machine_id varchar(32) not null,
tenant_id varchar(32) not null,
parent_id varchar(128),
gmt_started timestamp(3) not null,
business_key varchar(48),
uni_business_key varchar(128) not null generated always as( --Unique index does not allow empty columns on DB2
CASE
WHEN "BUSINESS_KEY" IS NULL
THEN "ID"
ELSE "BUSINESS_KEY"
END),
start_params clob(65536) inline length 1024,
gmt_end timestamp(3),
excep blob(10240),
end_params clob(65536) inline length 1024,
status varchar(2),
compensation_status varchar(2),
is_running smallint,
gmt_updated timestamp(3) not null,
primary key(id)
);
create unique index state_machine_inst_unibuzkey on seata_state_machine_inst(uni_business_key, tenant_id);
create table seata_state_inst
(
id varchar(48) not null,
machine_inst_id varchar(128) not null,
name varchar(128) not null,
type varchar(20),
service_name varchar(128),
service_method varchar(128),
service_type varchar(16),
business_key varchar(48),
state_id_compensated_for varchar(50),
state_id_retried_for varchar(50),
gmt_started timestamp(3) not null,
is_for_update smallint,
input_params clob(65536) inline length 1024,
output_params clob(65536) inline length 1024,
status varchar(2) not null,
excep blob(10240),
gmt_updated timestamp(3),
gmt_end timestamp(3),
primary key(id, machine_inst_id)
);

View File

@@ -0,0 +1,58 @@
create table if not exists seata_state_machine_def
(
id varchar(32) not null comment 'id',
name varchar(128) not null comment 'name',
tenant_id varchar(32) not null comment 'tenant id',
app_name varchar(32) not null comment 'application name',
type varchar(20) comment 'state language type',
comment_ varchar(255) comment 'comment',
ver varchar(16) not null comment 'version',
gmt_create timestamp(3) not null comment 'create time',
status varchar(2) not null comment 'status(AC:active|IN:inactive)',
content clob comment 'content',
recover_strategy varchar(16) comment 'transaction recover strategy(compensate|retry)',
primary key (id)
);
create table if not exists seata_state_machine_inst
(
id varchar(128) not null comment 'id',
machine_id varchar(32) not null comment 'state machine definition id',
tenant_id varchar(32) not null comment 'tenant id',
parent_id varchar(128) comment 'parent id',
gmt_started timestamp(3) not null comment 'start time',
business_key varchar(48) comment 'business key',
start_params clob comment 'start parameters',
gmt_end timestamp(3) comment 'end time',
excep blob comment 'exception',
end_params clob comment 'end parameters',
status varchar(2) comment 'status(SU succeed|FA failed|UN unknown|SK skipped|RU running)',
compensation_status varchar(2) comment 'compensation status(SU succeed|FA failed|UN unknown|SK skipped|RU running)',
is_running tinyint(1) comment 'is running(0 no|1 yes)',
gmt_updated timestamp(3) not null,
primary key (id),
unique key unikey_buz_tenant (business_key, tenant_id)
);
create table if not exists seata_state_inst
(
id varchar(48) not null comment 'id',
machine_inst_id varchar(128) not null comment 'state machine instance id',
name varchar(128) not null comment 'state name',
type varchar(20) comment 'state type',
service_name varchar(128) comment 'service name',
service_method varchar(128) comment 'method name',
service_type varchar(16) comment 'service type',
business_key varchar(48) comment 'business key',
state_id_compensated_for varchar(50) comment 'state compensated for',
state_id_retried_for varchar(50) comment 'state retried for',
gmt_started timestamp(3) not null comment 'start time',
is_for_update tinyint(1) comment 'is service for update',
input_params clob comment 'input parameters',
output_params clob comment 'output parameters',
status varchar(2) not null comment 'status(SU succeed|FA failed|UN unknown|SK skipped|RU running)',
excep blob comment 'exception',
gmt_updated timestamp(3) comment 'update time',
gmt_end timestamp(3) comment 'end time',
primary key (id, machine_inst_id)
);

View File

@@ -0,0 +1,64 @@
-- -------------------------------- The script used for sage --------------------------------
CREATE TABLE IF NOT EXISTS `seata_state_machine_def`
(
`id` VARCHAR(32) NOT NULL COMMENT 'id',
`name` VARCHAR(128) NOT NULL COMMENT 'name',
`tenant_id` VARCHAR(32) NOT NULL COMMENT 'tenant id',
`app_name` VARCHAR(32) NOT NULL COMMENT 'application name',
`type` VARCHAR(20) COMMENT 'state language type',
`comment_` VARCHAR(255) COMMENT 'comment',
`ver` VARCHAR(16) NOT NULL COMMENT 'version',
`gmt_create` DATETIME(3) NOT NULL COMMENT 'create time',
`status` VARCHAR(2) NOT NULL COMMENT 'status(AC:active|IN:inactive)',
`content` TEXT COMMENT 'content',
`recover_strategy` VARCHAR(16) COMMENT 'transaction recover strategy(compensate|retry)',
PRIMARY KEY (`id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8;
CREATE TABLE IF NOT EXISTS `seata_state_machine_inst`
(
`id` VARCHAR(128) NOT NULL COMMENT 'id',
`machine_id` VARCHAR(32) NOT NULL COMMENT 'state machine definition id',
`tenant_id` VARCHAR(32) NOT NULL COMMENT 'tenant id',
`parent_id` VARCHAR(128) COMMENT 'parent id',
`gmt_started` DATETIME(3) NOT NULL COMMENT 'start time',
`business_key` VARCHAR(48) COMMENT 'business key',
`start_params` TEXT COMMENT 'start parameters',
`gmt_end` DATETIME(3) COMMENT 'end time',
`excep` BLOB COMMENT 'exception',
`end_params` TEXT COMMENT 'end parameters',
`status` VARCHAR(2) COMMENT 'status(SU succeed|FA failed|UN unknown|SK skipped|RU running)',
`compensation_status` VARCHAR(2) COMMENT 'compensation status(SU succeed|FA failed|UN unknown|SK skipped|RU running)',
`is_running` TINYINT(1) COMMENT 'is running(0 no|1 yes)',
`gmt_updated` DATETIME(3) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `unikey_buz_tenant` (`business_key`, `tenant_id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8;
CREATE TABLE IF NOT EXISTS `seata_state_inst`
(
`id` VARCHAR(48) NOT NULL COMMENT 'id',
`machine_inst_id` VARCHAR(128) NOT NULL COMMENT 'state machine instance id',
`name` VARCHAR(128) NOT NULL COMMENT 'state name',
`type` VARCHAR(20) COMMENT 'state type',
`service_name` VARCHAR(128) COMMENT 'service name',
`service_method` VARCHAR(128) COMMENT 'method name',
`service_type` VARCHAR(16) COMMENT 'service type',
`business_key` VARCHAR(48) COMMENT 'business key',
`state_id_compensated_for` VARCHAR(50) COMMENT 'state compensated for',
`state_id_retried_for` VARCHAR(50) COMMENT 'state retried for',
`gmt_started` DATETIME(3) NOT NULL COMMENT 'start time',
`is_for_update` TINYINT(1) COMMENT 'is service for update',
`input_params` TEXT COMMENT 'input parameters',
`output_params` TEXT COMMENT 'output parameters',
`status` VARCHAR(2) NOT NULL COMMENT 'status(SU succeed|FA failed|UN unknown|SK skipped|RU running)',
`excep` BLOB COMMENT 'exception',
`gmt_updated` DATETIME(3) COMMENT 'update time',
`gmt_end` DATETIME(3) COMMENT 'end time',
PRIMARY KEY (`id`, `machine_inst_id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8;

View File

@@ -0,0 +1,64 @@
CREATE TABLE seata_state_machine_def
(
id VARCHAR(32) NOT NULL,
name VARCHAR(128) NOT NULL,
tenant_id VARCHAR(32) NOT NULL,
app_name VARCHAR(32) NOT NULL,
type VARCHAR(20),
comment_ VARCHAR(255),
ver VARCHAR(16) NOT NULL,
gmt_create TIMESTAMP(3) NOT NULL,
status VARCHAR(2) NOT NULL,
content CLOB,
recover_strategy VARCHAR(16),
PRIMARY KEY (id)
);
CREATE TABLE seata_state_machine_inst
(
id VARCHAR(128) NOT NULL,
machine_id VARCHAR(32) NOT NULL,
tenant_id VARCHAR(32) NOT NULL,
parent_id VARCHAR(128),
gmt_started TIMESTAMP(3) NOT NULL,
business_key VARCHAR(48),
uni_business_key VARCHAR(128) GENERATED ALWAYS AS (
CASE
WHEN "BUSINESS_KEY" IS NULL
THEN "ID"
ELSE "BUSINESS_KEY"
END),
start_params CLOB,
gmt_end TIMESTAMP(3),
excep BLOB,
end_params CLOB,
status VARCHAR(2),
compensation_status VARCHAR(2),
is_running SMALLINT,
gmt_updated TIMESTAMP(3) NOT NULL,
PRIMARY KEY (id)
);
CREATE UNIQUE INDEX state_machine_inst_unibuzkey ON seata_state_machine_inst (uni_business_key, tenant_id);
CREATE TABLE seata_state_inst
(
id VARCHAR(48) NOT NULL,
machine_inst_id VARCHAR(46) NOT NULL,
name VARCHAR(128) NOT NULL,
type VARCHAR(20),
service_name VARCHAR(128),
service_method VARCHAR(128),
service_type VARCHAR(16),
business_key VARCHAR(48),
state_id_compensated_for VARCHAR(50),
state_id_retried_for VARCHAR(50),
gmt_started TIMESTAMP(3) NOT NULL,
is_for_update SMALLINT,
input_params CLOB,
output_params CLOB,
status VARCHAR(2) NOT NULL,
excep BLOB,
gmt_updated TIMESTAMP(3),
gmt_end TIMESTAMP(3),
PRIMARY KEY (id, machine_inst_id)
);

View File

@@ -0,0 +1,59 @@
-- -------------------------------- The script used for sage --------------------------------
CREATE TABLE IF NOT EXISTS public.seata_state_machine_def
(
id VARCHAR(32) NOT NULL,
name VARCHAR(128) NOT NULL,
tenant_id VARCHAR(32) NOT NULL,
app_name VARCHAR(32) NOT NULL,
type VARCHAR(20),
comment_ VARCHAR(255),
ver VARCHAR(16) NOT NULL,
gmt_create TIMESTAMP(3) NOT NULL,
status VARCHAR(2) NOT NULL,
content TEXT,
recover_strategy VARCHAR(16),
CONSTRAINT pk_seata_state_machine_def PRIMARY KEY (id)
);
CREATE TABLE IF NOT EXISTS public.seata_state_machine_inst
(
id VARCHAR(128) NOT NULL,
machine_id VARCHAR(32) NOT NULL,
tenant_id VARCHAR(32) NOT NULL,
parent_id VARCHAR(128),
gmt_started TIMESTAMP(3) NOT NULL,
business_key VARCHAR(48),
start_params TEXT,
gmt_end TIMESTAMP(3) DEFAULT now(),
excep BYTEA,
end_params TEXT,
status VARCHAR(2),
compensation_status VARCHAR(2),
is_running BOOLEAN,
gmt_updated TIMESTAMP(3) DEFAULT now() NOT NULL,
CONSTRAINT pk_seata_state_machine_inst PRIMARY KEY (id),
CONSTRAINT unikey_buz_tenant UNIQUE (business_key, tenant_id)
)
;
CREATE TABLE IF NOT EXISTS public.seata_state_inst
(
id VARCHAR(48) NOT NULL,
machine_inst_id VARCHAR(128) NOT NULL,
name VARCHAR(128) NOT NULL,
type VARCHAR(20),
service_name VARCHAR(128),
service_method VARCHAR(128),
service_type VARCHAR(16),
business_key VARCHAR(48),
state_id_compensated_for VARCHAR(50),
state_id_retried_for VARCHAR(50),
gmt_started TIMESTAMP(3) NOT NULL,
is_for_update BOOLEAN,
input_params TEXT,
output_params TEXT,
status VARCHAR(2) NOT NULL,
excep BYTEA,
gmt_updated TIMESTAMP(3) DEFAULT now(),
gmt_end TIMESTAMP(3) DEFAULT now(),
CONSTRAINT pk_seata_state_inst PRIMARY KEY (id, machine_inst_id)
);

View File

@@ -0,0 +1,132 @@
#
# Copyright 1999-2019 Seata.io Group.
#
# Licensed 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.
#
seata.enabled=true
seata.excludes-for-auto-proxying=firstClassNameForExclude,secondClassNameForExclude
seata.application-id=applicationName
seata.tx-service-group=my_test_tx_group
seata.enable-auto-data-source-proxy=true
seata.data-source-proxy-mode=AT
seata.use-jdk-proxy=false
seata.client.rm.async-commit-buffer-limit=10000
seata.client.rm.report-retry-count=5
seata.client.rm.table-meta-check-enable=false
seata.client.rm.report-success-enable=false
seata.client.rm.saga-branch-register-enable=false
seata.client.rm.saga-json-parser=fastjson
seata.client.rm.saga-retry-persist-mode-update=false
seata.client.rm.saga-compensate-persist-mode-update=false
seata.client.rm.lock.retry-interval=10
seata.client.rm.lock.retry-times=30
seata.client.rm.lock.retry-policy-branch-rollback-on-conflict=true
seata.client.tm.commit-retry-count=5
seata.client.tm.rollback-retry-count=5
seata.client.tm.default-global-transaction-timeout=60000
seata.client.tm.degrade-check=false
seata.client.tm.degrade-check-allow-times=10
seata.client.tm.degrade-check-period=2000
seata.client.undo.data-validation=true
seata.client.undo.log-serialization=jackson
seata.client.undo.only-care-update-columns=true
seata.client.undo.log-table=undo_log
seata.client.undo.compress.enable=true
seata.client.undo.compress.type=zip
seata.client.undo.compress.threshold=64k
seata.client.load-balance.type=RandomLoadBalance
seata.client.load-balance.virtual-nodes=10
seata.log.exception-rate=100
seata.service.vgroup-mapping.my_test_tx_group=default
seata.service.grouplist.default=127.0.0.1:8091
seata.service.enable-degrade=false
seata.service.disable-global-transaction=false
seata.transport.shutdown.wait=3
seata.transport.thread-factory.boss-thread-prefix=NettyBoss
seata.transport.thread-factory.worker-thread-prefix=NettyServerNIOWorker
seata.transport.thread-factory.server-executor-thread-prefix=NettyServerBizHandler
seata.transport.thread-factory.share-boss-worker=false
seata.transport.thread-factory.client-selector-thread-prefix=NettyClientSelector
seata.transport.thread-factory.client-selector-thread-size=1
seata.transport.thread-factory.client-worker-thread-prefix=NettyClientWorkerThread
seata.transport.thread-factory.worker-thread-size=default
seata.transport.thread-factory.boss-thread-size=1
seata.transport.type=TCP
seata.transport.server=NIO
seata.transport.heartbeat=true
seata.transport.serialization=seata
seata.transport.compressor=none
seata.transport.enable-client-batch-send-request=true
seata.config.type=file
seata.config.consul.server-addr=127.0.0.1:8500
seata.config.consul.acl-token=
seata.config.apollo.apollo-meta=http://192.168.1.204:8801
seata.config.apollo.apollo-accesskey-secret=
seata.config.apollo.app-id=seata-server
seata.config.apollo.namespace=application
seata.config.etcd3.server-addr=http://localhost:2379
seata.config.nacos.namespace=
seata.config.nacos.server-addr=127.0.0.1:8848
seata.config.nacos.group=SEATA_GROUP
seata.config.nacos.username=
seata.config.nacos.password=
seata.config.zk.server-addr=127.0.0.1:2181
seata.config.zk.session-timeout=6000
seata.config.zk.connect-timeout=2000
seata.config.zk.username=
seata.config.zk.password=
seata.config.custom.name=
seata.registry.type=file
seata.registry.consul.server-addr=127.0.0.1:8500
seata.registry.etcd3.server-addr=http://localhost:2379
seata.registry.eureka.weight=1
seata.registry.eureka.service-url=http://localhost:8761/eureka
seata.registry.nacos.application=seata-server
seata.registry.nacos.server-addr=127.0.0.1:8848
seata.registry.nacos.group=SEATA_GROUP
seata.registry.nacos.namespace=
seata.registry.nacos.username=
seata.registry.nacos.password=
seata.registry.redis.server-addr=localhost:6379
seata.registry.redis.db=0
seata.registry.redis.password=
seata.registry.redis.timeout=0
seata.registry.sofa.server-addr=127.0.0.1:9603
seata.registry.sofa.region=DEFAULT_ZONE
seata.registry.sofa.datacenter=DefaultDataCenter
seata.registry.sofa.group=SEATA_GROUP
seata.registry.sofa.address-wait-time=3000
seata.registry.sofa.application=default
seata.registry.zk.server-addr=127.0.0.1:2181
seata.registry.zk.session-timeout=6000
seata.registry.zk.connect-timeout=2000
seata.registry.zk.username=
seata.registry.zk.password=
seata.registry.custom.name=

View File

@@ -0,0 +1,133 @@
seata:
enabled: true
application-id: applicationName
tx-service-group: my_test_tx_group
enable-auto-data-source-proxy: true
data-source-proxy-mode: AT
use-jdk-proxy: false
excludes-for-auto-proxying: firstClassNameForExclude,secondClassNameForExclude
client:
rm:
async-commit-buffer-limit: 10000
report-retry-count: 5
table-meta-check-enable: false
report-success-enable: false
saga-branch-register-enable: false
saga-json-parser: fastjson
saga-retry-persist-mode-update: false
saga-compensate-persist-mode-update: false
lock:
retry-interval: 10
retry-times: 30
retry-policy-branch-rollback-on-conflict: true
tm:
commit-retry-count: 5
rollback-retry-count: 5
default-global-transaction-timeout: 60000
degrade-check: false
degrade-check-period: 2000
degrade-check-allow-times: 10
undo:
data-validation: true
log-serialization: jackson
log-table: undo_log
only-care-update-columns: true
compress:
enable: true
type: zip
threshold: 64k
load-balance:
type: RandomLoadBalance
virtual-nodes: 10
service:
vgroup-mapping:
my_test_tx_group: default
grouplist:
default: 127.0.0.1:8091
enable-degrade: false
disable-global-transaction: false
transport:
shutdown:
wait: 3
thread-factory:
boss-thread-prefix: NettyBoss
worker-thread-prefix: NettyServerNIOWorker
server-executor-thread-prefix: NettyServerBizHandler
share-boss-worker: false
client-selector-thread-prefix: NettyClientSelector
client-selector-thread-size: 1
client-worker-thread-prefix: NettyClientWorkerThread
worker-thread-size: default
boss-thread-size: 1
type: TCP
server: NIO
heartbeat: true
serialization: seata
compressor: none
enable-client-batch-send-request: true
config:
type: file
consul:
server-addr: 127.0.0.1:8500
apollo:
apollo-meta: http://192.168.1.204:8801
app-id: seata-server
namespace: application
apollo-accesskey-secret: ""
etcd3:
server-addr: http://localhost:2379
nacos:
namespace: ""
server-addr: 127.0.0.1:8848
group: SEATA_GROUP
username: ""
password: ""
zk:
server-addr: 127.0.0.1:2181
session-timeout: 6000
connect-timeout: 2000
username: ""
password: ""
custom:
name: ""
registry:
type: file
file:
name: file.conf
consul:
server-addr: 127.0.0.1:8500
acl-token: ""
etcd3:
server-addr: http://localhost:2379
eureka:
weight: 1
service-url: http://localhost:8761/eureka
nacos:
application: seata-server
server-addr: 127.0.0.1:8848
group : "SEATA_GROUP"
namespace: ""
username: ""
password: ""
redis:
server-addr: localhost:6379
db: 0
password: ""
timeout: 0
sofa:
server-addr: 127.0.0.1:9603
region: DEFAULT_ZONE
datacenter: DefaultDataCenter
group: SEATA_GROUP
address-wait-time: 3000
application: default
zk:
server-addr: 127.0.0.1:2181
session-timeout: 6000
connect-timeout: 2000
username: ""
password: ""
custom:
name: ""
log:
exception-rate: 100

View File

@@ -0,0 +1,102 @@
# Script usage demo
![Since 1.2.0](https://img.shields.io/badge/Since%20-1.2.0-orange.svg?style=flat-square)
## important attributes
you only need to follow the instructions below and keep the corresponding configuration in 'config.txt' to run. For more configuration information, please visit [seata.io](https://seata.io/)
| server | client |
| ------------------------ | ------------------------------------------------------------ |
| store.mode: file,db | config.type: file、nacos 、apollo、zk、consul、etcd3、custom |
| #only db: | #only file: |
| store.db.driverClassName | service.default.grouplist |
| store.db.url | #All: |
| store.db.user | service.vgroupMapping.my_test_tx_group |
| store.db.password | service.disableGlobalTransaction |
## Nacos
shell:
```bash
sh ${SEATAPATH}/script/config-center/nacos/nacos-config.sh -h localhost -p 8848 -g SEATA_GROUP -t 5a3c7d6c-f497-4d68-a71a-2e5e3340b3ca -u username -w password
```
Parameter Description:
-h: host, the default value is localhost.
-p: port, the default value is 8848.
-g: Configure grouping, the default value is 'SEATA_GROUP'.
-t: Tenant information, corresponding to the namespace ID field of Nacos, the default value is ''.
-u: username, nacos 1.2.0+ on permission control, the default value is ''.
-w: password, nacos 1.2.0+ on permission control, the default value is ''.
python:
```bash
python ${SEATAPATH}/script/config-center/nacos/nacos-config.py localhost:8848
```
## Apollo
```bash
sh ${SEATAPATH}/script/config-center/apollo/apollo-config.sh -h localhost -p 8070 -e DEV -a seata-server -c default -n application -d apollo -r apollo -t 3aa026fc8435d0fc4505b345b8fa4578fb646a2c
```
Parameter Description:
-h: host, the default value is localhost.
-p: port, the default value is 8070.
-e: Managed configuration environment, the default value is DEV.
-a: AppId to which the namespace belongs, the default value is seata-server.
-c: Managed configuration cluster name, Generally, you can pass in default. If it is a special cluster, just pass in the name of the corresponding clusterthe default value is default.
-n: Name of the managed namespace, If the format is not properties, you need to add a suffix name, such as sample.yml, the default value is application.
-d: The creator of the item, in the format of a domain account, which is the User ID of the sso system.
-r: Publisher, domain account, note: if namespace.lock.switch in ApolloConfigDB.ServerConfig is set to true (default is false), Then the environment does not allow the publisher and editor to be the same person. So if the editor is zhangsan, the publisher can no longer be zhangsan.
-t: Apollo admin creates third-party applications in http://{portal_address}/open/manage.html, It is best to check whether this AppId has been created before creation. After successful creation, a token will be generated.
For details of the above parameter descriptions, please see:
https://github.com/ctripcorp/apollo/wiki/Apollo%E5%BC%80%E6%94%BE%E5%B9%B3%E5%8F%B0
## Consul
```bash
sh ${SEATAPATH}/script/config-center/consul/consul-config.sh -h localhost -p 8500
```
Parameter Description:
-h: host, the default value is localhost.
-p: port, the default value is 8500.
## Etcd3
```bash
sh ${SEATAPATH}/script/config-center/etcd3/etcd3-config.sh -h localhost -p 2379
```
Parameter Description:
-h: host, the default value is localhost.
-p: port, the default value is 2379.
## ZK
```bash
sh ${SEATAPATH}/script/config-center/zk/zk-config.sh -h localhost -p 2181 -z "/Users/zhangchenghui/zookeeper-3.4.14"
```
Parameter Description:
-h: host, the default value is localhost.
-p: port, the default value is 2181.
-z: zk path.

View File

@@ -0,0 +1,155 @@
#!/usr/bin/env bash
# Copyright 1999-2019 Seata.io Group.
#
# Licensed 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.
# apollo open api, click on the link for details:
# https://github.com/ctripcorp/apollo/wiki/Apollo%E5%BC%80%E6%94%BE%E5%B9%B3%E5%8F%B0
# add config: http://{portal_address}/openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/items
# publish config: http://{portal_address}/openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/releases
while getopts ":h:p:e:a:c:n:d:r:t:" opt
do
case $opt in
h)
host=$OPTARG
;;
p)
port=$OPTARG
;;
e)
env=$OPTARG
;;
a)
appId=$OPTARG
;;
c)
clusterName=$OPTARG
;;
n)
namespaceName=$OPTARG
;;
d)
dataChangeCreatedBy=$OPTARG
;;
r)
releasedBy=$OPTARG
;;
t)
token=$OPTARG
;;
?)
echo " USAGE OPTION: $0 [-h host] [-p port] [-e env] [a appId] [-c clusterName] [-n namespaceName] [-d dataChangeCreatedBy] [-r releasedBy] [-t token] "
exit 1
;;
esac
done
if [[ -z ${host} ]]; then
host=localhost
fi
if [[ -z ${port} ]]; then
port=8070
fi
if [[ -z ${env} ]]; then
env=DEV
fi
if [[ -z ${appId} ]]; then
appId=seata-server
fi
if [[ -z ${clusterName} ]]; then
clusterName=default
fi
if [[ -z ${namespaceName} ]]; then
namespaceName=application
fi
if [[ -z ${dataChangeCreatedBy} ]]; then
echo " dataChangeCreatedBy is empty, please usage option: [-d dataChangeCreatedBy] "
exit 1
fi
if [[ -z ${releasedBy} ]]; then
echo " releasedBy is empty, please usage option: [-r releasedBy] "
exit 1
fi
if [[ -z ${token} ]]; then
echo " token is empty, please usage option: [-t token] "
exit 1
fi
portalAddr=$host:$port
contentType="content-type:application/json;charset=UTF-8"
authorization="Authorization:$token"
publishBody="{\"releaseTitle\":\"$(date +%Y%m%d%H%M%S)\",\"releaseComment\":\"\",\"releasedBy\":\"${releasedBy}\"}"
echo "portalAddr is ${portalAddr}"
echo "env is ${env}"
echo "appId is ${appId}"
echo "clusterName is ${clusterName}"
echo "namespaceName is ${namespaceName}"
echo "dataChangeCreatedBy is ${dataChangeCreatedBy}"
echo "releasedBy is ${releasedBy}"
echo "token is ${token}"
failCount=0
tempLog=$(mktemp -u)
function addConfig() {
curl -X POST -H "${1}" -H "${2}" -d "${3}" "http://${4}/openapi/v1/envs/${5}/apps/${6}/clusters/${7}/namespaces/${8}/items" >"${tempLog}" 2>/dev/null
log=$(cat "${tempLog}")
if [[ ${log} =~ ":401" || ${log} =~ ":403"
|| ${log} =~ ":404" || ${log} =~ ":405"
|| ${log} =~ ":500" || ! ${log} =~ "{" ]]; then
echo "set $9=${10} failure "
(( failCount++ ))
else
echo "set $9=${10} successfully "
fi
}
function publishConfig() {
curl -X POST -H "${1}" -H "${2}" -d "${3}" "http://${4}/openapi/v1/envs/${5}/apps/${6}/clusters/${7}/namespaces/${8}/releases" >"${tempLog}" 2>/dev/null
log=$(cat "${tempLog}")
if [[ ${log} =~ ":401" || ${log} =~ ":403"
|| ${log} =~ ":404" || ${log} =~ ":405"
|| ${log} =~ ":500" || ! ${log} =~ "{" ]]; then
echo " Publish fail "
exit 1
else
echo " Publish successfully, please start seata-server. "
fi
}
count=0
for line in $(cat $(dirname "$PWD")/config.txt | sed s/[[:space:]]//g); do
(( count++ ))
key=${line%%=*}
value=${line#*=}
body="{\"key\":\"${key}\",\"value\":\"${value}\",\"comment\":\"\",\"dataChangeCreatedBy\":\"${dataChangeCreatedBy}\"}"
addConfig ${contentType} "${authorization}" "${body}" "${portalAddr}" "${env}" "${appId}" "${clusterName}" "${namespaceName}" "${key}" "${value}"
done
echo "========================================================================="
echo " Complete initialization parameters, total-count:$count , failure-count:$failCount "
echo "========================================================================="
if [[ $failCount -eq 0 ]]; then
read -p "Publish now, y/n: " result
if [[ ${result} == "y" ]]; then
publishConfig "${contentType}" "${authorization}" "${publishBody}" "${portalAddr}" "${env}" "${appId}" "${clusterName}" "${namespaceName}"
else
echo "Remember to publish later..."
fi
else
echo " init apollo config fail. "
fi

View File

@@ -0,0 +1,89 @@
transport.type=TCP
transport.server=NIO
transport.heartbeat=true
transport.enableClientBatchSendRequest=false
transport.threadFactory.bossThreadPrefix=NettyBoss
transport.threadFactory.workerThreadPrefix=NettyServerNIOWorker
transport.threadFactory.serverExecutorThreadPrefix=NettyServerBizHandler
transport.threadFactory.shareBossWorker=false
transport.threadFactory.clientSelectorThreadPrefix=NettyClientSelector
transport.threadFactory.clientSelectorThreadSize=1
transport.threadFactory.clientWorkerThreadPrefix=NettyClientWorkerThread
transport.threadFactory.bossThreadSize=1
transport.threadFactory.workerThreadSize=default
transport.shutdown.wait=3
service.vgroupMapping.my_test_tx_group=default
service.default.grouplist=127.0.0.1:8091
service.enableDegrade=false
service.disableGlobalTransaction=false
client.rm.asyncCommitBufferLimit=10000
client.rm.lock.retryInterval=10
client.rm.lock.retryTimes=30
client.rm.lock.retryPolicyBranchRollbackOnConflict=true
client.rm.reportRetryCount=5
client.rm.tableMetaCheckEnable=false
client.rm.tableMetaCheckerInterval=60000
client.rm.sqlParserType=druid
client.rm.reportSuccessEnable=false
client.rm.sagaBranchRegisterEnable=false
client.tm.commitRetryCount=5
client.tm.rollbackRetryCount=5
client.tm.defaultGlobalTransactionTimeout=60000
client.tm.degradeCheck=false
client.tm.degradeCheckAllowTimes=10
client.tm.degradeCheckPeriod=2000
store.mode=file
store.publicKey=
store.file.dir=file_store/data
store.file.maxBranchSessionSize=16384
store.file.maxGlobalSessionSize=512
store.file.fileWriteBufferCacheSize=16384
store.file.flushDiskMode=async
store.file.sessionReloadReadSize=100
store.db.datasource=druid
store.db.dbType=mysql
store.db.driverClassName=com.mysql.jdbc.Driver
store.db.url=jdbc:mysql://127.0.0.1:3306/seata?useUnicode=true&rewriteBatchedStatements=true
store.db.user=username
store.db.password=password
store.db.minConn=5
store.db.maxConn=30
store.db.globalTable=global_table
store.db.branchTable=branch_table
store.db.queryLimit=100
store.db.lockTable=lock_table
store.db.maxWait=5000
store.redis.mode=single
store.redis.single.host=127.0.0.1
store.redis.single.port=6379
store.redis.sentinel.masterName=
store.redis.sentinel.sentinelHosts=
store.redis.maxConn=10
store.redis.minConn=1
store.redis.maxTotal=100
store.redis.database=0
store.redis.password=
store.redis.queryLimit=100
server.recovery.committingRetryPeriod=1000
server.recovery.asynCommittingRetryPeriod=1000
server.recovery.rollbackingRetryPeriod=1000
server.recovery.timeoutRetryPeriod=1000
server.maxCommitRetryTimeout=-1
server.maxRollbackRetryTimeout=-1
server.rollbackRetryTimeoutUnlockEnable=false
client.undo.dataValidation=true
client.undo.logSerialization=jackson
client.undo.onlyCareUpdateColumns=true
server.undo.logSaveDays=7
server.undo.logDeletePeriod=86400000
client.undo.logTable=undo_log
client.undo.compress.enable=true
client.undo.compress.type=zip
client.undo.compress.threshold=64k
log.exceptionRate=100
transport.serialization=seata
transport.compressor=none
metrics.enabled=false
metrics.registryType=compact
metrics.exporterList=prometheus
metrics.exporterPrometheusPort=9898

View File

@@ -0,0 +1,75 @@
#!/usr/bin/env bash
# Copyright 1999-2019 Seata.io Group.
#
# Licensed 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.
while getopts ":h:p:" opt
do
case $opt in
h)
host=$OPTARG
;;
p)
port=$OPTARG
;;
?)
echo " USAGE OPTION: $0 [-h host] [-p port] "
exit 1
;;
esac
done
if [[ -z ${host} ]]; then
host=localhost
fi
if [[ -z ${port} ]]; then
port=8500
fi
consulAddr=$host:$port
contentType="content-type:application/json;charset=UTF-8"
echo "Set consulAddr=$consulAddr"
failCount=0
tempLog=$(mktemp -u)
function addConfig() {
curl -X PUT -H "${1}" -d "${2}" "http://$3/v1/kv/$4" >"${tempLog}" 2>/dev/null
if [[ -z $(cat "${tempLog}") ]]; then
echo " Please check the cluster status. "
exit 1
fi
if [[ $(cat "${tempLog}") =~ "true" ]]; then
echo "Set $4=$2 successfully "
else
echo "Set $4=$2 failure "
(( failCount++ ))
fi
}
count=0
for line in $(cat $(dirname "$PWD")/config.txt | sed s/[[:space:]]//g); do
(( count++ ))
key=${line%%=*}
value=${line#*=}
addConfig "${contentType}" "${value}" "${consulAddr}" "${key}"
done
echo "========================================================================="
echo " Complete initialization parameters, total-count:$count , failure-count:$failCount "
echo "========================================================================="
if [[ ${failCount} -eq 0 ]]; then
echo " Init consul config finished, please start seata-server. "
else
echo " Init consul config fail. "
fi

View File

@@ -0,0 +1,79 @@
#!/usr/bin/env bash
# Copyright 1999-2019 Seata.io Group.
#
# Licensed 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.
# etcd REST API v3.
while getopts ":h:p:" opt
do
case $opt in
h)
host=$OPTARG
;;
p)
port=$OPTARG
;;
?)
echo " USAGE OPTION: $0 [-h host] [-p port] "
exit 1
;;
esac
done
if [[ -z ${host} ]]; then
host=localhost
fi
if [[ -z ${port} ]]; then
port=2379
fi
etcd3Addr=$host:$port
contentType="content-type:application/json;charset=UTF-8"
echo "Set etcd3Addr=$etcd3Addr"
failCount=0
tempLog=$(mktemp -u)
function addConfig() {
keyBase64=$(printf "%s""$2" | base64)
valueBase64=$(printf "%s""$3" | base64)
curl -X POST -H "${1}" -d "{\"key\": \"$keyBase64\", \"value\": \"$valueBase64\"}" "http://$4/v3/kv/put" >"${tempLog}" 2>/dev/null
if [[ -z $(cat "${tempLog}") ]]; then
echo " Please check the cluster status. "
exit 1
fi
if [[ $(cat "${tempLog}") =~ "error" || $(cat "${tempLog}") =~ "code" ]]; then
echo "Set $2=$3 failure "
(( failCount++ ))
else
echo "Set $2=$3 successfully "
fi
}
count=0
for line in $(cat $(dirname "$PWD")/config.txt | sed s/[[:space:]]//g); do
(( count++ ))
key=${line%%=*}
value=${line#*=}
addConfig "${contentType}" "${key}" "${value}" "${etcd3Addr}"
done
echo "========================================================================="
echo " Complete initialization parameters, total-count:$count , failure-count:$failCount "
echo "========================================================================="
if [[ ${failCount} -eq 0 ]]; then
echo " Init etcd3 config finished, please start seata-server. "
else
echo " Init etcd3 config fail. "
fi

View File

@@ -0,0 +1,37 @@
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
import http.client
import sys
import urllib.parse
if len(sys.argv) < 2:
print ('python nacos-config.py nacosAddr')
exit()
headers = {
'content-type': "application/x-www-form-urlencoded"
}
hasError = False
for line in open('../config.txt'):
pair = line.rstrip("\n").split('=')
if len(pair) < 2:
continue
print (line),
url_prefix = sys.argv[1]
conn = http.client.HTTPConnection(url_prefix)
if len(sys.argv) == 3:
namespace=sys.argv[2]
url_postfix = '/nacos/v1/cs/configs?dataId={0}&group=SEATA_GROUP&content={1}&tenant={2}'.format(urllib.parse.quote(str(pair[0])),urllib.parse.quote(str(pair[1])).strip(),namespace)
else:
url_postfix = '/nacos/v1/cs/configs?dataId={}&group=SEATA_GROUP&content={}'.format(urllib.parse.quote(str(pair[0])),urllib.parse.quote(str(pair[1]))).strip()
conn.request("POST", url_postfix, headers=headers)
res = conn.getresponse()
data = res.read()
if data.decode("utf-8") != "true":
hasError = True
if hasError:
print ("init nacos config fail.")
else:
print ("init nacos config finished, please start seata-server.")

View File

@@ -0,0 +1,112 @@
#!/usr/bin/env bash
# Copyright 1999-2019 Seata.io Group.
#
# Licensed 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.
while getopts ":h:p:g:t:u:w:" opt
do
case $opt in
h)
host=$OPTARG
;;
p)
port=$OPTARG
;;
g)
group=$OPTARG
;;
t)
tenant=$OPTARG
;;
u)
username=$OPTARG
;;
w)
password=$OPTARG
;;
?)
echo " USAGE OPTION: $0 [-h host] [-p port] [-g group] [-t tenant] [-u username] [-w password] "
exit 1
;;
esac
done
urlencode() {
for ((i=0; i < ${#1}; i++))
do
char="${1:$i:1}"
case $char in
[a-zA-Z0-9.~_-]) printf $char ;;
*) printf '%%%02X' "'$char" ;;
esac
done
}
if [[ -z ${host} ]]; then
host=localhost
fi
if [[ -z ${port} ]]; then
port=8848
fi
if [[ -z ${group} ]]; then
group="SEATA_GROUP"
fi
if [[ -z ${tenant} ]]; then
tenant=""
fi
if [[ -z ${username} ]]; then
username=""
fi
if [[ -z ${password} ]]; then
password=""
fi
nacosAddr=$host:$port
contentType="content-type:application/json;charset=UTF-8"
echo "set nacosAddr=$nacosAddr"
echo "set group=$group"
failCount=0
tempLog=$(mktemp -u)
function addConfig() {
curl -X POST -H "${contentType}" "http://$nacosAddr/nacos/v1/cs/configs?dataId=$(urlencode $1)&group=$group&content=$(urlencode $2)&tenant=$tenant&username=$username&password=$password" >"${tempLog}" 2>/dev/null
if [[ -z $(cat "${tempLog}") ]]; then
echo " Please check the cluster status. "
exit 1
fi
if [[ $(cat "${tempLog}") =~ "true" ]]; then
echo "Set $1=$2 successfully "
else
echo "Set $1=$2 failure "
(( failCount++ ))
fi
}
count=0
for line in $(cat $(dirname "$PWD")/config.txt | sed s/[[:space:]]//g); do
(( count++ ))
key=${line%%=*}
value=${line#*=}
addConfig "${key}" "${value}"
done
echo "========================================================================="
echo " Complete initialization parameters, total-count:$count , failure-count:$failCount "
echo "========================================================================="
if [[ ${failCount} -eq 0 ]]; then
echo " Init nacos config finished, please start seata-server. "
else
echo " init nacos config fail. "
fi

View File

@@ -0,0 +1,102 @@
#!/usr/bin/env bash
# Copyright 1999-2019 Seata.io Group.
#
# Licensed 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.
# The purpose is to sync the local configuration(config.txt) to zk.
# This script need to rely on zk.
while getopts ":h:p:z:" opt
do
case $opt in
h)
host=$OPTARG
;;
p)
port=$OPTARG
;;
z)
zkHome=$OPTARG
;;
?)
echo " USAGE OPTION: $0 [-h host] [-p port] [-z zkHome] "
exit 1
;;
esac
done
if [[ -z ${host} ]]; then
host=localhost
fi
if [[ -z ${port} ]]; then
port=2181
fi
if [[ -z ${zkHome} ]]; then
echo " zk home is empty, please usage option: [-z zkHome] "
exit 1
fi
zkAddr=$host:$port
root="/seata"
tempLog=$(mktemp -u)
echo "ZK address is $zkAddr"
echo "ZK home is $zkHome"
echo "ZK config root node is $root"
function check_node() {
"$2"/bin/zkCli.sh -server "$1" ls ${root} >/dev/null 2>"${tempLog}"
}
function create_node() {
"$2"/bin/zkCli.sh -server "$1" create ${root} "" >/dev/null
}
function create_subNode() {
"$2"/bin/zkCli.sh -server "$1" create "${root}/$3" "$4" >/dev/null
}
function delete_node() {
"$2"/bin/zkCli.sh -server $1 rmr ${root} "" >/dev/null
}
check_node "${zkAddr}" "${zkHome}"
if [[ $(cat "${tempLog}") =~ "No such file or directory" ]]; then
echo " ZK home is error, please enter correct zk home! "
exit 1
elif [[ $(cat "${tempLog}") =~ "Exception" ]]; then
echo " Exception error, please check zk cluster status or if the zk address is entered correctly! "
exit 1
elif [[ $(cat "${tempLog}") =~ "Node does not exist" ]]; then
create_node "${zkAddr}" "${zkHome}"
else
read -p "${root} node already exists, now delete ${root} node in zk, y/n: " result
if [[ ${result} == "y" ]]; then
echo "Delete ${root} node..."
delete_node "${zkAddr}" "${zkHome}"
create_node "${zkAddr}" "${zkHome}"
else
exit 0
fi
fi
for line in $(cat $(dirname "$PWD")/config.txt | sed s/[[:space:]]//g); do
key=${line%%=*}
value=${line#*=}
echo "Set" "${key}" "=" "${value}"
create_subNode "${zkAddr}" "${zkHome}" "${key}" "${value}"
done

View File

@@ -0,0 +1,17 @@
# App(Logback KafkaAppender) -> Kafka -> Logstash -> Elasticsearch pipeline.
input {
kafka {
bootstrap_servers => "localhost:9092"
topics => ["logback_to_logstash"]
}
}
output{
elasticsearch {
hosts => ["localhost:9200"]
}
stdout {
codec => rubydebug
}
}

View File

@@ -0,0 +1,19 @@
# App(Logback LogstashTcpSocketAppender) -> Logstash -> Elasticsearch pipeline.
input {
# Using TCP protocol
tcp {
port => 4560
# execute command `./logstash-plugin install logstash-codec-json_lines` to install this plugin.
codec => json_lines
}
}
output{
elasticsearch {
hosts => ["localhost:9200"]
}
stdout {
codec => rubydebug
}
}

View File

@@ -0,0 +1,65 @@
## transaction log store, only used in seata-server
store {
## store mode: file、db、redis
mode = "file"
## file store property
file {
## store location dir
dir = "sessionStore"
# branch session size , if exceeded first try compress lockkey, still exceeded throws exceptions
maxBranchSessionSize = 16384
# globe session size , if exceeded throws exceptions
maxGlobalSessionSize = 512
# file buffer size , if exceeded allocate new buffer
fileWriteBufferCacheSize = 16384
# when recover batch read size
sessionReloadReadSize = 100
# async, sync
flushDiskMode = async
}
## database store property
db {
## the implement of javax.sql.DataSource, such as DruidDataSource(druid)/BasicDataSource(dbcp)/HikariDataSource(hikari) etc.
datasource = "druid"
## mysql/oracle/postgresql/h2/oceanbase etc.
dbType = "mysql"
driverClassName = "com.mysql.jdbc.Driver"
## if using mysql to store the data, recommend add rewriteBatchedStatements=true in jdbc connection param
url = "jdbc:mysql://127.0.0.1:3306/seata?rewriteBatchedStatements=true"
user = "mysql"
password = "mysql"
minConn = 5
maxConn = 100
globalTable = "global_table"
branchTable = "branch_table"
lockTable = "lock_table"
queryLimit = 100
maxWait = 5000
}
## redis store property
redis {
## redis mode: single、sentinel
mode = "single"
## single mode property
single {
host = "127.0.0.1"
port = "6379"
}
## sentinel mode property
sentinel {
masterName = ""
## such as "10.28.235.65:26379,10.28.235.65:26380,10.28.235.65:26381"
sentinelHosts = ""
}
password = ""
database = "0"
minConn = 1
maxConn = 10
maxTotal = 100
queryLimit = 100
}
}

View File

@@ -0,0 +1,33 @@
store.mode=file
store.file.dir=sessionStore
store.file.maxBranchSessionSize=16384
store.file.maxGlobalSessionSize=512
store.file.fileWriteBufferCacheSize=16384
store.file.sessionReloadReadSize=100
store.file.flushDiskMode=async
store.db.datasource=druid
store.db.dbType=mysql
store.db.driverClassName=com.mysql.jdbc.Driver
# if using mysql to store the data, recommend add rewriteBatchedStatements=true in jdbc connection param
store.db.url=jdbc:mysql://127.0.0.1:3306/seata?rewriteBatchedStatements=true
store.db.user=mysql
store.db.password=mysql
store.db.minConn=5
store.db.maxConn=100
store.db.globalTable=global_table
store.db.branchTable=branch_table
store.db.lockTable=lock_table
store.db.queryLimit=100
store.db.maxWait=5000
seata.store.redis.mode=single
seata.store.redis.single.host=127.0.0.1
seata.store.redis.single.port=6379
seata.store.redis.sentinel.masterName=
seata.store.redis.sentinel.sentinelHosts=
seata.store.redis.password=
seata.store.redis.database=0
seata.store.redis.minConn=1
seata.store.redis.maxConn=10
seata.store.redis.maxTotal=100
seata.store.redis.queryLimit=100

View File

@@ -0,0 +1,54 @@
## transaction log store, only used in seata-server
store:
## store mode: file、db、redis
mode: file
## file store property
file:
## store location dir
dir: sessionStore
# branch session size , if exceeded first try compress lockkey, still exceeded throws exceptions
maxBranchSessionSize: 16384
# globe session size , if exceeded throws exceptions
maxGlobalSessionSize: 512
# file buffer size , if exceeded allocate new buffer
fileWriteBufferCacheSize: 16384
# when recover batch read size
sessionReloadReadSize: 100
# async, sync
flushDiskMode: async
## database store property
db:
## the implement of javax.sql.DataSource, such as DruidDataSource(druid)/BasicDataSource(dbcp)/HikariDataSource(hikari) etc.
datasource: druid
## mysql/oracle/postgresql/h2/oceanbase etc.
dbType: mysql
driverClassName: com.mysql.jdbc.Driver
## if using mysql to store the data, recommend add rewriteBatchedStatements=true in jdbc connection param
url: jdbc:mysql://127.0.0.1:3306/seata?rewriteBatchedStatements=true
user: mysql
password: mysql
minConn: 5
maxConn: 100
globalTable: global_table
branchTable: branch_table
lockTable: lock_table
queryLimit: 100
maxWait: 5000
## redis store property
redis:
mode: "single"
single:
host: "127.0.0.1"
port: "6379"
sentinel:
masterName: ""
sentinelHosts: ""
password: ""
database: "0"
minConn: 1
maxConn: 10
maxTotal: 100
queryLimit: 100

View File

@@ -0,0 +1,91 @@
registry {
# file,nacos,eureka,redis,zk,consul,etcd3,sofa
type = "file"
nacos {
application = "seata-server"
serverAddr = "127.0.0.1:8848"
group = "SEATA_GROUP"
namespace = ""
cluster = "default"
username = ""
password = ""
}
eureka {
serviceUrl = "http://localhost:8761/eureka"
application = "default"
weight = "1"
}
redis {
serverAddr = "localhost:6379"
db = 0
password = ""
cluster = "default"
timeout = 0
}
zk {
cluster = "default"
serverAddr = "127.0.0.1:2181"
sessionTimeout = 6000
connectTimeout = 2000
username = ""
password = ""
}
consul {
cluster = "default"
serverAddr = "127.0.0.1:8500"
}
etcd3 {
cluster = "default"
serverAddr = "http://localhost:2379"
}
sofa {
serverAddr = "127.0.0.1:9603"
application = "default"
region = "DEFAULT_ZONE"
datacenter = "DefaultDataCenter"
cluster = "default"
group = "SEATA_GROUP"
addressWaitTime = "3000"
}
file {
name = "file.conf"
}
}
config {
# file、nacos 、apollo、zk、consul、etcd3
type = "file"
nacos {
serverAddr = "127.0.0.1:8848"
namespace = ""
group = "SEATA_GROUP"
username = ""
password = ""
dataId = "seataServer.properties"
}
consul {
serverAddr = "127.0.0.1:8500"
}
apollo {
appId = "seata-server"
apolloMeta = "http://192.168.1.204:8801"
namespace = "application"
apolloAccesskeySecret = ""
}
zk {
serverAddr = "127.0.0.1:2181"
sessionTimeout = 6000
connectTimeout = 2000
username = ""
password = ""
nodePath = "/seata/seata.properties"
}
etcd3 {
serverAddr = "http://localhost:2379"
}
file {
name = "file.conf"
}
}

View File

@@ -0,0 +1,54 @@
registry.type=file
registry.nacos.application=seata-server
registry.nacos.serverAddr=127.0.0.1:8848
registry.nacos.group=SEATA_GROUP
registry.nacos.namespace=
registry.nacos.cluster=default
registry.nacos.username=
registry.nacos.password=
registry.eureka.serviceUrl=http://localhost:8761/eureka
registry.eureka.application=default
registry.eureka.weight=1
registry.redis.serverAddr=localhost:6379
registry.redis.db=0
registry.redis.password=
registry.redis.cluster=default
registry.redis.timeout=0
registry.zk.cluster=default
registry.zk.serverAddr=127.0.0.1:2181
registry.zk.sessionTimeout=6000
registry.zk.connectTimeout=2000
registry.zk.username=
registry.zk.password=
registry.consul.cluster=default
registry.consul.serverAddr=127.0.0.1:8500
registry.etcd3.cluster=default
registry.etcd3.serverAddr=http://localhost:2379
registry.sofa.serverAddr=127.0.0.1:9603
registry.sofa.application=default
registry.sofa.region=DEFAULT_ZONE
registry.sofa.datacenter=DefaultDataCenter
registry.sofa.cluster=default
registry.sofa.group=SEATA_GROUP
registry.sofa.addressWaitTime=3000
registry.file.name=file.properties
config.type=file
config.nacos.serverAddr=127.0.0.1:8848
config.nacos.namespace=
config.nacos.group=SEATA_GROUP
config.nacos.username=
config.nacos.password=
config.nacos.dataId=seataServer.properties
config.consul.serverAddr=127.0.0.1:8500
config.apollo.appId=seata-server
config.apollo.apolloMeta=http://192.168.1.204:8801
config.apollo.namespace=application
config.apollo.apolloAccesskeySecret=
config.zk.serverAddr=127.0.0.1:2181
config.zk.sessionTimeout=6000
config.zk.connectTimeout=2000
config.zk.username=
config.zk.password=
config.zk.nodePath=/seata/seata.properties
config.etcd3.serverAddr=http://localhost:2379
config.file.name=file.properties

View File

@@ -0,0 +1,91 @@
registry:
# file,nacos,eureka,redis,zk,consul,etcd3,sofa
type: file
nacos:
application: seata-server
serverAddr: 127.0.0.1:8848
group: SEATA_GROUP
namespace:
cluster: default
username:
password:
eureka:
serviceUrl: http://localhost:8761/eureka
application: default
weight: 1
redis:
serverAddr: localhost:6379
db: 0
password:
cluster: default
timeout: 0
zk:
cluster: default
serverAddr: 127.0.0.1:2181
sessionTimeout: 6000
connectTimeout: 2000
username:
password:
consul:
cluster: default
serverAddr: 127.0.0.1:8500
etcd3:
cluster: default
serverAddr: http://localhost:2379
sofa:
serverAddr: 127.0.0.1:9603
application: default
region: DEFAULT_ZONE
datacenter: DefaultDataCenter
cluster: default
group: SEATA_GROUP
addressWaitTime: 3000
file:
name: file.yml
config:
# file、nacos 、apollo、zk、consul、etcd3
type: file
nacos:
serverAddr: 127.0.0.1:8848
namespace:
group: SEATA_GROUP
username:
password:
dataId: seataServer.properties
consul:
serverAddr: 127.0.0.1:8500
apollo:
appId: seata-server
apolloMeta: http://192.168.1.204:8801
namespace: application
apolloAccesskeySecret:
zk:
serverAddr: 127.0.0.1:2181
sessionTimeout: 6000
connectTimeout: 2000
username:
password:
nodePath: /seata/seata.properties
etcd3:
serverAddr: http://localhost:2379
file:
name: file.yml

View File

@@ -0,0 +1,56 @@
-- -------------------------------- The script used when storeMode is 'db' --------------------------------
-- the table to store GlobalSession data
CREATE TABLE IF NOT EXISTS `global_table`
(
`xid` VARCHAR(128) NOT NULL,
`transaction_id` BIGINT,
`status` TINYINT NOT NULL,
`application_id` VARCHAR(32),
`transaction_service_group` VARCHAR(32),
`transaction_name` VARCHAR(128),
`timeout` INT,
`begin_time` BIGINT,
`application_data` VARCHAR(2000),
`gmt_create` DATETIME,
`gmt_modified` DATETIME,
PRIMARY KEY (`xid`),
KEY `idx_gmt_modified_status` (`gmt_modified`, `status`),
KEY `idx_transaction_id` (`transaction_id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8;
-- the table to store BranchSession data
CREATE TABLE IF NOT EXISTS `branch_table`
(
`branch_id` BIGINT NOT NULL,
`xid` VARCHAR(128) NOT NULL,
`transaction_id` BIGINT,
`resource_group_id` VARCHAR(32),
`resource_id` VARCHAR(256),
`branch_type` VARCHAR(8),
`status` TINYINT,
`client_id` VARCHAR(64),
`application_data` VARCHAR(2000),
`gmt_create` DATETIME(6),
`gmt_modified` DATETIME(6),
PRIMARY KEY (`branch_id`),
KEY `idx_xid` (`xid`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8;
-- the table to store lock data
CREATE TABLE IF NOT EXISTS `lock_table`
(
`row_key` VARCHAR(128) NOT NULL,
`xid` VARCHAR(128),
`transaction_id` BIGINT,
`branch_id` BIGINT NOT NULL,
`resource_id` VARCHAR(256),
`table_name` VARCHAR(32),
`pk` VARCHAR(36),
`gmt_create` DATETIME,
`gmt_modified` DATETIME,
PRIMARY KEY (`row_key`),
KEY `idx_branch_id` (`branch_id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8;

View File

@@ -0,0 +1,56 @@
-- -------------------------------- The script used when storeMode is 'db' --------------------------------
-- the table to store GlobalSession data
CREATE TABLE global_table
(
xid VARCHAR2(128) NOT NULL,
transaction_id NUMBER(19),
status NUMBER(3) NOT NULL,
application_id VARCHAR2(32),
transaction_service_group VARCHAR2(32),
transaction_name VARCHAR2(128),
timeout NUMBER(10),
begin_time NUMBER(19),
application_data VARCHAR2(2000),
gmt_create TIMESTAMP(0),
gmt_modified TIMESTAMP(0),
PRIMARY KEY (xid)
);
CREATE INDEX idx_gmt_modified_status ON global_table (gmt_modified, status);
CREATE INDEX idx_transaction_id ON global_table (transaction_id);
-- the table to store BranchSession data
CREATE TABLE branch_table
(
branch_id NUMBER(19) NOT NULL,
xid VARCHAR2(128) NOT NULL,
transaction_id NUMBER(19),
resource_group_id VARCHAR2(32),
resource_id VARCHAR2(256),
branch_type VARCHAR2(8),
status NUMBER(3),
client_id VARCHAR2(64),
application_data VARCHAR2(2000),
gmt_create TIMESTAMP(6),
gmt_modified TIMESTAMP(6),
PRIMARY KEY (branch_id)
);
CREATE INDEX idx_xid ON branch_table (xid);
-- the table to store lock data
CREATE TABLE lock_table
(
row_key VARCHAR2(128) NOT NULL,
xid VARCHAR2(128),
transaction_id NUMBER(19),
branch_id NUMBER(19) NOT NULL,
resource_id VARCHAR2(256),
table_name VARCHAR2(32),
pk VARCHAR2(36),
gmt_create TIMESTAMP(0),
gmt_modified TIMESTAMP(0),
PRIMARY KEY (row_key)
);
CREATE INDEX idx_branch_id ON lock_table (branch_id);

View File

@@ -0,0 +1,56 @@
-- -------------------------------- The script used when storeMode is 'db' --------------------------------
-- the table to store GlobalSession data
CREATE TABLE IF NOT EXISTS public.global_table
(
xid VARCHAR(128) NOT NULL,
transaction_id BIGINT,
status SMALLINT NOT NULL,
application_id VARCHAR(32),
transaction_service_group VARCHAR(32),
transaction_name VARCHAR(128),
timeout INT,
begin_time BIGINT,
application_data VARCHAR(2000),
gmt_create TIMESTAMP(0),
gmt_modified TIMESTAMP(0),
CONSTRAINT pk_global_table PRIMARY KEY (xid)
);
CREATE INDEX idx_gmt_modified_status ON public.global_table (gmt_modified, status);
CREATE INDEX idx_transaction_id ON public.global_table (transaction_id);
-- the table to store BranchSession data
CREATE TABLE IF NOT EXISTS public.branch_table
(
branch_id BIGINT NOT NULL,
xid VARCHAR(128) NOT NULL,
transaction_id BIGINT,
resource_group_id VARCHAR(32),
resource_id VARCHAR(256),
branch_type VARCHAR(8),
status SMALLINT,
client_id VARCHAR(64),
application_data VARCHAR(2000),
gmt_create TIMESTAMP(6),
gmt_modified TIMESTAMP(6),
CONSTRAINT pk_branch_table PRIMARY KEY (branch_id)
);
CREATE INDEX idx_xid ON public.branch_table (xid);
-- the table to store lock data
CREATE TABLE IF NOT EXISTS public.lock_table
(
row_key VARCHAR(128) NOT NULL,
xid VARCHAR(128),
transaction_id BIGINT,
branch_id BIGINT NOT NULL,
resource_id VARCHAR(256),
table_name VARCHAR(32),
pk VARCHAR(36),
gmt_create TIMESTAMP(0),
gmt_modified TIMESTAMP(0),
CONSTRAINT pk_lock_table PRIMARY KEY (row_key)
);
CREATE INDEX idx_branch_id ON public.lock_table (branch_id);

View File

@@ -0,0 +1,10 @@
version: "3"
services:
seata-server:
image: seataio/seata-server
hostname: seata-server
ports:
- "8091:8091"
environment:
- SEATA_PORT=8091
- STORE_MODE=file

View File

@@ -0,0 +1,22 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

View File

@@ -0,0 +1,5 @@
apiVersion: v1
appVersion: "1.0"
description: Seata Server
name: seata-server
version: 1.0.0

View File

@@ -0,0 +1,15 @@
1. Get the application URL by running these commands:
{{- if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "seata-server.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "seata-server.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "seata-server.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "seata-server.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl port-forward $POD_NAME 8080:80
{{- end }}

View File

@@ -0,0 +1,56 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "seata-server.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "seata-server.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "seata-server.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Common labels
*/}}
{{- define "seata-server.labels" -}}
app.kubernetes.io/name: {{ include "seata-server.name" . }}
helm.sh/chart: {{ include "seata-server.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}
{{/*
Create the name of the service account to use
*/}}
{{- define "seata-server.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "seata-server.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}

View File

@@ -0,0 +1,71 @@
apiVersion: apps/v1
kind: Deployment
metadata:
{{- if .Values.namespace }}
namespace: {{ .Values.namespace }}
{{- end}}
name: {{ include "seata-server.name" . }}
labels:
{{ include "seata-server.labels" . | indent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "seata-server.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "seata-server.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 8091
protocol: TCP
{{- if .Values.volume }}
volumeMounts:
{{- range .Values.volume }}
- name: {{ .name }}
mountPath: {{ .mountPath }}
{{- end}}
{{- end}}
{{- if .Values.env }}
env:
{{- if .Values.env.seataIp }}
- name: SEATA_IP
value: {{ .Values.env.seataIp | quote }}
{{- end }}
{{- if .Values.env.seataPort }}
- name: SEATA_PORT
value: {{ .Values.env.seataPort | quote }}
{{- end }}
{{- if .Values.env.seataEnv }}
- name: SEATA_ENV
value: {{ .Values.env.seataEnv }}
{{- end }}
{{- if .Values.env.seataConfigName }}
- name: SEATA_CONFIG_NAME
value: {{ .Values.env.seataConfigName }}
{{- end }}
{{- if .Values.env.serverNode }}
- name: SERVER_NODE
value: {{ .Values.env.serverNode | quote }}
{{- end }}
{{- if .Values.env.storeMode }}
- name: STORE_MODE
value: {{ .Values.env.storeMode }}
{{- end }}
{{- end }}
{{- if .Values.volume }}
volumes:
{{- range .Values.volume }}
- name: {{ .name }}
hostPath:
path: {{ .hostPath}}
{{- end}}
{{- end}}

View File

@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "seata-server.fullname" . }}
labels:
{{ include "seata-server.labels" . | indent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
app.kubernetes.io/name: {{ include "seata-server.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}

View File

@@ -0,0 +1,15 @@
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "seata-server.fullname" . }}-test-connection"
labels:
{{ include "seata-server.labels" . | indent 4 }}
annotations:
"helm.sh/hook": test-success
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['{{ include "seata-server.fullname" . }}:{{ .Values.service.port }}']
restartPolicy: Never

View File

@@ -0,0 +1,17 @@
replicaCount: 1
namespace: default
image:
repository: seataio/seata-server
tag: latest
pullPolicy: IfNotPresent
service:
type: NodePort
port: 30091
env:
seataPort: "8091"
storeMode: "file"
serverNode: "1"

View File

@@ -0,0 +1,49 @@
apiVersion: v1
kind: Service
metadata:
name: seata-server
namespace: default
labels:
k8s-app: seata-server
spec:
type: NodePort
ports:
- port: 8091
nodePort: 30091
protocol: TCP
name: http
selector:
k8s-app: seata-server
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: seata-server
namespace: default
labels:
k8s-app: seata-server
spec:
replicas: 1
selector:
matchLabels:
k8s-app: seata-server
template:
metadata:
labels:
k8s-app: seata-server
spec:
containers:
- name: seata-server
image: docker.io/seataio/seata-server:latest
imagePullPolicy: IfNotPresent
env:
- name: SEATA_PORT
value: "8091"
- name: STORE_MODE
value: file
ports:
- name: http
containerPort: 8091
protocol: TCP