Skip to content

DB2 installer for dev/test VM#286

Merged
benilovj merged 8 commits intodbfit:masterfrom
pmsoftware:master
May 11, 2014
Merged

DB2 installer for dev/test VM#286
benilovj merged 8 commits intodbfit:masterfrom
pmsoftware:master

Conversation

@MMatten
Copy link
Copy Markdown
Contributor

@MMatten MMatten commented May 7, 2014

Chaps,

For your consideration...

As I want to get a fully functioning test VM for the Teradata updates (in case of core fixes) I've created an installer for DB2 Express-C for the VM. It's much along the lines of the Oracle shell script.

Not knowing much at all about Chef I've added the provisioning it straight to the Vagrantfile.

One known issue if that it doesn't make the JDBC driver available to the build (I copy it to dist/lib in the script but this just gets blitzed by the build) as I can't put stuff onto your S3 area (and know almost nothing about how to configure gradle anyway).

This is my first github pull request so hope I'm not breaking any etiquette!

Cheers,

Mark

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why 32 bit?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I must have been looking at old IBM docs that say 32 and 64bit are required for the installer but after experimenting it seems that only the 64bit libs are needed and that's the package that will actually get installed.

http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/index.jsp?topic=%2Fcom.ibm.db2.luw.qb.server.doc%2Fdoc%2Fr0008865.html

@javornikolov
Copy link
Copy Markdown
Contributor

@MMatten, what would happen if provisioning is executed twice?
E.g. for Oracle we skip the installation if it's already installed. The check is done via grep of /etc/oratab: test_vm/vendor/cookbooks/dbfit_test/recipes/oracle.rb

@MMatten
Copy link
Copy Markdown
Contributor Author

MMatten commented May 8, 2014

Good spot on the provisioning. I've added a check for an existing instance.

On the provisioning - is it better to use Chef than a Vagrant shell provisioner anyway? I don't know the pros and cons of that, and I can't really help with Chef either though.

@javornikolov
Copy link
Copy Markdown
Contributor

On the provisioning - is it better to use Chef than a Vagrant shell provisioner anyway? I don't know the pros and cons of that, and I can't really help with Chef either though.

I think it's good to keep things relatively uniform. Actually the Oracle recipe is pretty much shell script - it should be straightforward to convert this one in a similar shape. For reference - take a look at oracle.rb and Vagrantfile; instead of yum - try adding packages with package and the rest is just configuring the path of the shell script.

@javornikolov
Copy link
Copy Markdown
Contributor

In case there is no DB2 package in dbfit root (means it won't be installed): the script is still installing the related rpm packages.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Who will be the owner of this folder in case we create it here?

BTW: the content of dist folder is being purged when running some of the DbFit build tasks (bundle, start*).
I'm not sure we have to deal with deploying the jdbc driver at this stage. Maybe better to leave Gradle to deal with it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was expecting for this to be removed anyway. If you can let Gradle deploy the driver into dist/ then great. Can put a copy of the driver onto your S3 space (I think that's where the Oracle driver is pulled from into the local maven repo) and update the build or would you do using a script? redeploy-odjbc.bat is still present but I guess is dead now as no maven.

@javornikolov
Copy link
Copy Markdown
Contributor

db2_linuxx64_expc.tar.gz - this should be added to .gitignore.

@javornikolov
Copy link
Copy Markdown
Contributor

I got some errors on the unpacking step. But I was using another box (due to some other experiments and due to download from the official gets stuck for some reason).

vagrant-shell: INFO: found gzipped installation tarball. Unpacking...


Stderr from the command:

tar: expc/db2/linuxamd64/install/tblm_SCSIPR.so: Cannot change ownership to uid 1, gid 1: Operation not permitted
tar: expc/db2/linuxamd64/install/db2help: Cannot change ownership to uid 1, gid 1: Operation not permitted
tar: expc/db2/linuxamd64/install/locale/ja_JP.eucJP/db2istring.cat: Cannot change ownership to uid 1, gid 1: Operation not permitted
tar: expc/db2/linuxamd64/install/locale/ja_JP.eucJP/db2install.cat: Cannot change ownership to uid 1, gid 1: Operation not permitted
tar: expc/db2/linuxamd64/install/locale/ja_JP.eucJP: Cannot change ownership to uid 1, gid 1: Operation not permitted
...

@benilovj
Copy link
Copy Markdown
Member

@MMatten thanks for doing this work - so with this working within the VM, do the DB2 tests pass?

@MMatten
Copy link
Copy Markdown
Contributor Author

MMatten commented May 10, 2014

@benilovj - Jake, yes, they (the non i/z series tests) all pass.

@MMatten
Copy link
Copy Markdown
Contributor Author

MMatten commented May 10, 2014

@javornikolov Javor - what happens if you run the tar command in a different directory, like /tmp ?
What's the ownership and mode of your /var/dbfit dir?
Are you running the script manually via sudo, or as root or as vagrant or via vagrant/Chef?

@javornikolov
Copy link
Copy Markdown
Contributor

What's the ownership and mode of your /var/dbfit dir?

Folder is mounted via NFS. Owner is from my host OS (uid/gid are not present in the guest).

Are you running the script manually via sudo, or as root or as vagrant or via vagrant/Chef?

I ran vagrant provision.

