Skip to content

Commit

Permalink
rgw: read config startup from ceph.conf
Browse files Browse the repository at this point in the history
It's easier to read rgw config options from the ceph.conf instead of
overriding it on the CLI.
This is a disruptive change for users that were relying on options like
RGW_CIVETWEB_IP and RGW_CIVETWEB_PORT. These options will have to
addressed in the ceph.conf so we don't break anything.

The options mentioned above are still active for the nano/demo scenario
which is really unique and not intended for production deployment.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1582411
Signed-off-by: Sébastien Han <seb@redhat.com>
(cherry picked from commit 4f9efd3)
Signed-off-by: Sébastien Han <seb@redhat.com>
  • Loading branch information
leseb committed Aug 8, 2018
1 parent a9bdf2e commit 24bd34a
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 42 deletions.
15 changes: 13 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,26 @@ services:

before_install:
- docker --version
- docker login -u leseb -p "$DOCKER_HUB_PASSWORD"
- sudo apt-get install -y --force-yes xfsprogs
- sudo ./travis-builds/purge_cluster.sh
- sudo make FLAVORS="mimic,centos,7" build
- export RELEASE="travis-build-$TRAVIS_BRANCH-$TRAVIS_COMMIT"
- sudo make RELEASE="$RELEASE" FLAVORS="mimic,centos,7" build

install:
- sudo ./travis-builds/prepare_osd_fs.sh
- docker run -d --name ceph-demo -v /etc/modprobe.d:/etc/modprobe.d -e RGW_FRONTEND_TYPE=beast -e RGW_CIVETWEB_OPTIONS="num_threads=100" -e BLUESTORE_BLOCK_SIZE=15GB -e DEBUG=verbose -e RGW_CIVETWEB_PORT=8000 -e CLUSTER=test -e NETWORK_AUTO_DETECT=4 -e CEPH_DEMO_UID=demo -e CEPH_DEMO_ACCESS_KEY=G1EZ5R4K6IJ7XUQKMAED -e CEPH_DEMO_SECRET_KEY=cNmUrqpBKjCMzcfqG8fg4Qk07Xkoyau52OmvnSsz -e CEPH_DEMO_BUCKET=foobar -e SREE_VERSION=v0.1 -e DATA_TO_SYNC=/etc/modprobe.d -e DATA_TO_SYNC_BUCKET=travis ceph/daemon:HEAD-mimic-centos-7-x86_64 demo
- docker run -d --name ceph-demo -v /etc/modprobe.d:/etc/modprobe.d -e RGW_FRONTEND_TYPE=beast -e RGW_CIVETWEB_OPTIONS="num_threads=100" -e BLUESTORE_BLOCK_SIZE=15GB -e DEBUG=verbose -e RGW_CIVETWEB_PORT=8000 -e CLUSTER=test -e NETWORK_AUTO_DETECT=4 -e CEPH_DEMO_UID=demo -e CEPH_DEMO_ACCESS_KEY=G1EZ5R4K6IJ7XUQKMAED -e CEPH_DEMO_SECRET_KEY=cNmUrqpBKjCMzcfqG8fg4Qk07Xkoyau52OmvnSsz -e CEPH_DEMO_BUCKET=foobar -e SREE_VERSION=v0.1 -e DATA_TO_SYNC=/etc/modprobe.d -e DATA_TO_SYNC_BUCKET=travis ceph/daemon:"travis-build-$TRAVIS_BRANCH-$TRAVIS_COMMIT"-mimic-centos-7-x86_64 demo
- sleep 5 # let's give the container 5sec to create its Ceph config file

script:
- sudo ./travis-builds/validate_demo_cluster.sh
- docker exec ceph-demo ps fauwwwx
- docker exec ceph-demo ss -ntlp
- docker exec ceph-demo cat /etc/ceph/test.conf
# - curl -L https://github.com/ceph/cn/releases/download/v1.8.0/cn-v1.8.0-bb92a8e-linux-amd64 -o cn
# - chmod +x cn
# - ./cn cluster start "$RELEASE" -i ceph/daemon:"$RELEASE"-mimic-centos-7-x86_64
- sudo make RELEASE="$RELEASE" FLAVORS="mimic,centos,7" push


after_failure:
Expand All @@ -33,3 +40,7 @@ after_failure:
- docker ps -a
- docker logs ceph-demo
- docker exec ceph-demo ceph --cluster test -s

env:
global:
secure: Q7ilx50Ch5DPNiSfTpEwrlrzGOXTFaKVoaGdKWHoxj5zf2+G3/pggCtW3ZTeuof0AtHjsnfG0f20Y+S+pwo9q+ksTa52UdUIBOXZZVeovGfQAaH23E+gxJwxHYdWwhSJAzpRzFKgr7XoZO+lwMFYun0sBCTk8lLG/nEMw37t3ks=
32 changes: 31 additions & 1 deletion src/daemon/demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,35 @@ MGR_IP=$MON_IP
: "${EXPOSED_IP:=127.0.0.1}"
: "${SREE_PORT:=5000}"

# rgw options
: "${RGW_CIVETWEB_IP:=0.0.0.0}"
: "${RGW_CIVETWEB_PORT:=8080}"
: "${RGW_FRONTEND_IP:=$RGW_CIVETWEB_IP}"
: "${RGW_FRONTEND_PORT:=$RGW_CIVETWEB_PORT}"
: "${RGW_FRONTEND_TYPE:="civetweb"}"

RGW_CIVETWEB_OPTIONS="$RGW_CIVETWEB_OPTIONS port=$RGW_CIVETWEB_IP:$RGW_CIVETWEB_PORT"
RGW_BEAST_OPTIONS="$RGW_BEAST_OPTIONS endpoint=$RGW_FRONTEND_IP:$RGW_FRONTEND_PORT"

if [[ "$RGW_FRONTEND_TYPE" == "civetweb" ]]; then
RGW_FRONTED_OPTIONS="$RGW_CIVETWEB_OPTIONS"
elif [[ "$RGW_FRONTEND_TYPE" == "beast" ]]; then
RGW_FRONTED_OPTIONS="$RGW_BEAST_OPTIONS"
else
log "ERROR: unsupported rgw backend type $RGW_FRONTEND_TYPE"
exit 1
fi

: "${RGW_FRONTEND:="$RGW_FRONTEND_TYPE $RGW_FRONTED_OPTIONS"}"

if [[ "$RGW_FRONTEND_TYPE" == "beast" ]]; then
if [[ "$CEPH_VERSION" == "jewel" || "$CEPH_VERSION" == "kraken" || "$CEPH_VERSION" == "luminous" ]]; then
RGW_FRONTEND_TYPE=beast
log "ERROR: unsupported rgw backend type $RGW_FRONTEND_TYPE for your Ceph release $CEPH_VERSION, use at least the Mimic version."
exit 1
fi
fi

CEPH_DISK_CLI_OPTS=()


Expand Down Expand Up @@ -150,12 +179,13 @@ rgw usage log flush threshold = ${RGW_USAGE_LOG_FLUSH_THRESHOLD}
rgw usage max shards = ${RGW_USAGE_MAX_SHARDS}
rgw usage max user shards = ${RGW_USAGE_MAX_USER_SHARDS}
log file = /var/log/ceph/client.rgw.${RGW_NAME}.log
rgw frontends = ${RGW_FRONTEND}
ENDHERE
fi

# start RGW
radosgw "${DAEMON_OPTS[@]}" -n client.rgw."$(uname -n)" -k "$RGW_KEYRING" --rgw-socket-path="" --rgw-frontends="$RGW_FRONTEND"
radosgw "${DAEMON_OPTS[@]}" -n client.rgw."$(uname -n)" -k "$RGW_KEYRING"
}

function bootstrap_demo_user {
Expand Down
6 changes: 1 addition & 5 deletions src/daemon/start_rgw.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@ function start_rgw {

log "SUCCESS"

if [ "$RGW_REMOTE_CGI" -eq 1 ]; then
RGW_FRONTEND="fastcgi socket_port=$RGW_REMOTE_CGI_PORT socket_host=$RGW_REMOTE_CGI_HOST"
fi

exec /usr/bin/radosgw "${DAEMON_OPTS[@]}" -n client.rgw."${RGW_NAME}" -k "$RGW_KEYRING" --rgw-socket-path="" --rgw-zonegroup="$RGW_ZONEGROUP" --rgw-zone="$RGW_ZONE" --rgw-frontends="$RGW_FRONTEND"
exec /usr/bin/radosgw "${DAEMON_OPTS[@]}" -n client.rgw."${RGW_NAME}" -k "$RGW_KEYRING"
}

function create_rgw_user {
Expand Down
34 changes: 0 additions & 34 deletions src/daemon/variables_entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ done
: "${CEPHFS_DATA_POOL_PG:=8}"
: "${CEPHFS_METADATA_POOL:=${CEPHFS_NAME}_metadata}"
: "${CEPHFS_METADATA_POOL_PG:=8}"
: "${RGW_ZONEGROUP:=}"
: "${RGW_ZONE:=}"
: "${RGW_USER:="cephnfs"}"
: "${RESTAPI_IP:=0.0.0.0}"
: "${RESTAPI_PORT:=5000}"
Expand All @@ -66,38 +64,6 @@ done
: "${GANESHA_EPOCH:=""}" # For restarting
: "${MGR_IP:=0.0.0.0}"

# rgw options
: "${RGW_CIVETWEB_IP:=0.0.0.0}"
: "${RGW_CIVETWEB_PORT:=8080}"
: "${RGW_REMOTE_CGI:=0}"
: "${RGW_REMOTE_CGI_PORT:=9000}"
: "${RGW_REMOTE_CGI_HOST:=0.0.0.0}"
: "${RGW_FRONTEND_IP:=$RGW_CIVETWEB_IP}"
: "${RGW_FRONTEND_PORT:=$RGW_CIVETWEB_PORT}"
: "${RGW_FRONTEND_TYPE:="civetweb"}"

RGW_CIVETWEB_OPTIONS="$RGW_CIVETWEB_OPTIONS port=$RGW_CIVETWEB_IP:$RGW_CIVETWEB_PORT"
RGW_BEAST_OPTIONS="$RGW_BEAST_OPTIONS endpoint=$RGW_FRONTEND_IP:$RGW_FRONTEND_PORT"

if [[ "$RGW_FRONTEND_TYPE" == "civetweb" ]]; then
RGW_FRONTED_OPTIONS="$RGW_CIVETWEB_OPTIONS"
elif [[ "$RGW_FRONTEND_TYPE" == "beast" ]]; then
RGW_FRONTED_OPTIONS="$RGW_BEAST_OPTIONS"
else
log "ERROR: unsupported rgw backend type $RGW_FRONTEND_TYPE"
exit 1
fi

: "${RGW_FRONTEND:="$RGW_FRONTEND_TYPE $RGW_FRONTED_OPTIONS"}"

if [[ "$RGW_FRONTEND_TYPE" == "beast" ]]; then
if [[ "$CEPH_VERSION" == "jewel" || "$CEPH_VERSION" == "kraken" || "$CEPH_VERSION" == "luminous" ]]; then
RGW_FRONTEND_TYPE=beast
log "ERROR: unsupported rgw backend type $RGW_FRONTEND_TYPE for your Ceph release $CEPH_VERSION, use at least the Mimic version."
exit 1
fi
fi

# Make sure to change the value of one another if user changes some of the default values
while read -r line; do
if [[ "$line" == "OSD_FILESTORE=1" ]]; then
Expand Down

0 comments on commit 24bd34a

Please sign in to comment.