Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docker package testing infrastructure #1311

Open
wants to merge 1 commit into
base: 2.1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
31 changes: 31 additions & 0 deletions riak_test/docker/Dockerfile.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM centos:centos6
MAINTAINER Shunichi Shinohara <shino@basho.com>

RUN yum install -y tar
RUN yum install -y epel-release
RUN yum install -y s3cmd
# RUN apt-get install -qq logrotate sudo python-pip
# RUN pip install s3cmd

ADD @@RIAK_PKG@@ /
ADD @@ST_PKG@@ /
ADD @@CS_PKG@@ /

RUN rpm -ivh @@RIAK_PKG@@
RUN rpm -ivh @@ST_PKG@@
RUN rpm -ivh @@CS_PKG@@

COPY riak.conf /etc/riak/riak.conf
COPY riak.advanced.config /etc/riak/advanced.config
COPY stanchion.conf /etc/stanchion/stanchion.conf
COPY stanchion.advanced.config /etc/stanchion/advanced.config
COPY riak-cs.conf /etc/riak-cs/riak-cs.conf
COPY riak-cs.advanced.config /etc/riak-cs/advanced.config

COPY local.s3cfg /.s3cfg
COPY confirm.sh /root/confirm.sh
RUN chmod 755 /root/confirm.sh

RUN riak version
RUN stanchion version
RUN riak-cs version
25 changes: 25 additions & 0 deletions riak_test/docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Test release packages

This directory contains some configuration file templates and a Dockerfile template which
will enable you to construct a Docker container to test riak_cs release packages on various
operating system flavors.

Currently the Dockerfile builds an image based on centos6

## Prequisites

- docker properly installed and ready
- Riak EE, Riak CS EE and Stanchion RPM packages

## Usage

Make sure the rpm files are in this directory. Docker assumes you have root, which
is why the test script uses sudo. Make sure your user id has sufficient permissions
in the sudoers file to execute the commands in the test shell script.

The versions following the test script are for the riak_ee, riak_cs and stanchion
RPMs. Please make sure they match the version strings encoded in the RPM filenames.

```
./test.sh 2.0.5 2.0.0 2.0.0
```
83 changes: 83 additions & 0 deletions riak_test/docker/confirm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#!/bin/bash

trap 'echo "[ERROR] $0:$LINENO \"$BASH_COMMAND\"" ; exit 1' ERR

echo "starting all nodes"
riak start
riak-admin wait-for-service riak_kv riak@127.0.0.1
stanchion start
riak-cs start
echo "done."

riak ping
stanchion ping
riak-cs ping

riak version
stanchion version
riak-cs version

# which riak-cs-multibag
# echo `riak-cs-multibag list-bags`
# echo `riak-cs-multibag weight master 10`
# echo `riak-cs-multibag weight bag-A 10`
# echo `riak-cs-multibag weight`

echo "creating init user"

/usr/lib64/riak-cs/erts-5.10.3/bin/erl \
-name n@127.0.0.1 -setcookie riak \
-eval "io:format(\"~p\", [rpc:call('riak-cs@127.0.0.1', riak_cs_user, create_user, [\"name\", \"me@admin.com\", \"admin-key\", \"admin-secret\"])])." \
-s init stop

echo "\n... probably user created"

echo "sleeping ..."

riak-cs-admin gc set-leeway 2
riak-cs-admin gc batch
riak-cs-admin gc status
riak-cs-admin gc set-interval 5

S3CMD=s3cmd

${S3CMD} mb s3://test-bucket
${S3CMD} ls
${S3CMD} put *.rpm s3://test-bucket
${S3CMD} put -r /bin s3://test-bucket
${S3CMD} ls -r s3://test-bucket

riak-cs-admin access flush
riak-cs-admin storage batch
riak-cs-admin storage status

riak-cs-admin stanchion show
riak-cs-admin cleanup-orphan-multipart

CS_LOG_DIR=/var/log/riak-cs
touch -d "2016-03-01" ${CS_LOG_DIR}/console.log.old1
touch -d "2016-03-01" ${CS_LOG_DIR}/access.log.old1

riak-cs-debug -h
riak-cs-debug /tmp/rcs-debug-default.tar.gz
riak-cs-debug --log-mtime 2 /tmp/rcs-debug-log-mtime.tar.gz
riak-cs-debug --skip-accesslog /tmp/rcs-debug-log-skip-alog.tar.gz

echo "teardown"
${S3CMD} del -r -f s3://test-bucket
${S3CMD} -d rb s3://test-bucket
${S3CMD} -d ls

# /usr/lib/riak-cs/erts-5.9.1/bin/erl -name n@127.0.0.1 -setcookie riak -eval "io:format(\"~p\", [rpc:call('riak-cs@127.0.0.1', code, ensure_loaded, [riak_repl_pb_api])])." -s init stop

riak-cs stop
riak-cs-debug /tmp/rcs-debug-stopped.tar.gz

for f in /tmp/rcs-debug-*.tar.gz; do
echo "Extract "$f" to logs/riak-cs/..."
b=$(basename $f .tar.gz)
mkdir -p ${CS_LOG_DIR}/$b
tar zxf $f -C ${CS_LOG_DIR}/$b
done

echo "looks like package test has passed."
44 changes: 44 additions & 0 deletions riak_test/docker/local.s3cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[default]

access_key = admin-key
secret_key = admin-secret
signature_v2 = True

bucket_location = US
default_mime_type = binary/octet-stream
delete_removed = False
dry_run = False
enable_multipart = True
encoding = UTF-8
encrypt = False
follow_symlinks = False
force = False
get_continue = False
gpg_command = /usr/bin/gpg
gpg_decrypt = %(gpg_command)s -d --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s
gpg_encrypt = %(gpg_command)s -c --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s
gpg_passphrase =
guess_mime_type = True
host_base = s3.amazonaws.com
host_bucket = %(bucket)s.s3.amazonaws.com
human_readable_sizes = False
invalidate_on_cf = False
list_md5 = False
log_target_prefix =
mime_type =
multipart_chunk_size_mb = 15
preserve_attrs = True
progress_meter = True
proxy_host = localhost
proxy_port = 8080
#proxy_port = 443
##proxy_port = 8000
recursive = False
recv_chunk = 4096
reduced_redundancy = False
send_chunk = 4096
skip_existing = False
socket_timeout = 300
urlencoding_mode = normal
use_https = False
verbosity = WARNING
5 changes: 5 additions & 0 deletions riak_test/docker/riak-cs.advanced.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[
{riak_cs,
[
]}
].
Loading