Add swift boilerplate
Add swift boilerplate for Docker building and Kubernetes support
This commit is contained in:
parent
87276efbbd
commit
3c7e0da467
6
docker/swift/swift-account/Dockerfile
Normal file
6
docker/swift/swift-account/Dockerfile
Normal file
@ -0,0 +1,6 @@
|
||||
FROM fedora-rdo-base
|
||||
MAINTAINER Steven Dake <sdake@redhat.com>
|
||||
|
||||
ADD ./start.sh /start.sh
|
||||
CMD ["/start.sh"]
|
||||
|
2
docker/swift/swift-account/build
Executable file
2
docker/swift/swift-account/build
Executable file
@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
sudo docker build --tag fedora-rdo-swift-account-server .
|
40
docker/swift/swift-account/start.sh
Normal file
40
docker/swift/swift-account/start.sh
Normal file
@ -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 <<EOF
|
||||
CREATE DATABASE IF NOT EXISTS ${SWIFT_DB_NAME};
|
||||
GRANT ALL PRIVILEGES ON swift* TO
|
||||
'${SWIFT_DB_USER}'@'%' IDENTIFIED BY '${SWIFT_DB_PASSWORD}'
|
||||
EOF
|
||||
|
||||
export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}"
|
||||
export SERVICE_ENDPOINT="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONEMASTER_35357_PORT_35357_TCP_ADDR}:35357/v2.0"
|
||||
|
||||
/bin/keystone user-create --name ${SWIFT_KEYSTONE_USER} --pass ${SWIFT_ADMIN_PASSWORD}
|
||||
/bin/keystone role-create --name ${SWIFT_KEYSTONE_USER}
|
||||
/bin/keystone user-role-add --user ${SWIFT_KEYSTONE_USER} --role admin --tenant ${ADMIN_TENANT_NAME}
|
||||
|
||||
exec /usr/bin/swift-engine
|
8
docker/swift/swift-base/24q124
Normal file
8
docker/swift/swift-base/24q124
Normal file
@ -0,0 +1,8 @@
|
||||
FROM fedora-rdo-base
|
||||
MAINTAINER Steven Dake <sdake@redhat.com>
|
||||
|
||||
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
|
8
docker/swift/swift-base/Dockerfile
Normal file
8
docker/swift/swift-base/Dockerfile
Normal file
@ -0,0 +1,8 @@
|
||||
FROM fedora-rdo-base
|
||||
MAINTAINER Steven Dake <sdake@redhat.com>
|
||||
|
||||
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
|
2
docker/swift/swift-base/build
Executable file
2
docker/swift/swift-base/build
Executable file
@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
sudo docker build --tag swift-proxy-base .
|
6
docker/swift/swift-container/Dockerfile
Normal file
6
docker/swift/swift-container/Dockerfile
Normal file
@ -0,0 +1,6 @@
|
||||
FROM fedora-rdo-base
|
||||
MAINTAINER Steven Dake <sdake@redhat.com>
|
||||
|
||||
ADD ./start.sh /start.sh
|
||||
CMD ["/start.sh"]
|
||||
|
2
docker/swift/swift-container/build
Executable file
2
docker/swift/swift-container/build
Executable file
@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
sudo docker build --tag fedora-rdo-swift-container-server .
|
40
docker/swift/swift-container/start.sh
Normal file
40
docker/swift/swift-container/start.sh
Normal file
@ -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 <<EOF
|
||||
CREATE DATABASE IF NOT EXISTS ${SWIFT_DB_NAME};
|
||||
GRANT ALL PRIVILEGES ON swift* TO
|
||||
'${SWIFT_DB_USER}'@'%' IDENTIFIED BY '${SWIFT_DB_PASSWORD}'
|
||||
EOF
|
||||
|
||||
export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}"
|
||||
export SERVICE_ENDPOINT="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONEMASTER_35357_PORT_35357_TCP_ADDR}:35357/v2.0"
|
||||
|
||||
/bin/keystone user-create --name ${SWIFT_KEYSTONE_USER} --pass ${SWIFT_ADMIN_PASSWORD}
|
||||
/bin/keystone role-create --name ${SWIFT_KEYSTONE_USER}
|
||||
/bin/keystone user-role-add --user ${SWIFT_KEYSTONE_USER} --role admin --tenant ${ADMIN_TENANT_NAME}
|
||||
|
||||
exec /usr/bin/swift-container-server
|
6
docker/swift/swift-object/Dockerfile
Normal file
6
docker/swift/swift-object/Dockerfile
Normal file
@ -0,0 +1,6 @@
|
||||
FROM fedora-rdo-base
|
||||
MAINTAINER Steven Dake <sdake@redhat.com>
|
||||
|
||||
ADD ./start.sh /start.sh
|
||||
CMD ["/start.sh"]
|
||||
|
2
docker/swift/swift-object/build
Executable file
2
docker/swift/swift-object/build
Executable file
@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
sudo docker build --tag fedora-rdo-swift-object-server .
|
40
docker/swift/swift-object/start.sh
Normal file
40
docker/swift/swift-object/start.sh
Normal file
@ -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 <<EOF
|
||||
CREATE DATABASE IF NOT EXISTS ${SWIFT_DB_NAME};
|
||||
GRANT ALL PRIVILEGES ON swift* TO
|
||||
'${SWIFT_DB_USER}'@'%' IDENTIFIED BY '${SWIFT_DB_PASSWORD}'
|
||||
EOF
|
||||
|
||||
export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}"
|
||||
export SERVICE_ENDPOINT="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONEMASTER_35357_PORT_35357_TCP_ADDR}:35357/v2.0"
|
||||
|
||||
/bin/keystone user-create --name ${SWIFT_KEYSTONE_USER} --pass ${SWIFT_ADMIN_PASSWORD}
|
||||
/bin/keystone role-create --name ${SWIFT_KEYSTONE_USER}
|
||||
/bin/keystone user-role-add --user ${SWIFT_KEYSTONE_USER} --role admin --tenant ${ADMIN_TENANT_NAME}
|
||||
|
||||
exec /usr/bin/swift-object-server
|
6
docker/swift/swift-proxy-server/Dockerfile
Normal file
6
docker/swift/swift-proxy-server/Dockerfile
Normal file
@ -0,0 +1,6 @@
|
||||
FROM fedora-rdo-swift-base
|
||||
MAINTAINER Steven Dake <sdake@redhat.com>
|
||||
|
||||
ADD ./start.sh /start.sh
|
||||
CMD ["/start.sh"]
|
||||
|
2
docker/swift/swift-proxy-server/build
Executable file
2
docker/swift/swift-proxy-server/build
Executable file
@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
sudo docker build --tag fedora-rdo-swift-proxy-server .
|
5
docker/swift/swift-proxy-server/start.sh
Normal file
5
docker/swift/swift-proxy-server/start.sh
Normal file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
sh /opt/swift/config-swift.sh proxy
|
||||
|
||||
exec /usr/bin/swift-proxy-server
|
98
docker/swift/swift.json
Normal file
98
docker/swift/swift.json
Normal file
@ -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"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user