Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ matrix:
include:
- language: go
go: 1.8.x
script: cd go && go test ./...
script: cd go && bash .tools/gen_config.sh && go test ./...
- language: python
python: 2.7
sudo: required
Expand Down
10 changes: 10 additions & 0 deletions go/.tools/gen_config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#/bin/bash
mkdir -p ~/.paddle
cat > ~/.paddle/config << EOF
datacenters:
- name: datacenter1
username: [email protected]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[email protected] should not exist, use your-user-name instead.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

password: T123
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

T123 have no meaning, use your-secret instead.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

endpoint: http://127.0.0.1:8080
current-datacenter: datacenter1
EOF
7 changes: 7 additions & 0 deletions go/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM ubuntu:16.04
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Dockerfile is used for PFSServer, so we can move this to ./cmd/pfsserver ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

目前还不行,依赖了./tools/gen_config.sh,用来生成配置文件。后续解耦合以后可以放到./cmd/pfsserver下。
我在这里创建了一个ISSUE:#157


ADD .tools /pfsserver/.tools
RUN bash /pfsserver/.tools/gen_config.sh

ADD ./cmd/pfsserver/pfsserver /pfsserver/
RUN mkdir /pfsserver/log
60 changes: 60 additions & 0 deletions go/README_CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
1. 如何构建PFSServer的DockerImage
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a mark, we need to put pfs and pcloud in the same image later.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

- 构建PFSServer的编译环境

```
cd docker
bash build.sh
```

- 编译PFSServer

```
docker run --rm -v $(pwd):/root/gopath/src/github.com/PaddlePaddle/cloud/go pfsserver:dev
```

- 构建PFSServer的DockerImage

```
docker build . -t pfsserver:latest
```
- PFSServer启动命令

```
docker run pfsserver:latest /pfsserver/pfsserver -tokenuri http://cloud.paddlepaddle.org -logtostderr=false -log_dir=./log -v=3
```

2. 如何部署PFSServer

```
cd ../k8s
kuberctl create -f cloud_pfsserver.yaml
```

3. 如何使用PFSClient
- cp

```
upload:
paddlecloud cp ./file /pfs/$DATACENTER/home/$USER/file

download:
paddlecloud cp /pfs/$DATACENTER/home/$USER/file ./file
```
- ls

```
paddlecloud ls /pfs/$DATACENTER/home/$USER/folder
```

- rm

```
paddlecloud rm /pfs/$DATACENTER/home/$USER/file
paddlecloud rm -r /pfs/$DATACENTER/home/$USER/folder
```

- mkdir

```
paddlecloud mkdir /pfs/$DATACENTER/home/$USER/folder
```
17 changes: 17 additions & 0 deletions go/docker/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
cat > ./Dockerfile << EOF
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can use golang:1.8 as the base Docker image so that it will reduce the Image size.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

golang:1.8最小的257M,这个只有125M。

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, but you should wget golang.tar.gz if you use ubuntu as the base image. and we also need VPN so that we can download the tar file from storage.googleapis.com.

Copy link
Collaborator Author

@gongweibao gongweibao Jun 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

编译环境和运行环境是分开的。运行环境不需要wget任何东西。
编译环境很长时间才需要构建一次。

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having both go/docker/ and docker/ seems confusing, move to the same direcotry or use docker/build_docker.sh.

FROM ubuntu:16.04

RUN apt-get update && \
apt-get install -y wget git && \
wget -O go.tgz https://storage.googleapis.com/golang/go1.8.1.linux-amd64.tar.gz && \
tar -C /usr/local -xzf go.tgz && \
mkdir /root/gopath && \
rm go.tgz

ENV GOROOT=/usr/local/go GOPATH=/root/gopath
ENV PATH=${PATH}:${GOROOT}/bin

CMD ["sh", "-c", "cd /root/gopath/src/github.com/PaddlePaddle/cloud/go/cmd/pfsserver && go get ./... && go build"]
EOF

docker build . -t pfsserver:dev
1 change: 1 addition & 0 deletions k8s/cloud_ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ spec:
backend:
serviceName: paddle-cloud-service
servicePort: 8000

19 changes: 19 additions & 0 deletions k8s/pfs_app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: pfsserver
namespace: pfs
spec:
replicas: 1
template:
metadata:
labels:
app: pfsserver
spec:
containers:
- name: pfs
imagePullPolicy: Always
image: gongweibao/pfsserver:latest
ports:
- containerPort: 8080
command: ["/pfsserver/pfsserver", "-tokenuri", "http://paddle-cloud-service", "-alsologtostderr=true", "-log_dir=./log", "-v=3"]
19 changes: 19 additions & 0 deletions k8s/pfs_ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: extensions/v1beta1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ingress 和python django部分现在可以完成分发了么?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

kind: Ingress
metadata:
name: pfs-ingress
namespace: pfs
spec:
tls:
- hosts:
- pfs.paddlpaddle.org
secretName: pfs-secret
rules:
- host: pfs.paddlepaddle.org
http:
paths:
- backend:
serviceName: pfs-service
servicePort: 8080
path: /

13 changes: 13 additions & 0 deletions k8s/pfs_svc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
kind: Service
apiVersion: v1
metadata:
name: pfs-service
namespace: pfs
spec:
selector:
app: pfsserver
ports:
- protocol: TCP
port: 8080
targetPort: 8080
type: NodePort