Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MariaDB addon #303

Merged
merged 10 commits into from Jul 21, 2015
Merged

Add MariaDB addon #303

merged 10 commits into from Jul 21, 2015

Conversation

BanzaiMan
Copy link
Contributor

This PR adds MariaDB addon, based on instructions given at https://downloads.mariadb.org/mariadb/repositories/#mirror=digitalocean-nyc&distro=Ubuntu&distro_release=precise&version=10.0.

Versions 5.5, 10.0, and 10.1 can be specified in .travis.yml; e.g.,

addons:
  mariadb: "10.0"

Note that MariaDB is installed with the package-provided configuration file -o Dpkg::Options::='--force-confnew', so that it is run on disk, not ramfs, so it can be potentially slow.

User travis needs to be set up, but for some reason root cannot.

travis@debug-BanzaiMan-playing-around-php-1412545209:~$ mysql -u root 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 252
Server version: 10.0.14-MariaDB-1~precise-log mariadb.org binary distribution

Copyright (c) 2000, 2014, Oracle, SkySQL Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> CREATE USER 'travis'@'%' IDENTIFIED BY '';          GRANT ALL PRIVILEGES ON *.* TO 'travis'@'%';
ERROR 1396 (HY000): Operation CREATE USER failed for 'travis'@'%'
Query OK, 0 rows affected (0.00 sec)

@joshk
Copy link
Contributor

joshk commented Oct 8, 2014

Awesome work!

On Wed, Oct 8, 2014 at 3:12 PM, Hiro Asari notifications@github.com
wrote:

DO NOT MERGE YET

This PR adds MariaDB addon, based on instructions given at https://downloads.mariadb.org/mariadb/repositories/#mirror=digitalocean-nyc&distro=Ubuntu&distro_release=precise&version=10.0.
Versions 5.5, 10.0, and 10.1 can be specified in .travis.yml; e.g.,

addons:
  mariadb: "10.0"

Note that MariaDB is installed with the package-provided configuration file -o Dpkg::Options::='--force-confnew', so that it is run on disk, not ramfs, so it can be potentially slow.
User travis needs to be set up, but for some reason root cannot.

travis@debug-BanzaiMan-playing-around-php-1412545209:~$ mysql -u root 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 252
Server version: 10.0.14-MariaDB-1~precise-log mariadb.org binary distribution
Copyright (c) 2000, 2014, Oracle, SkySQL Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> CREATE USER 'travis'@'%' IDENTIFIED BY '';          GRANT ALL PRIVILEGES ON *.* TO 'travis'@'%';
ERROR 1396 (HY000): Operation CREATE USER failed for 'travis'@'%'
Query OK, 0 rows affected (0.00 sec)

You can merge this Pull Request by running:
git pull https://github.com/travis-ci/travis-build ha-feature-mariadb
Or you can view, comment on it, or merge it online at:
#303
-- Commit Summary --

@grooverdan
Copy link
Contributor

' CREATE USER 'travis'@'%' IDENTIFIED BY '';' failing would indicate that the travis user already exists supported by the fact the grant succeeded.

What does 'but for some reason root cannot.' mean? it appears you have a root user. Can you show select user,host,password from mysql.user and show grants in the test buiild?

@grooverdan
Copy link
Contributor

also mysql_upgrade might be running in the background (/etc/mysql/debian-start) meaning some of the system table structure may not be fully ready for changes.

Conflicts:
	lib/travis/build/script/addons.rb
This makes me sad, but I can't figure out how to defer
evaluating it till the script run-time.
@BanzaiMan
Copy link
Contributor Author

Picked this up again, and it seems to work with my limited testing.

https://staging.travis-ci.org/BanzaiMan/travis_staging_test/builds/433699#L205 (10.0.20)
https://staging.travis-ci.org/BanzaiMan/travis_staging_test/builds/433701#L214 (10.1.5)

I don't have an app to run it through more rigorous testing, though.

I do not like it that the Ubuntu release code name is hard coded at the moment.

@grooverdan
Copy link
Contributor

Provided the following return the right user and a mariadb version it should be ok

mysql -u root -e 'SELECT VERSION(); SELECT CURRENT_USER();'
mysql -u travis -e 'SELECT VERSION(); SELECT CURRENT_USER();'

I do not like it that the Ubuntu release code name is hard coded at the moment.

