差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン 次のリビジョン両方とも次のリビジョン | ||
python:moinmoin [2019/08/09 19:31] – ともやん | python:moinmoin [2020/03/10 10:26] – ともやん | ||
---|---|---|---|
行 1: | 行 1: | ||
- | <ifauth !@loggedinusers>< | ||
- | <script async src="// | ||
- | < | ||
- | | ||
- | google_ad_client: | ||
- | enable_page_level_ads: | ||
- | }); | ||
- | </ | ||
< | < | ||
< | < | ||
行 13: | 行 5: | ||
overflow: scroll; | overflow: scroll; | ||
overflow-x: hidden; | overflow-x: hidden; | ||
+ | font-size: 12px; | ||
+ | } | ||
+ | # | ||
+ | height: 200px; | ||
+ | overflow: scroll; | ||
+ | overflow-x: hidden; | ||
+ | font-size: 12px; | ||
} | } | ||
</ | </ | ||
行 31: | 行 30: | ||
==== ダウンロード ==== | ==== ダウンロード ==== | ||
+ | [[https:// | ||
< | < | ||
> git clone https:// | > git clone https:// | ||
行 37: | 行 37: | ||
==== quickinstall.py を venv を利用するようにハックする ==== | ==== quickinstall.py を venv を利用するようにハックする ==== | ||
GitHub からダウンロードした **quickinstall.py** をリネームする。\\ | GitHub からダウンロードした **quickinstall.py** をリネームする。\\ | ||
+ | **Linux**\\ | ||
+ | < | ||
+ | $ cd moin | ||
+ | $ mv quickinstall.py quickinstall.py.org | ||
+ | </ | ||
+ | **Windows**\\ | ||
< | < | ||
> cd moin | > cd moin | ||
行 42: | 行 48: | ||
</ | </ | ||
以下の **quickinstall.py** を **moin** ディレクトリにダウンロードする。(**quickinstall.py** を差し替える)\\ | 以下の **quickinstall.py** を **moin** ディレクトリにダウンロードする。(**quickinstall.py** を差し替える)\\ | ||
- | <WRAP prewrap 100% #result> | + | < |
+ | $ curl -O https:// | ||
+ | $ chmod 775 quickinstall.py | ||
+ | </ | ||
+ | <WRAP prewrap 100% #source_code> | ||
<file python moin/ | <file python moin/ | ||
# | # | ||
行 99: | 行 109: | ||
import fnmatch | import fnmatch | ||
from collections import Counter | from collections import Counter | ||
- | #try: | + | try: |
- | # | + | import virtualenv |
- | #except ImportError: | + | except ImportError: |
- | # | + | sys.exit(""" |
- | #Error: import virtualenv failed, either virtualenv is not installed (see installation docs) | + | Error: import virtualenv failed, either virtualenv is not installed (see installation docs) |
- | #or the virtual environment must be deactivated before rerunning quickinstall.py | + | or the virtual environment must be deactivated before rerunning quickinstall.py |
- | #""" | + | """ |
- | import venv | + | |
if sys.hexversion < 0x3050000: | if sys.hexversion < 0x3050000: | ||
行 459: | 行 468: | ||
if wiki_exists(): | if wiki_exists(): | ||
command = ' | command = ' | ||
- | print(' | + | print(' |
try: | try: | ||
subprocess.call(command, | subprocess.call(command, | ||
行 637: | 行 646: | ||
base, source_name = os.path.split(source) | base, source_name = os.path.split(source) | ||
executable = os.path.basename(sys.executable).split(' | executable = os.path.basename(sys.executable).split(' | ||
- | | + | venv = os.path.join(base, |
- | | + | venv = os.path.abspath(venv) |
- | | + | venv_home, venv_lib, venv_inc, venv_bin = virtualenv.path_locations(venv) |
- | venv_home = os.path.join(base, | + | |
- | venv_home = os.path.abspath(venv_home) | + | |
- | self.builder = venv.EnvBuilder(with_pip=True) | + | |
- | context = self.builder.ensure_directories(venv_home) | + | |
- | venv_home, venv_lib, venv_inc, venv_bin = ( | + | |
- | context.env_dir, | + | |
- | os.path.join(context.env_dir, | + | |
- | context.inc_path, | + | |
- | context.bin_path) | + | |
self.dir_venv = venv_home | self.dir_venv = venv_home | ||
self.dir_venv_bin = venv_bin | self.dir_venv_bin = venv_bin | ||
行 660: | 行 660: | ||
def do_venv(self): | def do_venv(self): | ||
- | | + | virtualenv.create_environment(self.dir_venv) |
- | self.builder.create(self.dir_venv) | + | |
def get_pip_version(self): | def get_pip_version(self): | ||
行 726: | 行 725: | ||
choices.add(name) | choices.add(name) | ||
args = sys.argv[:] | args = sys.argv[:] | ||
- | args[0] = os.path.basename(args[0]) | ||
if len(args) > 2 and args[-1] == ' | if len(args) > 2 and args[-1] == ' | ||
行 786: | 行 784: | ||
==== インストール ==== | ==== インストール ==== | ||
**quickinstall.py** を実行する。\\ | **quickinstall.py** を実行する。\\ | ||
+ | **Linux**\\ | ||
< | < | ||
- | > python | + | $ python3 |
</ | </ | ||
<WRAP prewrap 100% #result> | <WRAP prewrap 100% #result> | ||
< | < | ||
- | Searching m-quickinstall.txt, | + | Running quickinstall.py... output messages redirected to m-quickinstall.txt |
+ | |||
+ | Searching m-quickinstall.txt, | ||
83 | 83 | ||
119 Successfully installed Babel-2.7.0 Flask-1.1.1 Flask-Babel-0.12.2 Flask-Caching-1.7.2 Flask-Script-2.0.6 Flask-Theme-0.3.4 Jinja2-2.10.1 Markdown-3.1.1 MarkupSafe-1.1.1 Werkzeug-0.15.5 XStatic-1.0.2 XStatic-AnyWikiDraw-0.14.2 XStatic-Bootstrap-3.1.1.2 XStatic-CKEditor-3.6.4.0 XStatic-Font-Awesome-4.7.0.0 XStatic-JQuery.TableSorter-2.14.5.1 XStatic-Pygments-2.2.0.1 XStatic-TWikiDraw-moin-2004.10.23.2 XStatic-autosize-1.17.2.1 XStatic-jQuery-3.3.1.1 XStatic-jQuery-File-Upload-4.4.2 XStatic-svg-edit-moin-2012.11.27.1 blinker-1.4 chardet-3.0.4 click-7.0 docutils-0.15.2 emeraldtree-0.10.0 flatland-0.9.1 itsdangerous-1.1.0 moin passlib-1.7.1 pdfminer3-2018.12.3.0 pycryptodome-3.8.2 pygments-2.4.2 pytz-2019.2 setuptools-41.0.1 six-1.12.0 sortedcontainers-2.1.0 whoosh-2.7.4 | 119 Successfully installed Babel-2.7.0 Flask-1.1.1 Flask-Babel-0.12.2 Flask-Caching-1.7.2 Flask-Script-2.0.6 Flask-Theme-0.3.4 Jinja2-2.10.1 Markdown-3.1.1 MarkupSafe-1.1.1 Werkzeug-0.15.5 XStatic-1.0.2 XStatic-AnyWikiDraw-0.14.2 XStatic-Bootstrap-3.1.1.2 XStatic-CKEditor-3.6.4.0 XStatic-Font-Awesome-4.7.0.0 XStatic-JQuery.TableSorter-2.14.5.1 XStatic-Pygments-2.2.0.1 XStatic-TWikiDraw-moin-2004.10.23.2 XStatic-autosize-1.17.2.1 XStatic-jQuery-3.3.1.1 XStatic-jQuery-File-Upload-4.4.2 XStatic-svg-edit-moin-2012.11.27.1 blinker-1.4 chardet-3.0.4 click-7.0 docutils-0.15.2 emeraldtree-0.10.0 flatland-0.9.1 itsdangerous-1.1.0 moin passlib-1.7.1 pdfminer3-2018.12.3.0 pycryptodome-3.8.2 pygments-2.4.2 pytz-2019.2 setuptools-41.0.1 six-1.12.0 sortedcontainers-2.1.0 whoosh-2.7.4 | ||
- | 131 Successfully created or updated venv at c: | + | 131 Successfully created or updated venv at / |
- | > > > Type " | + | > > > Type "./m" for menu < < < |
+ | </ | ||
+ | </ | ||
+ | **Windows**\\ | ||
+ | < | ||
+ | > python quickinstall.py | ||
+ | </ | ||
+ | <WRAP prewrap 100% # | ||
+ | < | ||
+ | Searching m-quickinstall.txt, | ||
+ | |||
+ | 83 | ||
+ | 119 Successfully installed Babel-2.7.0 Flask-1.1.1 Flask-Babel-0.12.2 Flask-Caching-1.7.2 Flask-Script-2.0.6 Flask-Theme-0.3.4 Jinja2-2.10.1 Markdown-3.1.1 MarkupSafe-1.1.1 Werkzeug-0.15.6 XStatic-1.0.2 XStatic-AnyWikiDraw-0.14.2 XStatic-Bootstrap-3.1.1.2 XStatic-CKEditor-3.6.4.0 XStatic-Font-Awesome-4.7.0.0 XStatic-JQuery.TableSorter-2.14.5.1 XStatic-Pygments-2.2.0.1 XStatic-TWikiDraw-moin-2004.10.23.2 XStatic-autosize-1.17.2.1 XStatic-jQuery-3.3.1.1 XStatic-jQuery-File-Upload-4.4.2 XStatic-svg-edit-moin-2012.11.27.1 blinker-1.4 chardet-3.0.4 click-7.0 docutils-0.15.2 emeraldtree-0.10.0 flatland-0.9.1 itsdangerous-1.1.0 moin passlib-1.7.1 pdfminer3-2018.12.3.0 pycryptodome-3.9.0 pygments-2.4.2 pytz-2019.2 setuptools-41.2.0 six-1.12.0 sortedcontainers-2.1.0 whoosh-2.7.4 | ||
+ | 131 Successfully created or updated venv at C: | ||
</ | </ | ||
</ | </ | ||
行 810: | 行 824: | ||
menu を実行する。\\ | menu を実行する。\\ | ||
+ | **Linux**\\ | ||
+ | < | ||
+ | $ ./m | ||
+ | </ | ||
+ | **Windows**\\ | ||
< | < | ||
> m | > m | ||
行 844: | 行 863: | ||
==== 空の Wiki を作成 ==== | ==== 空の Wiki を作成 ==== | ||
+ | **Linux**\\ | ||
+ | < | ||
+ | $ ./m new-wiki | ||
+ | </ | ||
+ | **Windows**\\ | ||
< | < | ||
> m new-wiki | > m new-wiki | ||
</ | </ | ||
< | < | ||
+ | Creating a new empty wiki... | ||
+ | Output messages redirected to m-new-wiki.txt. | ||
+ | |||
Success: a new wiki has been created. | Success: a new wiki has been created. | ||
</ | </ | ||
==== moin2 の実行 ==== | ==== moin2 の実行 ==== | ||
+ | **Linux**\\ | ||
+ | < | ||
+ | $ ./m run | ||
+ | </ | ||
+ | **Windows**\\ | ||
< | < | ||
> m run | > m run | ||
行 876: | 行 908: | ||
[[http:// | [[http:// | ||
{{: | {{: | ||
+ | |||
+ | ===== ApacheBench してみる ===== | ||
+ | ローカル簡易実行での ApacheBench の結果。\\ | ||
+ | **Web Server:** Werkzeug/ | ||
+ | **Wiki App:** MoinMoin2\\ | ||
+ | **Lang:** Python 3.7.4\\ | ||
+ | **Web Interface: | ||
+ | <WRAP prewrap 100% #result> | ||
+ | < | ||
+ | > ab -n 1000 -c 100 http:// | ||
+ | This is ApacheBench, | ||
+ | Copyright 1996 Adam Twiss, Zeus Technology Ltd, http:// | ||
+ | Licensed to The Apache Software Foundation, http:// | ||
+ | |||
+ | Benchmarking localhost (be patient) | ||
+ | Completed 100 requests | ||
+ | Completed 200 requests | ||
+ | Completed 300 requests | ||
+ | Completed 400 requests | ||
+ | Completed 500 requests | ||
+ | Completed 600 requests | ||
+ | Completed 700 requests | ||
+ | Completed 800 requests | ||
+ | Completed 900 requests | ||
+ | Completed 1000 requests | ||
+ | Finished 1000 requests | ||
+ | |||
+ | |||
+ | Server Software: | ||
+ | Server Hostname: | ||
+ | Server Port: 8080 | ||
+ | |||
+ | Document Path: /Home | ||
+ | Document Length: | ||
+ | |||
+ | Concurrency Level: | ||
+ | Time taken for tests: | ||
+ | Complete requests: | ||
+ | Failed requests: | ||
+ | | ||
+ | Total transferred: | ||
+ | HTML transferred: | ||
+ | Requests per second: | ||
+ | Time per request: | ||
+ | Time per request: | ||
+ | Transfer rate: 48.51 [Kbytes/ | ||
+ | |||
+ | Connection Times (ms) | ||
+ | min mean[+/-sd] median | ||
+ | Connect: | ||
+ | Processing: | ||
+ | Waiting: | ||
+ | Total: | ||
+ | |||
+ | Percentage of the requests served within a certain time (ms) | ||
+ | 50% 35389 | ||
+ | 66% 37042 | ||
+ | 75% 37648 | ||
+ | 80% 38042 | ||
+ | 90% 38871 | ||
+ | 95% 39403 | ||
+ | 98% 39964 | ||
+ | 99% 40189 | ||
+ | | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | 1 秒間に平均どれくらいのリクエストをさばけるか?\\ | ||
+ | < | ||
+ | Requests per second: | ||
+ | </ | ||
+ | 1リクエストの平均応答時間は?\\ | ||
+ | < | ||
+ | Time per request: | ||
+ | </ | ||
+ | |||
+ | **Web Server:** Apache/ | ||
+ | **Wiki App:** DokuWiki Release 2018-04-22b " | ||
+ | **Lang:** PHP 7.3.3\\ | ||
+ | **Web Interface: | ||
+ | <WRAP prewrap 100% #result> | ||
+ | < | ||
+ | abs -n 1000 -c 100 https:// | ||
+ | This is ApacheBench, | ||
+ | Copyright 1996 Adam Twiss, Zeus Technology Ltd, http:// | ||
+ | Licensed to The Apache Software Foundation, http:// | ||
+ | |||
+ | Benchmarking wiki.monsters-g.local (be patient) | ||
+ | Completed 100 requests | ||
+ | Completed 200 requests | ||
+ | Completed 300 requests | ||
+ | Completed 400 requests | ||
+ | Completed 500 requests | ||
+ | Completed 600 requests | ||
+ | Completed 700 requests | ||
+ | Completed 800 requests | ||
+ | Completed 900 requests | ||
+ | Completed 1000 requests | ||
+ | Finished 1000 requests | ||
+ | |||
+ | |||
+ | Server Software: | ||
+ | Server Hostname: | ||
+ | Server Port: 1443 | ||
+ | SSL/TLS Protocol: | ||
+ | Server Temp Key: ECDH P-256 256 bits | ||
+ | TLS Server Name: wiki.monsters-g.local | ||
+ | |||
+ | Document Path: /start | ||
+ | Document Length: | ||
+ | |||
+ | Concurrency Level: | ||
+ | Time taken for tests: | ||
+ | Complete requests: | ||
+ | Failed requests: | ||
+ | Total transferred: | ||
+ | HTML transferred: | ||
+ | Requests per second: | ||
+ | Time per request: | ||
+ | Time per request: | ||
+ | Transfer rate: 315.21 [Kbytes/ | ||
+ | |||
+ | Connection Times (ms) | ||
+ | min mean[+/-sd] median | ||
+ | Connect: | ||
+ | Processing: | ||
+ | Waiting: | ||
+ | Total: | ||
+ | |||
+ | Percentage of the requests served within a certain time (ms) | ||
+ | 50% 2713 | ||
+ | 66% 3079 | ||
+ | 75% 3954 | ||
+ | 80% 5102 | ||
+ | 90% 11795 | ||
+ | 95% 23513 | ||
+ | 98% 33594 | ||
+ | 99% 40993 | ||
+ | | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | Requests per second: | ||
+ | Time per request: | ||
+ | </ | ||
+ | |||
+ | ===== 参考文献 ===== | ||
+ | [[https:// | ||