提交 546b6591 编写于 作者: 张乐 提交者: GitHub

Merge pull request #776 from nobodyiam/docker-quick-start

docker quick start and remove unnecessary files
version: '2'
services:
apollo-configservice:
image: apollo-configservice
container_name: apollo-configservice
restart: always
depends_on:
- db
ports:
- "8080:8080"
volumes:
- /tmp/logs:/opt/logs
links:
- db
apollo-adminservice:
image: apollo-adminservice
container_name: apollo-adminservice
restart: always
depends_on:
- db
ports:
- "8090:8090"
volumes:
- /tmp/logs:/opt/logs
links:
- db
apollo-portal:
image: apollo-portal
container_name: apollo-portal
restart: always
depends_on:
- db
ports:
- "8070:8080"
volumes:
- /tmp/logs:/opt/logs
links:
- db
db:
image: mariadb:latest
container_name: db
environment:
MYSQL_ROOT_PASSWORD: root
ports:
- "3307:3306"
volumes:
- /var/data/mysql:/var/lib/mysql
- ./scripts/sql-docker:/docker-entrypoint-initdb.d
# Apollo for Docker Quick Start
请参考[Apollo Quick Start Docker部署](https://github.com/ctripcorp/apollo/wiki/Apollo-Quick-Start-Docker%E9%83%A8%E7%BD%B2)
# 使用前请先运行run.sh构建镜像(注释最后docker-compose.yml).
# 或者自行构建镜像后push到docker仓库并修改下列image的配置.
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: apollo-configservice
labels:
name: apollo-configservice
namespace: apollo
spec:
replicas: 1
template:
metadata:
labels:
name: apollo-configservice
spec:
containers:
- name: apollo-configservice
image: apollo-configservice
ports:
- containerPort: 8080
imagePullPolicy: Never
nodeSelector:
beta.kubernetes.io/os: linux
---
apiVersion: v1
kind: Service
metadata:
name: apollo-configservice
labels:
name: apollo-configservice
namespace: apollo
spec:
ports:
- port: 8080
targetPort: 8080
selector:
name: apollo-configservice
---
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: apollo-adminservice
labels:
name: apollo-adminservice
namespace: apollo
spec:
replicas: 1
template:
metadata:
labels:
name: apollo-adminservice
spec:
containers:
- name: apollo-adminservice
image: apollo-adminservice
ports:
- containerPort: 8090
imagePullPolicy: Never
nodeSelector:
beta.kubernetes.io/os: linux
---
apiVersion: v1
kind: Service
metadata:
name: apollo-adminservice
labels:
name: apollo-adminservice
namespace: apollo
spec:
ports:
- port: 8090
targetPort: 8090
selector:
name: apollo-adminservice
---
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: apollo-portal
labels:
name: apollo-portal
namespace: apollo
spec:
replicas: 1
template:
metadata:
labels:
name: apollo-portal
spec:
containers:
- name: apollo-portal
image: apollo-portal
ports:
- containerPort: 8080
imagePullPolicy: Never
nodeSelector:
beta.kubernetes.io/os: linux
---
apiVersion: v1
kind: Service
metadata:
name: apollo-portal
labels:
name: apollo-portal
namespace: apollo
spec:
type: NodePort
ports:
- port: 8070
targetPort: 8080
nodePort: 30090
selector:
name: apollo-portal
---
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: db
labels:
name: db
namespace: apollo
spec:
replicas: 1
template:
metadata:
labels:
name: db
spec:
containers:
- name: db
image: mariadb:latest
env:
- name: MYSQL_ROOT_PASSWORD
value: root
ports:
- containerPort: 3306
imagePullPolicy: Never
volumeMounts:
- mountPath: /docker-entrypoint-initdb.d
name: mysqlinit
volumes:
- name: mysqlinit
hostPath:
path: /root/apollo/scripts/sql-docker # 路径根据apollo项目路径修改
nodeSelector:
beta.kubernetes.io/os: linux
---
apiVersion: v1
kind: Service
metadata:
name: db
labels:
name: db
namespace: apollo
spec:
ports:
- port: 3306
targetPort: 3306
selector:
name: db
#!/bin/sh
# apollo config db info
apollo_config_db_url=jdbc:mysql://db:3306/ApolloConfigDB?characterEncoding=utf8
apollo_config_db_username=root
apollo_config_db_password=root
# apollo portal db info
apollo_portal_db_url=jdbc:mysql://db:3306/ApolloPortalDB?characterEncoding=utf8
apollo_portal_db_username=root
apollo_portal_db_password=root
# meta server url
dev_meta=http://apollo-configservice:8080
fat_meta=http://apollo-configservice:8080
uat_meta=http://apollo-configservice:8080
pro_meta=http://apollo-configservice:8080
META_SERVERS_OPTS="-Ddev_meta=$dev_meta -Dfat_meta=$fat_meta -Duat_meta=$uat_meta -Dpro_meta=$pro_meta"
# =============== Please do not modify the following content =============== #
# package config-service and admin-service
echo "==== starting to build config-service and admin-service ===="
mvn clean package -DskipTests -pl apollo-configservice,apollo-adminservice -am -Dapollo_profile=github -Dspring_datasource_url=$apollo_config_db_url -Dspring_datasource_username=$apollo_config_db_username -Dspring_datasource_password=$apollo_config_db_password
echo "==== building config-service and admin-service finished ===="
echo "==== starting to build portal ===="
mvn clean package -DskipTests -pl apollo-portal -am -Dapollo_profile=github -Dspring_datasource_url=$apollo_portal_db_url -Dspring_datasource_username=$apollo_portal_db_username -Dspring_datasource_password=$apollo_portal_db_password $META_SERVERS_OPTS
echo "==== building portal finished ===="
echo "==== starting to build client ===="
mvn clean install -DskipTests -pl apollo-client -am $META_SERVERS_OPTS
echo "==== building client finished ===="
echo "==== starting to build apollo-spring-boot-sample ===="
mvn clean package -DskipTests -pl apollo-spring-boot-sample
echo "==== building apollo-spring-boot-sample finished ===="
echo "==== starting to build docker images ===="
cd apollo-configservice
mvn docker:build
cd ../apollo-adminservice
mvn docker:build
cd ../apollo-portal
mvn docker:build
echo "==== building docker images finished ===="
cd ..
echo "==== starting to run docker images ===="
docker-compose up
version: '2'
services:
apollo-quick-start:
image: nobodyiam/apollo-quick-start
container_name: apollo-quick-start
depends_on:
- apollo-db
ports:
- "8080:8080"
- "8070:8070"
links:
- apollo-db
apollo-db:
image: mysql:5.7
container_name: apollo-db
environment:
TZ: Asia/Shanghai
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
depends_on:
- apollo-dbdata
ports:
- "13306:3306"
volumes:
- ./sql:/docker-entrypoint-initdb.d
volumes_from:
- apollo-dbdata
apollo-dbdata:
image: alpine:latest
container_name: apollo-dbdata
volumes:
- /var/lib/mysql
......@@ -364,12 +364,44 @@ CREATE TABLE `ServerConfig` (
# ------------------------------------------------------------
INSERT INTO `ServerConfig` (`Key`, `Cluster`, `Value`, `Comment`)
VALUES
('eureka.service.url', 'default', 'http://apollo-configservice:8080/eureka/', 'Eureka服务Url,多个service以英文逗号分隔'),
('eureka.service.url', 'default', 'http://localhost:8080/eureka/', 'Eureka服务Url,多个service以英文逗号分隔'),
('namespace.lock.switch', 'default', 'false', '一次发布只能有一个人修改开关'),
('item.value.length.limit', 'default', '20000', 'item value最大长度限制'),
('config-service.cache.enabled', 'default', 'false', 'ConfigService是否开启缓存,开启后能提高性能,但是会增大内存消耗!'),
('item.key.length.limit', 'default', '128', 'item key 最大长度限制');
# Sample Data
# ------------------------------------------------------------
INSERT INTO `App` (`AppId`, `Name`, `OrgId`, `OrgName`, `OwnerName`, `OwnerEmail`)
VALUES
('SampleApp', 'Sample App', 'TEST1', '样例部门1', 'apollo', 'apollo@acme.com');
INSERT INTO `AppNamespace` (`Name`, `AppId`, `Format`, `IsPublic`, `Comment`)
VALUES
('application', 'SampleApp', 'properties', 0, 'default app namespace');
INSERT INTO `Cluster` (`Name`, `AppId`)
VALUES
('default', 'SampleApp');
INSERT INTO `Namespace` (`Id`, `AppId`, `ClusterName`, `NamespaceName`)
VALUES
(1, 'SampleApp', 'default', 'application');
INSERT INTO `Item` (`NamespaceId`, `Key`, `Value`, `Comment`, `LineNum`)
VALUES
(1, 'timeout', '100', 'sample timeout配置', 1);
INSERT INTO `Release` (`ReleaseKey`, `Name`, `Comment`, `AppId`, `ClusterName`, `NamespaceName`, `Configurations`)
VALUES
('20161009155425-d3a0749c6e20bc15', '20161009155424-release', 'Sample发布', 'SampleApp', 'default', 'application', '{\"timeout\":\"100\"}');
INSERT INTO `ReleaseHistory` (`AppId`, `ClusterName`, `NamespaceName`, `BranchName`, `ReleaseId`, `PreviousReleaseId`, `Operation`, `OperationContext`, `DataChange_CreatedBy`, `DataChange_LastModifiedBy`)
VALUES
('SampleApp', 'default', 'application', 'default', 1, 0, 0, '{}', 'apollo', 'apollo');
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
......
......@@ -275,7 +275,6 @@ CREATE TABLE `UserRole` (
KEY `IX_UserId_RoleId` (`UserId`,`RoleId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户和role的绑定表';
# Dump of table Users
# ------------------------------------------------------------
......@@ -309,7 +308,7 @@ CREATE TABLE `Authorities` (
INSERT INTO `ServerConfig` (`Key`, `Value`, `Comment`)
VALUES
('apollo.portal.envs', 'dev', '可支持的环境列表'),
('organizations', '[{\"orgId\":\"全辅导\",\"orgName\":\"全辅导\"},{\"orgId\":\"全课云\",\"orgName\":\"全课云\"}]', '部门列表'),
('organizations', '[{\"orgId\":\"TEST1\",\"orgName\":\"样例部门1\"},{\"orgId\":\"TEST2\",\"orgName\":\"样例部门2\"}]', '部门列表'),
('superAdmin', 'apollo', 'Portal超级管理员'),
('api.readTimeout', '10000', 'http接口read timeout'),
('consumer.token.salt', 'someSalt', 'consumer token salt');
......@@ -320,6 +319,44 @@ VALUES
INSERT INTO `Authorities` (`Username`, `Authority`) VALUES ('apollo', 'ROLE_user');
# Sample Data
# ------------------------------------------------------------
INSERT INTO `App` (`AppId`, `Name`, `OrgId`, `OrgName`, `OwnerName`, `OwnerEmail`)
VALUES
('SampleApp', 'Sample App', 'TEST1', '样例部门1', 'apollo', 'apollo@acme.com');
INSERT INTO `AppNamespace` (`Name`, `AppId`, `Format`, `IsPublic`, `Comment`)
VALUES
('application', 'SampleApp', 'properties', 0, 'default app namespace');
INSERT INTO `Permission` (`Id`, `PermissionType`, `TargetId`)
VALUES
(1, 'CreateCluster', 'SampleApp'),
(2, 'CreateNamespace', 'SampleApp'),
(3, 'AssignRole', 'SampleApp'),
(4, 'ModifyNamespace', 'SampleApp+application'),
(5, 'ReleaseNamespace', 'SampleApp+application');
INSERT INTO `Role` (`Id`, `RoleName`)
VALUES
(1, 'Master+SampleApp'),
(2, 'ModifyNamespace+SampleApp+application'),
(3, 'ReleaseNamespace+SampleApp+application');
INSERT INTO `RolePermission` (`RoleId`, `PermissionId`)
VALUES
(1, 1),
(1, 2),
(1, 3),
(2, 4),
(3, 5);
INSERT INTO `UserRole` (`UserId`, `RoleId`)
VALUES
('apollo', 1),
('apollo', 2),
('apollo', 3);
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册