From 5274cc9094fba96aa1095b9625869e338a3bc1d1 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jan 09 2017 18:46:16 +0000 Subject: [PATCH 1/3] Adjust the rundocserver script as we have the runserver one --- diff --git a/rundocserver.py b/rundocserver.py index ad845f0..d3df30b 100755 --- a/rundocserver.py +++ b/rundocserver.py @@ -4,15 +4,49 @@ __requires__ = ['SQLAlchemy >= 0.8', 'jinja2 >= 2.4'] import pkg_resources +import argparse import sys -from werkzeug.contrib.profiler import ProfilerMiddleware +import os + + +parser = argparse.ArgumentParser( + description='Run the Pagure doc server') +parser.add_argument( + '--config', '-c', dest='config', + help='Configuration file to use for the pagure doc server.') +parser.add_argument( + '--debug', dest='debug', action='store_true', + default=False, + help='Expand the level of data returned.') +parser.add_argument( + '--profile', dest='profile', action='store_true', + default=False, + help='Profile the doc server.') +parser.add_argument( + '--port', '-p', default=5001, + help='Port for the Pagure doc server to run on.') +parser.add_argument( + '--host', default="127.0.0.1", + help='Hostname to listen on. When set to 0.0.0.0 the server is ' + 'available externally. Defaults to 127.0.0.1 making the it only ' + 'visable on localhost') + +args = parser.parse_args() + +if args.config: + config = args.config + if not config.startswith('/'): + here = os.path.join(os.path.dirname(os.path.abspath(__file__))) + config = os.path.join(here, config) + os.environ['PAGURE_CONFIG'] = config from pagure import APP from pagure.docs_server import APP -APP.debug = True -if '--profile' in sys.argv: +if args.profile: + from werkzeug.contrib.profiler import ProfilerMiddleware APP.config['PROFILE'] = True APP.wsgi_app = ProfilerMiddleware(APP.wsgi_app, restrictions=[30]) -APP.run(port=5001) +APP.debug = True +APP.run(host=args.host, port=int(args.port)) From 494104362dfd94fa20dc9498a1c636f270bacc8a Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jan 09 2017 18:46:16 +0000 Subject: [PATCH 2/3] Document the DOC_APP_URL in the configuration section of pagure's doc --- diff --git a/doc/configuration.rst b/doc/configuration.rst index 4daeaa1..4c6a666 100644 --- a/doc/configuration.rst +++ b/doc/configuration.rst @@ -5,6 +5,7 @@ Pagure offers a wide varieties of options that must or can be used to adjust its behavior. + Must options ------------ @@ -85,6 +86,7 @@ The URL should end with a slash ``/``. Defaults to: ``'git://pagure.org/'`` + Repo Directories ---------------- @@ -198,6 +200,7 @@ upload. For more information, see the install.rst guide. Defaults to: ``False`` + Configure Gitolite ------------------ @@ -256,6 +259,7 @@ using a package manager or something like ``/opt/bin/`` for a more custom install. + EventSource options ------------------- @@ -277,6 +281,7 @@ running. below) + Web-hooks notifications ----------------------- @@ -292,6 +297,7 @@ Defaults to: ``False``. below) + Redis options ------------- @@ -320,6 +326,7 @@ communicating with the EventSource server. Defaults to: ``0``. + Authentication options ---------------------- @@ -340,6 +347,7 @@ the users in the admin groups listed above as well as admin rights to all projects hosted on this pagure instance. + Optional options ---------------- @@ -446,7 +454,6 @@ Defaults to: ] - CHECK_SESSION_IP ~~~~~~~~~~~~~~~~ @@ -586,6 +593,17 @@ or gitlab.com. Defaults to: ``False`` +DOC_APP_URL +~~~~~~~~~~~ + +This configuration key allows you to specify where the documentation server +is running (preferably in a different domain name entirely). +If not set, the documentation page will show an error message saying that +this pagure instance does not have a documentation server. + +Defaults to: ``None`` + + Deprecated configuration keys ----------------------------- From fe3bb6352f3fde0fc5a457919e2b6a532fff46b9 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jan 09 2017 18:46:16 +0000 Subject: [PATCH 3/3] Fix typo in the help string and remove un-needed import --- diff --git a/rundocserver.py b/rundocserver.py index d3df30b..ac34310 100755 --- a/rundocserver.py +++ b/rundocserver.py @@ -29,7 +29,7 @@ parser.add_argument( '--host', default="127.0.0.1", help='Hostname to listen on. When set to 0.0.0.0 the server is ' 'available externally. Defaults to 127.0.0.1 making the it only ' - 'visable on localhost') + 'visible on localhost') args = parser.parse_args() @@ -40,7 +40,6 @@ if args.config: config = os.path.join(here, config) os.environ['PAGURE_CONFIG'] = config -from pagure import APP from pagure.docs_server import APP if args.profile: diff --git a/runserver.py b/runserver.py index 2ee7a0a..44682ba 100755 --- a/runserver.py +++ b/runserver.py @@ -27,7 +27,8 @@ parser.add_argument( help='Port for the Pagure to run on.') parser.add_argument( '--host', default="127.0.0.1", - help='Hostname to listen on. When set to 0.0.0.0 the server is available externally. Defaults to 127.0.0.1 making the it only visable on localhost') + help='Hostname to listen on. When set to 0.0.0.0 the server is available ' + 'externally. Defaults to 127.0.0.1 making the it only visible on localhost') args = parser.parse_args()