Skip to content

Commit

Permalink
update docker add docker-compose.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
hexj committed Aug 16, 2018
1 parent 0b63add commit 6e58687
Show file tree
Hide file tree
Showing 8 changed files with 173 additions and 188 deletions.
30 changes: 30 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: '3'
services:
mongo:
image: mongo:latest
container_name: mongo
environment:
- TZ=Asia/Shanghai
- MONGO_INITDB_DATABASE=quantaxis
volumes:
- ./data:/data
ports:
- 27017:27017
#--
quantaxis:
build: qa
image: quantaxis:latest
container_name: quantaxis
environment:
- TZ=Asia/Shanghai
- MONGODB=mongo
volumes:
- ./_data_:/data
- ./_notebooks_:/home
ports:
- 8010:8888
- 8888:8888
depends_on:
- mongo
links:
- mongo
18 changes: 0 additions & 18 deletions docker/dockerfile

This file was deleted.

1 change: 0 additions & 1 deletion docker/mongo.sh

This file was deleted.

91 changes: 0 additions & 91 deletions docker/mongo/dockerfile

This file was deleted.

17 changes: 17 additions & 0 deletions docker/qa/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM jupyter/base-notebook
MAINTAINER yutiansut '[email protected]'
MAINTAINER hexj '[email protected]'
USER root
COPY source.list /etc/apt/sources.list
# 修改docker的时区
RUN sudo apt update -y \
&& apt install -y tzdata \
&& cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN sudo apt install -y python3-tk
# RUN pip install pip -U -i https://pypi.doubanio.com/simple
RUN pip install -i https://pypi.doubanio.com/simple --upgrade pip
USER jovyan
RUN pip install -r https://raw.githubusercontent.com/yutiansut/QUANTAXIS/master/requirements.txt -i https://pypi.doubanio.com/simple
RUN pip install tushare pytdx quantaxis

EXPOSE 8888
13 changes: 13 additions & 0 deletions docker/qa/source.list
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
99 changes: 21 additions & 78 deletions docker/readme.md
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,92 +1,35 @@
# 使用Docker建立QUANTAXIS执行环境

<!-- TOC -->

- [使用Docker建立QUANTAXIS执行环境](#使用docker建立quantaxis执行环境)
- [QUANTAXIS的镜像](#quantaxis的镜像)
- [1.获取QUANTAIS镜像](#1获取quantais镜像)
- [1.1 执行以下命令获取镜像(2选1)](#11-执行以下命令获取镜像2选1)
- [1.2 运行镜像](#12-运行镜像)
- [在浏览器中打开以下链接](#在浏览器中打开以下链接)
- [其他注意选项](#其他注意选项)

<!-- /TOC -->


## QUANTAXIS的镜像

quantaxis/quantaxis

## 1.获取QUANTAIS镜像

首先,到[docker网站](https://www.docker.com/)下载相应的版本,并创建账号(注意:登录docker账号才能下载镜像)

(如果国外网站下载速度过慢,windows版本的docker安装文件群共享有)


### 1.1 执行以下命令获取镜像(2选1)


```shell

docker pull quantaxis/quantaxis

docker image for QUANTAXIS: https://github.com/QUANTAXIS/QUANTAXIS

## deployment:
1. start up
```


![执行时的命令行](http://pic.yutiansut.com/QQ%E6%88%AA%E5%9B%BE20171213102629.png)


### 1.2 运行镜像

docker-compose up
```
docker run -it -e GRANT_SUDO=yes --user root -p 8080:8080 quantaxis/quantaxis bash
2. initialization #TODO

jupyter notebook --allow-root
(jupyter notebook 密码是 quantaxis)
```




### 在浏览器中打开以下链接
```angular2html
http://localhost:8888
```


### 其他注意选项

1. docker 是可以通过ssh 连接的 ``` /etc/init.d/ssh start ```
2. 多窗口

首先需要运行一个docker

docker exec -it CONTAINERNAME base
mkdir FOLDER
cd FOLDER
quantaxis
save all
```
A:\quantaxis [master ≡]
λ docker run -it -p 8080:8080 quantaxis/quantaxis bash
root@f22b5357dc6e:/#

## stop/remove container:
```
然后在别的命令行执行 ``` docker ps``` 查询正在运行的docker的container_id
1. docker-compose stop
2. docker-compose rm
```
A:\Users\yutia
λ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f22b5357dc6e quantaxis "bash" 21 seconds ago Up 20 seconds 0.0.0.0:8888->8888/tcp boring_panini

## update:
```
然后执行 ```docker exec -it [CONTAINERID] /bin/bash``` 进入

1. rename the 'image' name for qa service in docker-compose
2. docker-compose up -d
```
A:\Users\yutia
λ docker exec -it f22b5357dc6e /bin/bash
root@f22b5357dc6e:/#

## database backup:
```
1. docker-compose stop
2. ./data/db 为mongo数据文件
./notebooks 为 程序文件
```


92 changes: 92 additions & 0 deletions docker/readme_old.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# 使用Docker建立QUANTAXIS执行环境

<!-- TOC -->

- [使用Docker建立QUANTAXIS执行环境](#使用docker建立quantaxis执行环境)
- [QUANTAXIS的镜像](#quantaxis的镜像)
- [1.获取QUANTAIS镜像](#1获取quantais镜像)
- [1.1 执行以下命令获取镜像(2选1)](#11-执行以下命令获取镜像2选1)
- [1.2 运行镜像](#12-运行镜像)
- [在浏览器中打开以下链接](#在浏览器中打开以下链接)
- [其他注意选项](#其他注意选项)

<!-- /TOC -->


## QUANTAXIS的镜像

quantaxis/quantaxis

## 1.获取QUANTAIS镜像

首先,到[docker网站](https://www.docker.com/)下载相应的版本,并创建账号(注意:登录docker账号才能下载镜像)

(如果国外网站下载速度过慢,windows版本的docker安装文件群共享有)


### 1.1 执行以下命令获取镜像(2选1)


```shell

docker pull quantaxis/quantaxis


```


![执行时的命令行](http://pic.yutiansut.com/QQ%E6%88%AA%E5%9B%BE20171213102629.png)


### 1.2 运行镜像

```
docker run -it -e GRANT_SUDO=yes --user root -p 8080:8080 quantaxis/quantaxis bash
jupyter notebook --allow-root
(jupyter notebook 密码是 quantaxis)
```




### 在浏览器中打开以下链接
```angular2html
http://localhost:8888
```


### 其他注意选项

1. docker 是可以通过ssh 连接的 ``` /etc/init.d/ssh start ```
2. 多窗口

首先需要运行一个docker

```
A:\quantaxis [master ≡]
λ docker run -it -p 8080:8080 quantaxis/quantaxis bash
root@f22b5357dc6e:/#
```
然后在别的命令行执行 ``` docker ps``` 查询正在运行的docker的container_id
```
A:\Users\yutia
λ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f22b5357dc6e quantaxis "bash" 21 seconds ago Up 20 seconds 0.0.0.0:8888->8888/tcp boring_panini
```
然后执行 ```docker exec -it [CONTAINERID] /bin/bash``` 进入

```
A:\Users\yutia
λ docker exec -it f22b5357dc6e /bin/bash
root@f22b5357dc6e:/#
```


0 comments on commit 6e58687

Please sign in to comment.