Commit e3977931 authored by Kunkka王辉's avatar Kunkka王辉 😲

文档编写

parent eade8781
## galaxy-开发/测试环境 docker-compose
## Get Start
```
# 安装dev环境到本地
curl http://192.168.11.163/demo/install.sh | bash -s dev
```
## services
1. php7
2. nginx
......
......@@ -141,3 +141,4 @@ networks:
volumes:
maven-repo:
name: maven-repo
external: true
\ No newline at end of file
#!/bin/bash
OS_IS_LINUX='yes'; if [ $(uname -o) != "GNU/Linux" ]; then OS_IS_LINUX='no'; fi
DOCKER_YES='yes';if [ ! `command -v docker` ];then DOCKER_YES='no';fi;
GIT_YES='yes';if [ ! `command -v git` ];then DOCKER_YES='no';fi;
TAR_YES='yes';if [ ! `command -v tar` ];then DOCKER_YES='no';fi;
COMPOSE_CMD='docker-compose'
if docker --help | grep compose >/dev/null ; then
COMPOSE_CMD='docker compose'
fi
DOCKER_COMPOSE_YES='yes';if [ ! `command -v docker-compose` ] && [ "$COMPOSE_CMD" != 'docker compose' ];then DOCKER_COMPOSE_YES='no';fi;
PORT_YES ='yes'; if ss -tpl | grep -E '8118|8181' >/dev/null ;then PORT_YES='no';fi;
cat <<EOF
检查环境:
1. 是否是linux系统 $OS_IS_LINUX
2. docker $DOCKER_YES
3. git $GIT_YES
4. docker-compose/docker compose $DOCKER_COMPOSE_YES
5. tar $TAR_YES
6. 端口8118,8181是否可用 $PORT_YES
EOF
if echo "$TAR_YES$GIT_YES$DOCKER_COMPOSE_YES$OS_IS_LINUX$DOCKER_YES$PORT_YES" | grep no >/dev/null ;then
exit ;
fi
echo $@
# 变量声明
ENV='dev'
CODE_DIR=$(pwd)/code-$ENV
for arg in "$@";do
if [ -n "$arg" ];then
ENV="$arg"
break
fi
done
BUILD_DIR=galaxy-$ENV
if [ ! -d $CODE_DIR ]; then
mkdir -p $CODE_DIR
fi
cd $CODE_DIR
echo "下载demo代码"
curl -o data.tgz -# http://192.168.11.163/demo/code-demo-920.tgz
echo '解压缩......'
tar --strip-components=1 -xf data.tgz
rm -f data.tgz
echo '下载compose项目'
cd ../ # 到上一层
git clone git@gitlab.galaxy-immi.com:kunkka.wh/docker-test.git $BUILD_DIR
cd $BUILD_DIR
cat <<EOF > .env
# 环境变量env dev,test,test1,test2等区分
ENV=$ENV
# 服务宿主机的端口
PORT=8118
PORT_CRM=8181
# 代码目录,含前后端
CODE_DIR=$CODE_DIR
JAVA_PROFILE=innerdev # java需要根据环境调整
#nacos 客户端轮询间隔
TICK_TIME=30000
EOF
echo '生成.env文件'
cat .env
echo '启动容器,检查端口是否占用'
if ss -t
$COMPOSE_CMD up -d
cat <<EOF
本地访问地址
http://本机ip:8118/
http://本机ip:8181/
安装完成!
EOF
# xxx:1234/
# xxx:3322/
......@@ -182,9 +182,9 @@ server {
location ^~ /subapp/userInfo/ {
proxy_pass http://$HOST:$VUE_USERINFO_PORT/;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-Real-Ip $remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header Host \$host;
proxy_set_header X-Real-Ip \$remote_addr;
proxy_set_header X-Ngnix-Proxy true;
}
......
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