This file contains hidden or 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
| gunicorn --keyfile /srv/bzr-sync/certs/bzr-sync.key --certfile /srv/bzr-sync/certs/bzr-sync.cert --pythonpath /srv/bzr-sync --bind 0.0.0.0:9052 wsgi:application |
This file contains hidden or 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/bzr-sync.conf | |
| # A WSGI application | |
| # to sync a github repository to a launchpad one | |
| description "BZR sync" | |
| start on runlevel [2345] | |
| stop on runlevel [016] |
This file contains hidden or 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
| sudo start bzr-sync |
This file contains hidden or 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
| #!/usr/bin/env bash | |
| # Get the machine number for the first unit of a juju service | |
| # Requires: | |
| # - `jq` (http://stedolan.github.io/jq/) | |
| # Usage: | |
| # $ juju-machine-number.sh my-awesome-service | |
| # 12 | |
| service_name=${1} |
This file contains hidden or 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
| #!/usr/bin/env bash | |
| # Get the instance ID for a juju machine, by machine number | |
| # Requires: | |
| # - `jq` (http://stedolan.github.io/jq/) | |
| # Usage: | |
| # $ juju-instance-id.sh 12 | |
| # 92e3ef6a-ba3d-4eb4-adbc-8be78f2c8abe | |
| machine_number=${1} |
This file contains hidden or 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
| #!/usr/bin/env bash | |
| # Get the instance ID for a juju machine, by machine number | |
| # Requires: | |
| # - `jq` (http://stedolan.github.io/jq/) | |
| # - `juju-first-machine-number.sh` (https://gist.github.com/nottrobin/9e7ff961cc6c00a65c61) | |
| # - `juju-instance-id.sh` (https://gist.github.com/nottrobin/f918f98a8e1e20803b5f) | |
| # Usage: | |
| # $ juju-first-instance-id.sh my-awesome-service | |
| # 92e3ef6a-ba3d-4eb4-adbc-8be78f2c8abe |
This file contains hidden or 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
| forwarded_protocol = request._request.META.get('HTTP_X_FORWARDED_PROTO', '') | |
| is_secure = request.is_secure() or forwarded_protocol == 'https' |
This file contains hidden or 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
| from rest_framework.renderers import JSONRenderer | |
| from django.conf import settings | |
| class PrettyJSONRenderer(JSONRenderer): | |
| """ | |
| Extend the existing JSONRenderer from djangorestframework | |
| by using settings.DEFAULT_JSON_INDENT | |
| to always pretty-print JSON output | |
| """ |
This file contains hidden or 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
| from rest_framework.exceptions import AuthenticationFailed | |
| class PrettyAuthenticationFailed(AuthenticationFailed): | |
| """ | |
| A fork of the djangorestframework AuthenticationFailed exception | |
| to simply allow the `detail` parameter to contain fully formed | |
| JSON objects, rather than just text | |
| """ | |
| def __init__(self, detail=None): |
This file contains hidden or 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
| `.:/osyhhhhyoo+/. ..-/::///:-.. | |
| .:shmdmMNNNNNNNMmmMNNhdsshhddhyyysoss+-` | |
| `-odNMNdhhhyyysoooo+oyddmdh`-hhdmdhhhhysssssyy/. | |
| ./yNmhyhyyysyyyhdyyssy+ssoooo+/. :hhyyyyys+///o+ssdy:` | |
| `/hmhhyhhyssydyysyosossyssyhhdddddh- :ysosyhdNNNmhs++/+dms: | |
| `-smMMmmsssyyyssoy/+ssyhdyysss++////-o+ `osyddhyssyydhmNh+-+mNh: | |
| `o/ydmNmhoosssyshyssyhsossooososshddmmhyso``:yyhdmdNdNNNdhdmNNy++mN+` | |
| +NNNMds++sydhyss+so++o+sosydddhs+:-..``` ````.`--:/shhyosdh+yNs. | |
| hMmyo:ohNdssooossososhdNmh+-.` `sho` `-odmyydmNMm: |