Merge branch 'master' into qinzongyue

This commit is contained in:
ZongyueQin 2018-08-09 17:06:23 +08:00
commit 6399eda54a
8 changed files with 23 additions and 36 deletions

View File

@ -18,7 +18,7 @@ int main(int argc, char * argv[])
// build a new database by a RDF file.
// note that the relative path is related to gserver.
gc.build("LUBM10", "data/LUBM_10.n3");
gc.build("LUBM10", "data/lubm/lubm.nt");
gc.load("LUBM10");
// then you can execute SPARQL query on this database.

View File

@ -17,7 +17,7 @@ public class JavaAPIExample
// build a new database by a RDF file.
// note that the relative path is related to gserver.
gc.build("LUBM10", "data/LUBM_10.n3");
gc.build("LUBM10", "data/lubm/lubm.nt");
gc.load("LUBM10");
// then you can execute SPARQL query on this database.

View File

@ -3,7 +3,7 @@ require 'GstoreConnector.php';
$host = '127.0.0.1';
$port = 3305;
$dbname = "LUBM10";
$dbpath = "./data/LUBM_10.n3";
$dbpath = "./data/lubm/lubm.nt";
$query1 = "select ?x where
{
?x <ub:name> <FullProfessor0>.

View File

@ -8,7 +8,7 @@ from GstoreConnector import GstoreConnector
if __name__ == '__main__':
gc = GstoreConnector('127.0.0.1', 3305)
gc.build('LUBM10', 'data/LUBM_10.n3')
gc.build('LUBM10', 'data/lubm/lubm.nt')
gc.load('LUBM10')
sparql = '''select ?x where {

View File

@ -5,7 +5,7 @@ from GstoreConnector import GstoreConnector
if __name__ == '__main__':
gc = GstoreConnector('127.0.0.1', 3305)
gc.build('LUBM10', 'data/LUBM_10.n3')
gc.build('LUBM10', 'data/lubm/lubm.nt')
gc.load('LUBM10')
sparql = '''select ?x where {

View File

@ -17,6 +17,7 @@ openjdk | needed if using Java api
openjdk-devel | needed if using Java api
realpath | needed if using gconsole
ccache | optional, used to speed up the compilation
libcurl-devel | needed to be installed
NOTICE:

View File

@ -4,41 +4,33 @@
> 简单说我们提供两种方式通过容器部署gStore
>
> 一种是通过项目根目录的Dockerfile文件自主构建然后运行容器自动编译(make).
> 一种是通过项目根目录的Dockerfile文件自主构建然后运行容器.
>
> 另一种是直接下载已经构建完成的镜像,然后直接运行.
> 另一种是直接下载已经自动构建完成的镜像,然后直接运行.
## 0x00.环境准备
关于安装使用Docker官方针对常见Linux发行版文档已经写得很详细就直接给出参考地址[英文文档](https://docs.docker.com/install/linux/docker-ce/ubuntu/)[中文文档](https://docs.docker-cn.com/engine/installation/linux/docker-ce/centos/#%E5%85%88%E5%86%B3%E6%9D%A1%E4%BB%B6) 。
需要注意的是Docker版本过高可能导致一些问题建议仔细阅读注意事项。当前测试环境版本是<u>Docker CE 17.04</u>
需要注意的是Docker版本过高可能导致一些问题建议仔细阅读注意事项。当前测试环境版本是<u>Docker CE 17.06.1</u>
## 0x01.通过Dockerfile构建镜像
假设已经拥有正常的Docker环境跟网络后首先通过`git clone ` 下载项目,然后进入项目根目录,**修改**根目录的makefile文件的`CC = ccache g++` (*建议官方改回这个默认*)输入命令`docker build -t gstore .` 即可开始构建默认使用根目录的Dockerfile关于具体说明Dockerfile文件内也有补充。
假设已经拥有正常的Docker环境跟网络后首先通过`git clone ` 下载项目,然后进入项目根目录,输入命令`docker build -t gstore .` 即可开始构建默认使用根目录的Dockerfile关于具体说明Dockerfile文件内也有补充。
构建完成后,直接通过`docker run -it gstore` 即可进入容器自动触发make进行编译。完成后即可执行其他操作,后续待文档完善之所以未将make并入构建过程是因为触发了异常
构建完成后,直接通过`docker run -it gstore` 即可进入容器执行其他操作。
## 0x02.直接拉取镜像运行
无需下载项目或自己构建,直接输入`docker pull imbajin/test:gs` 拉取已经通过Dockerfile构建完成的镜像但是没有执行make 。拉取完成后 `docker run -it imbajin/test:gs ` 即可进入编译耗时大概要5~10分钟。您可以给容器添加别名以便方面使用
另外提供一个可选的版本是`docker pull imbajin/test:gsmake` 这个镜像保护make完成后的状态拉取完成后可开箱即用。是未来的理想状态但是尚未具体测试仅供参考。
*<u>补:目前仓库地址为个人维护,后续应会移交团队自行维护(包括自动构建) </u>*
无需下载项目或自己构建,直接输入`docker pull suxunbin/auto_gstore:latest` 拉取已经在docker hub上自动构建完成的镜像。拉取完成后 `docker run -it suxunbin/auto_gstore:latest ` 即可直接进入容器使用。
## 0x03.存在的问题
因为容器化伴随着一些不确定的影响,包括不限于网络,锁,缓存,权限等问题,遇到调试起来很难定位,已知可能存在以下问题:(宿主机是Centos7.4)
1. 如果在容器内直接执行make命令最后执行testall脚本会写满临时空间导致中断具体原因排查中
1. 在Dockerfile的构建过程中如果添加环境`ENV CC="ccache g++" ` 会导致编译错误,原因未知且可能影响镜像缓存层,导致之后构建反复报错。。
2. 通过Dockerfile关联Dockerhub自动构建时出现了奇怪的tar命令报错[详见地址](https://hub.docker.com/r/imbajin/docker/builds/b3rwguoffywc6equeajyg7g/)末尾。(原因也待查)
3. 在Dockerfile的构建过程中如果添加环境`ENV CC="ccache g++" ` 会导致编译错误,原因未知且可能影响镜像缓存层,导致之后构建反复报错。。
4. 通过docker run启动容器后可能出现启动后即自动关闭的情况。
2. 通过docker run启动容器后可能出现启动后即自动关闭的情况。
@ -50,7 +42,7 @@
#### B.连接其他容器测试
文档也待后续补充更新,因为目前也是抽空做的
文档也待后续补充更新
#### C.构建精简优化

View File

@ -4,38 +4,32 @@
>Roughly speaking, there are two ways to deploy gStore via Docker.
>
>The first one is using Dockerfile file in the root directory of project to automatically build it. And then run the container to compile automatically(make).
>The first one is using Dockerfile file in the root directory of project to automatically build it. And then run the container.
>
>Another one is downloading the mirror which has been built directly, then just run it.
>Another one is downloading the mirror which has been automatically built directly, then just run it.
## 0x00. prepare the environment
Official doc of Docker has explained how to download and use it on common Liunx release version in details. And here is the link: [English doc](https://docs.docker.com/install/linux/docker-ce/ubuntu/), [中文文档](https://docs.docker-cn.com/engine/installation/linux/docker-ce/centos/#%E5%85%88%E5%86%B3%E6%9D%A1%E4%BB%B6)
It's worth noting that the Docker with too high version may lead to some problems. Please read the precautions carefully. The current version of test environment is <u>Docker CE 17.04</u>
It's worth noting that the Docker with too high version may lead to some problems. Please read the precautions carefully. The current version of test environment is <u>Docker CE 17.06.1</u>
## 0x01. Build the mirror via Dockerfile
After having the correct Docker environment and network, use `git clone` to download the project firstly. Then enter the root directory and modify the `CC = gcc`(official setting) into `CC = ccache g++` in the makefile file. After inputting command `docker build -t gstore` it's available to start building. In the default case, it will use the Dockerfile in the root directory. More specific explanation has been written in the Dockerfile.
After having the correct Docker environment and network, use `git clone` to download the project firstly. After inputting command `docker build -t gstore` it's available to start building. In the default case, it will use the Dockerfile in the root directory. More specific explanation has been written in the Dockerfile.
After the building, using `docker run -it gstore` directly to enter the container. It will trigger make to compile automatically. Other operation can be executed after finishing all the procedure shown above. The subsequent document is waiting for completing. (The reason why we didn't merge the make to the building process is that it will trigger exception)
After the building, using `docker run -it gstore` directly to enter the container and execute other operations.
## 0x02. pulling the mirror directly to run
Instead of downloading project or building on your own, input `docker pull imbajin/test:gs` to pull the mirror which has been built well by the Dockerfile. But the make hasn't been executed yet. Then input `docker run -it imbajin/test:gs` to compile, which will cost 5 to 10 minutes or so. (You could add alias to the container in the sake of convenience)
Another optional version we provided is `docker pull imbajin/test:gsmake` . This mirror will protect the status after the completion of make, which is out of box after your pulling. It's a ideal one and its still waiting for test(just for reference).
*PS: The repository is personally maintained now, it will be handed over to the team to maintain later(including automatic build)*
Instead of downloading project or building on your own, input `docker pull suxunbin/auto_gstore:latest` to pull the mirror which has been automatically built well on the docker hub. Then input `docker run -it suxunbin/auto_gstore:latest` to enter the container and execute other operations.
## 0x03. Problems that exist
Owing to the uncertain influence accompanying the containerization, including but not limited to some problems about network, lock, caching, rights and so on, it's quite difficult to locate the problem when debugging. It has been known that the following problems may exist: (The host is Centos 7.4)
1. If execute the make command directly in the container straightforward, the last execution of the testall script will fill up the temporary space, resulting in interruption. (The specific reason is being investigated)
2. Strange tar command error occurred when associating Dockerhub automatic building via Dockerfile. See this [address](https://hub.docker.com/r/imbajin/docker/builds/b3rwguoffywc6equeajyg7g/)(reason is waiting for investigation)
3. If add the environment `ENV CC="ccache g++"` in the process of Dockerfile building, it will lead to compile error. The reason is still unknown and it may affect the mirror cache layer, which results in repeated errors in the later process of building.
4. The case of shutdown automatically as soon as its reboot may occur after starting the container via docker run.
1. If add the environment `ENV CC="ccache g++"` in the process of Dockerfile building, it will lead to compile error. The reason is still unknown and it may affect the mirror cache layer, which results in repeated errors in the later process of building.
2. The case of shutdown automatically as soon as its reboot may occur after starting the container via docker run.
## 0x04. Follow-up