RESTBase/Installation/ja

RESTbase ソースのダウンロード
この操作は、自分が権限を持っているあらゆるフォルダーで実施できます.

Git からダウンロードします: または、プロジェクトのリポジトリから ZIP ファイルをダウンロードして展開します.

restbase プロジェクトのディレクトリから、npm (nodejs の一部) を使用して Node の依存関係をインストールします.

設定
サンプル設定をコピーします:

config.yaml ファイルの以下の部分を編集します:


 * 非公開ウィキを運営していない限り、この節を変更したり気にしたりする必要はありません (質問を参照).


 * はあなたのウィキのベース ドメインです (同じドメインの異なるパスに複数のウィキがある場合は識別子). 例えば、MediaWiki のベース URL は   です.  これは、同じサーバーを複数のウィキで使用する場合に、識別子のパスとして使用されます.  MediaWiki 1.35 以降の Parsoid で使用するためには、ドメインはウィキの   構成のホスト部分と正確に一致しなければなりません.


 * は、あなたのウィキの  の位置です.  例えば、MediaWiki の API エンドポイントは mediawiki.org/w/api.php です.  を参照してください.
 * インターネットからアクセスできるため、 がエンドポイントです.  apache/nginx からこのサービスに直接トラフィックをプロキシする場合は、  のような URL を使用できます.  非標準のポートにアクセスできない人の問題を避けるために、これを推奨します.


 * MediaWiki 1.35 以降では、 は、あなたのウィキの   の場所です.  例えば、MediaWiki の REST エンドポイントは mediawiki.org/w/rest.php です.   を参照してください.
 * In MediaWiki 1.34 and earlier, using, the  entry must correspond to the URL and port of your Parsoid server. If your Parsoid and RESTBase servers are on the same machine, then   is a valid URL, but you will typically need to add the appropriate port number. Parsoid/JS used   as its default.


 * dbname: RESTBase will use by default a sqlite database for storing cached data. The file in the example script is named db.sqlite3 and is located in the same directory of the RESTBase folder. If you later want to run RESTBase as a service, you'll want to put the database on a different folder where the user running the service would have write permissions. For this you can change the line to:  (and ensuring the user account running the service has permissions to write on it). Please note: You must manually add   parameter since they introduced storage groups for SQLite (see 225579).

If you want to serve requests from multiple wikis on the same RESTBase server, you should copy and replicate the entire section, changing configurations as needed.
 * In MediaWiki 1.35 and later you need to call Parsoid via your "LocalSettings.php" file in case the is not installed for the wiki:

Run the server and Test
To test that it runs, from the RESTBase folder run: For testing, while it's running, on another terminal execute: You should see the HTML content of the Main_Page. In a browser you can also test by navigating to and you should see a page titled Wikimedia REST API. On this page you can test all manner of RESTBase methods and variables. For other testing refer to GitHub.

If Restbase Port is blocked
If you do not see the page (your browser says it can't connect), your restbase server port may be blocked. Do the following:


 * If you get, your restbase server port is ok.
 * If you did not get, then do:
 * If you get  the restbase server is not bad, but you cannot access the port.

To bypass the block, you can set proxypass to your Apache httpd configuration. See the Proxy requests to RESTBase from your webserver section for instructions.

Starting RESTBase Server automatically
Create a new user for the RESTBase service (optional, but recommended to avoid running it as root) and create a home folder for that user: For installing the RESTBase server as a service with systemd, create this file in the  directory (  for CentOS 7 and   for openSUSE) and name it. Replace  with the path to your restbase project directory.

To automatically start the RESTBase server at system startup, To control the RESTBase server, If you ever change the  script, you need to reload it with,

Proxy requests to RESTBase from your webserver
RESTBase must be accessible from the visitors of your site for some functions to work properly. Having RESTBase on a non-standard http port is problematic for some users behind a corporate proxy or firewall. To solve this, and specially to serve requests to RESTBase through HTTPS, you should set up a reverse-proxy on your webserver that would route requests at a given path of your wiki to the RESTBase server.

Apache
If you use apache, you can make a  file like this, and put on   of YOUR_RESTBASE_SERVER.

Nginx
On the general configuration: Inside the  block: {{#tag:syntaxhighlight| {{tmpl|0= location /$1/v1/ {
 * 1) Alternate configuration like WMF to have URLS like //example.com/api/rest_v1/
 * 2) location /api/rest_v1/ {

proxy_pass http://restbase/$1/v1/$restbasequery; } }} }}
 * 1 = YOUR_WIKI_WEBSITE
 * lang = "nginx"

Configuring config.yaml for WMF like URLS
If you don't want to get a fetch error when using WMF like URLS, you should add  to the   module like so:

Testing
You should restart httpd (by  or some means). In a browser you can now navigate to:

(alternate url like WMF setup):

and you should see a page titled Wikimedia REST API. And in this setting, you should add below to  for VisualEditor.