-
-
Notifications
You must be signed in to change notification settings - Fork 63
/
test-generate
executable file
·61 lines (55 loc) · 1.79 KB
/
test-generate
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/sh
if [ "$3" = "saml" ] ; then
TEST_EXTRA_ENV='WEBLATE_SAML_IDP_URL: https://example.com/idp'
elif [ "$3" = "celery-single" ] ; then
TEST_EXTRA_ENV='CELERY_SINGLE_PROCESS: 1'
else
TEST_EXTRA_ENV=''
fi
cat > docker-compose.override.yml <<EOT
services:
weblate:
image: ${TEST_CONTAINER:-weblate/weblate:edge}
restart: no
environment:
WEBLATE_TIME_ZONE: Europe/Prague
WEBLATE_SITE_DOMAIN: test.example.com
WEBLATE_SILENCED_SYSTEM_CHECKS: weblate.E003,weblate.E011,weblate.E012,weblate.E013,weblate.E017,security.W004,security.W008,security.W012,security.W018,weblate.I021,weblate.E016,weblate.I028,weblate.C030,otp_webauthn.E031
${TEST_EXTRA_ENV}
ports:
- 8080:8080
- 4443:4443
EOT
if [ "$3" = "split" ] ; then
mv docker-compose-split.yml docker-compose.yml
for service in celery-backup celery-beat celery-celery celery-memory celery-notify celery-translate ; do
cat >> docker-compose.override.yml <<EOT
weblate-${service}:
image: ${TEST_CONTAINER:-weblate/weblate:edge}
restart: no
environment:
WEBLATE_TIME_ZONE: Europe/Prague
WEBLATE_SITE_DOMAIN: test.example.com
EOT
done
fi
if [ "$3" = "read-write" ] || [ "$3" = "localtime" ] ; then
sed -i -e '/tmpfs:/D' -e '/- \/run/D' -e '/- \/tmp/D' -e '/read_only: true/D' docker-compose.yml
if [ "$3" = "localtime" ] ; then
sed -i -e '/weblate-cache:\/app\/cache/a\
- /etc/localtime:/etc/localtime:ro' docker-compose.yml
fi
else
# Allow execution in tmp
sed -i 's/- \/tmp/- \/tmp:exec/' docker-compose.yml
fi
IP=127.0.0.1
PORT=${1:-8080}
PROTO=${2:-http}
cat > .test.env <<EOT
URL=$PROTO://$IP:$PORT/
EOT
echo "Weblate will be running on $PROTO://$IP:$PORT/"
echo
echo "Weblate configuration (docker.compose.yml):"
cat docker-compose.yml