Skip to content

Commit

Permalink
feat(docs): add docs to gateway deploy;
Browse files Browse the repository at this point in the history
  • Loading branch information
maslow committed Nov 19, 2021
1 parent cbb8a5a commit 54e4ce4
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 23 deletions.
35 changes: 18 additions & 17 deletions deploy-scripts/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version: '3.8'
services:
services:
mongo:
image: bitnami/mongodb:5.0
environment:
environment:
- MONGODB_REPLICA_SET_MODE=primary
- MONGODB_INITIAL_PRIMARY_HOST=mongo
- MONGODB_ADVERTISED_HOSTNAME=mongo
Expand All @@ -17,14 +17,14 @@ services:
- db-data:/bitnami/mongodb
ports:
- "27017:27017"
networks:
networks:
- laf_shared_network

system_server:
image: lafyun/system-server:latest
user: root
working_dir: /app
environment:
environment:
SYS_DB_URI: mongodb://${SYS_DB_USER}:${SYS_DB_PASSWORD}@mongo:27017/?authSource=${SYS_DB}&replicaSet=laf&writeConcern=majority
APP_DB_URI: mongodb://root:${MONGODB_ROOT_PASSWORD}@mongo:27017/?authSource=admin&replicaSet=laf&writeConcern=majority
SYS_SERVER_SECRET_SALT: ${SYS_SERVER_SECRET_SALT}
Expand All @@ -40,36 +40,37 @@ services:
volumes:
- /var/run/docker.sock:/var/run/docker.sock
read_only: true
depends_on:
depends_on:
- mongo
cap_drop:
cap_drop:
- ALL
tmpfs:
tmpfs:
- /tmp
restart: always
networks:
networks:
- laf_shared_network

gateway:
image: lafyun/gateway:latest
depends_on:
depends_on:
- system_server
- mongo
environment:
DEPLOY_DOMAIN: "*.${DEPLOY_DOMAIN:?err}"
SYS_CLIENT_HOST: ${SYS_CLIENT_HOST:?err}
environment:
DEPLOY_DOMAIN: "*.${DEPLOY_DOMAIN:?err}"
SYS_CLIENT_HOST: ${SYS_CLIENT_HOST:?err}
DOCS_HOST: "docs.${DEPLOY_DOMAIN:?err}"
command: "sh /scripts/start.sh"
ports:
ports:
- ${PUBLISH_PORT:-8080}:80
networks:
networks:
- laf_shared_network

storage_service:
image: lafyun/storage-service:latest
user: root
working_dir: /app
environment:
DB_URI : mongodb://root:${MONGODB_ROOT_PASSWORD}@mongo:27017/laf_fs?authSource=admin&replicaSet=laf&writeConcern=majority
DB_URI: mongodb://root:${MONGODB_ROOT_PASSWORD}@mongo:27017/laf_fs?authSource=admin&replicaSet=laf&writeConcern=majority
LOG_LEVEL: ${LOG_LEVEL:-debug}
SERVER_SECRET_SALT: ${SYS_SERVER_SECRET_SALT}
command: dockerize -wait tcp://mongo:27017 node dist/index.js
Expand All @@ -86,6 +87,6 @@ services:
networks:
laf_shared_network:
external: true

volumes:
db-data:
db-data: null
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@ services:
environment:
DEPLOY_DOMAIN: "*.local-dev.host" # `*.local-dev.host` always resolved to 127.0.0.1, used to local development
SYS_CLIENT_HOST: console.local-dev.host
DOCS_HOST: docs.local-dev.host
volumes:
- ./packages/gateway/scripts:/scripts
- ./packages/system-client/dist:/app
- ./docs/.vitepress/dist:/docs
- ./packages/gateway/app.conf:/etc/nginx/templates/app.conf.template
- ./packages/gateway/system.conf:/etc/nginx/templates/system.conf.template
command: "sh /scripts/start.sh"
Expand Down
8 changes: 4 additions & 4 deletions docs/deploy/quick.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ sidebar: false

> 本例只给出 CentOS 下的安装脚本,若安装其它环境请参考官方文档 https://docs.docker.com/engine/install/
```sh
```shell
sudo yum install -y yum-utils
sudo yum-config-manager \
--add-repo \
Expand All @@ -26,7 +26,7 @@ sudo systemctl start docker
##### 启动服务

```sh
```shell
git clone https://github.com/Maslow/laf.git
cd laf/deploy-scripts

Expand All @@ -39,7 +39,7 @@ docker-compose up

##### 停止服务

```sh
```shell
# 停止服务
docker-compose down

Expand All @@ -49,7 +49,7 @@ docker-compose down -v

##### 更新服务镜像

```sh
```shell
# 更新镜像
docker-compose pull
```
2 changes: 1 addition & 1 deletion docs/guide/db/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ title: 云数据库简介

在前端项目中安装 laf-client-sdk sdk:

```sh
```shell
npm install laf-client-sdk
```

Expand Down
1 change: 1 addition & 0 deletions packages/gateway/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docs
1 change: 1 addition & 0 deletions packages/gateway/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ ADD ./app.conf /etc/nginx/templates/app.conf.template
ADD ./scripts /scripts

ADD ./dist /app/
ADD ./docs /docs/

CMD [ "sh", "/scripts/start.sh" ]
1 change: 1 addition & 0 deletions packages/gateway/copy-doc.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2021年11月19日 星期五 08时17分00秒 CST
2 changes: 2 additions & 0 deletions packages/gateway/copy-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
rm -rf docs
cp -r ../../docs/.vitepress/dist docs
5 changes: 4 additions & 1 deletion packages/gateway/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"description": "",
"main": "index.js",
"private": true,
"scripts": {},
"scripts": {
"copy-docs": "sh copy-docs.sh",
"build": "vitepress build ../../docs && npm run copy-docs"
},
"author": "Maslow(wangfugen@126.com)"
}
13 changes: 13 additions & 0 deletions packages/gateway/system.conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,16 @@ server {
proxy_read_timeout 600s;
}
}


# for docs
server {
listen 80;
server_name localhost ${DOCS_HOST};
client_max_body_size 0;

root /docs;
location / {
index index.html index.htm;
}
}

0 comments on commit 54e4ce4

Please sign in to comment.