Sample Chef Upload of Changes Made to a Project Managed by Chef
Sample Upload to Chef to Manage a Product Upgrade
The following steps were taken to download and then install a new version of XpressConnect? Wizard onto the https://connect.alaska.edu server. While this Cloudpath product is not likely to be the choice going forward for wireless entrollment, the steps involved are no different than they would be for any Chef managed service.
$ find . -name cookbooks
$ mv people-chef/ cookbooks
$ mdfind cookbooks
$ cd cookbooks/
$ ls
./ iam-app-people/ ../$ git clone git@…:OIT-IAM/iam-app-xpc.git
* Resulting outputremote: Counting objects: 173, done. remote: Compressing objects: 100% (26/26), done. remote: Total 173 (delta 10), reused 0 (delta 0), pack-reused 140 Receiving objects: 100% (173/173), 33.73 KiB | 0 bytes/s, done. Resolving deltas: 100% (54/54), done. Checking connectivity... done.$ ls -aFC
./ ../ iam-app-people/ iam-app-xpc/$ cd iam-app-xpc/
$ ls -FC
Berksfile README.md attributes/ files/ templates/ CHANGELOG.md Thorfile chefignore metadata.rb test/$ cd attributes/
$ ls
default.rb$ vi default.rb
Change default web_dir, xpc_url, xpc_fn# # Cookbook Name:: iam-app-xpc # Attributes:: default # default['iam-app-xpc']['web_dir'] = '/var/www/html' default['iam-app-xpc']['xpc_url'] = 'https://xpc.cloudpath.net/download_tar.php?guid={000372-539FAB66-DACE-FA53-AAAC-83771BF9C00E-9D97AC75-937B-E97D-BD5E}' default['iam-app-xpc']['xpc_fn'] = 'Cloudpath_PKG3987_SVR688_U1293_PHP_5-0-538_20161025.tar.gz' default['iam-app-xpc']['key_fn'] = '/etc/pki/tls/private/server.key' default['iam-app-xpc']['cert_fn'] = '/etc/pki/tls/certs/server.crt' default['iam-app-xpc']['chain_fn'] = '/etc/pki/tls/certs/server-chain.crt' # # Sensu Monitoring # default['iam-app-people']['sensu-handlers'] = ['oit-iam'] default['sensu']['rabbitmq']['host'] = '137.229.13.9' default['sensu']['rabbitmq']['password'] = 'czp0vEX6oWTy'$ git diff
Verify differences between local version and GitHub? before commit $ cd ../
Back to ~/cookbooks/iam-app-xpc $ vi metadata.rb
Change description, versionname 'iam-app-xpc' maintainer 'Glen Johnson' maintainer_email 'gfjohnson@alaska.edu' license 'All rights reserved' description 'Installs/Configures iam-app-xpc' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) version '0.1.4' depends 'chef-vault', '~> 1.3.3' depends 'sensu', '~> 3.0.0'$ vi CHANGELOG.md
Record changes for ongoing version history""# CHANGELOG This file is used to list changes made in each version of the cookbook. ## 0.1.0 - 0.1.4 - lttoth - apply latest XpressConnect update - 0.1.3 - gfjohnson - rsyslog.d config apache - 0.1.2 - gfjohnson - send apache logs to central logging - 0.1.1 - gfjohnson - sensu http check allow redirect - 0.1.0 - gfjohnson - initial prod release - - - Check the [Markdown Syntax Guide](http://daringfireball.net/projects/markdown/syntax) for help with Markdown. The [Github Flavored Markdown page](http://github.github.com/github-flavored-markdown/) describes the differences between markdown on github and standard markdown.$ kitchen test
Test that kitchen will run without errors, without actually running the program. The output is lengthy.-----> Starting Kitchen (v1.13.2) -----> Cleaning up any prior instances of <default-centos-67> -----> Destroying <default-centos-67>... Finished destroying <default-centos-67> (0m0.00s). -----> Testing <default-centos-67> -----> Creating <default-centos-67>... Bringing machine 'default' up with 'virtualbox' provider... ==> default: Importing base box 'bento/centos-6.7'... ==> default: Matching MAC address for NAT networking... ==> default: Checking if box 'bento/centos-6.7' is up to date... ==> default: Setting the name of the VM: kitchen-iam-app-xpc-default-centos-67_default_1477441968033_78767 ==> default: Clearing any previously set network interfaces... ==> default: Preparing network interfaces based on configuration... ... Chef Client finished, 50/70 resources updated in 03 minutes 58 seconds Finished converging <default-centos-67> (4m21.45s). -----> Setting up <default-centos-67>... Finished setting up <default-centos-67> (0m0.00s). -----> Verifying <default-centos-67>... Preparing files for transfer ... Service "httpd" should be enabled should be running Port "80" should be listening Port "443" should be listening Package "sensu" should be installed Service "sensu-client" should be enabled should be running Finished in 0.41218 seconds (files took 0.41847 seconds to load) 7 examples, 0 failures Finished verifying <default-centos-67> (0m8.89s). -----> Destroying <default-centos-67>... ==> default: Forcing shutdown of VM... ==> default: Destroying VM and associated drives... Vagrant instance <default-centos-67> destroyed. Finished destroying <default-centos-67> (0m4.54s). Finished testing <default-centos-67> (5m22.79s). -----> Kitchen is finished. (5m26.26s)$ git checkout -b xpcupdate
Checkout most recent version of XPC cookbook for as new branch."M CHANGELOG.md M attributes/default.rb M metadata.rb$ git status
On branch xpcupdate Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: CHANGELOG.md modified: attributes/default.rb modified: metadata.rb no changes added to commit (use "git add" and/or "git commit -a")$ git add .
$ git status
On branch xpcupdate Changes to be committed: (use "git reset HEAD <file>..." to unstage) modified: CHANGELOG.md modified: attributes/default.rb modified: metadata.rb$ git commit -m "apply latest XpressConnect? update"
[xpcupdate 336a244] apply latest XpressConnect update 3 files changed, 3 insertions(+), 2 deletions(-)$ git push -u origin xpcupdate
Counting objects: 11, done. Delta compression using up to 8 threads. Compressing objects: 100% (5/5), done. Writing objects: 100% (6/6), 551 bytes | 0 bytes/s, done. Total 6 (delta 4), reused 0 (delta 0) remote: Resolving deltas: 100% (4/4), completed with 4 local objects. To git@github.alaska.edu:OIT-IAM/iam-app-xpc.git * [new branch] xpcupdate -> xpcupdate Branch xpcupdate set up to track remote branch xpcupdate from origin.$ ls -aFC .git
./ HEAD description logs/ ../ ORIG_HEAD hooks/ objects/ COMMIT_EDITMSG branches/ index packed-refs FETCH_HEAD config info/ refs/$ git checkout master
Confirm that master and branch are the same.Switched to branch 'master' Your branch is up-to-date with 'origin/master'.$ git pull
remote: Counting objects: 6, done. remote: Compressing objects: 100% (1/1), done. remote: Total 6 (delta 4), reused 5 (delta 4), pack-reused 0 Unpacking objects: 100% (6/6), done. From github.alaska.edu:OIT-IAM/iam-app-xpc 556252d..44748a9 master -> origin/master Updating 556252d..44748a9 Fast-forward CHANGELOG.md | 1 + attributes/default.rb | 2 +- metadata.rb | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-)$ git branch
* master xpcupdate$ berks install
$ berks upload