Uncompressing to /tmp works OK. Also uncompress from vagrant user (not root) is OK. Following seems to work under /var/dbfIt too: tar --no-same-owner -xzvf ....

@MMatten
Copy link
Copy Markdown
Contributor Author

MMatten commented May 10, 2014

@javornikolov "--no-same-owner" looks like safe option considering the troubles I've also had with NFS. I guess that's why this might have worked for me (as Windows and so no NFS). I'll update the script to use this.

@javornikolov
Copy link
Copy Markdown
Contributor

@javornikolov "--no-same-owner" looks like safe option considering the troubles I've also had with NFS. I guess that's why this might have worked for me (as Windows and so no NFS). I'll update the script to use this.

I have some doubts though - in theory something may depend on the ownership of files in the archive (if db2 installer doesn't set them explicitly afterwards).

@javornikolov
Copy link
Copy Markdown
Contributor

Seems db2 installer is clever enough to handle setup when the archive is untarred with --no-same-owner. Provisioning succeeded and I managed to run Db2 tests and they succeeded. Awesome!

@javornikolov
Copy link
Copy Markdown
Contributor

When rebuilding the machine (while db2jcc4.jar is already in dist/lib) I got the following error:

cp: cannot create regular file `/var/dbfit/dist/lib/db2jcc4.jar': Permission denied
vagrant-shell: ERROR: copying DB2 JDBC driver to DbFit lib directory /var/dbfit/dist/lib

@MMatten
Copy link
Copy Markdown
Contributor Author

MMatten commented May 10, 2014

Ok, I've just pushed to my repo for some rework to do i) use Chef instead of the shell provisioner ii) allow installation via vagrant/chef or by executing the shell script whilst logged in iii) a tear down script to remove the installation (doesn't get run at the moment, may be useful to someone), though this will currently only succeed against a fully successful installation iv) changes to the tar switches v) if installing by running the shell script package installation won't be executed if there's no DB2 installation to perform (I think the Chef version might still do this though).

Also, I removed the JDBC driver copy to dist/lib.
Would you be be able to update the gradle build to deploy this instead?

@javornikolov
Copy link
Copy Markdown
Contributor

The .sh scripts don't have executable bit set (good to set that: chmod +x *.sh).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No newline at the end of file here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alignment issue here (mixing spaces and tabs).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

misalignment here too

@MMatten
Copy link
Copy Markdown
Contributor Author

MMatten commented May 11, 2014

@javornikolov Hi, I can add the missing EOLs on the last line of the shell scripts. As for the file modes - I had checked in from the Windows host. I didn't even know Git kept properties such as mode for files. Do you know a way to recommit these (without making a dummy change, committing, removing it, committing, etc) or modify the file permissions?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to invoke that with DOLIBS when we have them installed here via the chef package?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The in -d the Chef command means don't do the detection as it's already called in the not_if.
The -l in the Chef command means don't install the library packages as it's done via the recipe.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, indeed. OK.

@javornikolov
Copy link
Copy Markdown
Contributor

As for the file modes - I had checked in from the Windows host. I didn't even know Git kept properties such as mode for files. Do you know a way to recommit these (without making a dummy change, committing, removing it, committing, etc) or modify the file permissions?

I wasn't sure either but seems Git keeps the properties - and chmod is seen as change. Maybe you can try to change them from within the VM - It shows up e.g. like that:

diff --git a/dbfit-java/db2/src/test/resources/deinstall_db2.sh b/dbfit-java/db2/src/test/resources/deinstall_db2.sh
old mode 100644
new mode 100755

@MMatten
Copy link
Copy Markdown
Contributor Author

MMatten commented May 11, 2014

@javornikolov I chmodded the files and git saw them as a change. For some reason mode changes don't get listed by ls though. I think this is another Win/Linux VB synced folder issue.

@MMatten
Copy link
Copy Markdown
Contributor Author

MMatten commented May 11, 2014

@javornikolov I just cloned my fork to a new local repo on the guest and the local files didn't have the x attribute. So I've added from Linux, committed and pushed again. Should be ok now.

@javornikolov
Copy link
Copy Markdown
Contributor

Thanks! It looks good now.
I'll rebuild my VM to make sure it all works fine end to end.

@javornikolov
Copy link
Copy Markdown
Contributor

I'll rebuild my VM to make sure it all works fine end to end.

So gave it a try and all the provisioning (including db2) is working great for me 👍

@MMatten
Copy link
Copy Markdown
Contributor Author

MMatten commented May 11, 2014

Great stuff. Thanks! We still wont be able to execute tests until we can get the driver into the build.
Is there anything else you need me to do on this? Will you accept it into your the main repo?

@benilovj
Copy link
Copy Markdown
Member

LGTM - merging

benilovj added a commit that referenced this pull request May 11, 2014
DB2 installer for dev/test VM
@benilovj benilovj merged commit 37942e2 into dbfit:master May 11, 2014
@benilovj
Copy link
Copy Markdown
Member

thanks @MMatten!

@benilovj benilovj added this to the Next release milestone May 11, 2014
@MMatten
Copy link
Copy Markdown
Contributor Author

MMatten commented May 11, 2014

It's been a pleasure! Always glad to help out with odds and ends.

This was referenced May 11, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants