Skip to content

Commit

Permalink
Add or fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
lens0021 committed Feb 2, 2019
1 parent 60d3455 commit 5a08ea2
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ git:
env:
global:
- MEDIAWIKI_BRANCH=REL1_31
# Maximum iteration limit for loop
- LOOP_LIMIT=300

cache:
Expand All @@ -32,31 +33,42 @@ jobs:
- composer test .
- name: docker
before_script:
# Setup files for database and memcached
- git clone https://github.com/femiwiki/database.git ~/swarm --depth=1
- sudo mkdir -p /srv/mysql/
# Prepare configuration files
- cp configs/env.example configs/env
- cp configs/secret.php.example configs/secret.php
# Tweak LocalSettings.php for debugging
- echo -en "\n\nwfRunDebugMode( 'localhost' );\n" >> configs/LocalSettings.php
- echo -en '\n\nrequire_once "$IP/includes/DevelopmentSettings.php";\n' >> configs/LocalSettings.php
# Initialize docker swarm
- docker swarm init
# Setup database
# Start up database
- docker stack deploy -c ~/swarm/database.yml database
# We need root password of the database, so wait for the generation
- |
printf 'Waiting for database_mysql service...';
# Set counter to check endless loop
COUNTER=0;
while [ -z $(docker service logs database_mysql 2>&1 | grep -oP 'GENERATED ROOT PASSWORD: \K.+') ]; do
# retry every 1 second.
sleep 1;
# Append dots to the previous message if process is delayed.
printf '.';
# Terminate Travis-ci if loop exceeds limit
(( COUNTER++ ));
if [ $COUNTER -gt $LOOP_LIMIT ]; then
printf '\n';
echo 'Falied to start database_mysql service';
# Print logs for debugging
docker service logs database_mysql;
travis_terminate 1;
fi
done; printf '\n'
# Setup memcached
# Start up memcached
- docker stack deploy -c ~/swarm/memcached.yml memcached
# Configure mediawiki
- HOST_IP=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')
- MYSQL_USER=root
- "MYSQL_PW=$(docker service logs database_mysql 2>&1 | grep -Po 'GENERATED ROOT PASSWORD: \\K.+')"
Expand All @@ -73,7 +85,9 @@ jobs:
# We don't have a health check yet, so wait a moment for starting process is end...
- sleep 60
- docker service logs mediawiki_fastcgi
# Check if container is shoutdown
- test -z "$(docker service ps -qf "desired-state=Shutdown" mediawiki_fastcgi)"
# Access localhost until success
- |
printf 'Waiting for http...'
COUNTER=0;
Expand Down

0 comments on commit 5a08ea2

Please sign in to comment.