Tuesday 13 January 2015

chef server on the docker (community version)

Chef server on docker ubuntu container

I have seen so many people wondering for setting up chef server on docker container because they face so problem during the chef reconfiguration. It stuck during redis and postgresql during the chef server setup. There are some steps that will help you to install the chef server on the docker smoothly.

Start a ubuntu docker container with privilege option
# docker run -p 443 --privileged -h chef-server -it ubuntu

update the system
# sudo apt-get update

During this installation some files will need to be edited manually. If you are familiar with vim set it as default editor with the commands below. If you are not familiar with vim please skip this and keep using the default editor.
# sudo apt-get install -y vim

To diverse the package
# dpkg-divert --local --rename --add /sbin/initctl

To Make the soft link
# ln -sf /bin/true /sbin/initctl

To increase the shared memory of the kernel
# sysctl -w kernel.shmmax=1727989184

Now download chef server
# wget https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/12.04/x86_64/chef-server_11.0.10-1.ubuntu.12.04_amd64.deb

Install the chef-server
# dpkg -i chefXXXXX.dep

Run the chef server in the background
# /opt/chef-server/embedded/bin/runsvdir-start &

Reconfigure the chef server
# chef-server-ctl reconfigure

Now chef-server is installed go to the web browser and hit this https://container_ip:443 url now you can see the Gui of the community chef server.


Note***
After shutting down the docker container, when you start the container again then you have to restart the chef server. so follow these step
# sysctl -w kernel.shmmax=1727989184
# /opt/chef-server/embedded/bin/runsvdir-start &