1
0
mirror of https://github.com/chatopera/cosin.git synced 2025-08-01 16:38:02 +08:00

#43 add docker-compose, mysql, redis

This commit is contained in:
Hai Liang Wang 2018-09-03 18:54:16 +08:00
parent 45022274f7
commit ea4e8da308
13 changed files with 265 additions and 0 deletions

58
docker-compose.yml Normal file
View File

@ -0,0 +1,58 @@
version: '2'
services:
mysql:
image: "mysql:5.6"
restart: always
environment:
- MYSQL_ROOT_PASSWORD=123456
- MYSQL_DATABASE=contact-center
- MYSQL_USER=admin
- MYSQL_PASSWORD=admin123456
ports:
- "3306:3306"
volumes:
- $PWD/mysql/data:/var/lib/mysql
- $PWD/mysql/config:/etc/mysql
redis:
image: redis:latest
restart: always
command: redis-server --appendonly yes
volumes:
- $PWD/redis/data:/data
ports:
- "6379:6379"
contact-center:
image: "chatopera/contact-center:develop"
restart: always
ports:
- "8035:8080"
- "8036:8036"
volumes:
- $PWD/contact-center/data:/data
- $PWD/contact-center/logs:/logs
environment:
- JAVA_OPTS=-Xmx12288m -Xms2048m -XX:PermSize=256m -XX:MaxPermSize=1024m -Djava.net.preferIPv4Stack=true
- SERVER_PORT=8035
- SERVER_LOG_PATH=/logs
- SERVER_LOG_LEVEL=INFO
- WEB_UPLOAD_PATH=/data
- SPRING_FREEMARKER_CACHE=true
- SPRING_DATA_ELASTICSEARCH_PROPERTIES_PATH_DATA=/data
- UK_IM_SERVER_PORT=8036
- UK_IM_SERVER_HOST=localhost
- UK_IM_SERVER_THREADS=10
- SPRING_DATASOURCE_TYPE=com.alibaba.druid.pool.DruidDataSource
- SPRING_DATASOURCE_DRIVER_CLASS_NAME=com.mysql.jdbc.Driver
- SPRING_DATASOURCE_URL=jdbc:mysql://mysql:3306/contact-center?useUnicode=true&characterEncoding=UTF-8
- SPRING_DATASOURCE_USERNAME=root
- SPRING_DATASOURCE_PASSWORD=123456
- MANAGEMENT_SECURITY_ENABLED=false
- SPRING_REDIS_DATABASE=2
- SPRING_REDIS_HOST=redis
- SPRING_REDIS_PORT=6379
- CSKEFU_CALLOUT_WATCH_INTERVAL=60000
depends_on:
- mysql
- redis

18
mysql/admin/start.sh Executable file
View File

@ -0,0 +1,18 @@
#! /bin/bash
###########################################
#
###########################################
# constants
baseDir=$(cd `dirname "$0"`;pwd)
# functions
# main
[ -z "${BASH_SOURCE[0]}" -o "${BASH_SOURCE[0]}" = "$0" ] || return
cd $baseDir/../..
if [ -f docker-compose.yml ]; then
docker-compose up mysql
else
echo "Invalid docker compose."
exit 1
fi

18
mysql/admin/stop.sh Executable file
View File

@ -0,0 +1,18 @@
#! /bin/bash
###########################################
#
###########################################
# constants
baseDir=$(cd `dirname "$0"`;pwd)
# functions
# main
[ -z "${BASH_SOURCE[0]}" -o "${BASH_SOURCE[0]}" = "$0" ] || return
cd $baseDir/../..
if [ -f docker-compose.yml ]; then
docker-compose down mysql
else
echo "Invalid docker compose."
exit 1
fi

View File

@ -0,0 +1,3 @@
[mysqld]
skip-host-cache
skip-name-resolve

View File

@ -0,0 +1,22 @@
# Copyright (c) 2015, 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 Client configuration file.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
[mysql]

26
mysql/config/my.cnf Normal file
View File

@ -0,0 +1,26 @@
# Copyright (c) 2015, 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
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/

View File

@ -0,0 +1,25 @@
# Copyright (c) 2015, 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 Community Server configuration file.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/

26
mysql/config/mysql.cnf Normal file
View File

@ -0,0 +1,26 @@
# Copyright (c) 2015, 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
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/

View File

@ -0,0 +1,28 @@
# 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

2
mysql/data/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

18
redis/admin/start.sh Executable file
View File

@ -0,0 +1,18 @@
#! /bin/bash
###########################################
#
###########################################
# constants
baseDir=$(cd `dirname "$0"`;pwd)
# functions
# main
[ -z "${BASH_SOURCE[0]}" -o "${BASH_SOURCE[0]}" = "$0" ] || return
cd $baseDir/../..
if [ -f docker-compose.yml ]; then
docker-compose up redis
else
echo "Invalid docker compose."
exit 1
fi

18
redis/admin/stop.sh Executable file
View File

@ -0,0 +1,18 @@
#! /bin/bash
###########################################
#
###########################################
# constants
baseDir=$(cd `dirname "$0"`;pwd)
# functions
# main
[ -z "${BASH_SOURCE[0]}" -o "${BASH_SOURCE[0]}" = "$0" ] || return
cd $baseDir/../..
if [ -f docker-compose.yml ]; then
docker-compose down redis
else
echo "Invalid docker compose."
exit 1
fi

3
redis/data/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
*
!.gitignore