一、 Gitlab
version: '3'
services:
gitlab:
restart: always
image: gitlab/gitlab-ee:latest
container_name: gitlab
privileged: true
ports:
- '80:80'
- '443:443'
volumes:
- ./gitlab/:/etc/gitlab
- ./opt/:/var/opt/gitlab
- ./log/:/var/log/gitlab
默认帐户的用户名是:root
修改配置文件
vim gitlab/gitlab.rb
-------------------------------------
external_url 'http://192.168.17.101/'
-------------------------------------
vim opt/gitlab-rails/etc/gitlab.yml
-------------------------------------
production: &base
#
# 1. GitLab app settings
# ==========================
## GitLab settings
gitlab:
## Web server settings (note: host is the FQDN, do not include http://)
host: 192.168.17.101
port: 80
https: false
-------------------------------------
二、 Jenkins
mkdir data
chown -R 1000:1000 data
version: '3'
services:
jenkins:
restart: always
image: jenkins/jenkins:lts
container_name: jenkins
ports:
- '8080:8080'
- '50000:50000'
volumes:
- ./data/:/var/jenkins_home
- ./apache-maven-3.6.3:/var/apache-maven-3.6.3
- ./gradle-4.0.1/:/var/gradle-4.0.1
- ./jdk1.8.0_181/:/var/jdk1.8.0_181
- ./git-2.25.0/:/var/git-2.25.0
三、 MySQL
# docker-compose.yaml的书写格式版本
version: "3.0"
# 定义服务, 可以有很多服务,说白了就是多个容器,这个值是固定
services:
# 自定义服务
mysql:
# mysql依赖的基础镜像
image: mysql:5.7
# 端口
ports:
- "3306:3306"
# 容器名
container_name: mysql
# 数据卷
volumes:
# 将mysql的数据持久化到宿主机
- "./data:/var/lib/mysql"
# 让容器中mysql的配置使用我们自定义的配置文件,主要是编码问题
- "./conf/my.cnf:/etc/mysql/my.cnf"
environment:
# mysql的root用户密码
- MYSQL_ROOT_PASSWORD=123456
my.cnf
[mysqld]
character_set_server=utf8
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
datadir = /var/lib/mysql
version: "3.0"
services:
mysql:
image: mysql:5.7.26
ports:
- "3366:3306"
container_name: mysql
restart: always
privileged: true
command:
--character-set-server=utf8
--lower_case_table_names=1
--server-id=1
--log-bin=/var/lib/mysql/bin-log
volumes:
- "./data:/var/lib/mysql"
environment:
- MYSQL_ROOT_PASSWORD=123456
四、 Nexus
mkdir data
chmod 777 data
账号:admin
密码:cat data/admin.password
version: '3'
services:
nexus:
restart: always
image: sonatype/nexus3:latest
container_name: nexus3
privileged: true
ports:
- '8081:8081'
- '8082:8082'
- '8083:8083'
- '8084:8084'
- '8085:8085'
volumes:
- ./data/:/nexus-data
五、 Redis
version: '3'
services:
redis:
image: redis:4.0.6
container_name: redis
restart: always
command: --appendonly yes
ports:
- 6379:6379
volumes:
- ./data:/data
六、 RocketMQ
Broker 和 NameServer 分别都做了集群部署,各部署两个。
broker-1.conf
mkdir -p data/broker-1
vim data/broker-1/broker-1.conf
# 所属集群名字
brokerClusterName = rocketmq-cluster
# Broker的名称
brokerName = broker-1
# 0表示Master,大于0表示不同的Slave的ID
brokerId = 0
# 开发环境填外网,生产环境建议填内网
brokerIP1 = 192.168.17.101
# 表明在几点做消息删除动作,默认值04,表示凌晨4点
deleteWhen = 04
# 在磁盘上保存消息的时长,单位是小时,自动删除超时的消息
fileReservedTime = 48
# Broker角色,ASYNC_MASTER异步复制Master,SYNC_MASTER同步双写Master,SLAVE从节点
brokerRole = ASYNC_MASTER
# 刷盘方式,ASYNC_FLUSH异步刷盘,SYNC_FLUSH同步刷盘
flushDiskType = ASYNC_FLUSH
# nameserver地址,如果nameserver是多台集群的话,用分号分割,开发环境填外网,生产环境建议填内网
namesrvAddr=192.168.17.101:9876;192.168.17.101:9877
autoCreateTopicEnable=true
# Broker对外服务的监听端口
listenPort = 10911
broker-2.conf
mkdir -p data/broker-2
vim data/broker-2/broker-2.conf
# 所属集群名字
brokerClusterName = rocketmq-cluster
# Broker的名称
brokerName = broker-2
# 0表示Master,大于0表示不同的Slave的ID
brokerId = 0
# 开发环境填外网,生产环境建议填内网
brokerIP1 = 192.168.17.101
# 表明在几点做消息删除动作,默认值04,表示凌晨4点
deleteWhen = 04
# 在磁盘上保存消息的时长,单位是小时,自动删除超时的消息
fileReservedTime = 48
# Broker角色,ASYNC_MASTER异步复制Master,SYNC_MASTER同步双写Master,SLAVE从节点
brokerRole = ASYNC_MASTER
# 刷盘方式,ASYNC_FLUSH异步刷盘,SYNC_FLUSH同步刷盘
flushDiskType = ASYNC_FLUSH
# nameserver地址,如果nameserver是多台集群的话,用分号分割,开发环境填外网,生产环境建议填内网
namesrvAddr=192.168.17.101:9876;192.168.17.101:9877
autoCreateTopicEnable=true
# Broker对外服务的监听端口
listenPort = 10912
docker-compose.yaml
chown 3000:3000 -R data/
vim docker-compose.yaml
version: '3.5'
services:
nameserver-1:
image: rocketmqinc/rocketmq:4.3.0
container_name: nameserver-1
ports:
- 9876:9876
volumes:
- ./data/nameserver-1/logs:/home/rocketmq/logs
- ./data/nameserver-1/store:/home/rocketmq/store
command: sh mqnamesrv
networks:
rocketmq:
aliases:
- nameserver-1
nameserver-2:
image: rocketmqinc/rocketmq:4.3.0
container_name: nameserver-2
ports:
- 9877:9876
volumes:
- ./data/nameserver-2/logs:/home/rocketmq/logs
- ./data/nameserver-2/store:/home/rocketmq/store
command: sh mqnamesrv
networks:
rocketmq:
aliases:
- nameserver-2
broker-1:
image: rocketmqinc/rocketmq:4.3.0
container_name: broker-1
ports:
- 10911:10911
volumes:
- ./data/broker-1/logs:/home/rocketmq/logs
- ./data/broker-1/store:/home/rocketmq/store
- ./data/broker-1/broker-1.conf:/opt/rocketmq-4.3.0/conf/broker.conf
environment:
TZ: Asia/Shanghai
NAMESRV_ADDR: "nameserver-1:9876"
JAVA_OPT_EXT: "-server -Xms256m -Xmx256m -Xmn128m"
command: sh mqbroker -c /opt/rocketmq-4.3.0/conf/broker.conf autoCreateTopicEnable=true &
links:
- nameserver-1:nameserver-1
- nameserver-2:nameserver-2
networks:
rocketmq:
aliases:
- broker-1
broker-2:
image: rocketmqinc/rocketmq:4.3.0
container_name: broker-2
ports:
- 10912:10912
volumes:
- ./data/broker-2/logs:/home/rocketmq/logs
- ./data/broker-2/store:/home/rocketmq/store
- ./data/broker-2/broker-2.conf:/opt/rocketmq-4.3.0/conf/broker.conf
environment:
TZ: Asia/Shanghai
NAMESRV_ADDR: "nameserver-2:9876"
JAVA_OPT_EXT: "-server -Xms256m -Xmx256m -Xmn128m"
command: sh mqbroker -c /opt/rocketmq-4.3.0/conf/broker.conf autoCreateTopicEnable=true &
links:
- nameserver-1:nameserver-1
- nameserver-2:nameserver-2
networks:
rocketmq:
aliases:
- broker-2
console:
image: styletang/rocketmq-console-ng:latest
container_name: console
ports:
- 8080:8080
environment:
JAVA_OPTS: -Drocketmq.namesrv.addr=nameserver-1:9876;nameserver-2:9876 -Dcom.rocketmq.sendMessageWithVIPChannel=false
networks:
rocketmq:
aliases:
- console
networks:
rocketmq:
name: rocketmq
driver: bridge
<!-- SpringBoot整合RocketMQ -->
<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-spring-boot-starter</artifactId>
<version>2.1.0</version>
</dependency>
七、 Ngnix
version: "3"
services:
nginx:
image: docker.io/nginx:latest
restart: always
privileged: true
ports:
- "80:80"
- "443:443"
container_name: nginx
volumes:
- "./data/conf/nginx.conf:/etc/nginx/nginx.conf"
- "./data/conf/conf.d/default.conf:/etc/nginx/conf.d/default.conf"
- "./data/www:/usr/share/nginx/html"
- "./data/logs:/var/log/nginx"
- "./data/ssl:/ssl"
nginx.conf
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
}
default.conf
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
八、 ZipKin
version: '3.0'
services:
zipkin:
image: openzipkin/zipkin
restart: always
container_name: zipkin
ports:
- 9411:9411
九、 Elasticsearch
chmod 777 data/
version: '3'
services:
elasticsearch:
image: elasticsearch:6.4.3
container_name: elasticsearch
restart: always
volumes:
- ./data:/usr/share/elasticsearch/data
environment:
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- "cluster.name=elasticsearch"
- "TZ=Asia/Shanghai"
ports:
- "9200:9200"
- "9300:9300"
十、 Nacos
version: "3"
services:
nacos:
image: nacos/nacos-server:latest
container_name: nacos
volumes:
- ./data/logs/:/home/nacos/logs
- ./data/conf/custom.properties:/home/nacos/init.d/custom.properties
ports:
- "8848:8848"
- "9555:9555"
privileged: true
restart: always
environment:
- "PREFER_HOST_MODE=hostname"
- "MODE=standalone"
- "SPRING_DATASOURCE_PLATFORM=mysql"
- "MYSQL_SERVICE_HOST=192.168.17.199"
- "MYSQL_SERVICE_DB_NAME=nacos"
- "MYSQL_SERVICE_PORT=3306"
- "MYSQL_SERVICE_USER=root"
- "MYSQL_SERVICE_PASSWORD=123456"
custom.properties
#spring.security.enabled=false
#management.security=false
#security.basic.enabled=false
#nacos.security.ignore.urls=/**
#management.metrics.export.elastic.host=http://localhost:9200
# metrics for prometheus
management.endpoints.web.exposure.include=*
# metrics for elastic search
#management.metrics.export.elastic.enabled=false
#management.metrics.export.elastic.host=http://localhost:9200
# metrics for influx
#management.metrics.export.influx.enabled=false
#management.metrics.export.influx.db=springboot
#management.metrics.export.influx.uri=http://localhost:8086
#management.metrics.export.influx.auto-create-db=true
#management.metrics.export.influx.consistency=one
#management.metrics.export.influx.compressed=true
sql
/*
SQLyog Ultimate v12.4.0 (64 bit)
MySQL - 5.7.29 : Database - nacos
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;
/*!40101 SET SQL_MODE=''*/;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`nacos` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;
USE `nacos`;
/*Table structure for table `config_info` */
DROP TABLE IF EXISTS `config_info`;
CREATE TABLE `config_info` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`data_id` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'data_id',
`group_id` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`content` longtext COLLATE utf8_bin NOT NULL COMMENT 'content',
`md5` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT 'md5',
`gmt_create` datetime NOT NULL DEFAULT '2010-05-05 00:00:00' COMMENT '创建时间',
`gmt_modified` datetime NOT NULL DEFAULT '2010-05-05 00:00:00' COMMENT '修改时间',
`src_user` text COLLATE utf8_bin COMMENT 'source user',
`src_ip` varchar(20) COLLATE utf8_bin DEFAULT NULL COMMENT 'source ip',
`app_name` varchar(128) COLLATE utf8_bin DEFAULT NULL,
`tenant_id` varchar(128) COLLATE utf8_bin DEFAULT '' COMMENT '租户字段',
`c_desc` varchar(256) COLLATE utf8_bin DEFAULT NULL,
`c_use` varchar(64) COLLATE utf8_bin DEFAULT NULL,
`effect` varchar(64) COLLATE utf8_bin DEFAULT NULL,
`type` varchar(64) COLLATE utf8_bin DEFAULT NULL,
`c_schema` text COLLATE utf8_bin,
PRIMARY KEY (`id`),
UNIQUE KEY `uk_configinfo_datagrouptenant` (`data_id`,`group_id`,`tenant_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_info';
/*Data for the table `config_info` */
/*Table structure for table `config_info_aggr` */
DROP TABLE IF EXISTS `config_info_aggr`;
CREATE TABLE `config_info_aggr` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`data_id` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'data_id',
`group_id` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'group_id',
`datum_id` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'datum_id',
`content` longtext COLLATE utf8_bin NOT NULL COMMENT '内容',
`gmt_modified` datetime NOT NULL COMMENT '修改时间',
`app_name` varchar(128) COLLATE utf8_bin DEFAULT NULL,
`tenant_id` varchar(128) COLLATE utf8_bin DEFAULT '' COMMENT '租户字段',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_configinfoaggr_datagrouptenantdatum` (`data_id`,`group_id`,`tenant_id`,`datum_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='增加租户字段';
/*Data for the table `config_info_aggr` */
/*Table structure for table `config_info_beta` */
DROP TABLE IF EXISTS `config_info_beta`;
CREATE TABLE `config_info_beta` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`data_id` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'data_id',
`group_id` varchar(128) COLLATE utf8_bin NOT NULL COMMENT 'group_id',
`app_name` varchar(128) COLLATE utf8_bin DEFAULT NULL COMMENT 'app_name',
`content` longtext COLLATE utf8_bin NOT NULL COMMENT 'content',
`beta_ips` varchar(1024) COLLATE utf8_bin DEFAULT NULL COMMENT 'betaIps',
`md5` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT 'md5',
`gmt_create` datetime NOT NULL DEFAULT '2010-05-05 00:00:00' COMMENT '创建时间',
`gmt_modified` datetime NOT NULL DEFAULT '2010-05-05 00:00:00' COMMENT '修改时间',
`src_user` text COLLATE utf8_bin COMMENT 'source user',
`src_ip` varchar(20) COLLATE utf8_bin DEFAULT NULL COMMENT 'source ip',
`tenant_id` varchar(128) COLLATE utf8_bin DEFAULT '' COMMENT '租户字段',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_configinfobeta_datagrouptenant` (`data_id`,`group_id`,`tenant_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_info_beta';
/*Data for the table `config_info_beta` */
/*Table structure for table `config_info_tag` */
DROP TABLE IF EXISTS `config_info_tag`;
CREATE TABLE `config_info_tag` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`data_id` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'data_id',
`group_id` varchar(128) COLLATE utf8_bin NOT NULL COMMENT 'group_id',
`tenant_id` varchar(128) COLLATE utf8_bin DEFAULT '' COMMENT 'tenant_id',
`tag_id` varchar(128) COLLATE utf8_bin NOT NULL COMMENT 'tag_id',
`app_name` varchar(128) COLLATE utf8_bin DEFAULT NULL COMMENT 'app_name',
`content` longtext COLLATE utf8_bin NOT NULL COMMENT 'content',
`md5` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT 'md5',
`gmt_create` datetime NOT NULL DEFAULT '2010-05-05 00:00:00' COMMENT '创建时间',
`gmt_modified` datetime NOT NULL DEFAULT '2010-05-05 00:00:00' COMMENT '修改时间',
`src_user` text COLLATE utf8_bin COMMENT 'source user',
`src_ip` varchar(20) COLLATE utf8_bin DEFAULT NULL COMMENT 'source ip',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_configinfotag_datagrouptenanttag` (`data_id`,`group_id`,`tenant_id`,`tag_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_info_tag';
/*Data for the table `config_info_tag` */
/*Table structure for table `config_tags_relation` */
DROP TABLE IF EXISTS `config_tags_relation`;
CREATE TABLE `config_tags_relation` (
`id` bigint(20) NOT NULL COMMENT 'id',
`tag_name` varchar(128) COLLATE utf8_bin NOT NULL COMMENT 'tag_name',
`tag_type` varchar(64) COLLATE utf8_bin DEFAULT NULL COMMENT 'tag_type',
`data_id` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'data_id',
`group_id` varchar(128) COLLATE utf8_bin NOT NULL COMMENT 'group_id',
`tenant_id` varchar(128) COLLATE utf8_bin DEFAULT '' COMMENT 'tenant_id',
`nid` bigint(20) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`nid`),
UNIQUE KEY `uk_configtagrelation_configidtag` (`id`,`tag_name`,`tag_type`),
KEY `idx_tenant_id` (`tenant_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_tag_relation';
/*Data for the table `config_tags_relation` */
/*Table structure for table `group_capacity` */
DROP TABLE IF EXISTS `group_capacity`;
CREATE TABLE `group_capacity` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`group_id` varchar(128) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'Group ID,空字符表示整个集群',
`quota` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '配额,0表示使用默认值',
`usage` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '使用量',
`max_size` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '单个配置大小上限,单位为字节,0表示使用默认值',
`max_aggr_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '聚合子配置最大个数,,0表示使用默认值',
`max_aggr_size` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '单个聚合数据的子配置大小上限,单位为字节,0表示使用默认值',
`max_history_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '最大变更历史数量',
`gmt_create` datetime NOT NULL DEFAULT '2010-05-05 00:00:00' COMMENT '创建时间',
`gmt_modified` datetime NOT NULL DEFAULT '2010-05-05 00:00:00' COMMENT '修改时间',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_group_id` (`group_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='集群、各Group容量信息表';
/*Data for the table `group_capacity` */
/*Table structure for table `his_config_info` */
DROP TABLE IF EXISTS `his_config_info`;
CREATE TABLE `his_config_info` (
`id` bigint(64) unsigned NOT NULL,
`nid` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`data_id` varchar(255) COLLATE utf8_bin NOT NULL,
`group_id` varchar(128) COLLATE utf8_bin NOT NULL,
`app_name` varchar(128) COLLATE utf8_bin DEFAULT NULL COMMENT 'app_name',
`content` longtext COLLATE utf8_bin NOT NULL,
`md5` varchar(32) COLLATE utf8_bin DEFAULT NULL,
`gmt_create` datetime NOT NULL DEFAULT '2010-05-05 00:00:00',
`gmt_modified` datetime NOT NULL DEFAULT '2010-05-05 00:00:00',
`src_user` text COLLATE utf8_bin,
`src_ip` varchar(20) COLLATE utf8_bin DEFAULT NULL,
`op_type` char(10) COLLATE utf8_bin DEFAULT NULL,
`tenant_id` varchar(128) COLLATE utf8_bin DEFAULT '' COMMENT '租户字段',
PRIMARY KEY (`nid`),
KEY `idx_gmt_create` (`gmt_create`),
KEY `idx_gmt_modified` (`gmt_modified`),
KEY `idx_did` (`data_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='多租户改造';
/*Data for the table `his_config_info` */
/*Table structure for table `permissions` */
DROP TABLE IF EXISTS `permissions`;
CREATE TABLE `permissions` (
`role` varchar(50) NOT NULL,
`resource` varchar(512) NOT NULL,
`ACTION` varchar(8) NOT NULL,
UNIQUE KEY `uk_role_permission` (`role`,`resource`,`ACTION`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*Data for the table `permissions` */
/*Table structure for table `roles` */
DROP TABLE IF EXISTS `roles`;
CREATE TABLE `roles` (
`username` varchar(50) NOT NULL,
`role` varchar(50) NOT NULL,
UNIQUE KEY `uk_username_role` (`username`,`role`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*Data for the table `roles` */
insert into `roles`(`username`,`role`) values
('nacos','ROLE_ADMIN');
/*Table structure for table `tenant_capacity` */
DROP TABLE IF EXISTS `tenant_capacity`;
CREATE TABLE `tenant_capacity` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`tenant_id` varchar(128) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'Tenant ID',
`quota` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '配额,0表示使用默认值',
`usage` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '使用量',
`max_size` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '单个配置大小上限,单位为字节,0表示使用默认值',
`max_aggr_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '聚合子配置最大个数',
`max_aggr_size` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '单个聚合数据的子配置大小上限,单位为字节,0表示使用默认值',
`max_history_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '最大变更历史数量',
`gmt_create` datetime NOT NULL DEFAULT '2010-05-05 00:00:00' COMMENT '创建时间',
`gmt_modified` datetime NOT NULL DEFAULT '2010-05-05 00:00:00' COMMENT '修改时间',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_tenant_id` (`tenant_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='租户容量信息表';
/*Data for the table `tenant_capacity` */
/*Table structure for table `tenant_info` */
DROP TABLE IF EXISTS `tenant_info`;
CREATE TABLE `tenant_info` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`kp` varchar(128) COLLATE utf8_bin NOT NULL COMMENT 'kp',
`tenant_id` varchar(128) COLLATE utf8_bin DEFAULT '' COMMENT 'tenant_id',
`tenant_name` varchar(128) COLLATE utf8_bin DEFAULT '' COMMENT 'tenant_name',
`tenant_desc` varchar(256) COLLATE utf8_bin DEFAULT NULL COMMENT 'tenant_desc',
`create_source` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT 'create_source',
`gmt_create` bigint(20) NOT NULL COMMENT '创建时间',
`gmt_modified` bigint(20) NOT NULL COMMENT '修改时间',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_tenant_info_kptenantid` (`kp`,`tenant_id`),
KEY `idx_tenant_id` (`tenant_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='tenant_info';
/*Data for the table `tenant_info` */
/*Table structure for table `users` */
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`username` varchar(50) NOT NULL,
`PASSWORD` varchar(500) NOT NULL,
`enabled` tinyint(1) NOT NULL,
PRIMARY KEY (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*Data for the table `users` */
insert into `users`(`username`,`PASSWORD`,`enabled`) values
('nacos','$2a$10$EuWPZHzz32dJN7jexM34MOeYirDdFAZm2kuWj7VEOJhhZkDrxfvUu',1);
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
十一 、Sentinel
账号:sentinel
密码:sentinel
访问:http://192.168.17.101:8858/
version: '3.0'
services:
sentinel:
image: bladex/sentinel-dashboard:latest
container_name: sentinel
network_mode: "host"
restart: always
privileged: true
ports:
- '8858:8858'
environment:
- auth.username=sentinel
- auth.password=sentinel
十三、Oracle
初始化先启动一次,不做数据卷,从容器复制数据文件到本地,后做数据卷。
mkdir -p /home/qiang/docker-compose/oracle/data
cd /home/qiang/docker-compose/oracle/data
chmod 777 data/
docker cp oracle:/u01/app/oracle/ data/
无数据卷
version: '3.0'
services:
oracle:
image: alexeiled/docker-oracle-xe-11g:latest
container_name: oracle
restart: always
privileged: true
ports:
- '1521:1521'
- '8080:8080'
environment:
- "ORACLE_ALLOW_REMOTE=true"
有数据卷
version: '3.0'
services:
oracle:
image: alexeiled/docker-oracle-xe-11g:latest
container_name: oracle
restart: always
privileged: true
ports:
- '1521:1521'
- '8080:8080'
volumes:
- ./data/oracle:/u01/app/oracle
environment:
- "ORACLE_ALLOW_REMOTE=true"
服务:xe
账号:system
密码:oracle
端口:1521
Oracle12C
docker pull sath89/oracle-12c:latest 5.7 GB
docker pull truevoly/oracle-12c:latest 5.7 GB
docker pull absolutapps/oracle-12c-ee 6.12 GB
初始化先启动一次,不做数据卷,从容器复制数据文件到本地,后做数据卷。
[root@iz2zeau84juzpalekyrpfmz oracle12c]# docker-compose up -d
Creating network "oracle12c_default" with the default driver
Creating oracle12c ... done
[root@iz2zeau84juzpalekyrpfmz oracle12c]# docker logs -f oracle12c
Database not initialized. Initializing database.
Starting tnslsnr
Copying database files
1% complete
3% complete
11% complete
100% complete
[root@iz2zeau84juzpalekyrpfmz oracle12c]# mkdir data/
[root@iz2zeau84juzpalekyrpfmz oracle12c]# chmod 777 data/
[root@iz2zeau84juzpalekyrpfmz oracle12c]# docker cp oracle12c:/u01/app/ data/
无数据卷
version: '3.0'
services:
oracle12c:
image: sath89/oracle-12c:latest
container_name: oracle12c
restart: always
privileged: true
ports:
- '1521:1521'
- '8080:8080'
environment:
- "TZ=Asia/Shanghai"
有数据卷
version: '3.0'
services:
oracle12c:
image: sath89/oracle-12c:latest
container_name: oracle12c
restart: always
privileged: true
ports:
- '1522:1521'
- '8082:8080'
volumes:
- ./data/app:/u01/app/
environment:
- "TZ=Asia/Shanghai"
十四、Xxl-Job
version: "3.0"
services:
xxl-job-admin:
image: xuxueli/xxl-job-admin:2.2.0
ports:
- "8080:8080"
container_name: xxl-job-admin
restart: always
privileged: true
volumes:
- "./data:/data/applogs"
environment:
TZ: Asia/Shanghai
PARAMS: '--spring.datasource.url=jdbc:mysql://192.168.17.101:3366/xxl_job?Unicode=true&characterEncoding=UTF-8 --spring.datasource.username=root --spring.datasource.password=123456 --xxl.job.login.username=admin --xxl.job.login.password=123456'
十五、Skywalking
这里选用Elasticsearch做存储,所以先启动Elasticsearch——192.168.17.101:9200
version: "3.0"
services:
skywalking:
image: apache/skywalking-oap-server:8.0.1-es6
ports:
- "11800:11800"
- "12800:12800"
container_name: skywalking
restart: always
privileged: true
environment:
- "SW_STORAGE=elasticsearch"
- "SW_STORAGE_ES_CLUSTER_NODES=192.168.17.101:9200"
- "TZ=Asia/Shanghai"
skywalking-ui:
image: apache/skywalking-ui:8.0.1
container_name: skywalking-ui
restart: always
privileged: true
depends_on:
- skywalking
ports:
- "8080:8080"
environment:
- "SW_OAP_ADDRESS=192.168.17.101:12800"
- "TZ=Asia/Shanghai"
十六、Elasticsearch-Head
无数据卷
version: '3.0'
services:
elasticsearch-head:
image: mobz/elasticsearch-head:5
container_name: elasticsearch-head
restart: always
privileged: true
ports:
- '9100:9100'
# 解决连上新版本的elasticsearch查不到数据问题
docker cp elasticsearch-head:/usr/src/app/_site/vendor.js data/
vim data/vendor.js
%s/x-www-form-urlencoded/json;charset=UTF-8/g
有数据卷
version: '3.0'
services:
elasticsearch-head:
image: mobz/elasticsearch-head:5
container_name: elasticsearch-head
restart: always
privileged: true
ports:
- '9100:9100'
volumes:
- "./data/vendor.js:/usr/src/app/_site/vendor.js"
如有问题
问题:WARNING: IPv4 forwarding is disabled. Networking will not work.
解决:vim /usr/lib/sysctl.d/00-system.conf
添加:net.ipv4.ip_forward=1
重启:systemctl restart network
十七、Grafana
mkdir data
chmod 777 data
账号密码:admin/admin
version: '3.0'
services:
grafana:
image: grafana/grafana:7.0.6
container_name: grafana
restart: always
privileged: true
ports:
- '3000:3000'
volumes:
- "./data:/var/lib/grafana"
十八、GLP
Grafana
用于 UI 展示。Loki
是主服务器,负责存储日志和处理查询。Promtail
是代理,负责收集日志并将其发送给 loki 。
打开 http://192.168.17.101:3100/ 选择loki 地址填 http://loki:3100/
mkdir -p data/grafana
chmod 777 data/grafana
mkdir -p data/promtail
touch data/promtail/docker-config.yaml
vim data/promtail/docker-config.yaml
docker-config.yaml
server:
http_listen_port: 9080
grpc_listen_port: 0
positions:
filename: /tmp/positions.yaml
clients:
- url: http://loki:3100/loki/api/v1/push
scrape_configs:
- job_name: system
static_configs:
- targets:
- localhost
labels:
job: varlogs
__path__: /var/log/**/*.log
要收集的日志
- "/var/lib/docker/containers:/var/log/docker/containers"
docker-compose.yaml
version: '3.0'
networks:
loki:
services:
loki:
image: grafana/loki:master
container_name: loki
restart: always
privileged: true
ports:
- '3100:3100'
command: -config.file=/etc/loki/local-config.yaml
networks:
- loki
promtail:
image: grafana/promtail:master
container_name: promtail
restart: always
privileged: true
volumes:
- "/var/lib/docker/containers:/var/log/docker/containers"
- "./data/promtail/docker-config.yaml:/etc/promtail/docker-config.yaml"
command: -config.file=/etc/promtail/docker-config.yaml
networks:
- loki
grafana:
image: grafana/grafana:7.0.6
container_name: grafana
restart: always
privileged: true
ports:
- '3000:3000'
volumes:
- "./data/grafana:/var/lib/grafana"
networks:
- loki
十九、ShowDoc
mkdir data
chmod -R 777 data
docker-compose.yaml
账户:showdoc
密码:123456
version: '3'
services:
showdoc:
restart: always
image: star7th/showdoc:latest
container_name: showdoc
privileged: true
ports:
- '80:80'
volumes:
- ./data/:/var/www/html
二十、Centos
version: '3'
services:
centos:
restart: always
image: centos:7.5.1804
container_name: centos
privileged: true
command: /usr/sbin/init
ports:
- '50100:22'
volumes:
- ./data:/home
# 进入容器
docker exec -it centos bash
# 更换yum国内源
----------------------
cd /etc/yum.repos.d/
rm -rf ./*
vi CentOS-Base.repo
推荐阿里源或者清华源
yum clean all && yum makecache
----------------------
# 安装ssh
yum install -y openssh-server
# 安装vim
yum install -y vim
# 配置文件
vim /etc/ssh/sshd_config
添加这行
RSAAuthentication yes
去掉注释
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
# 配置密钥
cd ~
mkdir .ssh
cd .ssh/
touch authorized_keys
chmod 644 authorized_keys
# 按三下回车
ssh-keygen -t rsa
# 公钥输入
cat id_rsa.pub >> authorized_keys
# 启动服务
systemctl start sshd.service
# 查看状态
systemctl status sshd.service
# 开机启动
systemctl enable sshd.service
# 修改密码
passwd root
# 如果需要安装docekr,必须安装iptables
yum install -y sudo
yum install -y iptables-services
# 安装防火墙
yum install firewalld systemd -y
# 安装网络命令
yum -y install net-tools
# 修改中文编码
echo 'export LANG="en_US.UTF-8"' >> /etc/profile
source /etc/profile
# 登录重叠
systemctl status getty@tty1.service
systemctl stop getty@tty1.service
systemctl disable getty@tty1.service
# 修改DNS
vim /etc/resolv.conf
nameserver 114.114.114.114
# 退出容器
exit
# 构建新镜像,627c3d217d1d为正在运行的容器,-a镜像作者,-m提交说明
docker commit -a='xiaoqiangzai' -m='CentOS based version 7.5.1804' 627c3d217d1d centos:qiang
修改后的docker-compose
version: '3'
services:
centos-50101:
restart: always
image: centos:50101
container_name: centos-50101
privileged: true
command: /usr/sbin/init
ports:
- '50101:22'
volumes:
- ./data:/home
ssh缓存报错时
# 清除旧缓存
ssh-keygen -R [xiaoqiangzai.xyz]:50001
[root@localhost centos]# ssh root@xiaoqiangzai.xyz -p 50001
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:rLUokblfhbBlpt3ZI+VLPQRx7akHly6NPNnkNfZXD8o.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /root/.ssh/known_hosts:3
ECDSA host key for [xiaoqiangzai.xyz]:50001 has changed and you have requested strict checking.
Host key verification failed.
[root@localhost centos]# ssh-keygen -R [xiaoqiangzai.xyz]:50001
# Host [xiaoqiangzai.xyz]:50001 found: line 3
/root/.ssh/known_hosts updated.
Original contents retained as /root/.ssh/known_hosts.old
[root@localhost centos]# ssh root@xiaoqiangzai.xyz -p 50001
The authenticity of host '[xiaoqiangzai.xyz]:50001 ([45.10.175.35]:50001)' can't be established.
ECDSA key fingerprint is SHA256:rLUokblfhbBlpt3ZI+VLPQRx7akHly6NPNnkNfZXD8o.
ECDSA key fingerprint is MD5:ad:fc:81:82:a0:fc:eb:58:29:d1:8e:ce:a8:48:af:de.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[xiaoqiangzai.xyz]:50001,[45.10.175.35]:50001' (ECDSA) to the list of known hosts.
root@xiaoqiangzai.xyz's password:
Last login: Fri Jul 31 14:17:17 2020 from 192.168.17.1
二十一、Ubuntu
version: '3'
services:
ubuntu:
restart: always
image: ubuntu:18.04
container_name: ubuntu
privileged: true
tty: true
command: /bin/bash
ports:
- '50200:22'
volumes:
- ./data:/home
# 进入容器
docker exec -it ubuntu bash
# 更新源
apt-get update
# 安装ssh
apt-get install -y openssh-server
# 安装vim
apt-get install -y vim
# 允许root登录
vim /etc/ssh/sshd_config
PermitRootLogin yes
# 启动ssh
service ssh start
# 查看状态
service ssh status
# 创建启动脚本
vim /root/ssh.sh
------------------
#! /bin/bash
/usr/sbin/sshd -D
------------------
# 授权
chmod 777 /root/ssh.sh
# 修改密码
passwd root
# 退出容器
exit
# 构建新镜像,6e85f8c5cb3a为正在运行的容器
docker commit -a='xiaoqiangzai' -m='ubuntu-50201' 6e85f8c5cb3a ubuntu:50201
修改后的docker-compose
version: '3'
services:
ubuntu-50201:
restart: always
image: ubuntu:50201
container_name: ubuntu-50201
privileged: true
tty: true
command: /root/ssh.sh
ports:
- '50201:22'
volumes:
- ./data:/home
二十二、H5ai
version: '3'
services:
h5ai:
restart: always
image: ilemonrain/h5ai:full
container_name: h5ai
privileged: true
ports:
- '80:80'
volumes:
- ./data:/h5ai
添加账号和密码
# 编辑文件
vim /home/qiang/docker-compose/h5ai/data/_h5ai/public/index.php
去掉第二行注释,在第5行添加账号密码
文件存放在data目录下既可以看到
二十三、Aria2
version: '3'
services:
aira2:
restart: always
image: wjg1101766085/aira2-ng:0.0.1
container_name: aira2
privileged: true
ports:
- '6800:6800'
- '6880:80'
- '6888:8080'
volumes:
- ./data/download:/data
- ./data/config:/config
environment:
- "SECRET=123456"
访问地址
Aria2:http://192.168.17.101:6880/
浏览下载目录:http://192.168.17.101:6888/
页面标题设置:$, $ - $
在设置里面添加密码
内网穿透
tunnels:
# 下载服务器
aria2:
subdomain: aria2
proto:
http: 192.168.17.101:6880
# 连接服务器
link:
remote_port: 6800
proto:
tcp: 192.168.17.101:6800
# 管理文件服务器
manager:
subdomain: manager
proto:
http: 192.168.17.101:6888
配置文件aria2.conf,下载完后执行脚本on-complete.sh
[root@bb3cabea903d config]# pwd
/home/qiang/docker-compose/aira2/data/config
[root@bb3cabea903d config]# ls
aria2.conf aria2.session on-complete.sh
关闭做种
--seed-time=0
修改日志存放位置,强迫症
vim on-complete.sh
#!/bin/sh
if [ $2 -eq 1 ]; then
mv "$3" /data
fi
echo [$(date)] $2, $3, $1 "<br>" >> /config/log.html
二十四、Seata
导入seata.sql数据库
/*
SQLyog Ultimate v12.4.0 (64 bit)
MySQL - 5.7.29 : Database - seata
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;
/*!40101 SET SQL_MODE=''*/;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`seata` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;
USE `seata`;
/*Table structure for table `branch_table` */
DROP TABLE IF EXISTS `branch_table`;
CREATE TABLE `branch_table` (
`branch_id` bigint(20) NOT NULL,
`xid` varchar(128) NOT NULL,
`transaction_id` bigint(20) DEFAULT NULL,
`resource_group_id` varchar(32) DEFAULT NULL,
`resource_id` varchar(256) DEFAULT NULL,
`branch_type` varchar(8) DEFAULT NULL,
`status` tinyint(4) DEFAULT NULL,
`client_id` varchar(64) DEFAULT NULL,
`application_data` varchar(2000) DEFAULT NULL,
`gmt_create` datetime(6) DEFAULT NULL,
`gmt_modified` datetime(6) DEFAULT NULL,
PRIMARY KEY (`branch_id`),
KEY `idx_xid` (`xid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Data for the table `branch_table` */
/*Table structure for table `global_table` */
DROP TABLE IF EXISTS `global_table`;
CREATE TABLE `global_table` (
`xid` varchar(128) NOT NULL,
`transaction_id` bigint(20) DEFAULT NULL,
`status` tinyint(4) NOT NULL,
`application_id` varchar(32) DEFAULT NULL,
`transaction_service_group` varchar(32) DEFAULT NULL,
`transaction_name` varchar(128) DEFAULT NULL,
`timeout` int(11) DEFAULT NULL,
`begin_time` bigint(20) DEFAULT NULL,
`application_data` varchar(2000) DEFAULT NULL,
`gmt_create` datetime DEFAULT NULL,
`gmt_modified` datetime DEFAULT NULL,
PRIMARY KEY (`xid`),
KEY `idx_gmt_modified_status` (`gmt_modified`,`status`),
KEY `idx_transaction_id` (`transaction_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Data for the table `global_table` */
/*Table structure for table `lock_table` */
DROP TABLE IF EXISTS `lock_table`;
CREATE TABLE `lock_table` (
`row_key` varchar(128) NOT NULL,
`xid` varchar(96) DEFAULT NULL,
`transaction_id` bigint(20) DEFAULT NULL,
`branch_id` bigint(20) NOT NULL,
`resource_id` varchar(256) DEFAULT NULL,
`table_name` varchar(32) DEFAULT NULL,
`pk` varchar(36) DEFAULT NULL,
`gmt_create` datetime DEFAULT NULL,
`gmt_modified` datetime DEFAULT NULL,
PRIMARY KEY (`row_key`),
KEY `idx_branch_id` (`branch_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Data for the table `lock_table` */
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
配置文件
mkdir -p data/conf
vim data/conf/file.conf
以mysql为存储
## transaction log store, only used in seata-server
store {
## store mode: file、db、redis
mode = "db"
## 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"
url = "jdbc:mysql://192.168.17.101:3306/seata"
user = "root"
password = "123456"
minConn = 5
maxConn = 100
globalTable = "global_table"
branchTable = "branch_table"
lockTable = "lock_table"
queryLimit = 100
maxWait = 5000
}
## redis store property
redis {
host = "127.0.0.1"
port = "6379"
password = ""
database = "0"
minConn = 1
maxConn = 10
queryLimit = 100
}
}
vim data/conf/registry.conf
以nacos为注册中心
registry {
# file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
type = "nacos"
nacos {
application = "seata-server"
serverAddr = "119.29.175.92: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 = ""
}
consul {
serverAddr = "127.0.0.1:8500"
}
apollo {
appId = "seata-server"
apolloMeta = "http://192.168.1.204:8801"
namespace = "application"
}
zk {
serverAddr = "127.0.0.1:2181"
sessionTimeout = 6000
connectTimeout = 2000
username = ""
password = ""
}
etcd3 {
serverAddr = "http://localhost:2379"
}
file {
name = "file.conf"
}
}
docker-compose.yaml
version: "3"
services:
seata-server:
image: seataio/seata-server
container_name: seata-server
privileged: true
restart: always
ports:
- "8091:8091"
volumes:
- ./data/conf/file.conf:/seata-server/resources/file.conf
- ./data/conf/registry.conf:/seata-server/resources/registry.conf
environment:
- SEATA_PORT=8091
二十五、Filebrowser
无数据卷
version: '3'
services:
filebrowser:
restart: always
image: filebrowser/filebrowser:latest
container_name: filebrowser
privileged: true
ports:
- '80:80'
从容器复制文件
mkdir -p data/db
docker cp filebrowser:/database.db data/db/database.db
mkdir -p data/conf
docker cp filebrowser:.filebrowser.json data/conf/filebrowser.json
有数据卷
账号密码:admin/admin
version: '3'
services:
filebrowser:
restart: always
image: filebrowser/filebrowser:latest
container_name: filebrowser
privileged: true
ports:
- '80:80'
volumes:
- ./data/db/database.db:/database.db
- ./data/srv:/srv
- ./data/conf/filebrowser.json:/.filebrowser.json
filebrowser.json
{
"port": 80,
"baseURL": "/filebrowser", //nginx代理时需要配置
"address": "0.0.0.0", //docker 安装需要允许所有网段
"log": "stdout",
"database": "/database.db",
"root": "/srv"
}
二十六、Minio
version: '3.0'
services:
minio:
image: minio/minio:latest
container_name: minio
ports:
- "9000:9000"
restart: always
privileged: true
command: server /data1 /data2 /data3 /data4 /data5 /data6 /data7 /data8
environment:
# 账号
MINIO_ACCESS_KEY: admin
# 大于等于8位
MINIO_SECRET_KEY: 12345678
volumes:
# 映射文件路径
- ./data/data1:/data1
- ./data/data2:/data2
- ./data/data3:/data3
- ./data/data4:/data4
- ./data/data5:/data5
- ./data/data6:/data6
- ./data/data7:/data7
- ./data/data8:/data8
version: '3.0'
services:
minio:
image: minio/minio:latest
container_name: minio
ports:
- "9000:9000"
restart: always
privileged: true
command: server /data
environment:
# 账号
MINIO_ACCESS_KEY: admin
# 大于等于8位
MINIO_SECRET_KEY: 12345678
volumes:
# 映射文件路径
- ./data:/data
二十七、Tomcat
version: '3.0'
services:
tomcat:
image: tomcat:8.5.57
container_name: tomcat
ports:
- "8080:8080"
restart: always
privileged: true
volumes:
- ./data:/usr/local/tomcat/webapps/ROOT
二十八、Zookeeper
单机搭建
version: '3.0'
services:
zookeeper:
image: zookeeper:latest
container_name: zookeeper
ports:
- "2181:2181"
restart: always
privileged: true
volumes:
- ./data/data:/data
- ./data/datalog:/datalog
复制配置文件
docker cp zookeeper:/conf/zoo.cfg data/conf/zoo.cfg
zoo.cfg
dataDir=/data
dataLogDir=/datalog
tickTime=2000
initLimit=5
syncLimit=2
autopurge.snapRetainCount=3
autopurge.purgeInterval=0
maxClientCnxns=60
standaloneEnabled=true
admin.enableServer=true
server.1=localhost:2888:3888;2181
集群搭建
注意:新版本配置文件有2181端口,旧版本没有。
# 创建网络
docker network create --driver bridge --subnet 172.20.0.0/16 --gateway 172.20.0.1 zookeeper_network
# 查看网络
docker network ls
version: '3.0'
services:
zookeeper1:
image: zookeeper:latest
container_name: zookeeper1
hostname: zookeeper1
ports:
- "2181:2181"
restart: always
privileged: true
environment:
ZOO_MY_ID: 1
ZOO_SERVERS: server.1=zookeeper1:2888:3888;2181 server.2=zookeeper2:2888:3888;2181 server.3=zookeeper3:2888:3888;2181
volumes:
- ./data/zookeeper1/data:/data
- ./data/zookeeper1/datalog:/datalog
networks:
default:
ipv4_address: 172.20.0.11
zookeeper2:
image: zookeeper:latest
container_name: zookeeper2
hostname: zookeeper2
ports:
- "2182:2181"
restart: always
privileged: true
environment:
ZOO_MY_ID: 2
ZOO_SERVERS: server.1=zookeeper1:2888:3888;2181 server.2=zookeeper2:2888:3888;2181 server.3=zookeeper3:2888:3888;2181
volumes:
- ./data/zookeeper2/data:/data
- ./data/zookeeper2/datalog:/datalog
networks:
default:
ipv4_address: 172.20.0.12
zookeeper3:
image: zookeeper:latest
container_name: zookeeper3
hostname: zookeeper3
ports:
- "2183:2181"
restart: always
privileged: true
environment:
ZOO_MY_ID: 3
ZOO_SERVERS: server.1=zookeeper1:2888:3888;2181 server.2=zookeeper2:2888:3888;2181 server.3=zookeeper3:2888:3888;2181
volumes:
- ./data/zookeeper3/data:/data
- ./data/zookeeper3/datalog:/datalog
networks:
default:
ipv4_address: 172.20.0.13
networks:
default:
external:
name: zookeeper_network
集群配置文件
# 如果需要外置挂载配置文件则映射以下文件
volumes:
- ./data/zookeeper3/data:/data
- ./data/zookeeper3/datalog:/datalog
- ./data/conf/zoo.cfg:/conf/zoo.cfg
zoo.cfg
dataDir=/data
dataLogDir=/datalog
tickTime=2000
initLimit=5
syncLimit=2
autopurge.snapRetainCount=3
autopurge.purgeInterval=0
maxClientCnxns=60
standaloneEnabled=true
admin.enableServer=true
server.1=zookeeper1:2888:3888;2181
server.2=zookeeper2:2888:3888;2181
server.3=zookeeper3:2888:3888;2181
验证集群
docker exec -it zookeeper1 bash
bin/zkServer.sh status
二十九、Kafka
单机搭建
version: '3.0'
services:
kafka:
image: wurstmeister/kafka:latest
container_name: kafka
ports:
- "9092:9092"
restart: always
privileged: true
environment:
# 修改本机IP
KAFKA_ADVERTISED_HOST_NAME: 192.168.17.101
# 修改本机IP
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://192.168.17.101:9092
# 修改zookeeper的地址
KAFKA_ZOOKEEPER_CONNECT: 192.168.17.101:2181
KAFKA_ADVERTISED_PORT: 9092
KAFKA_BROKER_ID: 1
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
volumes:
- ./data:/kafka
- /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime
集群搭建
# 创建网络
docker network create --driver bridge --subnet 172.21.0.0/16 --gateway 172.21.0.1 kafka_network
# 查看网络
docker network ls
version: '3.0'
services:
kafka1:
image: wurstmeister/kafka:latest
container_name: kafka1
hostname: kafka1
ports:
- "9092:9092"
restart: always
privileged: true
environment:
KAFKA_HOST_NAME: kafka1
KAFKA_ADVERTISED_HOST_NAME: kafka1
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://192.168.17.101:9092
KAFKA_ZOOKEEPER_CONNECT: 192.168.17.101:2181,192.168.17.101:2182,192.168.17.101:2183
KAFKA_ADVERTISED_PORT: 9092
KAFKA_BROKER_ID: 1
volumes:
- ./data/kafka1:/kafka
- /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime
networks:
default:
ipv4_address: 172.21.0.11
kafka2:
image: wurstmeister/kafka:latest
container_name: kafka2
hostname: kafka2
ports:
- "9093:9092"
restart: always
privileged: true
environment:
KAFKA_HOST_NAME: kafka2
KAFKA_ADVERTISED_HOST_NAME: kafka2
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://192.168.17.101:9093
KAFKA_ZOOKEEPER_CONNECT: 192.168.17.101:2181,192.168.17.101:2182,192.168.17.101:2183
KAFKA_ADVERTISED_PORT: 9093
KAFKA_BROKER_ID: 2
volumes:
- ./data/kafka2:/kafka
- /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime
networks:
default:
ipv4_address: 172.21.0.12
kafka3:
image: wurstmeister/kafka:latest
container_name: kafka3
hostname: kafka3
ports:
- "9094:9092"
restart: always
privileged: true
environment:
KAFKA_HOST_NAME: kafka3
KAFKA_ADVERTISED_HOST_NAME: kafka3
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://192.168.17.101:9094
KAFKA_ZOOKEEPER_CONNECT: 192.168.17.101:2181,192.168.17.101:2182,192.168.17.101:2183
KAFKA_ADVERTISED_PORT: 9094
KAFKA_BROKER_ID: 3
volumes:
- ./data/kafka3:/kafka
- /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime
networks:
default:
ipv4_address: 172.21.0.13
networks:
default:
external:
name: kafka_network
验证集群
# 创建top,每个节点都能查看到
docker exec -it kafka1 bash
kafka-topics.sh --create --zookeeper 192.168.17.101:2181 --replication-factor 1 --partitions 3 --topic test
kafka-topics.sh --list --zookeeper 192.168.17.101:2181
kafka-topics.sh --list --zookeeper 192.168.17.101:2182
kafka-topics.sh --list --zookeeper 192.168.17.101:2183
三十、Shadowsocks
version: '3.0'
services:
shadowsocks:
image: oddrationale/docker-shadowsocks:latest
container_name: shadowsocks
ports:
- "12306:12306"
restart: always
privileged: true
command: -s 0.0.0.0 -p 12306 -k password -m aes-256-cfb
三十一、Samba
# 用户,不用的用户只能登录自己的目录
账号:forever 密码:123456 目录:\\192.168.17.101\forever
账号:together 密码:654321 目录:\\192.168.17.101\together
version: '3'
services:
samba:
restart: always
image: dperson/samba:latest
container_name: samba
privileged: true
ports:
- '139:139'
- '445:445'
volumes:
- ./data/forever:/data/forever
- ./data/together:/data/together
command: '-u "forever;123456" -s "forever;/data/forever/;yes;no;no;forever;none" -u "together;654321" -s "together;/data/together/;yes;no;no;together;none"'
# windows清除缓存凭证
net use * /del /y
三十二、Jellyfin
version: '3'
services:
jellyfin:
restart: always
image: jellyfin/jellyfin:latest
container_name: jellyfin
privileged: true
ports:
- '8096:8096'
volumes:
- ./data/movie:/data/movie
- ./data/music:/data/music
- ./data/tv:/data/tv
- ./data/audio:/data/audio
- ./data/picture:/data/picture
- ./data/mv:/data/mv
- ./data/mixture:/data/mixture
- ./data/config:/config
三十三、WebIDE
docker run -p 8080:8080 -v coding-ide-home:/root/.coding-ide webide/webide
version: '3'
services:
webide:
restart: always
image: webide/webide:latest
container_name: webide
privileged: true
ports:
- '8080:8080'
volumes:
- ./data:/root/.coding-ide
三十四、Wordpress
version: '3'
services:
wordpress:
restart: always
image: wordpress:latest
container_name: wordpress
privileged: true
ports:
- '80:80'
environment:
WORDPRESS_DB_HOST: www.wuduoqiang.com:3306
WORDPRESS_DB_USER: root
WORDPRESS_DB_PASSWORD: 123456
三十五、Kafka-Manager
version: '3'
services:
kafka-manager:
image: sheepkiller/kafka-manager:latest
restart: always
privileged: true
container_name: kafka-manager
ports:
- 9000:9000
environment:
ZK_HOSTS: 192.168.17.101:2181,192.168.17.101:2182,192.168.17.101:2183
三十六、SqlServer
version: '3'
services:
sqlserver:
image: microsoft/mssql-server-linux:latest
restart: always
privileged: true
container_name: sqlserver
ports:
- 1433:1433
volumes:
- ./data:/var/opt/mssql/data
environment:
ACCEPT_EULA: Y
SA_PASSWORD: aA123456
三十七、Postgres
# 账号密码
postgres/123456
version: '3'
services:
postgres:
image: postgres:12-alpine
restart: always
privileged: true
container_name: postgres
ports:
- 5432:5432
volumes:
- ./data/:/var/lib/postgresql/data
environment:
- POSTGRES_PASSWORD=123456
# 账号密码
sonar/sonar
version: '3'
services:
postgres:
image: postgres:12-alpine
restart: always
privileged: true
container_name: postgres
ports:
- 5432:5432
volumes:
- ./data/:/var/lib/postgresql/data
environment:
- POSTGRES_USER=sonar
- POSTGRES_PASSWORD=sonar
三十八、Pgadmin4
# 数据卷
midir data
chmod 777 data
# 账号密码
875667601@qq.com/123456
version: '3'
services:
pgadmin4:
image: dpage/pgadmin4:latest
restart: always
privileged: true
container_name: pgadmin4
ports:
- 5433:80
volumes:
- ./data:/var/lib/pgadmin
environment:
- PGADMIN_DEFAULT_EMAIL=875667601@qq.com
- PGADMIN_DEFAULT_PASSWORD=123456
三十九、Sonarqube
# 账号密码
admin/admin
version: '3'
services:
sonarqube:
image: sonarqube:latest
restart: always
container_name: sonarqube
ports:
- 9000:9000
volumes:
- ./data/data/:/opt/sonarqube/data
- ./data/log/:/opt/sonarqube/log
- ./data/extensions/:/opt/sonarqube/extensions
environment:
- SONARQUBE_JDBC_URL=jdbc:postgresql://192.168.17.101:5432/sonar
安装插件
Chinese Pack
Java Code Quality and Security
配置maven的setting.xml
<profile>
<id>sonar</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<sonar.jdbc.url>jdbc:postgresql://192.168.17.101:5432/sonar</sonar.jdbc.url>
<sonar.jdbc.username>sonar</sonar.jdbc.username>
<sonar.jdbc.password>sonar</sonar.jdbc.password>
<sonar.host.url>http://192.168.17.101:9000</sonar.host.url>
</properties>
</profile>
扫描代码
# 如报错:Please provide compiled classes of your project with sonar.java.binaries property
mvn install
# 扫描命令
mvn sonar:sonar
四十、Svn
version: '3'
services:
svn:
restart: always
image: garethflowers/svn-server:latest
container_name: svn
privileged: true
ports:
- '3690:3690'
volumes:
- ./data:/var/opt/svn
# 创建project1项目
docker exec -it svn svnadmin create project1
# 用户名 = 密码
vim passwd
----------------------------------------
[users]
admin = admin
xiaozhu = 123456
xiaoqiang = 123456
xiaoqiangzai = 123456
----------------------------------------
# 这里分了两个组,cool和beautiful,每个组有相应的用户和权限,cool组有xiaoqiang,xiaoqiangzai用户,权限为可读写。beautiful组有xiaozhu用户,权限为只读。admin用户直接授权可读写。
vim authz
----------------------------------------
[groups]
cool = xiaoqiang,xiaoqiangzai
beautiful = xiaozhu
# 控制根目录的权限
[/]
admin = rw
@cool = rw
@beautiful = r
----------------------------------------
# 修改Svn配置文件
vim svnserve.conf
----------------------------------------
[general]
# 匿名用户不能访问
anon-access = none
# 授权用户可读可写
auth-access = write
# 密码文件位置
password-db = passwd
# 授权文件位置
authz-db = authz
----------------------------------------
四十一、Ngrok
version: "3.0"
services:
ngrok:
image: hteen/ngrok:latest
ports:
- "81:80"
- "444:443"
- "4444:4443"
container_name: ngrok
restart: always
privileged: true
command: /bin/sh /server.sh
volumes:
- "/home/qiang/docker-compose/ngrok/data:/myfiles"
environment:
- DOMAIN=xiaoqiangzai.xyz
九十九、Wait
持续更新......