Puppet and Mysql 5.5 - mysql

The Background
I am using Centos 6.5 with Puppet 3.7.3.
I've installed the module puppetlabs-mysql v3.1.0
Centos 6.5 comes with MySql 5.1.73 installed by default. What I'd like to achieve is to upgrade that version via Puppet to 5.5.40, using the module described above
The initial Solution
Well, I couldn't find a proper solution to do this. The official documentation only tells how to configure the puppet manifest in order to have MySql installed, not taking into account the version. That doesn't suit me because the version remains unchanged after running the puppet agent.
package { "MySQL-client": ensure => installed }
Solution #1 found on Internet Forums
Found here.
package {
'mysql-client-core-5.5': ensure => present
}
With that solution, I am getting the following error:
Error: Execution of '/usr/bin/yum -d 0 -e 0 -y list mysql-client-core-5.5'
returned 1: Error: No matching Packages to list
Solution #2 found on Internet Forums
Found here.
It is actually proposing two solutions:
package { 'mysql-server' : ensure => '5.5' , }
and
package { 'mysql55w' : ensure => 'present' , }
In both cases I am getting a similar error, which is no other than package not found on the current installed repos
In order to fix all the problems above, I successfully added the necessary changes on the puppet manifest to install the repo where MySQL 5.5.40 lives.
After repuppetting again, I am now getting a different error:
Error: mysql55w-libs conflicts with mysql-libs-5.1.73-3.el6_5.i686
Of course, the old libraries are conflicting with the new ones. Fortunately, there is a workaround for this, as described here. I successfully added those commands to my puppet manifest (using the EXEC command)
yum install mysql.`uname -i` yum-plugin-replace
yum replace mysql --replace-with mysql55w
After all these workarounds, my puppet manifest executes fine, but only after chaining each declaration to execute it sequentially (puppet doesn't assume order). Otherwise, it may try to install Mysql 5.5 before to install the repo or before to change the libraries.
The Question
Well, the question is, is there any other way to manage this more gracefully in puppet?
It wasn't enough to tell puppet that I wanted MySQL installed. I actually had to tell Puppet how to do it.
My Puppet manifest looks like the good old fashion scripts that Puppet is supposed to replace. I can't concentrate in what I want. I had to instruct it how to achieve it too

Even with configuration management package-providers can be a headache! :)
However, in this instance we can leverage the work by using a pre-existing module to manage Yum: example42/yum
Install the module like so:
puppet module install example42/yum
With this, it becomes much easier to manage, and you can install MySQL 5.5 much cleaner and idempotently:
class { 'yum':
defaultrepo => false,
extrarepo => '' ,
}
class { 'yum::repo::mysql_community':
enabled_version => '5.5',
}
package { 'mysql-community-server':
ensure => '5.5.42-2.el6',
require => Class['yum::repo::mysql_community'],
}
As you can see, the only ordering used is the require on the package, to make sure the Yum repo has been setup before trying to install it.
Worked for me on a brand new Centos 6.6 Vagrant box:
# Vagrantfile
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "puppetlabs/centos-6.6-64-puppet"
config.vm.provision "shell", inline: "puppet module install example42/yum"
config.vm.provision "puppet" do |puppet|
puppet.manifests_path = "./"
puppet.manifest_file = "default.pp"
end
end
Output:
==> default: Running provisioner: shell...
default: Running: inline script
==> default: Notice: Preparing to install into /etc/puppet/modules ...
==> default: Notice: Downloading from https://forgeapi.puppetlabs.com ...
==> default: Notice: Installing -- do not interrupt ...
==> default: /etc/puppet/modules
==> default: └─┬ example42-yum (v2.1.17)
==> default: └── example42-puppi (v2.1.10)
==> default: Running provisioner: puppet...
==> default: Running Puppet with default.pp...
==> default: Notice: Compiled catalog for localhost.home in environment production in 0.85 seconds
==> default: Notice: /Stage[main]/Yum::Repo::Mysql_community/Yum::Managed_yumrepo[mysql-connectors-community]/File[/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql]/ensure: defined content as '{md5}26b9ed77a3a087874a27103c1f9d6a6f'
==> default: Notice: /Stage[main]/Yum::Repo::Mysql_community/Yum::Managed_yumrepo[mysql-tools-community]/File[/etc/yum.repos.d/mysql-tools-community.repo]/ensure: created
==> default: Notice: /Stage[main]/Yum::Repo::Mysql_community/Yum::Managed_yumrepo[mysql56-community]/File[/etc/yum.repos.d/mysql56-community.repo]/ensure: created
==> default: Notice: /Stage[main]/Yum::Repo::Mysql_community/Yum::Managed_yumrepo[mysql56-community]/Yumrepo[mysql56-community]/ensure: created
==> default: Notice: /Stage[main]/Yum::Repo::Mysql_community/Yum::Managed_yumrepo[mysql57-community-dmr]/File[/etc/yum.repos.d/mysql57-community-dmr.repo]/ensure: created
==> default: Notice: /Stage[main]/Yum::Repo::Mysql_community/Yum::Managed_yumrepo[mysql57-community-dmr]/Yumrepo[mysql57-community-dmr]/ensure: created
==> default: Notice: /Stage[main]/Yum::Repo::Mysql_community/Yum::Managed_yumrepo[mysql-connectors-community]/File[/etc/yum.repos.d/mysql-connectors-community.repo]/ensure: created
==> default: Notice: /Stage[main]/Yum::Repo::Mysql_community/Yum::Managed_yumrepo[mysql-connectors-community]/Yumrepo[mysql-connectors-community]/ensure: created
==> default: Notice: /Stage[main]/Yum::Prerequisites/Yum::Plugin[priorities]/Package[yum-plugin-priorities]/ensure: created
==> default: Notice: /Stage[main]/Yum::Repo::Mysql_community/Yum::Managed_yumrepo[mysql-tools-community]/Yumrepo[mysql-tools-community]/ensure: created
==> default: Notice: /Stage[main]/Yum::Repo::Mysql_community/Yum::Managed_yumrepo[mysql55-community]/File[/etc/yum.repos.d/mysql55-community.repo]/ensure: created
==> default: Notice: /Stage[main]/Yum::Repo::Mysql_community/Yum::Managed_yumrepo[mysql55-community]/Yumrepo[mysql55-community]/ensure: created
==> default: Notice: /Stage[main]/Main/Node[default]/Package[mysql-community-server]/ensure: created
==> default: Notice: Finished catalog run in 63.97 seconds