sh.cmd "add-apt-repository 'deb http://#{MARIADB_MIRROR}/mariadb/repo/#{mariadb_version}/ubuntu ${TRAVIS_UBUNTU_RELEASE} main'", sudo: true

TRAVIS_UBUNTU_RELEASE is in a single quote when run so its not interpolated.

@BanzaiMan
Copy link
Contributor Author

@grooverdan Yay. User creds seem to work. https://staging.travis-ci.org/BanzaiMan/travis_staging_test/builds/433703

I'll revisit the release code name tomorrow.

@grooverdan
Copy link
Contributor

thanks for revisiting this. Looks good.

@BanzaiMan
Copy link
Contributor Author

Cool. it worked.

@BanzaiMan
Copy link
Contributor Author

@BanzaiMan
Copy link
Contributor Author

By rough accounting, it adds about 30 seconds to the build.

@joshk
Copy link
Contributor

joshk commented Jul 17, 2015

@henrikhodne @meatballhat can you review the PR pretty please

SUPER_USER_SAFE = true

MARIADB_GPG_KEY = '0xcbcb082a1bb943db'
MARIADB_MIRROR = 'nyc2.mirrors.digitalocean.com'

This comment was marked as spam.

This comment was marked as spam.

@BanzaiMan BanzaiMan changed the title [WIP] Add MariaDB addon Add MariaDB addon Jul 17, 2015
svenfuchs added a commit that referenced this pull request Jul 21, 2015
@svenfuchs svenfuchs merged commit 002c412 into master Jul 21, 2015
@svenfuchs svenfuchs deleted the ha-feature-mariadb branch July 21, 2015 15:50
@BanzaiMan
Copy link
Contributor Author

@grooverdan Hello! We have deployed this to production (both .org and .com; not yet documented). Could you test this and see if it works to your satisfaction? We would like to get documentation ready, very much like what we have for MySQL. Could you review the documentation, and see if there are any notable differences between MySQL and MariaDB? (Please open a separate issue if you find any!)

Thank you for your help!

@grooverdan
Copy link
Contributor

@BanzaiMan 👍 thank you

basic support on 5.5, 10.0 and 10.1 looks great.

single list form resulted in [5.5] as the version and hence didn't install 5.5.

multiple list form seemed to ignore all repos and resort to mysql.

My guess on a matrix form was silently ignored.

A multiple list form would be really nice to test an application against multiple versions.

Is having none as a item in a list acceptable to revert to the installed MySQL so an application can be test against mariadb versions and mysql.

Minor note, Is the exclude/include syntax of travis-ci/travis-ci/issues/1492 supported somehow? It will be useful when multiple MySQL versions to exclude a matrix where MariaDB and MySQL versions get installed.

For container builds having /etc/mysql writeable would be useful - its currently root owned. To protect against users running items as root a check will need to be done to ensure there isn't user= set in a [mysqld_safe] or [safe_mysqld] section (its the OS user that mysqld will start at and by pushing user plugins they could effectively escalate to root). Look for --user=root in the output of

my_print_defaults --loose-verbose mysqld_safe safe_mysqld mariadb_safe
. Using the MySQL version of my_print_defaults is sufficient for this test. There may be cases where --user=travis is suitable.

Is there a stage where custom config files can be pushed into /etc/mysql/ so they are there when the package is installed and hence the service started? Its quite possible to install config files there that will affect mariadb and not mysql (putting config files having sections [mariadb] [mariadb-10.0], [mariadb-5.5], [mariadb-10.1] (which is something that would be useful to document). mariadb/mariadb-connector-j (and script) seem keen on changing settings based on vars too.

Exporting in an environment variable which mariadb version was installed would enable a user to do specific scripts/actions/configs/tests for mariadb that might not be accessible on MySQL (or vise versa).

Apart from the minor tip on introducing mariadb specific configuration I can't see anything that would be useful to include in travis documentation.

Sorry if this contains a little too many feature requests. Its a great capability to start with so thank you.

@grooverdan
Copy link
Contributor

think I worked out to do matrix builds, not perfect but getting closer

@grooverdan
Copy link
Contributor

@BanzaiMan did you want the above broken up to separate feature requests?

@BanzaiMan
Copy link
Contributor Author

@grooverdan Yes, please. This is a PR, and feature requests tend to be lost here.

@grooverdan
Copy link
Contributor

@ntwb
Copy link

ntwb commented Jul 29, 2015

Just wanted to say thanks, I've started testing this with WordPress, works as expected 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants