Skip to content

Commit 78f1acf

Browse files
authored
[T279538.3] Add example docker compose yml (#117)
* Add example docker compose yml
1 parent 35c7b91 commit 78f1acf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+524
-78
lines changed

.env

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
WIKIBASE_BRANCH_NAME=master
22
MEDIAWIKI_BRANCH_NAME=master
3-
QUERYSERVICE_VERSION=0.3.40
3+
WDQS_VERSION=0.3.40
44

55
MEDIAWIKI_MAJOR_VERSION=1.36
66
MEDIAWIKI_VERSION=1.36.0

.github/workflows/built_and_test.yml

+14-14
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ jobs:
265265
if-no-files-found: error
266266
path: artifacts/quickstatements.docker.tar.gz
267267

268-
build_queryservice:
268+
build_wdqs:
269269
runs-on: ubuntu-latest
270270
steps:
271271
- uses: actions/checkout@v2
@@ -278,17 +278,17 @@ jobs:
278278
with:
279279
env-file: ${{ env.env_file }}
280280

281-
- name: Cache queryservice service tar
281+
- name: Cache wdqs service tar
282282
uses: actions/cache@v2
283283
env:
284284
cache-name: cache-wdqs-backend-git-repo
285285
with:
286286
path: cache
287287
key: cache-wdqs-backend-git-repo
288288

289-
- name: Build QueryService Image
289+
- name: Build WDQS Image
290290
id: download_step
291-
run: bash build.sh queryservice ${{ env.env_file }}
291+
run: bash build.sh wdqs ${{ env.env_file }}
292292

293293
- name: Login to GitHub Container Registry
294294
uses: docker/login-action@v1
@@ -301,13 +301,13 @@ jobs:
301301
if: github.ref == 'refs/heads/main'
302302
uses: wmde/tag-push-ghcr-action@v3
303303
with:
304-
image_name: ${{ env.QUERYSERVICE_IMAGE_NAME }}
304+
image_name: ${{ env.WDQS_IMAGE_NAME }}
305305
tag: latest
306306

307307
- name: Store workflow id image on GHCR
308308
uses: wmde/tag-push-ghcr-action@v3
309309
with:
310-
image_name: ${{ env.QUERYSERVICE_IMAGE_NAME }}
310+
image_name: ${{ env.WDQS_IMAGE_NAME }}
311311
tag: ${{ github.run_id }}
312312

313313
- name: Archive docker production artifacts
@@ -335,7 +335,7 @@ jobs:
335335
if-no-files-found: error
336336
path: artifacts/wdqs-proxy.docker.tar.gz
337337

338-
build_queryservice_ui:
338+
build_wdqs_frontend:
339339
runs-on: ubuntu-latest
340340
steps:
341341
- uses: actions/checkout@v2
@@ -356,15 +356,15 @@ jobs:
356356
path: git_cache
357357
key: cache-wdqs-frontend-git-repo
358358

359-
- name: Build QueryService UI
360-
run: bash build.sh queryservice-ui ${{ env.env_file }}
359+
- name: Build WDQS-frontend
360+
run: bash build.sh wdqs-frontend ${{ env.env_file }}
361361

362362
- name: Archive metadata artifacts
363363
uses: actions/upload-artifact@v2
364364
with:
365365
name: BuildMetadata
366366
if-no-files-found: error
367-
path: artifacts/build_metadata_wdqs_ui.env
367+
path: artifacts/build_metadata_wdqs_frontend.env
368368

369369
- name: Archive tar production artifacts
370370
uses: actions/upload-artifact@v2
@@ -391,13 +391,13 @@ jobs:
391391
if: github.ref == 'refs/heads/main'
392392
uses: wmde/tag-push-ghcr-action@v3
393393
with:
394-
image_name: ${{ env.QUERYSERVICE_UI_IMAGE_NAME }}
394+
image_name: ${{ env.WDQS_FRONTEND_IMAGE_NAME }}
395395
tag: latest
396396

397397
- name: Store workflow id image on GHCR
398398
uses: wmde/tag-push-ghcr-action@v3
399399
with:
400-
image_name: ${{ env.QUERYSERVICE_UI_IMAGE_NAME }}
400+
image_name: ${{ env.WDQS_FRONTEND_IMAGE_NAME }}
401401
tag: ${{ github.run_id }}
402402

403403
build_elasticsearch:
@@ -451,9 +451,9 @@ jobs:
451451
databaseImageName: [ 'mysql:5.6', 'mariadb:10.3' ]
452452
needs:
453453
- build_wikibase_bundle
454-
- build_queryservice
454+
- build_wdqs
455455
- build_elasticsearch
456-
- build_queryservice_ui
456+
- build_wdqs_frontend
457457
- build_wdqs_proxy
458458
- build_quickstatements
459459
runs-on: ubuntu-latest

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Wikibase.tar.gz
99

1010
Docker/build/Wikibase/artifacts
1111

12-
Docker/build/QueryService/wait-for-it.sh
12+
Docker/build/WDQS/wait-for-it.sh
1313

1414
#temp
1515
Docker/**/*.tar.gz
File renamed without changes.

Docker/build/WDQS/wait-for-it.sh

+176
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
#!/usr/bin/env bash
2+
# Use this script to test if a given TCP host/port are available
3+
# shellcheck disable=SC2064,SC2086,SC2206,SC2124,SC2230,SC2046
4+
cmdname=$(basename $0)
5+
6+
echoerr() { if [[ $QUIET -ne 1 ]]; then echo "$@" 1>&2; fi }
7+
8+
usage()
9+
{
10+
cat << USAGE >&2
11+
Usage:
12+
$cmdname host:port [-s] [-t timeout] [-- command args]
13+
-h HOST | --host=HOST Host or IP under test
14+
-p PORT | --port=PORT TCP port under test
15+
Alternatively, you specify the host and port as host:port
16+
-s | --strict Only execute subcommand if the test succeeds
17+
-q | --quiet Don't output any status messages
18+
-t TIMEOUT | --timeout=TIMEOUT
19+
Timeout in seconds, zero for no timeout
20+
-- COMMAND ARGS Execute command with args after the test finishes
21+
USAGE
22+
exit 1
23+
}
24+
25+
wait_for()
26+
{
27+
if [[ $TIMEOUT -gt 0 ]]; then
28+
echoerr "$cmdname: waiting $TIMEOUT seconds for $HOST:$PORT"
29+
else
30+
echoerr "$cmdname: waiting for $HOST:$PORT without a timeout"
31+
fi
32+
start_ts=$(date +%s)
33+
while :
34+
do
35+
if [[ $ISBUSY -eq 1 ]]; then
36+
nc -z $HOST $PORT
37+
result=$?
38+
else
39+
(echo > /dev/tcp/$HOST/$PORT) >/dev/null 2>&1
40+
result=$?
41+
fi
42+
if [[ $result -eq 0 ]]; then
43+
end_ts=$(date +%s)
44+
echoerr "$cmdname: $HOST:$PORT is available after $((end_ts - start_ts)) seconds"
45+
break
46+
fi
47+
sleep 1
48+
done
49+
return $result
50+
}
51+
52+
wait_for_wrapper()
53+
{
54+
# In order to support SIGINT during timeout: http://unix.stackexchange.com/a/57692
55+
if [[ $QUIET -eq 1 ]]; then
56+
timeout $BUSYTIMEFLAG $TIMEOUT $0 --quiet --child --host=$HOST --port=$PORT --timeout=$TIMEOUT &
57+
else
58+
timeout $BUSYTIMEFLAG $TIMEOUT $0 --child --host=$HOST --port=$PORT --timeout=$TIMEOUT &
59+
fi
60+
PID=$!
61+
trap "kill -INT -$PID" INT
62+
wait $PID
63+
RESULT=$?
64+
if [[ $RESULT -ne 0 ]]; then
65+
echoerr "$cmdname: timeout occurred after waiting $TIMEOUT seconds for $HOST:$PORT"
66+
fi
67+
return $RESULT
68+
}
69+
70+
# process arguments
71+
while [[ $# -gt 0 ]]
72+
do
73+
case "$1" in
74+
*:* )
75+
hostport=(${1//:/ })
76+
HOST=${hostport[0]}
77+
PORT=${hostport[1]}
78+
shift 1
79+
;;
80+
--child)
81+
CHILD=1
82+
shift 1
83+
;;
84+
-q | --quiet)
85+
QUIET=1
86+
shift 1
87+
;;
88+
-s | --strict)
89+
STRICT=1
90+
shift 1
91+
;;
92+
-h)
93+
HOST="$2"
94+
if [[ $HOST == "" ]]; then break; fi
95+
shift 2
96+
;;
97+
--host=*)
98+
HOST="${1#*=}"
99+
shift 1
100+
;;
101+
-p)
102+
PORT="$2"
103+
if [[ $PORT == "" ]]; then break; fi
104+
shift 2
105+
;;
106+
--port=*)
107+
PORT="${1#*=}"
108+
shift 1
109+
;;
110+
-t)
111+
TIMEOUT="$2"
112+
if [[ $TIMEOUT == "" ]]; then break; fi
113+
shift 2
114+
;;
115+
--timeout=*)
116+
TIMEOUT="${1#*=}"
117+
shift 1
118+
;;
119+
--)
120+
shift
121+
CLI="$@"
122+
break
123+
;;
124+
--help)
125+
usage
126+
;;
127+
*)
128+
echoerr "Unknown argument: $1"
129+
usage
130+
;;
131+
esac
132+
done
133+
134+
if [[ "$HOST" == "" || "$PORT" == "" ]]; then
135+
echoerr "Error: you need to provide a host and port to test."
136+
usage
137+
fi
138+
139+
TIMEOUT=${TIMEOUT:-15}
140+
STRICT=${STRICT:-0}
141+
CHILD=${CHILD:-0}
142+
QUIET=${QUIET:-0}
143+
144+
# check to see if timeout is from busybox?
145+
TIMEOUT_PATH=$(realpath $(which timeout))
146+
if [[ $TIMEOUT_PATH =~ "busybox" ]]; then
147+
ISBUSY=1
148+
BUSYTIMEFLAG="-t"
149+
else
150+
ISBUSY=0
151+
BUSYTIMEFLAG=""
152+
fi
153+
154+
if [[ $CHILD -gt 0 ]]; then
155+
wait_for
156+
RESULT=$?
157+
exit $RESULT
158+
else
159+
if [[ $TIMEOUT -gt 0 ]]; then
160+
wait_for_wrapper
161+
RESULT=$?
162+
else
163+
wait_for
164+
RESULT=$?
165+
fi
166+
fi
167+
168+
if [[ $CLI != "" ]]; then
169+
if [[ $RESULT -ne 0 && $STRICT -eq 1 ]]; then
170+
echoerr "$cmdname: strict mode, refusing to execute subprocess"
171+
exit $RESULT
172+
fi
173+
exec $CLI
174+
else
175+
exit $RESULT
176+
fi

Docker/publish/tag_git/tag_git.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ function echo_tag {
3333
# tag and push Wikibase
3434
echo_tag "$METADATA_WIKIBASE_COMMIT_HASH" "Wikibase"
3535

36-
# tag and push queryservice ui
37-
echo_tag "$METADATA_WDQS_UI_COMMIT_HASH" "Queryservice UI"
36+
# tag and push wdqs-frontend
37+
echo_tag "$METADATA_WDQS_UI_COMMIT_HASH" "WDQS frontend"
3838

3939
# tag and push WikibaseManifest
4040
echo_tag "$METADATA_WIKIBASEMANIFEST_COMMIT_HASH" "Wikibase Manifest"

Docker/publish/upload_dockerhub/publish.sh

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
#!/bin/bash
22
set -e
33

4-
if [ -z "$QUERYSERVICE_BACKEND_DOCKER_PATH" ] || \
5-
[ -z "$QUERYSERVICE_FRONTEND_DOCKER_PATH" ] || \
4+
if [ -z "$WDQS_DOCKER_PATH" ] || \
5+
[ -z "$WDQS_FRONTEND_DOCKER_PATH" ] || \
66
[ -z "$WIKIBASE_DOCKER_PATH" ] || \
77
[ -z "$WIKIBASE_BUNDLE_DOCKER_PATH" ] || \
88
[ -z "$ELASTICSEARCH_DOCKER_PATH" ] || \
99
[ -z "$QUICKSTATEMENTS_DOCKER_PATH" ] || \
1010
[ -z "$WDQS_PROXY_DOCKER_PATH" ] || \
1111
\
12+
[ -z "$WDQS_FRONTEND_IMAGE_NAME" ] || \
13+
[ -z "$WDQS_IMAGE_NAME" ] || \
1214
[ -z "$WDQS_PROXY_IMAGE_NAME" ] || \
13-
[ -z "$QUERYSERVICE_UI_IMAGE_NAME" ] || \
14-
[ -z "$QUERYSERVICE_IMAGE_NAME" ] || \
1515
[ -z "$WIKIBASE_IMAGE_NAME" ] || \
1616
[ -z "$WIKIBASE_BUNDLE_IMAGE_NAME" ] || \
1717
[ -z "$ELASTICSEARCH_IMAGE_NAME" ] || \
1818
[ -z "$QUICKSTATEMENTS_IMAGE_NAME" ] || \
1919
\
2020
[ -z "$RELEASE_VERSION" ] || \
2121
[ -z "$WMDE_RELEASE_VERSION" ] || \
22-
[ -z "$QUERYSERVICE_VERSION" ] || \
22+
[ -z "$WDQS_VERSION" ] || \
2323
[ -z "$ELASTICSEARCH_VERSION" ] || \
2424
\
2525
[ -z "$DOCKER_HUB_ID" ] || \
@@ -59,20 +59,20 @@ echo "$DOCKER_HUB_ACCESS_TOKEN" | docker login --username "$DOCKER_HUB_ID" --pas
5959
# load images
6060
docker load -i "$WIKIBASE_DOCKER_PATH"
6161
docker load -i "$WIKIBASE_BUNDLE_DOCKER_PATH"
62-
docker load -i "$QUERYSERVICE_BACKEND_DOCKER_PATH"
63-
docker load -i "$QUERYSERVICE_FRONTEND_DOCKER_PATH"
62+
docker load -i "$WDQS_DOCKER_PATH"
63+
docker load -i "$WDQS_FRONTEND_DOCKER_PATH"
6464
docker load -i "$ELASTICSEARCH_DOCKER_PATH"
6565
docker load -i "$QUICKSTATEMENTS_DOCKER_PATH"
6666
docker load -i "$WDQS_PROXY_DOCKER_PATH"
6767

6868
# Tag Queryservice Proxy with version
6969
tag_and_push "$WDQS_PROXY_IMAGE_NAME" "$WMDE_RELEASE_VERSION"
7070

71-
# Tag Queryservice UI with version
72-
tag_and_push "$QUERYSERVICE_UI_IMAGE_NAME" "$WMDE_RELEASE_VERSION"
71+
# Tag WDQS-frontend with version
72+
tag_and_push "$WDQS_FRONTEND_IMAGE_NAME" "$WMDE_RELEASE_VERSION"
7373

74-
# Tag Queryservice with version
75-
tag_and_push "$QUERYSERVICE_IMAGE_NAME" "$QUERYSERVICE_VERSION-$WMDE_RELEASE_VERSION"
74+
# Tag WDQS with version
75+
tag_and_push "$WDQS_IMAGE_NAME" "$WDQS_VERSION-$WMDE_RELEASE_VERSION"
7676

7777
# Tag Wikibase with version
7878
tag_and_push "$WIKIBASE_IMAGE_NAME" "$RELEASE_VERSION-$WMDE_RELEASE_VERSION"

Docker/test/curl/test_curl.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ check_if_up() {
2020

2121
check_if_up "$WIKIBASE_SERVER" "/wiki/Main_Page"
2222

23-
check_if_up "$QUERYSERVICE_SERVER" "/bigdata/namespace/wdq/sparql"
23+
check_if_up "$WDQS_SERVER" "/bigdata/namespace/wdq/sparql"
2424

25-
check_if_up "$QUERYSERVICE_UI_SERVER" "/"
25+
check_if_up "$WDQS_FRONTEND_SERVER" "/"

Docker/test/selenium/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
- [ ] add a statement
1010
- [ ] add a qualifier
1111
- [ ] add a reference
12-
## Wikibase & QueryService/QueryService UI
12+
## Wikibase & WDQS/WDQS-frontend
1313
- [x] Create an item on Wikibase, and verify it can be found on Query Service (including the label etc)
1414
- [x] Delete an item on Wikibase, and verify that the item isn’t there on the query service any more
1515
- [x] Create an item with a statement and verify that querying using prefixes work correctly (wdt:P1 etc.. )
@@ -30,7 +30,7 @@
3030
## Wikibase Federated properties (using wikidata.org as source wiki)
3131
- [X] Create an item on Wikibase and add a statement using a federated property
3232
- [X] verify it is available with the correct rdf through the Entity page
33-
- [X] verify it is available through the QueryService with the correct prefixes
33+
- [X] verify it is available through the WDQS-frontend with the correct prefixes
3434

3535
## Elasticsearch
3636
- [X] Create item with an alias and search by item alias

0 commit comments

Comments
 (0)