Last active
August 29, 2015 14:02
-
-
Save jharley/e23034135966bb7b438e to your computer and use it in GitHub Desktop.
ceph REST API: upstart+uwsgi+nginx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/nginx/sites-available/ceph-rest-api | |
server { | |
listen 80; | |
server_name ceph-rest-api; | |
charset utf-8; | |
location / { | |
root /var/log/nginx; | |
error_log /var/log/nginx/ceph-restapi-error.log; | |
access_log /var/log/nginx/ceph-restapi-access.log combined; | |
include uwsgi_params; | |
uwsgi_pass unix:/var/lib/nginx/uwsgi/ceph-restapi.sock; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/init/ceph-restapi.conf | |
description "Ceph REST API uWSGI Container" | |
start on runlevel [2345] | |
stop on runlevel [06] | |
respawn | |
exec /usr/bin/uwsgi --ini /etc/ceph/restapi-uwsgi.ini |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
/etc/nginx/uwsgi-wrapper/ceph-restapi.wsgi | |
WSGI wrapper for the Ceph REST API | |
Taken from Wido den Hollander's helpful Gist: https://gist.github.com/wido/8bf032e5f482bfef949c | |
''' | |
conffile="/etc/ceph/ceph.conf" | |
cluster="ceph" | |
clientname=None | |
clientid="admin" | |
args=None | |
try: | |
import ceph_rest_api | |
except EnvironmentError as e: | |
print >> sys.stderr, "Error importing ceph_rest_api: ", str(e) | |
sys.exit(1) | |
application = ceph_rest_api.generate_app( | |
conffile, | |
cluster, | |
clientname, | |
clientid, | |
args, | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/ceph/restapi-uwsgi.ini | |
[uwsgi] | |
uid = root | |
gid = www-data | |
logdate = yes | |
die-on-term = yes | |
socket = /var/lib/nginx/uwsgi/ceph-restapi.sock | |
chmod-socket = 660 | |
plugin = python | |
enable-threads = yes | |
wsgi-file = /etc/nginx/uwsgi-wrapper/ceph-restapi.wsgi | |
callable = application | |
need-app = yes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment