Making erchef

Erlang 2014. 3. 8. 15:53

Making erchef


Opscode publish the new Chef server called erchef. It is build from erlang.

This blog is a log of making erchef on Ubuntu 12.04.1.

1st. erlang install

A default ubuntu erlang apt-package is a little bit old. I compile from the source.

% sudo apt-get install make gcc libncurses5-dev libssl-dev \
  libssl1.0.0 openssl libstdc++6 libstdc++6-4.6-dev
% curl -O http://www.erlang.org/download/otp_src_R15B02.tar.gz
% gzip -dc otp_src_R15B02.tar.gz | tar xvf -
% cd otp_src_R15B02
% ./configure --prefix=/usr/local/ && make
% sudo make install

Next, compile the reber(dependency management tool).

% git clone git://github.com/basho/rebar.git
% cd rebar
% ./bootstrap
% sudo cp -p rebar /usr/local/bin/

2. make

make.

% git clone git://github.com/opscode/erchef.git
% cd erchef
% make rel

That’s it. easy.

I was just tought.

until launching erchef....

3. creating app.config

A configuration file called app.config is required to launching erchef. However, that repository does not contain app.config.

After several googling, I found the omnibus-chef repository.

% sudo apt-get install ruby-bundler rake
% git clone git://github.com/opscode/omnibus-chef.git
% cd omnibus-chef
% bundle install
% mv omnibus.rb.example omnibus.rb
% sudo CHEF_GIT_REV=10.14.4 rake projects:chef-server

But I could not launch this omnibus-chef-server (sorry, I forgot why it could not). So, I use only a attribute and template to build app.config.

Here is the app.config I made after a lot of, a lot of, trial and error.

There are some notes to create app.config.

  • use relative path to choose log directory. not Absolute.
  • I use ‘/’ as rabbitmq directory. A guest can read/write to there. But it should be change.
  • should be change postgres dbname and password.

4. Running erchef

OK. now I got the shiny app.config. Let’s launch erchef!

Install dependency.
(solr does not required?)
% apt-get install postgres rabbitmq-server openjdk-7-jre solr-common solr-jetty

Create log directory.
% mkdir -p log/chef-server/erchef/

Use postgres schema (I cutting corner to use postgres user).
% sudo -u postgres createdb opscode_chef
% sudo -u postgres psql opscode_chef -f deps/chef_db/priv/pgsql_schema.sql

Create chef certificate.
% sudo escript bin/bootstrap-chef-server
client <<"admin">> created. Key written to
<<"/etc/chef-server/admin.pem">>
client <<"chef-validator">> created. Key written to
<<"/etc/chef-server/chef-validator.pem">>
client <<"chef-webui">> created. Key written to
<<"/etc/chef-server/chef-webui.pem">>
environment '_default' created

Place app.config under the erchef/etc.
% mv ~/app.config etc

Launch erchef.
% sudo bin/erchef start

Confirm.
% sudo bin/erchef ping
pong

Yah. erchef started. finally.

next, configure chef-client.

% knife configure -i
Overwrite /home/ubuntu/.chef/knife.rb? (Y/N) Y
Please enter the chef server URL: [http://blah.example:4000]   http://localhost:4000
Please enter a clientname for the new client: [ubuntu] user1  <-- !Another user!
Please enter the existing admin clientname: [chef-webui]
Please enter the location of the existing admin client's private key:
[/etc/chef/webui.pem] /etc/chef-server/chef-webui.pem
Please enter the validation clientname: [chef-validator]
Please enter the location of the validation key:
[/etc/chef/validation.pem] /etc/chef-server/chef-validator.pem
Please enter the path to a chef repository (or leave blank):
Creating initial API user...
Created client[user1]
Configuration file written to /home/ubuntu/.chef/knife.rb

That’s it.

% knife client list
admin
chef-validator
chef-webui
user1

5. However...

I can get list, role, node. However, I still could not upload cookbook or rebuild index. If you have any suggestions, please let me know.


'Erlang' 카테고리의 다른 글

ErLang/OTP  (0) 2014.03.10
Tcp ErLang  (0) 2014.03.07
Posted by sjokim
,