Skip to content

Commit

Permalink
Merge pull request #8 from crawlab-team/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
tikazyq authored Sep 19, 2019
2 parents 9b90d97 + 48dbb07 commit 692fb8f
Show file tree
Hide file tree
Showing 20 changed files with 463 additions and 156 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ yarn.lock
.DS_Store
package-lock.json
.umi/
dist/
17 changes: 16 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
FROM jelastic/nodejs:8.16.1-npm AS frontend

WORKDIR /app
ADD . /app
RUN npm install
RUN npm run build

FROM jelastic/nodejs:8.16.1-npm

COPY . /app
WORKDIR /app
ADD . /app
COPY --from=frontend /app/dist /frontend
RUN cp ./backend/package.json .
RUN npm install --registry=https://registry.npm.taobao.org
RUN yum install -y nginx
RUN cp /app/nginx/artipub.conf /etc/nginx/conf.d

CMD /app/docker_init.sh
18 changes: 18 additions & 0 deletions Dockerfile-local
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM jelastic/nodejs:8.16.1-npm AS frontend

WORKDIR /app
ADD . /app
RUN npm install --registry=https://registry.npm.taobao.org
RUN npm run build

FROM jelastic/nodejs:8.16.1-npm

WORKDIR /app
ADD . /app
COPY --from=frontend /app/dist /frontend
RUN cp ./backend/package.json .
RUN npm install --registry=https://registry.npm.taobao.org
RUN yum install -y nginx
RUN cp /app/nginx/artipub.conf /etc/nginx/conf.d

CMD /app/docker_init.sh
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,20 @@ ArtiPub提供3种安装方式如下。

### 通过Docker安装

通过Docker,可以免去
通过Docker,可以免去安装MongoDB的步骤,也是我们最推荐的安装方式。

**安装Docker Compose**

```bash
docker-compose
docker-compose up
```

就这一行命令,然后在浏览器中输入`http://localhost:8000`可以看到界面。

### 通过npm包安装

如果您对npm熟悉,且已经有MongoDB的环境,这是最为快捷的方式。

**安装npm包**

```bash
Expand Down
3 changes: 2 additions & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"description": "",
"main": "server.js",
"scripts": {
"start": "node server.js"
"start": "node server.js",
"start:backend": "node server.js"
},
"author": "",
"license": "ISC",
Expand Down
2 changes: 1 addition & 1 deletion config/defaultSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default {
menu: {
locale: true,
},
title: 'ArtiPub v0.1.0',
title: 'ArtiPub v0.1.2',
pwa: false,
iconfontUrl: '',
} as DefaultSettings;
23 changes: 12 additions & 11 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
version: '3.3'
services:
master:
app:
image: "tikazyq/artipub:latest"
environment:
CRAWLAB_API_ADDRESS: "192.168.99.100:8000"
CRAWLAB_SERVER_MASTER: "Y"
CRAWLAB_MONGO_HOST: "192.168.99.1"
CRAWLAB_REDIS_ADDRESS: "192.168.99.1"
CRAWLAB_LOG_PATH: "/var/logs/crawlab"
ports:
- "8080:8080" # frontend
- "8000:8000" # backend
volumes:
- "/Users/yeqing/projects/artipub/spiders:/app/spiders"
MONGO_HOST: "mongo"
ports:
- "8000:8000" # frontend
- "3000:3000" # backend
depends_on:
- mongo
mongo:
image: mongo:latest
restart: always
ports:
- "27017:27017"
17 changes: 17 additions & 0 deletions docker_init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

# replace original url to new one
if [ "${ARTIPUB_API_ADDRESS}" = "" ];
then
:
else
jspath=`ls /frontend/umi.*.js`
sed -i "s?localhost:3000?${ARTIPUB_API_ADDRESS}?g" ${jspath}
fi

# start frontend
nginx -s stop | true
nginx

# start backend
npm run start:backend
Loading

0 comments on commit 692fb8f

Please sign in to comment.