RESTBase/Installation/nan



Hā-tsài RESTbase guân-tāi-bé
You can do this operation from any folder where you have permissions.

Uì git hā-tsài: Alternatively, download the zip from the project repository and extract it.

Install node dependencies
RESTBase has been tested with node.js version 10.

From the restbase project directory, install the Node dependencies using npm (part of nodejs):

Phuè-tī
Hok-tsè sī-lē phuè-tī

Teh tsia-ê pōo-hūn pian-tsip config.yaml ê bûn-kiānn:


 * You don't need to change anything nor worry about this section unless you run a private wiki (see question).


 * is the base domain of your wiki (or identifier if you have several wikis at different paths of the same domain). For example, MediaWiki's base URL is . It's used as an identifier path in case you use the same server for multiple wikis. For use with Parsoid in MediaWiki 1.35+, the domain must match exactly the host portion of your wiki's   configuration.


 * is the location of your wiki's . For example, MediaWiki's API endpoint is mediawiki.org/w/api.php. Tsham-ua̍t.
 * is the endpoint as it can be accessed from the Internet. If you proxy the traffic directly from apache/nginx to this service, you may use a URL like . This is recommended, to avoid problems for people that can't access non-standard ports.


 * For MediaWiki 1.35 and later,  is the location of your wiki's  . For example, MediaWiki's REST endpoint is mediawiki.org/w/rest.php. Tsham-ua̍t.
 * 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 sú-iōng   tsiânn-tsò i-ê bi̍k-jīm-tī.


 * 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  file in case the  is not installed for the wiki:



Ūn-hîng sī-ho̍k-khì hām tshik-tshì
To test that it runs, from the RESTBase folder run: For testing, while it's running, on another terminal execute: If everything is configured appropriately, 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. Kî-thann ê tshik-tshì tshiánn tsham-khó GitHub.



Lû-kó Restbase ê tuann-kháu hông that-tiâu
If you do not see the page (your browser says it can't connect), your restbase server port may be blocked. Tshiánn tsip-hîng hā-liat tshau-tsok:


 * If you get, your restbase server port is ok.
 * Lû-kó lí nā-bô tit-tio̍h, tshiánn tsip-hîng hā-liat ê tshau-tsok:
 * 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, run. It will open a text editor. Fill it with the following contents:

Replace  with the path to your restbase project directory.

To automatically start the RESTBase server at system startup, Khòng-tsè RESTBase sī-ho̍k-khí,



Uì lí-ê bāng-lōo ho̍k-bū-khì kàu RESTBase ê tāi-lí iau-kiû
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.

Nginx
Teh it-puann ê phuè-tī: Teh  khu-tè: {{#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:

Tshik-tshì
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.

