Skip to content

hiroshi/foundationdb-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

foundationdb-docker

A Dockerfile of FoundationDB.

How to build docker image

You can find pre-built images at https://hub.docker.com/r/hiroshi3110/foundationdb/, but you should not trust those image ;-)

git clone https://github.com/hiroshi/foundationdb-docker.git
make build IMAGE=you/foundationdb:5.1.5-1_ubuntu-16.04

Docker

Start a FoundationDB server in a docker container.

$ docker run --init --rm --name=fdb-0 -v fdb-0:/var/lib/foundationdb hiroshi3110/foundationdb:5.1.5-1_ubuntu-16.04 ./start.sh

If /var/lib/foundationdb/data/4500 directory is empty, it will configure new cluster.

Join a server to the cluster

$ docker run --init --rm --name=fdb-1 -v fdb-1:/var/lib/foundationdb hiroshi3110/foundationdb:5.1.5-1_ubuntu-16.04 ./start.sh $(docker exec fdb-0 cat /var/lib/foundationdb/fdb.cluster)

Open a fdbcli session

You can run fdbcli on any server containers,

$ docker exec -ti fdb-0 fdbcli -C /var/lib/foundationdb/fdb.cluster

or run as a new container.

docker run -ti --rm -v fdb-0:/etc/foundationdb hiroshi3110/foundationdb:5.1.5-1_ubuntu-16.04 fdbcli

Kubernetes

A sample StatefulSet configuration.

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: foundationdb
spec:
  selector:
    matchLabels:
      app: foundationdb
  serviceName: foundationdb
  template:
    metadata:
      labels:
        app: foundationdb
    spec:
      initContainers:
      - name: copy-fdb-cluster
        image: google/cloud-sdk
        command: ["sh", "-c", "if [ $HOSTNAME != foundationdb-0 ]; then kubectl exec foundationdb-0 cat /var/lib/foundationdb/fdb.cluster | tee /fdb/fdb.cluster; fi"]
        volumeMounts:
        - name: var-lib-fdb
          mountPath: "/fdb"
      containers:
      - name: foundationdb
        image: hiroshi3110/foundationdb:5.1.5-1_ubuntu-16.04
        imagePullPolicy: Always
        command: ["/root/tini"]
        args: ["--", "/root/start.sh"]
        ports:
        - containerPort: 4500
          name: fdb
        volumeMounts:
        - name: var-lib-fdb
          mountPath: "/var/lib/foundationdb"
      volumes:
      - name: var-lib-fdb
        emptyDir: {}

To put /etc/foundationdb/fdb.cluster in your own pod, initContainer like this may help.

      initContainers:
      - name: copy-fdb-cluster
        image: google/cloud-sdk
        command: ["sh", "-c", "kubectl exec foundationdb-0 cat /var/lib/foundationdb/fdb.cluster > /fdb/fdb.cluster"]
        volumeMounts:
        - name: fdb-cluster
          mountPath: "/fdb"
      containers:
        ...
        volumeMounts:
        - name: fdb-cluster
          mountPath: "/etc/foundationdb/fdb.cluster"
          subPath: "fdb.cluster"
      volumes:
      - name: fdb-cluster
        emptyDir: {}

About

A docker file for running FoundationDB server and client

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published