Commit 173448f2 authored by 张 斌's avatar 张 斌

Merge branch 'master' of gitabc.xyqb.com:dekun.dai/qg-dockerfiles

parents eced0afc 0d35ac28
# VERSION 1.0
FROM mysql:5.6.37
MAINTAINER kalvin <dekun.dai@quantgroup.cn>
#定义工作目录
ENV WORK_PATH /home/quant_group/mysql
#定义会被容器自动执行的目录
ENV AUTO_RUN_DIR /docker-entrypoint-initdb.d
WORKDIR $WORK_PATH
RUN mkdir -p sql_to_run
COPY ./sql_to_run/0-init_user_and_db.sql ./sql_to_run/
#把要执行的shell文件放到/docker-entrypoint-initdb.d/目录下,容器会自动执行这个shell
COPY ./init_db_data.sh $AUTO_RUN_DIR/
#给执行文件增加可执行权限
RUN chmod a+x $AUTO_RUN_DIR/init_db_data.sh
\ No newline at end of file
# -------------------------------------------------------------------------------
# Filename: init_db_data.sh
# Revision: 1.0
# Date: 2017/08
# Author: dekun.dai
# Description: 执行目录下所有数据库脚本
# -------------------------------------------------------------------------------
sql_file_folder=$WORK_PATH/sql_to_run
echo "cd $sql_file_folder"
cd $sql_file_folder
for entry in ./*
do
echo "run sql file: $entry"
mysql -uroot -pQuantgroup2017 < $entry
done
\ No newline at end of file
CREATE DATABASE xyqb;
GRANT ALL PRIVILEGES ON *.* TO 'qa'@'%' IDENTIFIED BY 'qatest';
flush privileges;
CREATE DATABASE xyqb_app;
GRANT ALL PRIVILEGES ON *.* TO 'qa'@'%' IDENTIFIED BY 'qatest';
flush privileges;
CREATE DATABASE payment_center;
GRANT ALL PRIVILEGES ON *.* TO 'qa'@'%' IDENTIFIED BY 'qatest';
flush privileges;
CREATE DATABASE risk_control;
GRANT ALL PRIVILEGES ON *.* TO 'qa'@'%' IDENTIFIED BY 'qatest';
flush privileges;
CREATE DATABASE dujiangyan;
GRANT ALL PRIVILEGES ON *.* TO 'qa'@'%' IDENTIFIED BY 'qatest';
flush privileges;
CREATE DATABASE mall;
GRANT ALL PRIVILEGES ON *.* TO 'qa'@'%' IDENTIFIED BY 'qatest';
flush privileges;
CREATE DATABASE qinqiong;
GRANT ALL PRIVILEGES ON *.* TO 'qa'@'%' IDENTIFIED BY 'qatest';
flush privileges;
CREATE DATABASE cash_loan_flow;
GRANT ALL PRIVILEGES ON *.* TO 'qa'@'%' IDENTIFIED BY 'qatest';
flush privileges;
CREATE DATABASE quartz;
GRANT ALL PRIVILEGES ON *.* TO 'qa'@'%' IDENTIFIED BY 'qatest';
flush privileges;
CREATE DATABASE contract;
GRANT ALL PRIVILEGES ON *.* TO 'qa'@'%' IDENTIFIED BY 'qatest';
flush privileges;
CREATE DATABASE fund_manage;
GRANT ALL PRIVILEGES ON *.* TO 'qa'@'%' IDENTIFIED BY 'qatest';
flush privileges;
CREATE DATABASE financial_system;
GRANT ALL PRIVILEGES ON *.* TO 'qa'@'%' IDENTIFIED BY 'qatest';
flush privileges;
CREATE DATABASE gyxd;
GRANT ALL PRIVILEGES ON *.* TO 'qa'@'%' IDENTIFIED BY 'qatest';
flush privileges;
CREATE DATABASE offline;
GRANT ALL PRIVILEGES ON *.* TO 'qa'@'%' IDENTIFIED BY 'qatest';
flush privileges;
CREATE DATABASE redpacket;
GRANT ALL PRIVILEGES ON *.* TO 'qa'@'%' IDENTIFIED BY 'qatest';
flush privileges;
CREATE DATABASE spider_center;
GRANT ALL PRIVILEGES ON *.* TO 'qa'@'%' IDENTIFIED BY 'qatest';
flush privileges;
CREATE DATABASE xyqb_user;
GRANT ALL PRIVILEGES ON *.* TO 'qa'@'%' IDENTIFIED BY 'qatest';
flush privileges;
CREATE DATABASE merchant;
GRANT ALL PRIVILEGES ON *.* TO 'qa'@'%' IDENTIFIED BY 'qatest';
flush privileges;
......@@ -13,8 +13,8 @@ nohup /usr/sbin/rabbitmq-server > /tmp/rabbitmq.out &
echo "sleep 15"
sleep 15
echo "get definitions from 192.168.4.15"
response=$(curl -X GET -H "Authorization: Basic cmFiYml0X2FkbWluOmFiYzEyMzQ=" "http://172.16.1.231:15672/api/definitions")
echo "get definitions from 172.16.3.111"
response=$(curl -X GET -H "Authorization: Basic cWE6cWF0ZXN0" "http://172.16.3.111:15672/api/definitions")
curl -X POST -H "Content-Type: application/json" -H "Authorization: Basic cWE6cWF0ZXN0" -d $response "http://localhost:15672/api/definitions"
tail -f /tmp/rabbitmq.out
\ No newline at end of file
version: '2'
services:
merchant-backend:
image: 192.168.4.36/java/merchant-backend
image: 192.168.4.36/library/merchant-backend:master-97
domainname: merchantapi.xyqb.com
ports:
- "7038:7038"
......@@ -26,7 +26,7 @@ services:
- front-tier
- back-tier
merchant-op-ui:
image: 192.168.4.36/ui/merchant-op-ui
image: 192.168.4.36/library/merchant-op-ui:77
ports:
- "80:80"
depends_on:
......@@ -34,7 +34,7 @@ services:
networks:
- front-tier
db:
image: 192.168.4.36/baseimg/mysql:5.6
image: 192.168.4.36/baseimg/db:1
environment:
- MYSQL_ROOT_PASSWORD=Quantgroup2017
- MYSQL_DATABASE=db
......@@ -44,7 +44,7 @@ services:
ports:
- "3306:3306"
volumes:
- /home/quant_group/docker_disk/mysql/data:/var/lib/mysql
- /home/quant_group/docker_disk/mysql/data3:/var/lib/mysql
networks:
- back-tier
redis:
......
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mysql-pv-claim
# annotations:
# volume.beta.kubernetes.io/storage-class: qingcloud-storageclass
labels:
app: redpacket
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
\ No newline at end of file
apiVersion: v1
kind: Service
metadata:
name: redpacket-mysql
namespace: redpacket-mysql
labels:
app: redpacket
spec:
ports:
- port: 3306
selector:
app: redpacket
tier: mysql
clusterIP: None
\ No newline at end of file
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: redpacket-mysql
labels:
app: redpacket
spec:
strategy:
type: Recreate
template:
metadata:
labels:
app: redpacket
tier: mysql
spec:
containers:
- image: dockerhub.qingcloud.com/mysql:5.6
name: mysql
env:
# $ kubectl create secret generic mysql-pass --from-file=password.txt
# make sure password.txt does not have a trailing newline
- name: MYSQL_ROOT_PASSWORD
value: Quantgroup2017
ports:
- containerPort: 3306
name: mysql
volumeMounts:
- name: mysql-persistent-storage
mountPath: /var/lib/mysql
volumes:
- name: mysql-persistent-storage
persistentVolumeClaim:
claimName: mysql-pv-claim
\ No newline at end of file
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: redpacket-server
labels:
name: redpacket-server
spec:
replicas: 1
template:
metadata:
name: redpacket-server
labels:
name: redpacket
spec:
containers:
- name: "redpacket-server"
image: "192.168.4.36/redpacket/redpacket:0.0.1-master-SNAPSHOT"
ports:
- containerPort: 8080
- containerPort: 7031
imagePullPolicy: Always
imagePullSecrets:
- name: k8s-to-harbor-secret
\ No newline at end of file
apiVersion: v1
kind: ServiceAccount
metadata:
name: ingress
namespace: kube-system
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: ingress
subjects:
- kind: ServiceAccount
name: ingress
namespace: kube-system
roleRef:
kind: ClusterRole
name: cluster-admin
apiGroup: rbac.authorization.k8s.io
\ No newline at end of file
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: traefik-ingress-lb
namespace: kube-system
labels:
k8s-app: traefik-ingress-lb
spec:
template:
metadata:
labels:
k8s-app: traefik-ingress-lb
name: traefik-ingress-lb
spec:
terminationGracePeriodSeconds: 60
hostNetwork: true
restartPolicy: Always
serviceAccountName: ingress
containers:
- image: traefik
name: traefik-ingress-lb
resources:
limits:
cpu: 200m
memory: 30Mi
requests:
cpu: 100m
memory: 20Mi
ports:
- name: http
containerPort: 80
hostPort: 80
- name: admin
containerPort: 8580
hostPort: 8580
args:
- --web
- --web.address=:8580
- --kubernetes
\ No newline at end of file
apiVersion: v1
kind: Service
metadata:
name: traefik-web-ui
namespace: kube-system
spec:
selector:
k8s-app: traefik-ingress-lb
ports:
- name: web
port: 80
targetPort: 8580
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: traefik-web-ui
namespace: kube-system
spec:
rules:
- host: traefik-ui.local
http:
paths:
- path: /
backend:
serviceName: traefik-web-ui
servicePort: web
\ No newline at end of file
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: traefik-ingress
spec:
rules:
- host: traefik.nginx.io
http:
paths:
- path: /
backend:
serviceName: my-nginx
servicePort: 80
- host: traefik.frontend.io
http:
paths:
- path: /
backend:
serviceName: frontend
servicePort: 80
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment