Commit 8bbdebbb by 马兴宇

Initial commit

parents
File added
storage/mysql/*
storage/redis/*
!storage/mysql/.gitkeep
!storage/redis/.gitkeep
vue/*
!vue/.gitkeep
laravel/*
!laravel/.gitkeep
gulp/*
!gulp/.gitkeep
.c9/
.idea/
\ No newline at end of file
## 四轮科技docker开发环境
- 声明:仅在mac环境下投入使用,Windows理论上可用;本项目已是工作目录,最好不要放在子项目下
- mysql、redis暂无使用
- topka项目未接入在内,依旧是在虚拟机内运行
### 使用前准备
- 请自行前往docker官网下载新版docker或者升级本机docker版本
- docker官网链接:https://docs.docker.com/docker-for-mac/install/
- mac环境下使用resolver解析本容器dns,命令如下
```
sudo mkdir /etc/resolver
sudo touch /etc/resolver/test
sudo vi /etc/resolver/test
写入
nameserver 127.0.0.1
```
### 使用步骤
```
1.将自己的私钥放入本目录内,方便在 http://c9.test (账户:密码:root:root,浏览器ide)操作git
2.数据使用虚拟机内的,所以这里只启动这两个
命令:docker-compose up -d workspace dns
3.启动gulp容器 请在当前gulp目录内执行 -p 后端口按实际需要使用
docker run -itd -v $PWD:/gulp -p 3000:3000 --name gulp cnice/piston:1.0.0
如需使用gulp命令进入容器内:docker exec -it gulp bash
```
### 解读
- 由于使用了dns与resolver解析器 所以nginx配置的路由以.test为结尾的地址无需修改hosts文件
```
目录结构说明
├── gulp (需要gulp的项目)
│ ├── layui-agent
│ └── piston
│ └── ...
├── laravel (laravel项目 php7.1)
│ ├── dealer
│ └── promotion
│ └── ...
├── vue (vue项目)
│ ├── dealer
│ └── promotion
│ └── ...
├── dns
│ └── dnsmasq.conf
├── storage (数据存放)
│ ├── redis
│ └── mysql
│ └── ...
├── .gitignore
├── c9.conf
├── docker-compose.yml
├── html.conf (前端 nginx配置)
├── php.conf (php nginx配置)
├── README.md
```
\ No newline at end of file
server {
listen 80;
server_name c9.test;
access_log off;
location / {
proxy_pass http://localhost:8181/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
log-queries
no-resolv
server=223.5.5.5
server=223.6.6.6
address=/.test/127.0.0.1
address=/gw.proxy/172.31.1.104
\ No newline at end of file
version: '3.5'
services:
workspace:
container_name: workspace
image: cnice/4wheels-devops:latest
networks:
- wb_net
ports:
- 80:80
volumes:
- '.:/workspace'
hostname: workspace
mysql.test:
container_name: mysql
image: mysql:8
networks:
- wb_net
environment:
MYSQL_ROOT_PASSWORD: root
volumes:
- './storage/mysql:/var/lib/mysql'
- './my.cnf:/etc/mysql/my.cnf'
ports:
- 3306:3306
hostname: mysql
redis.test:
container_name: redis
image: redis:alpine
networks:
- wb_net
volumes:
- './storage/redis:/data'
ports:
- 6379:6379
command: redis-server --appendonly yes
hostname: redis
dns:
container_name: dns
image: jpillora/dnsmasq
networks:
- wb_net
ports:
- 53:53/udp
- 5380:8080
volumes:
- './dns/dnsmasq.conf:/etc/dnsmasq.conf'
networks:
wb_net:
name: wb_net
ipam:
driver: default
config:
- subnet: "172.29.233.0/24"
server {
listen 80;
server_name agent.sosocar.test;
root /workspace/gulp/layui-agent/start;
access_log /var/log/nginx/agent.sosocar.local.access.log;
error_log /var/log/nginx/agent.sosocar.local.error.log;
index index.html index.htm;
location /src/ {
alias //workspace/gulp/layui-agent/src/;
}
location /dist/ {
alias //workspace/gulp/layui-agent/dist/;
}
location /master/ {
proxy_pass http://dealer.test;
}
}
\ No newline at end of file
# Copyright (c) 2017, 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
secure-file-priv= NULL
default_authentication_plugin=mysql_native_password
# Custom config should go here
!includedir /etc/mysql/conf.d/
server {
listen 80;
server_name dealer.test;
root /workspace/laravel/dealer/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
index index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
server {
listen 80;
server_name promotion.test;
root /workspace/laravel/promotion/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
index index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
\ 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