Listen on port 8081 by default instead of 80

pull/7/head
Ferry Boender 8 years ago
parent 58d79a1dbb
commit 9c3fde01c6
  1. 8
      README.md
  2. 2
      contrib/scriptform.init.d_debian
  3. 2
      contrib/scriptform.init.d_redhat
  4. 22
      doc/MANUAL.md
  5. 4
      src/scriptform.py

@ -101,9 +101,9 @@ Set some rights and create the initial `htpasswd` file:
We can now start ScriptForm to start serving the form over HTTP. By default it
starts as a daemon, so we specify the `-f` option to start it in the foreground
instead.
instead. We also specify the port, even though 8081 is already the default.
$ scriptform -f -p8080 ./test_server.json
$ scriptform -f -p8081 ./test_server.json
The user is presented with the following form:
@ -197,7 +197,7 @@ ScriptForm can run both in daemon mode or in the foreground. In daemon mode, we
can control ScriptForm with the `--start` and `--stop` options. By default it
runs on port 80, which we can change with the `-p` option.
$ ./scriptform -p8000 ./test_server.json
$ ./scriptform -p8081 ./test_server.json
This puts ScriptForm in the background as a daemon. It creates a PID file and a
log file.
@ -205,7 +205,7 @@ log file.
$ tail scriptform.py.log
2015-04-08 07:57:27,160:DAEMON:INFO:Starting
2015-04-08 07:57:27,161:DAEMON:INFO:PID = 5614
2015-04-08 07:57:27,162:SCRIPTFORM:INFO:Listening on 0.0.0.0:8000
2015-04-08 07:57:27,162:SCRIPTFORM:INFO:Listening on 0.0.0.0:8081
In order to stop the daemon:

@ -20,7 +20,7 @@ PIDFILE=/var/run/scriptform.pid
LOGFILE=/var/log/scriptform.log
DAEMON=/usr/bin/scriptform
FORM_CONFIG=
PORT=8080
PORT=8081
DAEMON_ARGS="--port $PORT --pid-file $PIDFILE --log-file $LOGFILE $FORM_CONFIG"
# Define LSB log_* functions.

@ -18,7 +18,7 @@ PIDFILE=/var/run/scriptform.pid
LOGFILE=/var/log/scriptform.log
DAEMON=/usr/bin/scriptform
FORM_CONFIG=
PORT=8080
PORT=8081
DAEMON_ARGS="--port $PORT --pid-file $PIDFILE --log-file $LOGFILE $FORM_CONFIG"
start() {

@ -176,18 +176,18 @@ production ready.
Sriptform can be run directly from the shell in the foreground with the `-f`
(`--foreground`) option. This is most useful for testing and development:
$ /usr/bin/scriptform -p8000 -f ./formdef.json
$ /usr/bin/scriptform -p8081 -f ./formdef.json
You can specify the `-r` option to automatically reload the JSON file upon each
request:
$ /usr/bin/scriptform -p8000 -r -f ./formdef.json
$ /usr/bin/scriptform -p8081 -r -f ./formdef.json
### <a name="invocations_daemon">Daemon</a>
If you do not specify the `-f` option, Scriptform will go into the background:
$ /usr/bin/scriptform -p8000 ./formdef.json
$ /usr/bin/scriptform -p8081 ./formdef.json
$
A pid file will be written in the current directory, or to the file specified
@ -260,8 +260,8 @@ Enable Apache modules mod_proxy and mod_proxy_http:
Configure:
Redirect permanent /scriptform /scriptform/
ProxyPass /scriptform/ http://localhost:8000/
ProxyPassReverse /scriptform/ http://localhost:8000/
ProxyPass /scriptform/ http://localhost:8081/
ProxyPassReverse /scriptform/ http://localhost:8081/
Make sure the path ends in a slash! (That's what the redirect is for).
Otherwise, you may encounter the following error:
@ -336,10 +336,10 @@ Fix the permisions so it is executable:
Now start Scriptform with our newly created form configuration file:
$ scriptform -p8000 -f -r ./sf_tutorial.json
$ scriptform -p8081 -f -r ./sf_tutorial.json
This starts the built-in webserver which will serve the form on port 8000. When
you open it in your browser (http://127.0.0.1:8000/) you will immediately see
This starts the built-in webserver which will serve the form on port 8081. When
you open it in your browser (http://127.0.0.1:8081/) you will immediately see
the form. If we had multiple forms in this form configuration, you would first
see a list of all the forms.
@ -378,7 +378,7 @@ Now modify the `job_sysinfo.sh` script to output HTML instead of plain text:
<pre>$DISK</pre>
END_OF_TEXT
Open http://127.0.0.1:8000 in your browser and submit the form. That looks a
Open http://127.0.0.1:8081 in your browser and submit the form. That looks a
little better, doesn't it? The `html` output type lets you embed HTML in the
output of the script. The default output type is `escaped`, which escaped any
HTML and just outputs plain text wrapped in a Scriptform response header and
@ -441,9 +441,9 @@ Make it executable:
And start Scriptform (not required if it's still running and you're using the
same .json file):
$ scriptform -p8000 -f -r ./sf_tutorial.json
$ scriptform -p8081 -f -r ./sf_tutorial.json
Point your browser to http://127.0.0.01:8000. Try submitting the form with and
Point your browser to http://127.0.0.01:8081. Try submitting the form with and
without entering a name.
As you can see, Scriptform makes form values available to scripts through the

@ -135,7 +135,7 @@ class ScriptForm(object):
self.form_config_singleton = form_config
return form_config
def run(self, listen_addr='0.0.0.0', listen_port=80):
def run(self, listen_addr='0.0.0.0', listen_port=8081):
"""
Start the webserver on address `listen_addr` and port `listen_port`.
This call is blocking until the user hits Ctrl-c, the shutdown() method
@ -187,7 +187,7 @@ def main(): # pragma: no cover
action="store_true", default=False,
help="Generate password")
parser.add_option("-p", "--port", dest="port", action="store", type="int",
default=80, help="Port to listen on (default=80)")
default=8081, help="Port to listen on (default=8081)")
parser.add_option("-f", "--foreground", dest="foreground",
action="store_true", default=False,
help="Run in foreground (debugging)")

Loading…
Cancel
Save