From 3c7e0da4677273b160288da30259662742b68032 Mon Sep 17 00:00:00 2001 From: Steven Dake Date: Sat, 20 Sep 2014 13:14:59 -0700 Subject: [PATCH] Add swift boilerplate Add swift boilerplate for Docker building and Kubernetes support --- docker/swift/swift-account/Dockerfile | 6 ++ docker/swift/swift-account/build | 2 + docker/swift/swift-account/start.sh | 40 +++++++++ docker/swift/swift-base/24q124 | 8 ++ docker/swift/swift-base/Dockerfile | 8 ++ docker/swift/swift-base/build | 2 + docker/swift/swift-container/Dockerfile | 6 ++ docker/swift/swift-container/build | 2 + docker/swift/swift-container/start.sh | 40 +++++++++ docker/swift/swift-object/Dockerfile | 6 ++ docker/swift/swift-object/build | 2 + docker/swift/swift-object/start.sh | 40 +++++++++ docker/swift/swift-proxy-server/Dockerfile | 6 ++ docker/swift/swift-proxy-server/build | 2 + docker/swift/swift-proxy-server/start.sh | 5 ++ docker/swift/swift.json | 98 ++++++++++++++++++++++ 16 files changed, 273 insertions(+) create mode 100644 docker/swift/swift-account/Dockerfile create mode 100755 docker/swift/swift-account/build create mode 100644 docker/swift/swift-account/start.sh create mode 100644 docker/swift/swift-base/24q124 create mode 100644 docker/swift/swift-base/Dockerfile create mode 100755 docker/swift/swift-base/build create mode 100644 docker/swift/swift-container/Dockerfile create mode 100755 docker/swift/swift-container/build create mode 100644 docker/swift/swift-container/start.sh create mode 100644 docker/swift/swift-object/Dockerfile create mode 100755 docker/swift/swift-object/build create mode 100644 docker/swift/swift-object/start.sh create mode 100644 docker/swift/swift-proxy-server/Dockerfile create mode 100755 docker/swift/swift-proxy-server/build create mode 100644 docker/swift/swift-proxy-server/start.sh create mode 100644 docker/swift/swift.json diff --git a/docker/swift/swift-account/Dockerfile b/docker/swift/swift-account/Dockerfile new file mode 100644 index 0000000000..49b80e1f66 --- /dev/null +++ b/docker/swift/swift-account/Dockerfile @@ -0,0 +1,6 @@ +FROM fedora-rdo-base +MAINTAINER Steven Dake + +ADD ./start.sh /start.sh +CMD ["/start.sh"] + diff --git a/docker/swift/swift-account/build b/docker/swift/swift-account/build new file mode 100755 index 0000000000..d1733a86b1 --- /dev/null +++ b/docker/swift/swift-account/build @@ -0,0 +1,2 @@ +#!/bin/bash +sudo docker build --tag fedora-rdo-swift-account-server . diff --git a/docker/swift/swift-account/start.sh b/docker/swift/swift-account/start.sh new file mode 100644 index 0000000000..783df0a668 --- /dev/null +++ b/docker/swift/swift-account/start.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +: ${SWIFT_DB_USER:=swift} +: ${SWIFT_DB_NAME:=swift} +: ${KEYSTONE_AUTH_PROTOCOL:=http} +: ${SWIFT_KEYSTONE_USER:=swift} +: ${ADMIN_TENANT_NAME:=admin} + +if ! [ "$KEYSTONE_ADMIN_TOKEN" ]; then + echo "*** Missing KEYSTONE_ADMIN_TOKEN" >&2 + exit 1 +fi + +if ! [ "$DB_ROOT_PASSWORD" ]; then + echo "*** Missing DB_ROOT_PASSWORD" >&2 + exit 1 +fi + +if ! [ "$SWIFT_DB_PASSWORD" ]; then + SWIFT_DB_PASSWORD=$(openssl rand -hex 15) + export SWIFT_DB_PASSWORD +fi + +sh /opt/swift/config-swift.sh account-server + +mysql -h ${MARIADBMASTER_PORT_3306_TCP_ADDR} -u root \ + -p${DB_ROOT_PASSWORD} mysql < + +RUN yum -y install openstack-utils openstack-swift && yum clean all + +# These will come after we sort out start time config +RUN mkdir /opt/swift +#COPY config-swift.sh /opt/swift/config-swift.sh diff --git a/docker/swift/swift-base/Dockerfile b/docker/swift/swift-base/Dockerfile new file mode 100644 index 0000000000..36d7d0e009 --- /dev/null +++ b/docker/swift/swift-base/Dockerfile @@ -0,0 +1,8 @@ +FROM fedora-rdo-base +MAINTAINER Steven Dake + +RUN yum -y install openstack-utils openstack-swift && yum clean all + +# These will come after we sort out start time config +RUN mkdir /opt/swift +config-swift.sh /opt/swift/config-swift.sh diff --git a/docker/swift/swift-base/build b/docker/swift/swift-base/build new file mode 100755 index 0000000000..9ad15afd64 --- /dev/null +++ b/docker/swift/swift-base/build @@ -0,0 +1,2 @@ +#!/bin/bash +sudo docker build --tag swift-proxy-base . diff --git a/docker/swift/swift-container/Dockerfile b/docker/swift/swift-container/Dockerfile new file mode 100644 index 0000000000..49b80e1f66 --- /dev/null +++ b/docker/swift/swift-container/Dockerfile @@ -0,0 +1,6 @@ +FROM fedora-rdo-base +MAINTAINER Steven Dake + +ADD ./start.sh /start.sh +CMD ["/start.sh"] + diff --git a/docker/swift/swift-container/build b/docker/swift/swift-container/build new file mode 100755 index 0000000000..866c638ec4 --- /dev/null +++ b/docker/swift/swift-container/build @@ -0,0 +1,2 @@ +#!/bin/bash +sudo docker build --tag fedora-rdo-swift-container-server . diff --git a/docker/swift/swift-container/start.sh b/docker/swift/swift-container/start.sh new file mode 100644 index 0000000000..8e952c7297 --- /dev/null +++ b/docker/swift/swift-container/start.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +: ${SWIFT_DB_USER:=swift} +: ${SWIFT_DB_NAME:=swift} +: ${KEYSTONE_AUTH_PROTOCOL:=http} +: ${SWIFT_KEYSTONE_USER:=swift} +: ${ADMIN_TENANT_NAME:=admin} + +if ! [ "$KEYSTONE_ADMIN_TOKEN" ]; then + echo "*** Missing KEYSTONE_ADMIN_TOKEN" >&2 + exit 1 +fi + +if ! [ "$DB_ROOT_PASSWORD" ]; then + echo "*** Missing DB_ROOT_PASSWORD" >&2 + exit 1 +fi + +if ! [ "$SWIFT_DB_PASSWORD" ]; then + SWIFT_DB_PASSWORD=$(openssl rand -hex 15) + export SWIFT_DB_PASSWORD +fi + +sh /opt/swift/config-swift.sh container + +mysql -h ${MARIADBMASTER_PORT_3306_TCP_ADDR} -u root \ + -p${DB_ROOT_PASSWORD} mysql < + +ADD ./start.sh /start.sh +CMD ["/start.sh"] + diff --git a/docker/swift/swift-object/build b/docker/swift/swift-object/build new file mode 100755 index 0000000000..c25af585c7 --- /dev/null +++ b/docker/swift/swift-object/build @@ -0,0 +1,2 @@ +#!/bin/bash +sudo docker build --tag fedora-rdo-swift-object-server . diff --git a/docker/swift/swift-object/start.sh b/docker/swift/swift-object/start.sh new file mode 100644 index 0000000000..4b294d5086 --- /dev/null +++ b/docker/swift/swift-object/start.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +: ${SWIFT_DB_USER:=swift} +: ${SWIFT_DB_NAME:=swift} +: ${KEYSTONE_AUTH_PROTOCOL:=http} +: ${SWIFT_KEYSTONE_USER:=swift} +: ${ADMIN_TENANT_NAME:=admin} + +if ! [ "$KEYSTONE_ADMIN_TOKEN" ]; then + echo "*** Missing KEYSTONE_ADMIN_TOKEN" >&2 + exit 1 +fi + +if ! [ "$DB_ROOT_PASSWORD" ]; then + echo "*** Missing DB_ROOT_PASSWORD" >&2 + exit 1 +fi + +if ! [ "$SWIFT_DB_PASSWORD" ]; then + SWIFT_DB_PASSWORD=$(openssl rand -hex 15) + export SWIFT_DB_PASSWORD +fi + +sh /opt/swift/config-swift.sh engine + +mysql -h ${MARIADBMASTER_PORT_3306_TCP_ADDR} -u root \ + -p${DB_ROOT_PASSWORD} mysql < + +ADD ./start.sh /start.sh +CMD ["/start.sh"] + diff --git a/docker/swift/swift-proxy-server/build b/docker/swift/swift-proxy-server/build new file mode 100755 index 0000000000..376c1fb5b3 --- /dev/null +++ b/docker/swift/swift-proxy-server/build @@ -0,0 +1,2 @@ +#!/bin/bash +sudo docker build --tag fedora-rdo-swift-proxy-server . diff --git a/docker/swift/swift-proxy-server/start.sh b/docker/swift/swift-proxy-server/start.sh new file mode 100644 index 0000000000..dff824f462 --- /dev/null +++ b/docker/swift/swift-proxy-server/start.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +sh /opt/swift/config-swift.sh proxy + +exec /usr/bin/swift-proxy-server diff --git a/docker/swift/swift.json b/docker/swift/swift.json new file mode 100644 index 0000000000..43b23827c0 --- /dev/null +++ b/docker/swift/swift.json @@ -0,0 +1,98 @@ +{ + "id": "swift", + "desiredState": { + "manifest": { + "version": "v1beta1", + "id": "swift-1", + "containers": [ + { + "name": "swift-account-server", + "image": "fedora-rdo-swift-account-server", + "ports": [ + {"containerPort": 9292}, + ], + "env": [ + { + "name": "DB_ROOT_PASSWORD", + "value": "password" + }, + { + "name": "SWIFT_DB_PASSWORD", + "value": "swiftdbpassword" + }, + { + "name": "KEYSTONE_ADMIN_TOKEN", + "value": "ADMINTOKEN" + }, + ] + }, + { + "name": "swift-container-server", + "image": "fedora-rdo-swift-container-server", + "ports": [ + {"containerPort": 9292}, + ], + "env": [ + { + "name": "DB_ROOT_PASSWORD", + "value": "password" + }, + { + "name": "SWIFT_DB_PASSWORD", + "value": "swiftdbpassword" + }, + { + "name": "KEYSTONE_ADMIN_TOKEN", + "value": "ADMINTOKEN" + }, + ] + }, + { + "name": "swift-object-server", + "image": "fedora-rdo-swift-object-server", + "ports": [ + {"containerPort": 9292}, + ], + "env": [ + { + "name": "DB_ROOT_PASSWORD", + "value": "password" + }, + { + "name": "SWIFT_DB_PASSWORD", + "value": "swiftdbpassword" + }, + { + "name": "KEYSTONE_ADMIN_TOKEN", + "value": "ADMINTOKEN" + }, + ] + }, + { + "name": "swift-proxy-server", + "image": "fedora-rdo-swift-proxy-server", + "ports": [ + {"containerPort": 9292}, + ], + "env": [ + { + "name": "DB_ROOT_PASSWORD", + "value": "password" + }, + { + "name": "SWIFT_DB_PASSWORD", + "value": "swiftdbpassword" + }, + { + "name": "KEYSTONE_ADMIN_TOKEN", + "value": "ADMINTOKEN" + }, + ] + }, + ] + } + }, + "labels": { + "name": "keystone-master" + } +}