Commit cb811048 authored by tywldx's avatar tywldx

Merge branch 'master' of http://git.quantgroup.cn/QA/qg-dockerfiles

# Conflicts:
#	templates/python/Dockerfile
parents f9a74fd7 4c323990
# VERSION 1.0
FROM mysql:5.6.37
MAINTAINER kalvin <dekun.dai@quantgroup.cn>
#定义工作目录
ENV WORK_PATH /home/quant_group/mysql
......@@ -14,7 +11,8 @@ WORKDIR $WORK_PATH
RUN mkdir -p sql_to_run
COPY mysqld.cnf /etc/mysql/mysql.conf.d/mysqld.cnf
COPY my.cnf /etc/mysql/mysql.conf.d/mysqld.cnf
COPY mysqld_charset.cnf /etc/mysql/conf.d/mysqld_charset.cnf
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/
......
......@@ -14,5 +14,5 @@ cd $sql_file_folder
for entry in ./*
do
echo "run sql file: $entry"
mysql -uroot -pQuantgroup2017 < $entry
mysql -uroot < $entry
done
\ No newline at end of file
# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# The MySQL Server configuration file.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
[mysqld]
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
datadir = /var/lib/mysql
log-error = /var/log/mysql/error.log
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
max_connections = 1000
\ No newline at end of file
[mysqld]
character_set_server=utf8
character_set_filesystem=utf8
collation-server=utf8_general_ci
init-connect='SET NAMES utf8'
init_connect='SET collation_connection = utf8_general_ci'
skip-character-set-client-handshake
\ No newline at end of file
# 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 mysqld.cnf /etc/mysql/mysql.conf.d/mysqld.cnf
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;
CREATE DATABASE user_credit;
GRANT ALL PRIVILEGES ON *.* TO 'qa'@'%' IDENTIFIED BY 'qatest';
flush privileges;
CREATE DATABASE silk_road;
GRANT ALL PRIVILEGES ON *.* TO 'qa'@'%' IDENTIFIED BY 'qatest';
flush privileges;
\ No newline at end of file
#!/bin/bash
echo "java_start java"
module_name=project
package_path="./${module_name}/app.jar"
config_path="./${module_name}/application.properties"
package_path="`pwd`/${module_name}/app.jar"
config_path="`pwd`/${module_name}/application.properties"
export NAMESPACE=`cat /var/run/secrets/kubernetes.io/serviceaccount/namespace`
echo "NAMESPACE is $NAMESPACE"
......@@ -11,7 +11,7 @@ sed -i "s/.domain.com/-$NAMESPACE.q-gp.com/g" ${config_path}
sed -i "s/xterm.js demo/${SYSTEM_NAME}@${NAMESPACE}/" /home/qg-xterm/demo/index.html
echo "nohup java -Xmx512m -XX:PermSize64m -XX:MaxMetaspaceSize=128m -Xloggc:/tmp/${module_name}_gc.log -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Denv=dev -Didc=k8s -Dtest=true -jar ${package_path} --worker 1 --currentWorker 1 -t --server.port=80 --spring.config.location=${config_path} &" > java_command
echo "nohup java -Xmx512m -XX:PermSize64m -XX:MaxMetaspaceSize=128m -Xloggc:/tmp/${module_name}_gc.log -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Denv=dev -Didc=k8s -Dtest=true -jar ${package_path} --worker 1 --currentWorker 1 -t --server.port=80 --spring.config.location=${config_path} & " > java_command
nohup java -Xmx512m -XX:PermSize64m -XX:MaxMetaspaceSize=128m -Xloggc:/tmp/${module_name}_gc.log -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Denv=dev -Didc=k8s -Dtest=true -jar ${package_path} --worker 1 --currentWorker 1 -t --server.port=80 --spring.config.location=${config_path} &
echo "sleep 10"
......@@ -31,5 +31,5 @@ cd /home/qg-xterm/;git pull;cd -
echo "node /home/qg-xterm/demo/app.js"
nohup node /home/qg-xterm/demo/app.js &
echo "frontail logs/*.log -d -n 1000"
frontail ./logs/*log -n 1000
\ No newline at end of file
echo "frontail logs/*.log -d -n 300"
frontail ./logs/*log -n 300
\ No newline at end of file
......@@ -7,16 +7,24 @@ ARG BUILD_TIME
USER root
WORKDIR /home/quant_group
RUN mkdir ${SYSTEM_NAME}
RUN mkdir project
RUN mkdir logs
RUN echo "${BUILD_NUMBER}" >> ./version.txt
ARG BUILD_NUMBER
ARG SYSTEM_NAME
ARG BRANCH_NAME
ENV BUILD_NUMBER=$BUILD_NUMBER
ENV SYSTEM_NAME=$SYSTEM_NAME
ENV BRANCH_NAME=$BRANCH_NAME
RUN echo "BUILD_NUMBER: ${BUILD_NUMBER},SYSTEM_NAME: ${SYSTEM_NAME},BRANCH_NAME: ${BRANCH_NAME}" >> ./build_info
RUN pip install -i http://pypi.douban.com/simple --default-timeout 6000 tornado MySQL-python DBUtils synthesis executor futures --trusted-host pypi.douban.com
#RUN apt-get remove python-pip -y && apt-get autoremove -y
EXPOSE 80
COPY docker-entrypoint.sh .
COPY dist.tgz ./${SYSTEM_NAME}/dist.tgz
COPY dist.tgz ./project/dist.tgz
RUN chmod +x ./docker-entrypoint.sh
CMD ["./docker-entrypoint.sh"]
\ 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