Blame view

README.chef.md 2.16 KB
dfbf2427   Antonio Terceiro   Unified release p...
1
2
3
4
# Software Público - configuration management

## Requirements

f95e628f   Paulo Tada   Updating dependec...
5
* [chake](https://rubygems.org/gems/chake)
56dd9d0a   Paulo Tada   Updating README.c...
6
7
* rake

dfbf2427   Antonio Terceiro   Unified release p...
8
9
10
11
12
13
14
15
16
17
18
For development

* vagrant
* shunit2
* moreutils
* redir

## Configuration parameters

All configuration parameters are defined in `nodes.yaml`, with exception of IP
addresses, which are defined in different files:
56dd9d0a   Paulo Tada   Updating README.c...
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

- for local development, the IP addresses of the Vagrant VMs are defined in
  config/local/ips.yaml.

- for production, you need to create a new file called
  `config/production/ips.yaml`

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:

dfbf2427   Antonio Terceiro   Unified release p...
35
36
37
38
39
40
41
42
43
44
45
46
47
```bash
$ vagrant up
$ rake preconfig
$ rake bootstrap_common
```

Right now there are 5 VM's, so this might take a while. The basic commands for
deployment:

```bash
$ rake                                  # deploys all servers
$ rake nodes                            # lists all servers
$ rake converge:$server                 # deploys only $server
56dd9d0a   Paulo Tada   Updating README.c...
48
49
50
51
52
```

### Production

* TODO: document adding the SSL key and certificate
dfbf2427   Antonio Terceiro   Unified release p...
53
* TODO: document creation of `prod.yaml`.
56dd9d0a   Paulo Tada   Updating README.c...
54
* TODO: document SSH configuration
dfbf2427   Antonio Terceiro   Unified release p...
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73

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.

After that:

```bash
$ 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
56dd9d0a   Paulo Tada   Updating README.c...
74
75
`rake` calls.

dfbf2427   Antonio Terceiro   Unified release p...
76
77
78
79
80
81
82
83
84
See the output of `rake -T` for other tasks.

## Viewing the running site when developping locally

Run:

```bash
./server
```
56dd9d0a   Paulo Tada   Updating README.c...
85
86

Follow the on-screen instructions an browse to
dfbf2427   Antonio Terceiro   Unified release p...
87
88
89
90
91
92
93
94
95
[http://softwarepublico.dev/](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
```