Related

Getting ERROR: unknown key name ‘docinfo’ on sharetribe installation

I've been struggling to run bundle exec rake ts:index in my sharetribe project. It's returning an error:
rony#ronyMacMini sharetribe % bundle exec rake ts:index
Generating configuration to /Users/rony/Documents/freelensia Ofc/sharetribe/config/development.sphinx.conf
DEBUG (1.0ms) SET NAMES utf8, ##SESSION.sql_mode = CONCAT(CONCAT(##sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO'), ##SESSION.sql_auto_is_null = 0, ##SESSION.wait_timeout = 2147483
DEBUG ↳ app/indices/custom_field_value_index.rb:8
DEBUG Delayed::Backend::ActiveRecord::Job Destroy (4.2ms) DELETE FROM `delayed_jobs` WHERE (handler LIKE ('--- !ruby/object:ThinkingSphinx::Deltas::%') AND locked_at IS NULL AND locked_by IS NULL AND failed_at IS NULL)
DEBUG ↳ /Users/rony/.rvm/gems/ruby-2.6.5/bin/rake:23
Sphinx 3.3.1 (commit b72d67bc)
Copyright (c) 2001-2020, Andrew Aksyonoff
Copyright (c) 2008-2016, Sphinx Technologies Inc (http://sphinxsearch.com)
using config file '/Users/rony/Documents/abc/sharetribe/config/development.sphinx.conf'...
ERROR: unknown key name 'docinfo' in /Users/rony/Documents/abc/sharetribe/config/development.sphinx.conf line 40 col 10.
FATAL: failed to parse config file '/Users/rony/Documents/abc/sharetribe/config/development.sphinx.conf'
The Sphinx indexing command failed:
Command: indexer --config "/Users/rony/Documents/abc/sharetribe/config/development.sphinx.conf" --all
Status: 1
Output: See above
There may be more information about the failure in /Users/rony/Documents/abc/sharetribe/log/development.searchd.log.
Note that: To install thinking-sphinx on my mac, I’ve downloaded a
pre-built set of binaries and copy-pasted content of bin inside
usr/local/bin.
Searched everywhere but couldn't found the solution. I'm sure I'm missing some stupid thing.
Please help me to fix it.
Update
Downgraded sphinx to 2.2.11. Now another issue raised:
dyld: Library not loaded: /opt/local/lib/mysql55/mysql/libmysqlclient.18.dylib
Referenced from: /usr/local/bin/indexer
Reason: image not found
zsh: abort indexer
I think /opt/local is not correct system directory format for mac. :(
This is due to recent versions of Sphinx removing the docinfo setting.
Which version of Thinking Sphinx is Sharetribe using? If it's 4.x, you can disable the docinfo settings by adding skip_docinfo: true to each appropriate environment in config/thinking_sphinx.yml. For example:
development:
skip_docinfo: true
In Thinking Sphinx v5.0, docinfo is no longer used, but upgrading requires a bit of work with adding callbacks to all indexed models.
If you're using Thinking Sphinx v3.x, then you'll need to downgrade your version of Sphinx to v2.2.11.

CocoaPods 1.0.1 Redefinition of 'XYZ', Redefinition of enumerator 'ABC', Duplicate interface definition for 'MNO'

I am upgrading CocoaPods (0.39.0) to latest version (1.0.1) and moving some directly integrated frameworks (copied in the main project instead of using CocoaPods-spec). I am using XCode (7.2.1).
Following is the podfile that is used with CocoaPods 1.0.1:
platform :ios, '8.0'
target 'ABC-v2' do
# use_framework is required for dynamic frameworks integration.
use_frameworks!
pod 'SSKeychain', '~>1'
pod 'Mantle', '~>1'
pod 'GoogleAPIClient/Drive', '~>1'
pod 'GTMOAuth2', '~>1'
pod 'GTMSessionFetcher'
pod 'libextobjc/EXTScope', '~>0.4'
pod 'Typhoon', '~>3'
# swift framework test, would need this eventually.
#pod 'Alamofire', '~>3'
# PSPDFKit - 5.8.3
pod 'PSPDFKit', podspec:'https://customers.pspdfkit.com/cocoapods/.../latest.podspec'
#disabled it temporarily to separate out xcode build error.
#target :SSS do
# pod 'ABC-iOS-SDK', :path => 'submodules/abc-ios-sdk'
#end
#disabled it temporarily to separate out xcode build error.
#target :TW do
# pod 'ABC-iOS-SDK', :path => 'submodules/abc-ios-sdk'
#end
target :ABCTests do
inherit! :search_paths
pod 'OCMock', '~> 3'
pod 'OCMockito', '~> 1'
pod 'VCRURLConnection', '~> 0.2', :inhibit_warnings => true
end
end
Now I am trying to resolve compile errors upon build, which are related to libraries getting included multiple times.
Referred to CocoaPods Migration Guide at http://blog.cocoapods.org/CocoaPods-1.0-Migration-Guide/
Tried recompiling after complete clean (cmd-alt-shift-k), removing pod files (rm -rf Pods/ podfile.lock) & deleting DerivedData.
Ensured that there is no duplicate *.a files in the Target->Build Phases->Link Binary with Libraries. Upon 'pod install', "Pods_ABC_v2.framework" is added there.
Deleted other targets, such as Widget and an extension & disabled them in podfile as well.
There is directly integrated evernote sdk (evernote-sdk-ios.xcodeproj), which has EVSSKeychain.h/.m files with modified definitions with EV prefix (EVSSKeychainErrorCode, EVSSKeychainErrorBadArguments, etc). Screenshot below:
I believe above evernote sdk isn't causing the errors I am getting; I could try to remove evernote sdk (directly integrated), but I am not sure about it ??
Errors upon compilation:
/path../Pods/SSKeychain/Sources/SSKeychain.h:65:1: Duplicate interface definition for class ‘SSKeychain'
/path../Pods/SSKeychain/Sources/SSKeychain.h:22:27: Redefinition of 'SSKeychainErrorCode'
/path../Pods/SSKeychain/Sources/SSKeychain.h:24:2: Redefinition of enumerator 'SSKeychainErrorBadArguments'
Please help with the ideas to remove these errors?
This was fixed by modifying the import statements for SSKeychain.h

Connect to mysql from node.js app, error: "dyld: lazy symbol binding failed: Symbol not found: _mysql_init"

I use OSX 10.6.8 and MySQL from XAMPP.
When I run this node.js app (app.js):
var mysql = require('mysql-libmysqlclient');
var conn = mysql.createConnectionSync();
conn.connectSync('127.0.0.1', 'root', '', 'database_name');
I see this output:
Airs0urce:nodejs airs0urce$ node app.js
dyld: lazy symbol binding failed: Symbol not found: _mysql_init
Referenced from: /Applications/XAMPP/xamppfiles/htdocs/myproject/nodejs/node_modules/mysql-libmysqlclient/build/Release/mysql_bindings.node
Expected in: dynamic lookup
dyld: Symbol not found: _mysql_init
Referenced from: /Applications/XAMPP/xamppfiles/htdocs/myproject/nodejs/node_modules/mysql-libmysqlclient/build/Release/mysql_bindings.node
Expected in: dynamic lookup
Trace/BPT trap
Already tried couple solutions after googling.
Added mysql libs from XAMPP directory to include path this way:
export DYLD_LIBRARY_PATH=/Applications/XAMPP/xamppfiles/lib/mysql:$DYLD_LIBRARY_PATH
tried to install mysql5-devel using MacPorts, but no luck, building failed:
Airs0urce:~ airs0urce$ sudo port install mysql5-devel
---> Computing dependencies for mysql5-devel
---> Building mysql5-devel
Error: Target org.macports.build returned: shell command failed (see log for details)
Log for mysql5-devel is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_databases_mysql5-devel/mysql5-devel/main.log
Error: Status 1 encountered during processing.
To report a bug, see <http://guide.macports.org/#project.tickets>
There is log file if you want to see: http://dl.dropbox.com/u/1875424/main.log
This is because of a config issue on Mac OS X Lion (10.7): lib/libmysqlclient.18.dylib (mysql 5.5 and above).
Step 1:
Make sure you set the path in ~/.profile
export ARCHFLAGS=-arch x86_64
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH
Step 2:
I am using rvm so, I used the following command:
rvmsudo ARCHFLAGS="-arch x86_64" gem install mysql2 -- --with-mysql-config=/usr/local/mysql/bin/mysql_config --with-opt-lib=/usr/local/mysql/lib
which has solved the issues with rails application on Mac lion and mysql x86_64.
I futzed around with this for a ton of time including setting the DVLD library path and copying the library into /usr/lib.
sudo cp /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib
Heck, anything to get it working. Finally I tried clearing the default for 64 vs 32 bit and it worked!
defaults delete com.apple.versioner.perl
Not sure if my perl is 64 or 32 bit, but my db is 64 bit and just using the default default seems to work better ;-)

Why rasqal configuration can't recognize the already raptor library on cygwin?

I am trying to install rasqal 0.9.20 library http://librdf.org/rasqal/ onto a windows 7 machine with cygwin.Earlier i have successfully installed the raptor-2.2.0 library http://librdf.org/raptor/ and i can verify this with the rapper tool was created after the installation(./configure , ./make ,/make install)
The error that i am getting from the configuration of rasqal is :
./configure --enable-raptor2
...
checking for raptor... configure: error: Raptor2 is not installed - see http://librdf.org/raptor/ to get a version newer than 1.9.0
I can't find a way to fix it. The code from the cofigure file that handles this flag is the below :
11840 # raptor is REQUIRED despite the checking here
11841 RAPTOR_MIN_VERSION=1.4.19
11842 RAPTOR_MAX_VERSION=1.8.99
11843 RAPTOR2_MIN_VERSION=1.9.0
11844
11845 raptor2=no
11846 # Check whether --enable-raptor2 was given.
11847 if test "${enable_raptor2+set}" = set; then :
11848 enableval=$enable_raptor2; raptor2="$enableval"
11849 else
11850 raptor2="no"
11851 fi
Raptor 2.0.0 uses only pkg-config to provide configuration information, raptor-config was removed. The same applies to rasqal itself, the rasqal-config program will go away at some point. The --enable-raptor2 option to rasqal and librdf was for testing the beta raptor2, and it has been removed from rasqal 0.9.22 and librdf GIT head.
Set PKG_CONFIG_PATH to include the correct path:
env PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure
Another method, if available on your system, is to define the environment variable in /etc/environment:
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

Installation error for DBD::MySQL on OSX v10.6.6

I'm attempting to get DBD::MySQL working on Snow Leopard (v10.6.6). The default version of Perl that comes with the OS is v5.10.0. Since I've read that's 64-bit, I went ahead and downloaded and installed a 64-bit version of MySQL (mysql-5.5.8-osx10.6-x86_64).
Installing and setting up MySQL went smoothly, here's my config and version number for reference.
I used CPAN to download DBI and the DBD::MySQL drivers. I then:
Installed DBI
Setup a Makefile.PL
Ran the make command from the command line
The Makefile.PL said it would use the following settings for compiling and testing:
I will use the following settings for compiling and testing:
cflags (mysql_config ) = -I/usr/local/mysql/include -Os -g -fno-common -fno-strict-aliasing -arch x86_64
embedded (mysql_config ) =
libs (mysql_config ) = -L/usr/local/mysql/lib -lmysqlclient -lpthread
mysql_config (guessed ) = mysql_config
nocatchstderr (default ) = 0
nofoundrows (default ) = 0
ssl (guessed ) = 0
testdb (default ) = test
testhost (default ) =
testpassword (User's choice) = r00t!
testsocket (default ) =
testuser (User's choice) = root
To change these settings, see 'perl Makefile.PL --help' and
'perldoc INSTALL'.
Multiple copies of Driver.xst found in: /Library/Perl/5.10.0/darwin-thread-multi-2level/auto/DBI/ /System/Library/Perl/Extras/5.10.0/darwin-thread-multi-2level/auto/DBI/ at Makefile.PL line 907
Using DBI 1.616 (for perl 5.010000 on darwin-thread-multi-2level) installed in /Library/Perl/5.10.0/darwin-thread-multi-2level/auto/DBI/
Writing Makefile for DBD::mysql
Everything seemed to be going fine, until I tried to run make test :
t/00base....................NOK 2/6# Tried to use 'DBD::mysql'.
# Error: Can't load '/Users/swm/.cpan/build/DBD-mysql-4.018-Pnd2qz/blib/arch/auto/DBD/mysql/mysql.bundle' for module DBD::mysql: dlopen(/Users/swm/.cpan/build/DBD-mysql-4.018-Pnd2qz/blib/arch/auto/DBD/mysql/mysql.bundle, 2): Library not loaded: libmysqlclient.16.dylib
# Referenced from: /Users/swm/.cpan/build/DBD-mysql-4.018-Pnd2qz/blib/arch/auto/DBD/mysql/mysql.bundle
# Reason: image not found at /System/Library/Perl/5.10.0/darwin-thread-multi-2level/DynaLoader.pm line 207.
# at (eval 7) line 2
# Compilation failed in require at (eval 7) line 2.
# BEGIN failed--compilation aborted at (eval 7) line 2.
FAILED--Further testing stopped: Unable to load DBD::mysql
make: *** [test_dynamic] Error 9
It's failing because it can't seem to find the mysql.bundle for DBD. Has anyone come across this problem? Or can point me in the right direction on what to try next? I need DBI/DBD::MySQL for my new job and I'm scrambling to find a solution.
Many thanks in advance.
I got around the "Library not loaded: libmysqlclient.16.dylib" problem by placing a symbolic link in /usr/lib/" to /usr/local/mysql-5.5.8-osx10.6-x86_64/lib/libmysqlclient.16.dylib
I worked around the same or a similar issue. Somehow I could build and test DBD::mysql with cpan but when I tried to use it in a script it said things like
dyld: lazy symbol binding failed: Symbol not found: _mysql_init
Referenced from: /Library/Perl/5.10.0/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle
Expected in: flat namespace
Apparently, it's a 64-bit vs 32-bit issue.
Installing the fink dbd-mysql-pm5100 package made it work though it took kind of a long time. I also removed the cpan-installed version:
sudo rm -rf /Library/Perl/5.10.0/darwin-thread-multi-2level/auto/DBD/mysql
sudo rm -rf /Library/Perl/5.10.0/darwin-thread-multi-2level/DBD/mysql
sudo rm -rf /Library/Perl/5.10.0/darwin-thread-multi-2level/DBD/mysql.pm
also include in .profile
export VERSIONER_PERL_PREFER_32_BIT=yes;
Besides creating the link the executions of the program with DBI::mysql generated an error, thus including this variable on the environment make it works
I know this is an old post. But I suppose the best solution would be to add the library directory to the DYLD_FALLBACK_LIBRARY_PATH env variable. (reason here: https://stackoverflow.com/a/3172515/119958 )
There is no ldconfig in mac, so just add the path to this env var and rerun the install process for DBD::mysql
Donato-Vianas-MacBook-Pro:Invoicer donato$ cpanm DBD::mysql
--> Working on DBD::mysql
Fetching http://www.cpan.org/authors/id/C/CA/CAPTTOFU/DBD-mysql-4.022.tar.gz ... OK
Configuring DBD-mysql-4.022 ... OK
Building and testing DBD-mysql-4.022 ... FAIL
! Installing DBD::mysql failed. See /Users/donato/.cpanm/build.log for details.
# Failed test 'use DBD::mysql;'
# at t/00base.t line 21.
# Tried to use 'DBD::mysql'.
# Error: Can't load '/Users/donato/.cpanm/work/1359948144.491/DBD-mysql-4.022/blib/arch/auto/DBD/mysql/mysql.bundle' for module DBD::mysql: dlopen(/Users/donato/.cpanm/work/1359948144.491/DBD-mysql-4.022/blib/arch/auto/DBD/mysql/mysql.bundle, 2): Library not loaded: libmysqlclient.18.dylib
Donato-Vianas-MacBook-Pro:Invoicer donato$ export DYLD_FALLBACK_LIBRARY_PATH=/usr/local/mysql/lib/:$DYLD_FALLBACK_LIBRARY_PATH
Donato-Vianas-MacBook-Pro:Invoicer donato$ cpanm DBD::mysql--> Working on DBD::mysql
Fetching http://www.cpan.org/authors/id/C/CA/CAPTTOFU/DBD-mysql-4.022.tar.gz ... OK
Configuring DBD-mysql-4.022 ... OK
Building and testing DBD-mysql-4.022 ... OK
Successfully installed DBD-mysql-4.022
1 distribution installed
Donato's solution works for install, but the var has to be present at runtime as well or I get the same error. The following fixes this at runtime for shell and _www user:
# For command line use, add following line to ~/.bash_profile:
export DYLD_FALLBACK_LIBRARY_PATH=/usr/local/mysql/lib/:$DYLD_FALLBACK_LIBRARY_PATH
# If Apache needs it, add following line to /etc/apache2/httpd.conf:
# On Lion Server, I put it after <IfDefine MACOSXSERVER>, but shouldn't matter
SetEnv DYLD_FALLBACK_LIBRARY_PATH /usr/local/mysql/lib/:$DYLD_FALLBACK_LIBRARY_PATH
It's somewhat of an aside, but I strongly recommend setting up a separate perl on the machine -- either by fink / macports, or from source -- and leaving the Mac's system perl (and its libraries) alone.
Once I did this on my own Mac, I had very few troubles installing modules thereafter, and I didn't have to worry about accidentally blowing a hole in my OS by breaking the perl that the system uses.
If it were my Mac, I'd install a new perl from source (the Perl source distribution is smart enough to install itself see that it's on a Mac and install itself safely into /usr/local/bin) and the proceed from thee to install DBD::Mysql (and the other modules you require).