diff --git a/.gitignore b/.gitignore index 47e4cd1..a63f53d 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .build-docker +*.swp diff --git a/.travis.yml b/.travis.yml index 2e72923..b55bc84 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,27 +1,18 @@ -dist: trusty sudo: required - -language: go +services: + - docker branches: except: - gh-pages -matrix: - include: - - env: CEPH_RELEASE=jewel - - env: CEPH_RELEASE=kraken +#matrix: +# include: +# - env: CEPH_RELEASE=jewel +# - env: CEPH_RELEASE=kraken before_install: - - sudo apt-get update - - ci/before_install.sh - - bash ci/micro-osd.sh /tmp/micro-ceph - - export CEPH_CONF=/tmp/micro-ceph/ceph.conf - - ceph status + - docker build -t ceph-golang-ci . script: - - go get -t -v ./... - - go list ./... - - go test -v $(go list ./... | grep -v cephfs) - - go fmt ./... - - go vet ./... + - docker run --rm -it -v ${PWD}:/go/src/github.com/ceph/go-ceph:z ceph-golang-ci diff --git a/Dockerfile b/Dockerfile index f0201aa..6061160 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,26 +1,26 @@ -FROM golang:1.7.1 -MAINTAINER Abhishek Lekshmanan "abhishek.lekshmanan@gmail.com" +FROM ubuntu:xenial -ENV CEPH_VERSION jewel +RUN apt-get update && apt-get install -y \ + apt-transport-https \ + git \ + golang-go \ + software-properties-common \ + uuid-runtime \ + wget -RUN echo deb http://download.ceph.com/debian-$CEPH_VERSION/ jessie main | tee /etc/apt/sources.list.d/ceph-$CEPH_VERSION.list +RUN wget -q -O- 'https://download.ceph.com/keys/release.asc' | apt-key add - +RUN apt-add-repository 'deb https://download.ceph.com/debian-luminous/ xenial main' -# Running wget with no certificate checks, alternatively ssl-cert package should be installed -RUN wget --no-check-certificate -q -O- 'https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/release.asc' | apt-key add - \ - && apt-get update \ - && apt-get install -y --no-install-recommends \ - ceph \ - ceph-mds \ - librados-dev \ - librbd-dev \ - libcephfs-dev \ - uuid-runtime \ - && rm -rf /var/lib/apt/lists/* \ - && apt-get clean +RUN apt-get update && apt-get install -y \ + ceph \ + libcephfs-dev \ + librados-dev \ + librbd-dev +ENV GOPATH /go +WORKDIR /go/src/github.com/ceph/go-ceph VOLUME /go/src/github.com/ceph/go-ceph -COPY ./ci/entrypoint.sh /tmp/entrypoint.sh - -ENTRYPOINT ["/tmp/entrypoint.sh", "/tmp/micro-ceph"] - +COPY micro-osd.sh / +COPY entrypoint.sh / +ENTRYPOINT /entrypoint.sh diff --git a/README.md b/README.md index c773281..6298c9f 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,16 @@ delete a pool with the given name. The following will delete the pool named conn.DeletePool("new_pool") ``` +# Development + +``` +docker run --rm -it --net=host + -v ${PWD}:/go/src/github.com/ceph/go-ceph:z + -v /home/nwatkins/src/ceph/build:/home/nwatkins/src/ceph/build:z + -e CEPH_CONF=/home/nwatkins/src/ceph/build/ceph.conf + ceph-golang +``` + ## Contributing Contributions are welcome & greatly appreciated, every little bit helps. Make code changes via Github pull requests: diff --git a/ci/before_install.sh b/ci/before_install.sh deleted file mode 100755 index 1823499..0000000 --- a/ci/before_install.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -set -e -set -x - -sudo apt-get install -y python-virtualenv - -# ceph-deploy and ceph - -WORKDIR=$HOME/workdir -mkdir $WORKDIR -pushd $WORKDIR - -ssh-keygen -f $HOME/.ssh/id_rsa -t rsa -N '' -cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys -chmod 600 ~/.ssh/authorized_keys - -git clone git://github.com/ceph/ceph-deploy -pushd ceph-deploy -./bootstrap -./ceph-deploy install --release ${CEPH_RELEASE} `hostname` -./ceph-deploy pkg --install librados-dev `hostname` -./ceph-deploy pkg --install librbd-dev `hostname` -./ceph-deploy pkg --install libcephfs-dev `hostname` -popd # ceph-deploy - -popd # workdir diff --git a/ci/entrypoint.sh b/ci/entrypoint.sh deleted file mode 100755 index 59f604b..0000000 --- a/ci/entrypoint.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2013,2014 Loic Dachary -# -# 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 . -# -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 <> $DIR/ceph.conf <> $DIR/ceph.conf <> $DIR/ceph.conf < -# -# 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 . -# -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 <> $DIR/ceph.conf <> $DIR/ceph.conf <> $DIR/ceph.conf < /dev/null; then - break - fi - fi - sleep 1 -done - -# 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 diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..4d207fb --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +set -e + +mkdir /tmp/ceph +/micro-osd.sh /tmp/ceph +export CEPH_CONF=/tmp/ceph/ceph.conf + +go vet ./... +go get -t -v ./... +go list ./... +go test -v $(go list ./... | grep -v cephfs) diff --git a/micro-osd.sh b/micro-osd.sh new file mode 100755 index 0000000..6a80998 --- /dev/null +++ b/micro-osd.sh @@ -0,0 +1,87 @@ +# +# Copyright (C) 2013,2014 Loic Dachary +# +# 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 . +# +set -e +set -x +set -u + +DIR=${1} + +# reset +pkill ceph || true +rm -rf ${DIR}/* +LOG_DIR=${DIR}/log +MON_DATA=${DIR}/mon +OSD_DATA=${DIR}/osd +mkdir ${LOG_DIR} ${MON_DATA} ${OSD_DATA} + +# cluster wide parameters +cat >> ${DIR}/ceph.conf <