-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds: * Procfile + web.sh to run the web server * Aptfiles with python as a dependency to serve static files * http-server module to serve the generated json files * Used the $TOOl_DATA_DIR in build.js to generate the files in the right path. * Added info in the readme Signed-off-by: David Caro <[email protected]>
- Loading branch information
1 parent
59a591f
commit 0a9ba9e
Showing
6 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# used to serve the static files | ||
python3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
web: scripts/web.sh | ||
update: scripts/update.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,42 @@ The goal of this project is to provide filtered versions of [Wikimedia's site ma | |
The data/ directory contains a prettified JSON file and a minified JSON file for each Wikimedia project. The all.json and all.min.json files include all the Wikimedia wikis, including not only the projects that have their own JSON files but also multilingual and special wikis. | ||
|
||
To update the JSON files, run `make`. | ||
|
||
|
||
## Running on toolforge | ||
To run on toolforge log into the tool accounnt: | ||
``` | ||
ssh [email protected] | ||
myuser@tools-sgebastion-10:$ become wmf-sitematrix | ||
wmf-sitematrix@tools-sgebastion-10:$ | ||
``` | ||
|
||
Start a build to pick up the new code | ||
``` | ||
wmf-sitematrix@tools-sgebastion-10:$ toolforge build start https://github.com/osmlab/wmf-sitematrix | ||
... takes a minute | ||
``` | ||
|
||
|
||
Start/restart the webservice mounting the NFS: | ||
``` | ||
wmf-sitematrix@tools-sgebastion-10:$ toolforge webservice buildservice --mount=all restart | ||
``` | ||
|
||
And create the job if it's not there to update `public_html/data/*json`: | ||
``` | ||
wmf-sitematrix@tools-sgebastion-10:$ toolforge jobs run \ | ||
--schedule '0 0 */15 * *' \ | ||
--filelog \ | ||
--mount=all \ | ||
--image tool-wmf-sitematrix/tool-wmf-sitematrix:latest \ | ||
--command 'update' \ | ||
cron-tools.wmf-sitematrix-1 | ||
``` | ||
|
||
Or restart it if it exists and you want to run it right away: | ||
``` | ||
wmf-sitematrix@tools-sgebastion-10:$ toolforge jobs restart cron-tools.wmf-sitematrix-1 | ||
``` | ||
|
||
Otherwise the next run will pull the new code. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
DEST_DIR="$TOOL_DATA_DIR/public_html/data" | ||
|
||
echo "Updating" | ||
|
||
mkdir -p "$DEST_DIR" | ||
wget -O "$DEST_DIR/all.json" 'https://meta.wikimedia.org/w/api.php?action=sitematrix&uselang=en&format=json' | ||
|
||
# For the first run in case there's nothing there | ||
cp --update data/*.json "$DEST_DIR/" | ||
node scripts/build.js | ||
echo "Update finished" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
python -m http.server \ | ||
--bind "0.0.0.0" \ | ||
--directory "$TOOL_DATA_DIR/public_html/data" \ | ||
"$PORT" |