Bug 989899 - mediawiki quickstart should support scalable application.
mediawiki quickstart should support scalable application.
Status: CLOSED CURRENTRELEASE
Product: OpenShift Online
Classification: Red Hat
Component: Templates (Show other bugs)
2.x
Unspecified Unspecified
medium Severity medium
: ---
: ---
Assigned To: Dan McPherson
libra bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-30 02:55 EDT by Johnny Liu
Modified: 2015-05-14 22:24 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-08-07 18:58:16 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Johnny Liu 2013-07-30 02:55:25 EDT
Description of problem:
When adding mysql to a scalable app, mysql's listening port will not be default "3306" port, that will lead to mediawiki quickstart can not work with a scalable app.

If apply the two patches to quick-start, it works well with scalable app.
$ cat deploy.patch 
--- .openshift/action_hooks/deploy.bak	2013-07-30 11:53:27.274877828 +0800
+++ .openshift/action_hooks/deploy	2013-07-30 14:26:54.553892132 +0800
@@ -17,13 +17,13 @@
 fi
 
 # Confirm database exists, if not create it
-if ! /usr/bin/mysql -u "$OPENSHIFT_MYSQL_DB_USERNAME" --password="$OPENSHIFT_MYSQL_DB_PASSWORD" -h "$OPENSHIFT_MYSQL_DB_HOST" -e "show tables;" openshift_mediawiki > /dev/null 2>&1
+if ! /usr/bin/mysql -u "$OPENSHIFT_MYSQL_DB_USERNAME" --password="$OPENSHIFT_MYSQL_DB_PASSWORD" -h "$OPENSHIFT_MYSQL_DB_HOST" -P "$OPENSHIFT_MYSQL_DB_PORT" -e "show tables;" openshift_mediawiki > /dev/null 2>&1
 then
     echo
     echo "Database not found!  Creating and importing"
     echo
-    /usr/bin/mysqladmin -u "$OPENSHIFT_MYSQL_DB_USERNAME" --password="$OPENSHIFT_MYSQL_DB_PASSWORD" -h "$OPENSHIFT_MYSQL_DB_HOST" create "openshift_mediawiki" 
-    /usr/bin/mysql -u "$OPENSHIFT_MYSQL_DB_USERNAME" --password="$OPENSHIFT_MYSQL_DB_PASSWORD" -h "$OPENSHIFT_MYSQL_DB_HOST" openshift_mediawiki < "$OPENSHIFT_REPO_DIR/.openshift/action_hooks/openshift.sql"
+    /usr/bin/mysqladmin -u "$OPENSHIFT_MYSQL_DB_USERNAME" --password="$OPENSHIFT_MYSQL_DB_PASSWORD" -h "$OPENSHIFT_MYSQL_DB_HOST" -P "$OPENSHIFT_MYSQL_DB_PORT" create "openshift_mediawiki" 
+    /usr/bin/mysql -u "$OPENSHIFT_MYSQL_DB_USERNAME" --password="$OPENSHIFT_MYSQL_DB_PASSWORD" -h "$OPENSHIFT_MYSQL_DB_HOST" -P "$OPENSHIFT_MYSQL_DB_PORT" openshift_mediawiki < "$OPENSHIFT_REPO_DIR/.openshift/action_hooks/openshift.sql"
     echo
     echo "done."
     echo "=================================================="


$ cat LocalSettings.php.patch 
--- php/LocalSettings.php.bak	2013-07-30 14:32:38.535183474 +0800
+++ php/LocalSettings.php	2013-07-30 14:32:58.967021369 +0800
@@ -51,7 +51,7 @@
 
 ## Database settings
 $wgDBtype           = "mysql";
-$wgDBserver         = $_ENV['OPENSHIFT_MYSQL_DB_HOST'];
+$wgDBserver         = $_ENV['OPENSHIFT_MYSQL_DB_HOST'].":".$_ENV['OPENSHIFT_MYSQL_DB_PORT'];
 $wgDBname           = "openshift_mediawiki";
 $wgDBuser           = $_ENV['OPENSHIFT_MYSQL_DB_USERNAME'];
 $wgDBpassword       = $_ENV['OPENSHIFT_MYSQL_DB_PASSWORD'];


Version-Release number of selected component (if applicable):
devenv_3580

How reproducible:
Always

Steps to Reproduce:
1. Create a php-5.3 application and attach mysql to it:
   $ rhc app create -a mediawiki -t php-5.3 -s
   $ rhc cartridge add -a mediawiki -c mysql-5.1
2. Add this upstream mediawiki repo
   $ cd mediawiki
   $ git remote add upstream -m master git://github.com/openshift/mediawiki-example.git
   $ git pull -s recursive -X theirs upstream master
3. Then push the repo upstream
   $ git push

Actual results:
$ git push
remote: Waiting for stop to finish
remote: CLIENT_MESSAGE: HAProxy instance is stopped
remote: Starting application mediawiki2
remote: CLIENT_MESSAGE: HAProxy instance is started
remote: 
remote: Database not found!  Creating and importing
remote: 
remote: /usr/bin/mysqladmin: connect to server at '51f736a9b83f4c0a64000012-jialiu.dev.rhcloud.com' failed
remote: error: 'Lost connection to MySQL server at 'reading initial communication packet', system error: 111'
remote: An error occurred executing 'gear postreceive' (exit code: 1)
remote: Error message: Failed to execute action hook 'deploy' for 1197d6baf8ca11e291ad22000aa50424 application mediawiki2
remote: 
remote: For more details about the problem, try running the command again with the '--trace' option.
To ssh://1197d6baf8ca11e291ad22000aa50424@mediawiki2-jialiu.dev.rhcloud.com/~/git/mediawiki2.git/
   1407ee2..640e505  master -> master


Expected results:
deploy script should be executed successfully.

Additional info:
Comment 1 Dan McPherson 2013-07-30 16:06:14 EDT
Hi Jianlin,

  Do you want to submit a pull request with these changes?


-Dan
Comment 2 Johnny Liu 2013-07-31 02:07:04 EDT
(In reply to Dan McPherson from comment #1)
> Hi Jianlin,
> 
>   Do you want to submit a pull request with these changes?
> 
> 
> -Dan

I already sent a pull request, this is my first pull request, maybe I miss something, need your review, if it is ok for you, need your merge operation, am I right?
Comment 3 Dan McPherson 2013-07-31 09:34:57 EDT
Perfect thx!
Comment 4 Johnny Liu 2013-07-31 23:00:51 EDT
Verify this bug with latest mediawiki quick-start, and PASS.

Note You need to log in before you can comment on or make changes to this bug.