Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pure go env #1

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
COMPOSE_PROJECT_NAME=dnmpg
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# 一个mysql8.0 php7.3/php5.6 nginx redis mongodb rabbitmq的环境
# 一个mysql8.0 redis mongodb activeMQ的环境

## 可以自选需要的服务进行启动
1 change: 1 addition & 0 deletions activeMQ/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
data/*
132 changes: 33 additions & 99 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,96 +1,31 @@
version: '3.3'
services:
nginx:
image: nginx:1.17 #最新版本
container_name: nginx
ports:
- "80:80" #nginx
restart: always
tty: true
volumes:
- ./www:/var/www/html
- ./logs/nginx:/var/log/nginx
- ./nginx/conf:/etc/nginx
- ./nginx/etc/letsencrypt:/etc/letsencrypt #ssl证书目录
networks:
- lnmp-networks
php7:
build:
context: ./php7.4
container_name: php7-fpm
tty: true
restart: always
privileged: true
volumes:
- ./www:/var/www/html
- ./logs/php:/var/log/php
- ./php7.4/etc:/usr/local/etc
depends_on:
- nginx
ports:
- "9000:9000"
networks:
- lnmp-networks
# php5:
# build:
# context: ./php5.6
# container_name: php5-fpm
# tty: true
# restart: always
# privileged: true
# volumes:
# - ./www:/var/www/html
# - ./logs/php:/var/log/php
# - ./php5.6/php.ini:/usr/local/etc/php/php.ini
# - ./php5.6/www.conf:/usr/local/etc/php-fpm.d/www.conf
# depends_on:
# - nginx
# ports:
# - "9000:9000"
# networks:
# - lnmp-networks
golang:
build: ./golang
ports:
- "8088:8088"
links:
- "mysql"
- "redis"
volumes:
- ./goProjects:/go
tty: true
redis:
image: redis:5.0.7
image: 'redis:5.0.7'
container_name: redis
ports:
- "6379:6379"
- '6379:6379'
tty: true
restart: always
volumes:
- ./redis/redis.conf:/etc/redis/redis.conf
- ./redis/data:/var/lib/redis
- ./logs/redis:/var/log/redis
- './redis/redis.conf:/etc/redis/redis.conf'
- './redis/data:/var/lib/redis'
- './logs/redis:/var/log/redis'
command: redis-server --port 6379 --requirepass pwd123456 --appendonly yes
networks:
- lnmp-networks
mysql:
image: mysql:8.0
image: 'mysql:8.0'
container_name: mysql
tty: true
restart: always
ports:
- "3306:3306" #mysql
- '3306:3306'
volumes:
- ./mysql/data:/var/lib/mysql
- ./mysql/data/mysql-files:/var/lib/mysql-files
- ./mysql/conf:/etc/mysql
- ./logs/mysql:/var/log/mysql
command:
--default-authentication-plugin=mysql_native_password
--character-set-server=utf8mb4
--collation-server=utf8mb4_general_ci
--explicit_defaults_for_timestamp=true
--lower_case_table_names=1
--max_allowed_packet=128M;
- './mysql/data:/var/lib/mysql'
- './mysql/mysql-files:/var/lib/mysql-files'
- './mysql/conf:/etc/mysql'
- './logs/mysql:/var/log/mysql'
environment:
MYSQL_ROOT_PASSWORD: 123456
networks:
Expand All @@ -102,8 +37,8 @@ services:
- "27017:27017"
volumes:
- ./mongodb/data:/data
- ./mongodb/conf/mongod.conf.orig:/etc/mongod.conf #默认配置文件
- ./log/mongodb/mongodb.log:/var/log/mongodb/mongodb.log:rw
- ./mongodb/conf/mongod.conf:/etc/mongod.conf #默认配置文件
- ./logs/mongodb/mongodb.log:/var/log/mongodb/mongodb.log:rw
environment:
MONGO_INITDB_ROOT_USERNAME: admin
MONGO_INITDB_ROOT_PASSWORD: 123456
Expand All @@ -112,28 +47,27 @@ services:
user: mongodb
networks:
- lnmp-networks
rabbitmq:
image: rabbitmq:management-alpine
container_name: rabbitmq
ports:
- "15672:15672" #管理界面端口
- "5672:5672" #服务端端口
activemq:
container_name: activeMQ
image: "webcenter/activemq"
restart: always
volumes:
- ./rabbitmq/data:/var/lib/rabbitmq
- ./rabbitmq/conf:/etc/rabbitmq
- ./log/rabbitmq/rabbitmq.log:/var/log/rabbitmq/rabbitmq.log:rw
- ./activeMQ/data:/data/activemq
- ./logs/activeMQ:/var/log/activemq
ports:
- 8161:8161
- 61616:61616
- 5672:5672
- 61613:61613
- 1883:1883
- 61614:61614
environment:
- RABBITMQ_DEFAULT_USER=root
- RABBITMQ_DEFAULT_PASS=123456
logging:
driver: "json-file"
options:
max-size: "200k"
max-file: "10"
tty: true
restart: always
user: rabbitmq
- ACTIVEMQ_ADMIN_LOGIN=admin
- ACTIVEMQ_ADMIN_PASSWORD=admin
- ACTIVEMQ_CONFIG_MINMEMORY=512
- ACTIVEMQ_CONFIG_MAXMEMORY=2048
- TZ=Asia/Shanghai
networks:
- lnmp-networks
networks:
lnmp-networks:
lnmp-networks: null
1 change: 1 addition & 0 deletions etcd/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
COMPOSE_PROJECT_NAME=etcd
40 changes: 40 additions & 0 deletions etcd/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
version: '2'
services:
etcd1:
image: quay.io/coreos/etcd
container_name: etcd1
restart: always
command: >-
etcd -name etcd1 -advertise-client-urls http://0.0.0.0:2379 -listen-client-urls http://0.0.0.0:2379 -listen-peer-urls http://0.0.0.0:2380 -initial-cluster-token etcd-cluster -initial-cluster
"etcd1=http://etcd1:2380,etcd2=http://etcd2:2380,etcd3=http://etcd3:2380" -initial-cluster-state new
ports:
- 2379
- 2380
networks:
- etcd-network
etcd2:
image: quay.io/coreos/etcd
container_name: etcd2
restart: always
command: >-
etcd -name etcd2 -advertise-client-urls http://0.0.0.0:2379 -listen-client-urls http://0.0.0.0:2379 -listen-peer-urls http://0.0.0.0:2380 -initial-cluster-token etcd-cluster -initial-cluster
"etcd1=http://etcd1:2380,etcd2=http://etcd2:2380,etcd3=http://etcd3:2380" -initial-cluster-state new
ports:
- 2379
- 2380
networks:
- etcd-network
etcd3:
image: quay.io/coreos/etcd
container_name: etcd3
restart: always
command: >-
etcd -name etcd3 -advertise-client-urls http://0.0.0.0:2379 -listen-client-urls http://0.0.0.0:2379 -listen-peer-urls http://0.0.0.0:2380 -initial-cluster-token etcd-cluster -initial-cluster
"etcd1=http://etcd1:2380,etcd2=http://etcd2:2380,etcd3=http://etcd3:2380" -initial-cluster-state new
ports:
- 2379
- 2380
networks:
- etcd-network
networks:
etcd-network: null
64 changes: 0 additions & 64 deletions golang/Dockerfile

This file was deleted.

Empty file removed log/nginx/access.log
Empty file.
Empty file removed log/nginx/error.log
Empty file.
Empty file removed log/nginx/host.access.log
Empty file.
Empty file.
Empty file.
3 changes: 2 additions & 1 deletion logs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ mongodb/
mysql/
nginx/
php/
redis/
redis/
activeMQ/
File renamed without changes.
3 changes: 2 additions & 1 deletion mysql/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
data/
data/
mysql-files/
20 changes: 17 additions & 3 deletions mysql/conf/my.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

[client]
default-character-set=utf8mb4

[mysqld]
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
datadir = /var/lib/mysql
secure-file-priv = /var/lib/mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links = 0
# Custom config should go here
#!includedir /etc/mysql/conf.d/
skip-name-resolve
Expand All @@ -38,12 +39,25 @@ back_log = 600
# 你的操作系统在这个队列大小上有它自己的限制(可以检查你的OS文档找出这个变量的最大值),试图设定back_log高于你的操作系统的限制将是无效的。
log_bin = mysql-bin
binlog_format = mixed
expire_logs_days = 30 #超过30天的binlog删除
binlog_expire_logs_seconds = 2592000
log_error = /var/log/mysql/mysql-error.log #错误日志路径
slow_query_log = 1
long_query_time = 1 #慢查询时间 超过1秒则为慢查询
slow_query_log_file = /var/log/mysql/mysql-slow.log
performance_schema = 0
default-storage-engine = InnoDB #默认存储引擎
max_connections = 1000
character-set-server = utf8mb4
collation-server = utf8mb4_general_ci
skip-character-set-client-handshake
secure-file-priv = NULL
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links =0
# default: sql_mode = STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
sql_mode = STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
explicit_defaults_for_timestamp = 1
lower_case_table_names = 1
max_allowed_packet = 128M

[mysql]
default-character-set = utf8mb4
2 changes: 2 additions & 0 deletions nginx/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
!conf/conf.d/default.conf
!etc/letsencrypt/*
20 changes: 10 additions & 10 deletions nginx/conf/conf.d/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ server {

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
location ~ \.php$ {
proxy_pass http://127.0.0.1;
}
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root html;
fastcgi_pass php7:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
#location ~ \.php$ {
# root html;
# fastcgi_pass php7:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# include fastcgi_params;
#}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
Expand Down
Loading