Name Last Update
config Loading commit data...
cookbooks Loading commit data...
docs Loading commit data...
monitoring Loading commit data...
roles Loading commit data...
rpm_mirrors Loading commit data...
src Loading commit data...
tasks Loading commit data...
test Loading commit data...
utils Loading commit data...
.ackrc Loading commit data...
.gitignore Loading commit data...
Gemfile Loading commit data...
Makefile Loading commit data...
README.chef.md Loading commit data...
README.md Loading commit data...
Rakefile Loading commit data...
Rakefile.ci Loading commit data...
VERSION Loading commit data...
Vagrantfile Loading commit data...
ci Loading commit data...
config.rb Loading commit data...
local.rake.example Loading commit data...
nodes-ci.yaml Loading commit data...
nodes.yaml Loading commit data...
server Loading commit data...
ssh_config.erb Loading commit data...

README.chef.md

Software Público - configuration management

Requirements

For development

  • vagrant
  • shunit2
  • moreutils
  • redir

Configuration parameters

All configuration parameters are defined in nodes.yaml, with exception of IP addresses and ssh configuration, which are defined in different files. Each environment are defined on config/<ENV>/* and to deploy you're need to use the SPB_ENV variable. The environment local is defined by default. The files to configure a new env are:

  • config.yaml: any configuration used for the specific environment.
  • ips.yaml: the IP of each node.
  • ssh_config: used to login into the machine with the command rake login:$server.
  • iptables-filter-rules: any iptables configuration needed to the environment.

If you need to do any changes on the IPs addresses, make sure that the ips.yaml are configure for the right environment. You will probably not need to change nodes.yaml unless you are developing the deployment process.

Deploy

Development

First you have to bring up the development virtual machines:

$ vagrant up
$ rake preconfig
$ rake bootstrap_common
WARNING: Right now there are 7 VM's: six of them with 512MB of
 RAM and one with 1GB of RAM. Make sure that your local machine
 can handle this environment. Also, this might take a while.

The basic commands for deployment:

$ rake                                  # deploys all servers
$ rake nodes                            # lists all servers
$ rake converge:$server                 # deploys only $server

Production

  • TODO: document adding the SSL key and certificate
  • TODO: document creation of prod.yaml.
  • TODO: document SSH configuration

The very first step is

$ rake preconfig SPB_ENV=production

This will perform some initial configuration to the system that is required before doing the actual deployment. This command should only be runned one time.

After that:

$ rake SPB_ENV=production                   # deploys all servers
$ rake nodes SPB_ENV=production             # lists all servers
$ rake converge:$server SPB_ENV=production  # deploys only $server

You can also do export SPB_ENV=production in your shell and omit it in the rake calls.

See the output of rake -T for other tasks.

Viewing the running site when developping locally

Run:

./server

Follow the on-screen instructions an browse to http://softwarepublico.dev/.

Note: this requires that your system will resolve \*.dev to localhost. Google DNS servers will do that automatically, otherwise you might add the following entries to /etc/hosts:

127.0.53.53 softwarepublico.dev
127.0.53.53 listas.softwarepublico.dev