Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tools:hg [2024/07/15 17:40] – darron | tools:hg [2024/07/16 23:26] (current) – darron | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | =====Mercurial===== | + | ====Mercurial==== |
+ | |||
+ | This example install mercurial as a web service. | ||
+ | |||
+ | ===Install=== | ||
< | < | ||
Line 5: | Line 9: | ||
</ | </ | ||
- | ====Resources==== | + | |
+ | ===UWSGI=== | ||
+ | |||
+ | ==Test== | ||
+ | |||
+ | __Application__ | ||
+ | |||
+ | foobar.py | ||
+ | < | ||
+ | def application(env, | ||
+ | start_response(' | ||
+ | return [b" | ||
+ | </ | ||
+ | |||
+ | __Server__ | ||
+ | < | ||
+ | uwsgi --plugins http, | ||
+ | </ | ||
+ | |||
+ | __Client__ | ||
+ | < | ||
+ | $ telnet 127.0.0.1 9090 | ||
+ | Trying 127.0.0.1... | ||
+ | Connected to 127.0.0.1. | ||
+ | Escape character is ' | ||
+ | HEAD / HTTP/1.0 | ||
+ | |||
+ | HTTP/1.0 200 OK | ||
+ | Content-Type: | ||
+ | |||
+ | Hello World | ||
+ | </ | ||
+ | |||
+ | ===Run it=== | ||
+ | |||
+ | ==CGI== | ||
+ | |||
+ | __/ | ||
+ | |||
+ | < | ||
+ | config = b"/ | ||
+ | import os | ||
+ | os.environ[" | ||
+ | import cgitb; cgitb.enable() | ||
+ | from mercurial import demandimport; | ||
+ | from mercurial.hgweb import hgweb | ||
+ | application = hgweb(config) | ||
+ | </ | ||
+ | |||
+ | ==CONF== | ||
+ | |||
+ | __/ | ||
+ | < | ||
+ | [collections] | ||
+ | / | ||
+ | |||
+ | [web] | ||
+ | staticurl = /static/ | ||
+ | allow_archive = gz | ||
+ | </ | ||
+ | |||
+ | ==RUN== | ||
+ | |||
+ | __http__ | ||
+ | < | ||
+ | #! /bin/bash | ||
+ | |||
+ | #LOG | ||
+ | exec 2>& | ||
+ | ulimit -l unlimited | ||
+ | ulimit -i unlimited | ||
+ | ulimit -q unlimited | ||
+ | ulimit -n 8192 | ||
+ | ulimit -aH | ||
+ | |||
+ | #RUN | ||
+ | export TZ=" | ||
+ | exec /bin/uwsgi --die-on-term --plugins http, | ||
+ | </ | ||
+ | |||
+ | |||
+ | __UWSGI__ | ||
+ | |||
+ | < | ||
+ | #! /bin/bash | ||
+ | |||
+ | #LOG | ||
+ | exec 2>& | ||
+ | ulimit -l unlimited | ||
+ | ulimit -i unlimited | ||
+ | ulimit -q unlimited | ||
+ | ulimit -n 8192 | ||
+ | ulimit -aH | ||
+ | |||
+ | #RUN | ||
+ | export TZ=" | ||
+ | mkdir -p / | ||
+ | chown -R www-data: | ||
+ | exec /bin/uwsgi --die-on-term --plugins python3 --uwsgi-socket / | ||
+ | </ | ||
+ | ===NGINX=== | ||
+ | |||
+ | < | ||
+ | ... | ||
+ | location / { | ||
+ | uwsgi_pass unix:/ | ||
+ | include uwsgi_params; | ||
+ | |||
+ | limit_except GET HEAD { | ||
+ | auth_basic " | ||
+ | auth_basic_user_file / | ||
+ | } | ||
+ | } | ||
+ | |||
+ | location /static/ { | ||
+ | alias / | ||
+ | expires 30d; | ||
+ | } | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | ===Resources=== | ||
[[https:// | [[https:// | ||
+ | [[https:// |