summaryrefslogtreecommitdiff
path: root/bootstrap.mdwn
blob: d0690b368e4eb2ba9a545dc4221e0538043ca754 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
[[!toc  levels=4]]

Bootstrap de uma configura��o completa
======================================


Est�gios de configura��o
------------------------

Os seguintes est�gios fazem parte de uma instala��o padr�o completa:

1. [Instala��o do sistema padr�o](/install) na m�quina hospedeira.
2. [Cria��o de um vserver padr�o](/vservers) para hospedar um n� administrativo.
3. [Bootstrap do puppet](/puppet) no vserver administrativo usando [hydra](http://git.sarava.org/?p=hydra.git;a=summary).
4. Configura��o de servi�os fundamentais:
    * Gitosis.
    * Reposit�rios de chaves criptogr�ficas (gitosis + hydra)
       * Chaves GPG para backup local criptografado.
       * Chaves SSH para armazenamento remoto de backup.
    * Reposit�rio de configura��o do puppet (reposit�rio modelo no [puppet-bootstrap](http://git.sarava.org/?p=puppet-bootstrap.git;a=summary)).
    * Backups.
    * Puppetmaster.
5. Cria��o de outros vservers/n�s:
    * N� de armazenamento ("storage") para agrupamento de backups.
    * Proxy.
    * Web.
    * Test.


Configura��o do puppet
----------------------

    apt-get install puppetmaster puppet git-core openssh-server
    cd /etc/puppet
    mkdir modules
    git init
    git add .
    
    repos="`lynx -dump http://git.sarava.org/?a=project_index | awk '{ print $1 }' | grep ^puppet-`"
    for repo in $repos; do
      module="`basename $repo .git | cut -d - -f 2`"
      if [ ! -d "modules/$module" ]; then
        git submodule add git://git.sarava.org/puppet-$module.git modules/$module
      fi
    done

No caso de bootstrap para um novo projeto, substitua as refer�ncias de `git.sarava.org` para `git.projeto.org`.

Configurando refer�ncias remotas em massa
-----------------------------------------

    # Configuracao
    origin="sarava.org"
    remotes="sarava.org:porta"
    repos="`lynx -dump http://git.$origin/?a=project_index | awk '{ print $1 }' | grep ^puppet-`"

    # Adicionando referencias
    for repo in $repos; do
      module="`basename $repo .git | cut -d - -f 2`"
      if [ -d "puppet-$module" ]; then
        cd puppet-$module
        for remote in $remotes; do
          ref="`echo $remote   | cut -d . -f 1`"
          domain="`echo remote | cut -d : -f 1`"
          port="`echo remote   | cut -d : -f 2`"
          git remote add $ref ssh://gitosis@git.$domain:$port/puppet-$module.git
          git push $ref master
        done
        cd ..
      fi
    done

Mudando refer�ncias em subm�dulos
---------------------------------

    # Configuracao
    origin="sarava.org"
    dest="exemplo.org"

    cd puppet
    sed -i -e "s/git.$origin/git.$dest/" .gitmodules
    cd modules
    for module in `ls`; do
      cd $module
      git remote rm origin
      git remote add origin git://git.$dest/puppet-$module.git
      git config branch.master.remote origin
      git config branch.master.merge refs/heads/master
      cd ..
    done

Exemplo de cria��o em massa de m�dulos
--------------------------------------

    # Configuracao
    origin="sarava.org"
    remotes="sarava.org:porta"

    mkdir puppet-{ikiwiki,moin,mysql,trac}/manifests -p
    touch puppet-{ikiwiki,moin,mysql,trac}/manifests/init.pp
    for module in ikiwiki moin mysql trac; do
      cd puppet-$module
      cp ../puppet-git/LICENSE .
      git init
      git add .
      git commit -a -m "Initial import"
      for remote in $remotes; do
        ref="`echo $remote   | cut -d . -f 1`"
        domain="`echo remote | cut -d : f 1`"
        port="`echo remote   | cut -d : f 2`"
        git remote add $ref ssh://gitosis@git.$domain:$port/puppet-$module.git
        git push $ref master
      done
      cd ..
    done