Tuesday, June 25, 2013

CHEF: echa-oracle v1.0.0 cookbook tests on EC2

Update on 4/4/2014: The cookbook has been re-lauched at https://github.com/aririikonen/oracle (v1.1.x), also available from Chef community site at http://community.opscode.com/cookbooks/oracle.

Been a while since I've posted something. This time it is about Chef and the new echa-oracle cookbook. At the time writing this post, echa-oracle cookbook has not been released yet, but I'll link the GitHub repo here once it is available.

Wanted to make sure, that before releasing the echa-oracle cookbook, I'll run a few smoke tests against some instances on EC2 and post the results here.

Pre-reqs:
Steps:

Made sure the knife ec2 commands were working fine with

knife ec2 server list

Bootstrapped a new flavor m1.small instance with ora_quickstart role. ora_quickstart role is described in detail on the echa-oracle cookbook README.md.

knife ec2 server create -I ami-9bf6e0ef -S pem_name -i ~/.ssh/pem_file_name.pem -x ec2-user -G sec_group -f m1.small --ebs-size 20 -r "role[ora_quickstart]" -j '{"oracle" : {"rdbms": {"dbs": {"FOO" : false}}}}'

Result:

Success.

Notes:
  • Deployment will take some time, especially installing the Oracle binaries, latest patch and db creation, so don't be alarmed if it seems to be stuck, it isn't. Just check 'top' on the instance to verify this.
  • Used a Red Hat Enterprise Linux 6.4 AMI (ami-9bf6e0ef)
  • By default, an EC2 instance doesn't come with swap. Depending on the flavor, you need to add 2x memory size swap on the VM. It is a normal Oracle recommendation, but you can get further details by checking the 11.2. documentation.
  • I had to use --ebs-size 20 parameter to get a bigger 20GB disk for the deployment. m1.small comes with 7GB as a default configuration.
  • Already mentioned in the echa-oracle cookbook README.md, but resize the /dev/shm as well. You might face some issues with a running Oracle database, if it is not big enough.
  • If you don't want to create a database(s) at the same deployment, you can leave the -j '{"oracle" : {"rdbms": {"dbs": {"FOO" : false}}}}' option out. Although you are able to create the database(s) later on by adding the node attributes directly with knife node edit.
Sample output of the test deployment:

https://gist.github.com/aririikonen/5936747

12 comments:

  1. Looks promising, I'd really like to try that cookbook. When do you plan on releasing it?

    ReplyDelete
    Replies
    1. Very soon. We have the legal side done, now we're just making sure we won't be releasing anything, which would be Oracle copywrited. I've been running final tests on both EC2 and DigitalOcean VM's and the code is frozen currently to version 1.0.0.

      Delete
    2. echa-oracle cookbook has now been released (v1.0.2). Check it out from https://github.com/echaeu/echa-oracle

      Delete
  2. After the last test on EC2 RHEL I decided to update all the packages with 'yum update'. Restarted the VM and found out that Oracle listener wasn't starting up correctly. This is due to not having the /dev/shm and swap configured correctly, so be aware.

    ReplyDelete
  3. I've tried your cookbook and it is working quite well so far.
    My setup is a CentOS 6.4 x64 VM running in vagrant and chef-solo.

    One thing that is giving me a bit of a problem though is the reliance on stored node values - chef solo does not support this and so I have to work around it.

    Thanks for sharing your cookbook :)

    ReplyDelete
    Replies
    1. You're most welcome. I'm glad that you find it useful. We've built all of our Oracle databases with an expanded version of this cookbook (we simplified it for the opensource release quite a lot) and it has been serving us well.

      Chef solo is something that we haven't used here, so as you mentioned, a workaround for that needs to be done. Might be worth while to check out Chef zero perhaps.

      https://github.com/jkeiser/chef-zero

      Delete
  4. Hi Ari,
    This is pretty useful! Are you planning to support Oracle clustered databases as well in the future? I am also wondering if it is even possible to write recipes for clustered database as there could be dependency across nodes.

    ReplyDelete
    Replies
    1. Thank you for the feedback Girish! Next plans are still smaller than diving in to the clustering. I'm already finished with the patching recipe, so you can patch the installations by adding a recipe to the node run list (haven't pushed the recipe to echa-oracle repo yet though).

      Currently working to get the Oracle client recipe done (installs a 11.2.0.3.7 client on linux). Moving on to most likely to the ASM recipe. Getting the ASM install working properly is a milestone to start to think about the clustering configurations. So overall, I'm not that close yet to what comes for clustering. Although feel free to fork the cookbook on Github https://github.com/echaeu/echa-oracle and start to work on your on clustering recipes. Maybe we could merge some of the ideas in the future.

      In addition, I'll try the current echa-oracle cookbook with 12c media. Let's see, if it works without any major changes.

      Delete
  5. Hi Ari,
    Thanks a lot for this great blog. It is indeed very helpful.
    I am trying to use the cookbook for some poc stuff, but I run into curl timeout exception. Would you know of a way to increase this.
    I have tried "curl -k0 -m 7200" but it doesnt seem to work. For the time being I have changed it to a cp command that copies the same asset from a locat shared drive on the file system that gets created when my image is built initially.
    Thanks a lot for all your efforts.
    Sandeep Rai

    10.0.5.151 Compiled Resource:
    10.0.5.151 ------------------
    10.0.5.151 # Declared in /var/chef/cache/cookbooks/oracle/recipes/dbbin.rb:55:in `block in from_file'
    10.0.5.151
    10.0.5.151 execute("fetch_oracle_media_http://assetsrvr.xxxx.com/linuxamd64_12c_database_1of2.zip") do
    10.0.5.151 action "run"
    10.0.5.151 retries 0
    10.0.5.151 retry_delay 2
    10.0.5.151 guard_interpreter :default
    10.0.5.151 command "curl -kO -m 7200 http://assetsrvr.xxxx.com/linuxamd64_12c_database_1of2.zip"
    10.0.5.151 backup 5
    10.0.5.151 cwd "/opt/oracle/install_dir"
    10.0.5.151 group "oinstall"
    10.0.5.151 returns 0
    10.0.5.151 user "oracle"
    10.0.5.151 cookbook_name "oracle"
    10.0.5.151 recipe_name "dbbin"
    10.0.5.151 end
    10.0.5.151
    10.0.5.151
    10.0.5.151 Running handlers:
    10.0.5.151 [2014-10-12T07:41:17+00:00] ERROR: Running exception handlers
    10.0.5.151 Running handlers complete
    10.0.5.151 [2014-10-12T07:41:17+00:00] ERROR: Exception handlers complete
    10.0.5.151 [2014-10-12T07:41:17+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
    10.0.5.151 Chef Client failed. 2 resources updated in 3927.900646915 seconds
    10.0.5.151 [2014-10-12T07:41:17+00:00] ERROR: execute[fetch_oracle_media_http://assetsrvr.xxxx.com/linuxamd64_12c_database_1of2.zip] (oracle::dbbin line 55) had an error: Mixlib::ShellOut::CommandTimeout: Command timed out after 3600s:

    ReplyDelete
    Replies
    1. Hi Sandeep,

      Apologies for not responding to you sooner.

      Did you try out the curl options from the node with the shell prompt first? Did this work?

      You might want to try out remote_file resource instead. We're going to use it for upcoming v.2.0.0 version (might even go to v 1.3.0). More information from https://docs.getchef.com/resource_remote_file.html.

      Br, Ari

      Delete
    2. Sandeep,

      Seens that the chef client run times out after 3600 seconds (see below), so the curl option doesn't really matter, since chef cuts it off. On the top of my head, I can't recall how the timeout for the chef-client run was modified.

      (oracle::dbbin line 55) had an error: Mixlib::ShellOut::CommandTimeout: Command timed out after 3600s:

      Delete
    3. Actually, just had a brief look at the script chef resource. It has a default timeout attribute http://docs.getchef.com/chef/resources.html#script. You might want to try to add the timeout attribute with a higher value to the script resource on the recipe.

      timeout The amount of time (in seconds) a command will wait before timing out. Default value: 3600.

      Br, Ari

      Delete