rabin 7 years ago
parent
commit
1d2dc1c9ab

+ 0 - 0
container/conf/db/mysql/my.conf → container/conf/db/mariadb/my.conf


+ 3 - 0
container/conf/db/mysql/conf.d/docker.cnf

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

+ 22 - 0
container/conf/db/mysql/conf.d/mysql.cnf

@@ -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]

+ 25 - 0
container/conf/db/mysql/my.cnf

@@ -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/

+ 25 - 0
container/conf/db/mysql/my.cnf.fallback

@@ -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/

+ 17 - 0
container/conf/db/mysql/mysql.cnf

@@ -0,0 +1,17 @@
+# Copyright (c) 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
+
+!includedir /etc/mysql/conf.d/
+!includedir /etc/mysql/mysql.conf.d/

+ 30 - 0
container/conf/db/mysql/mysql.conf.d/mysqld.cnf

@@ -0,0 +1,30 @@
+# 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
+# By default we only accept connections from localhost
+#bind-address	= 127.0.0.1
+# Disabling symbolic-links is recommended to prevent assorted security risks
+symbolic-links=0

+ 2 - 26
src/docker/build/db/mysql/Dockerfile

@@ -1,27 +1,3 @@
-FROM docker.dever.cc/os/alpine:latest
+FROM mysql:5.7
 
-MAINTAINER Rabin "https://github.com/shemic"
-
-USER root
-RUN apk add --no-cache --update bash mysql mysql-client && \
-	mkdir /run/mysqld && chmod 777 /run/mysqld && \
-	rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql && \
-	chmod 664 /etc/mysql/my.cnf
-
-
-RUN sed -Ei 's/^(bind-address|log|binlog)/#&/' /etc/mysql/my.cnf \
-	#&& sed -Ei 's/^(#skip-networking)/skip-networking/' /etc/mysql/my.cnf \
-	&& echo 'user=root' | awk '{ print } $1 == "[mysqld]" && c == 0 { c = 1; system("cat") }' /etc/mysql/my.cnf > /tmp/my.cnf \
-	&& mv /tmp/my.cnf /etc/mysql/my.cnf \
-	&& echo 'skip-host-cache' | awk '{ print } $1 == "[mysqld]" && c == 0 { c = 1; system("cat") }' /etc/mysql/my.cnf > /tmp/my.cnf \
-	&& mv /tmp/my.cnf /etc/mysql/my.cnf \
-	&& echo 'skip-name-resolve' | awk '{ print } $1 == "[mysqld]" && c == 0 { c = 1; system("cat") }' /etc/mysql/my.cnf > /tmp/my.cnf \
-	&& mv /tmp/my.cnf /etc/mysql/my.cnf
-
-VOLUME ["/var/lib/mysql", "/etc/mysql"]
-
-COPY entrypoint.sh /entrypoint.sh
-ENTRYPOINT ["/entrypoint.sh"]
-
-EXPOSE 3306
-CMD ["mysqld"]
+MAINTAINER Rabin "https://github.com/shemic"

+ 0 - 91
src/docker/build/db/mysql/entrypoint.sh

@@ -1,91 +0,0 @@
-#!/bin/bash
-set -e
-
-# if command starts with an option, prepend mysqld
-if [ "${1:0:1}" = '-' ]; then
-	set -- mysqld "$@"
-fi
-
-if [ "$1" = 'mysqld' ]; then
-	# Get config
-	DATADIR="$("$@" --verbose --help 2>/dev/null | awk '$1 == "datadir" { print $2; exit }')"
-
-	if [ ! -d "$DATADIR/mysql" ]; then
-		if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" ]; then
-			echo >&2 'error: database is uninitialized and MYSQL_ROOT_PASSWORD not set'
-			echo >&2 '  Did you forget to add -e MYSQL_ROOT_PASSWORD=... ?'
-			exit 1
-		fi
-
-		mkdir -p "$DATADIR"
-		#chown -R mysql:mysql "$DATADIR"
-
-		echo 'Running mysql_install_db'
-		mysql_install_db --user=root --datadir="$DATADIR" --rpm
-		echo 'Finished mysql_install_db'
-
-		mysqld --user=root --datadir="$DATADIR" --skip-networking &
-		pid="$!"
-
-		mysql=( mysql --protocol=socket -uroot )
-
-		for i in {30..0}; do
-			if echo 'SELECT 1' | "${mysql[@]}" &> /dev/null; then
-				break
-			fi
-			echo 'MySQL init process in progress...'
-			sleep 1
-		done
-		if [ "$i" = 0 ]; then
-			echo >&2 'MySQL init process failed.'
-			exit 1
-		fi
-
-		# sed is for https://bugs.mysql.com/bug.php?id=20545
-		mysql_tzinfo_to_sql /usr/share/zoneinfo | sed 's/Local time zone must be set--see zic manual page/FCTY/' | "${mysql[@]}" mysql
-
-		"${mysql[@]}" <<-EOSQL
-			-- What's done in this file shouldn't be replicated
-			--  or products like mysql-fabric won't work
-			SET @@SESSION.SQL_LOG_BIN=0;
-			DELETE FROM mysql.user ;
-			CREATE USER 'root'@'%' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ;
-			GRANT ALL ON *.* TO 'root'@'%' WITH GRANT OPTION ;
-			DROP DATABASE IF EXISTS test ;
-			FLUSH PRIVILEGES ;
-		EOSQL
-
-		if [ ! -z "$MYSQL_ROOT_PASSWORD" ]; then
-			mysql+=( -p"${MYSQL_ROOT_PASSWORD}" )
-		fi
-
-		if [ "$MYSQL_DATABASE" ]; then
-			echo "CREATE DATABASE IF NOT EXISTS \`$MYSQL_DATABASE\` ;" | "${mysql[@]}"
-			mysql+=( "$MYSQL_DATABASE" )
-		fi
-
-		if [ "$MYSQL_USER" -a "$MYSQL_PASSWORD" ]; then
-			echo "CREATE USER '"$MYSQL_USER"'@'%' IDENTIFIED BY '"$MYSQL_PASSWORD"' ;" | "${mysql[@]}"
-
-			if [ "$MYSQL_DATABASE" ]; then
-				echo "GRANT ALL ON \`"$MYSQL_DATABASE"\`.* TO '"$MYSQL_USER"'@'%' ;" | "${mysql[@]}"
-			fi
-
-			echo 'FLUSH PRIVILEGES ;' | "${mysql[@]}"
-		fi
-
-		if ! kill -s TERM "$pid" || ! wait "$pid"; then
-			echo >&2 'MySQL init process failed.'
-			exit 1
-		fi
-
-		echo
-		echo 'MySQL init process done. Ready for start up.'
-		echo
-	fi
-
-	#chown -R mysql:mysql "$DATADIR"
-fi
-
-mysqld --user=root --datadir="$DATADIR"
-#exec "$@"

+ 1 - 1
src/docker/build/elastic/elasticsearch/Dockerfile

@@ -20,7 +20,7 @@ RUN apk add --no-cache --update bash curl procps ncurses openjdk8 && \
     mkdir -p /elasticsearch/logs && \
     mkdir -p /share/process/elasticsearch && \
     chown -R es:es $ES_HOME /elasticsearch /tmp && \
-    chmod -R 777 /tmp /elasticsearch /share/process/elasticsearch $ES_HOME/config/scripts/ && \
+    chmod -R 777 /tmp /elasticsearch /share/process/elasticsearch && \
     cd $ES_HOME && \
     echo y | elasticsearch-plugin install x-pack && \
     apk del curl openjdk8

+ 29 - 0
src/docker/build/java/presto/Dockerfile

@@ -0,0 +1,29 @@
+FROM docker.dever.cc/java/base:latest
+
+MAINTAINER Rabin "https://github.com/shemic"
+
+# set environment variable
+ENV HADOOP_HOME=/usr/local/hadoop
+ENV HADOOP_CONF_DIR=$HADOOP_HOME/etc/hadoop
+ENV HADOOP_VERSION=2.7.4
+ENV HADOOP_LOG_DIR=/root/hadoop/logs
+ENV YARN_CONF_DIR=$HADOOP_CONF_DIR
+ENV YARN_LOG_DIR=/root/yarn/logs
+ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HADOOP_HOME/lib/native
+ENV PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin
+
+# install hadoop
+RUN mkdir -p /root/hdfs/namenode && \ 
+    mkdir -p /root/hdfs/datanode && \
+    mkdir -p /root/hadoop/tmp && \
+    mkdir -p /root/hadoop/logs && \
+    mkdir -p /root/yarn/logs && \
+    curl -O ${MIRRORS}apache/hadoop/common/hadoop-$HADOOP_VERSION/hadoop-$HADOOP_VERSION.tar.gz && \
+    tar -xzvf hadoop-$HADOOP_VERSION.tar.gz && \
+    rm -rf hadoop-$HADOOP_VERSION/share/doc hadoop-$HADOOP_VERSION/share/hadoop/common/jdiff && \
+    mv hadoop-$HADOOP_VERSION $HADOOP_HOME && \
+    rm hadoop-$HADOOP_VERSION.tar.gz
+
+COPY hadoop.sh /entrypoint/hadoop.sh
+
+VOLUME ["/usr/local/hadoop/etc/hadoop"]

+ 35 - 0
src/docker/build/java/presto/presto.sh

@@ -0,0 +1,35 @@
+#!/usr/bin/env sh
+set -e
+
+start_share_hadoop()
+{
+    share $HADOOP_HOME hadoop
+}
+
+stop_share_hadoop()
+{
+    true
+}
+
+start_hadoop()
+{
+	if [ "$1" == "share" ]; then
+        start_share_hadoop
+    fi
+    rm -rf /root/hdfs/*
+    rm -rf /root/hadoop/tmp/*
+    $HADOOP_HOME/bin/hdfs namenode -format
+    $HADOOP_HOME/sbin/start-dfs.sh
+    $HADOOP_HOME/sbin/start-yarn.sh
+    #$HADOOP_HOME/sbin/start-all.sh
+} 
+
+stop_hadoop()
+{
+	stop-all.sh &
+}
+
+monit_hadoop()
+{
+    process_monit hdfs
+}

+ 11 - 0
src/docker/build/learning/Dockerfile

@@ -0,0 +1,11 @@
+FROM docker.dever.cc/dev/python/v3:latest
+
+MAINTAINER Rabin "https://github.com/shemic"
+
+RUN apk update && apk add --no-cache python3-dev gcc g++ automake lapack lapack-dev gfortran freetype freetype-dev && \
+	pip3 install numpy && \
+	pip3 install scipy && \
+	pip3 install pandas && \
+	pip3 install matplotlib && \
+	pip3 install scikit-learn && \
+	apk del gcc g++ automake gfortran

+ 1 - 5
src/docker/build/learning/conda/Dockerfile

@@ -4,8 +4,4 @@ MAINTAINER Rabin "https://github.com/shemic"
 
 RUN apk update && apk add --no-cache curl && \
 	curl -O https://repo.continuum.io/archive/Anaconda3-5.0.1-Linux-x86_64.sh && \
-	mkdir /src && \
-	mkdir /root/.pip && \
-	echo -e "[global]\nindex-url = https://pypi.tuna.tsinghua.edu.cn/simple" > /root/.pip/pip.conf
-
-VOLUME ["/src"]
+	./Anaconda3-5.0.1-Linux-x86_64.sh && \

+ 7 - 0
src/docker/build/learning/matplotlib/Dockerfile

@@ -0,0 +1,7 @@
+FROM docker.dever.cc/dev/python/v3:latest
+
+MAINTAINER Rabin "https://github.com/shemic"
+
+RUN apk update && apk add --no-cache python3-dev gcc g++ automake freetype freetype-dev && \
+	pip3 install matplotlib && \
+	apk del gcc g++ automake

+ 3 - 3
src/docker/build/learning/numpy/Dockerfile

@@ -2,6 +2,6 @@ FROM docker.dever.cc/dev/python/v3:latest
 
 MAINTAINER Rabin "https://github.com/shemic"
 
-RUN apk update && apk add --no-cache curl && \
-	curl -O https://pypi.python.org/packages/b6/fc/34342ee8ea0c413679ddfb23d73a132fc7ecbf479383de9f0946344ec73c/numpy-1.13.3-cp27-cp27m-manylinux1_x86_64.whl#md5=64bc7dc4a503398e0b4cc48778136374 && \
-	pip install numpy-1.13.3-cp27-cp27m-manylinux1_x86_64.whl
+RUN apk update && apk add --no-cache python3-dev gcc g++ automake && \
+	pip3 install numpy && \
+	apk del gcc g++ automake

+ 7 - 0
src/docker/build/learning/scipy/Dockerfile

@@ -0,0 +1,7 @@
+FROM docker.dever.cc/dev/python/v3:latest
+
+MAINTAINER Rabin "https://github.com/shemic"
+
+RUN apk update && apk add --no-cache python3-dev gcc g++ automake lapack lapack-dev gfortran && \
+	pip3 install scipy && \
+	apk del gcc g++ automake gfortran

+ 5 - 7
src/docker/build/learning/sklearn/Dockerfile

@@ -2,10 +2,8 @@ FROM docker.dever.cc/dev/python/v3:latest
 
 MAINTAINER Rabin "https://github.com/shemic"
 
-RUN apk update && apk add --no-cache curl && \
-	curl -O https://repo.continuum.io/archive/Anaconda3-5.0.1-Linux-x86_64.sh && \
-	mkdir /src && \
-	mkdir /root/.pip && \
-	echo -e "[global]\nindex-url = https://pypi.tuna.tsinghua.edu.cn/simple" > /root/.pip/pip.conf
-
-VOLUME ["/src"]
+RUN apk update && apk add --no-cache python3-dev gcc g++ automake lapack lapack-dev gfortran && \
+	pip3 install numpy && \
+	pip3 install scipy && \
+	pip3 install scikit-learn && \
+	apk del gcc g++ automake gfortran

+ 4 - 1
src/docker/conf/elk.conf

@@ -26,4 +26,7 @@ command = filebeat
 [kibana]
 port = 5602:5601
 volumes = {container}conf/elastic/kibana:/usr/local/kibana/config
-command = kibana
+command = kibana
+
+[grafana]
+port = 3002:3000

+ 14 - 0
src/docker/conf/learn.conf

@@ -0,0 +1,14 @@
+[base]
+;根目录
+path = {base}
+
+[core]
+image = learn
+volumes = {container}src/learn:/src
+alias = python3
+
+[tool]
+image = learn-tool
+port = 10001:8888
+volumes = {container}conf/jupyter:/root/.jupyter
+command = jupyter

+ 6 - 0
src/docker/conf/web.conf

@@ -7,6 +7,12 @@ port = 3309:3306
 volumes = {container}conf/db/mysql:/etc/mysql,/mysql/{name}/data:/var/lib/mysql
 environment = MYSQL_ROOT_PASSWORD=123456
 
+[#mysql]
+image = mariadb
+port = 3309:3306
+volumes = {container}conf/db/mariadb:/etc/mysql,/mysql/{name}/data:/var/lib/mysql
+environment = MYSQL_ROOT_PASSWORD=123456
+
 [#php]
 port = 8082:8080
 link = [mysql]{num}:[mysql]{num}

+ 5 - 0
src/docker/core.conf

@@ -35,6 +35,7 @@ nongxiaohe			= iot/nongxiaohe
 
 ;db
 mysql				= db/mysql
+mariadb				= db/mariadb
 memcached			= db/memcached
 redis				= db/redis
 ;mongodb			= db/mongodb
@@ -62,6 +63,10 @@ apidoc				= tool/apidoc
 jupyter				= tool/jupyter
 grafana				= tool/grafana
 
+;learn
+learn				= learning
+learn-tool			= learning/jupyter
+
 ;base
 gogs				= base/gogs
 registry			= base/registry