Skip to content

Commit

Permalink
docker: add ci image
Browse files Browse the repository at this point in the history
Signed-off-by: Noah Watkins <[email protected]>
  • Loading branch information
dotnwat committed Oct 27, 2015
1 parent 1cc2f5b commit bc91234
Show file tree
Hide file tree
Showing 4 changed files with 151 additions and 0 deletions.
41 changes: 41 additions & 0 deletions docker/ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
FROM ubuntu:14.04

MAINTAINER Noah Watkins <[email protected]>

RUN apt-get update && apt-get install -y git wget

# install ceph master development branch
RUN wget -q -O- 'https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/autobuild.asc' | sudo apt-key add -
RUN echo deb http://gitbuilder.ceph.com/ceph-deb-$(lsb_release -sc)-x86_64-basic/ref/master $(lsb_release -sc) main | sudo tee /etc/apt/sources.list.d/ceph.list
RUN apt-get update && apt-get install -y --force-yes ceph librados-dev

# install ceph build dependencies and build zlog ceph plugin bits
RUN mkdir /src && cd /src && \
git clone --recursive https://github.com/noahdesu/ceph.git && \
cd ceph && \
git checkout -b cls_zlog origin/cls_zlog && \
bash ./install-deps.sh && \
./autogen.sh && \
./configure && \
cd src && \
make libcls_zlog.la && \
make libcls_zlog_client.la && \
cp .libs/libcls_zlog.so* /usr/lib/rados-classes/ && \
cp .libs/libcls_zlog_client.so* /usr/lib/ && \
cp cls/zlog/cls_zlog_client.h /usr/include/rados/ && \
cd .. && \
make clean

# install zlog
RUN cd /src && \
apt-get install -y libprotobuf-dev protobuf-compiler && \
git clone https://github.com/noahdesu/zlog.git && \
cd zlog && \
autoreconf -ivf && \
./configure && \
make

ADD micro-osd.sh /src/micro-osd.sh
ADD entrypoint.sh /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
9 changes: 9 additions & 0 deletions docker/ci/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
zlog-ci
=======

zlog continuous integration docker image.

Usage
-----

`docker run`
11 changes: 11 additions & 0 deletions docker/ci/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
set -e

# startup a ceph cluster
mkdir /tmp/ceph
bash /src/micro-osd.sh /tmp/ceph

cd /src/zlog/src
export CEPH_CONF=/tmp/ceph/ceph.conf
./zlog-seqr --port 5678 --daemon
./test
90 changes: 90 additions & 0 deletions docker/ci/micro-osd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
#
# Copyright (C) 2013,2014 Loic Dachary <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
set -e
set -u

DIR=$1

#if ! dpkg -l ceph ; then
# wget -q -O- 'https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/release.asc' | sudo apt-key add -
# echo deb http://ceph.com/debian-dumpling/ $(lsb_release -sc) main | sudo tee /etc/apt/sources.list.d/ceph.list
# sudo apt-get update
# sudo apt-get --yes install ceph ceph-common
#fi

# get rid of process and directories leftovers
pkill ceph-mon || true
pkill ceph-osd || true
rm -fr $DIR

# cluster wide parameters
mkdir -p ${DIR}/log
cat >> $DIR/ceph.conf <<EOF
[global]
fsid = $(uuidgen)
osd crush chooseleaf type = 0
run dir = ${DIR}/run
auth cluster required = none
auth service required = none
auth client required = none
osd pool default size = 1
EOF
export CEPH_ARGS="--conf ${DIR}/ceph.conf"

# single monitor
MON_DATA=${DIR}/mon
mkdir -p $MON_DATA

cat >> $DIR/ceph.conf <<EOF
[mon.0]
log file = ${DIR}/log/mon.log
chdir = ""
mon cluster log file = ${DIR}/log/mon-cluster.log
mon data = ${MON_DATA}
mon addr = 127.0.0.1
EOF

ceph-mon --id 0 --mkfs --keyring /dev/null
touch ${MON_DATA}/keyring
ceph-mon --id 0

# single osd
OSD_DATA=${DIR}/osd
mkdir ${OSD_DATA}

cat >> $DIR/ceph.conf <<EOF
[osd.0]
log file = ${DIR}/log/osd.log
chdir = ""
osd data = ${OSD_DATA}
osd journal = ${OSD_DATA}.journal
osd journal size = 100
osd objectstore = memstore
EOF

OSD_ID=$(ceph osd create)
ceph osd crush add osd.${OSD_ID} 1 root=default host=localhost
ceph-osd --id ${OSD_ID} --mkjournal --mkfs
ceph-osd --id ${OSD_ID}

# check that it works
rados --pool rbd put group /etc/group
rados --pool rbd get group ${DIR}/group
diff /etc/group ${DIR}/group
ceph osd tree

export CEPH_CONF="${DIR}/ceph.conf"

0 comments on commit bc91234

Please sign in to comment.