This project puts Cayley in scratch docker container. It is available on Docker Hub and can be pulled using the following command.
docker pull alectolytic/cayley
You will note that this is a tiny image.
$ docker images | grep docker.io/alectolytic/cayley
docker.io/alectolytic/cayley latest 9f8c078ba15a 17 minutes ago 13.34 MB
In this example we deploy cayley with data persisted via a data container and mongo db or PostgreSQL as a backend.
# create data storage container
docker create -v /data -v /data/db -v /log --name cayley-data tianon/true
# start database container
docker run -d --volumes-from cayley-data --name cayley-mongo mongo
# initialize database
docker run --rm -it --name cayley \
--volumes-from cayley-data \
--link cayley-mongo:mongo \
alectolytic/cayley init \
-db="mongo" -dbpath="mongo:27017"
# start cayley as required
docker run -d --name cayley -p 64210:64210 \
--volumes-from cayley-data \
--link cayley-mongo:mongo \
alectolytic/cayley http -host="0.0.0.0" \
-db="mongo" -dbpath="mongo:27017"
# create data storage container
docker create -v /data -v /data/db -v /log --name cayley-data tianon/true
# start database container
docker run -d --name cayley-postgres -e POSTGRES_PASSWORD=cayley --volumes-from cayley-data postgres
# initialize database
docker run --rm -it --name cayley \
--link cayley-postgres:postgres \
--volumes-from cayley-data \
alectolytic/cayley init -db=sql \
-dbpath="postgres://postgres:cayley@postgres:5432/?sslmode=disable"
# start cayley as required
docker run -d --name cayley -p 64210:64210 \
--link cayley-postgres:postgres \
--volumes-from cayley-data \
alectolytic/cayley http -host="0.0.0.0" -db=sql \
-dbpath="postgres://postgres:cayley@postgres:5432/?sslmode=disable"
You can start or stop cayley using the following command.
# Starting
docker start cayley-[mongo|postgres] cayley
# stopping
docker stop cayley cayley-[mongo|postgres]
You can access data from the data container using any container of your choice.
# using alpine (tiny busybox)
docker run --rm -it --volumes-from cayley-data alpine sh
# using fedora
docker run --rm -it --volumes-from cayley-data fedora:latest bash
make
docker run --rm -it alectolytic/cayley -help
docker run -d -name cayley -p 64210:64210 \
-v /path/to/cayley.cfg:/cayley.cfg \
alectolytic/cayley http -config="/cayley.cfg"
# start mongo container
docker run -d --name cayley-mongo mongo
# start cayley
docker run -d -name cayley -p 64210:64210 \
--link cayley-mongo:mongo \
alectolytic/cayley http -host="0.0.0.0" \
-db="mongo" -dbpath="mongo:27017"
docker run --rm -it -p 64210:64210 \
-v /path/to/data:/data \
alectolytic/cayley http -host="0.0.0.0" \
-db="memstore" -dbpath="/data/30kmoviedata.nq" -logtostderr=true