Commit 58dc6423561a1314027fbdf7713ac2084fa5ca60

Authored by macartur
1 parent 87f53a50

Fixing gitlab backup and restore , adding backup.txt to backup redmine and ldap

Makefile
... ... @@ -35,5 +35,3 @@ clean:
35 35 missfont.log $(BASE_NAME)*.bbl $(BASE_NAME)*.pdf $(BASE_NAME)*.out \
36 36 $(BASE_NAME)*.lof $(BASE_NAME)*.lot *.swp
37 37  
38   -remake:
39   - make clean && make
... ...
installDoc/backup_restauracao-sei.tex
... ... @@ -33,9 +33,17 @@ sudo gitlab-rake gitlab:backup:restore BACKUP=<TIMESTAMP\_of\_backup>
33 33 Caso só haja um arquivo de backup no diretório de backups, o parâmetro
34 34  
35 35 BACKUP=<TIMESTAMP\_of\_backup>
36   -
37 36 torna-se opcional.
38 37  
  38 +Durante a restauração será pedido para sobrescrever o arquivo authorized\_kyes, digite 'yes' para confirmar ou 'no' para não sobrescrever e então click no 'Enter'.
  39 +
  40 +
  41 +
  42 +
  43 +
  44 +
  45 +
  46 +
39 47 \subsection{Redmine}
40 48 \subsubsection{Backup}
41 49  
... ... @@ -59,15 +67,18 @@ cd /opt
59 67  
60 68 \fbox{\parbox{\textwidth}{
61 69 \texttt{
62   -sudo chown \$USER:\$GROUP -R /opt
63   -\\
64   -cd /opt
  70 +
  71 +
  72 +
  73 +
65 74 }}}
66 75 \subsubsection{Restauração}
67 76  
68 77 \fbox{\parbox{\textwidth}{
69 78 \texttt{
70   -sudo chown \$USER:\$GROUP -R /opt
71   -\\
72   -cd /opt
  79 +
  80 +
  81 +
  82 +
  83 +
73 84 }}}
... ...
script/backup.txt
... ... @@ -5,26 +5,36 @@ backup:
5 5 sudo slapcat -v -l /tmp/ldap-backup.ldif
6 6  
7 7 modificando o arquivo de configuração padrao
8   - sudo slapcat -v -f /etc/openldap/slapd.conf -l /tmp/ldap-backup.ldif
  8 + sudo slapcat -v -f /etc/openldap/slapd.conf -l /tmp/ldap-backup.ldif
9 9  
10 10 restaurar:
11   - sudo service slapd stop
12   - sudo rm -rf /var/lib/ldap/!(DB_CONFIG)
13   - sudo service slapd start
14   - sudo service slapd stop
15   - sudo slapadd -l /tmp/ldap-backup.ldif
16   - sudo slapindex -v
17   - sudo chown ldap:ldap /var/lib/ldap/*
18   - service slapd start
19   -
  11 + remover usuários antigos :
  12 + sudo service slapd stop
  13 + sudo rm -rf /var/lib/ldap/!(DB_CONFIG)
  14 + sudo service slapd start
  15 + sudo service slapd stop
  16 +
  17 + addicionar usuários na ldap:
  18 + sudo slapadd -l /tmp/ldap-backup.ldif
  19 + sudo slapindex -v
  20 + sudo chown ldap:ldap /var/lib/ldap/*
  21 + service slapd start
20 22  
21 23 redmine
22   - postgresql:
23   - Backup:
24   - pg_dump -U {user-name} {source_db} -f {dumpfilename.sql}
  24 + Backup:
  25 + export PGPASSWORD=<PASSWORD_REDMINE_USER>
  26 + /usr/pgsql-9.3/bin/pg_dump -i -h <LOCALHOST> -p <PORT> -U <REMINE_USER> -F c -b -v -f "<DIRECTORY_TO_BACKUP>" DATABASE_REDMINE
  27 +
  28 + backup file:
  29 + sudo rsync -bvza /opt/redmine/files <DIRECTORY_TO_BACKUP> --delete
  30 +
  31 + restore:
25 32  
26   - Restore:
27   - psql -U {user-name} -d {desintation_db}-f {dumpfilename.sql}
28   - mysql:
  33 + sudo -u postgres psql -c "DROP DATABASE <DATABASE_REDMINE>;"
  34 + sudo -u postgres psql -c "CREATE DATABASE <DATABASE_REDMINE> WITH ENCODING='UTF8' OWNER=<REDMINE_USER>;"
29 35  
30 36  
  37 + export PGPASSWORD=<PASSWORD_REDMINE_USER>
  38 + /usr/pgsql-9.3/bin/pg_restore --host=<LOCALHOST>--port=5432 --dbname=<DATABASE_REDMINE> --username=<REDMINE_USER> <DIRECTORY_TO_BACKUP> -n public
  39 + restore file:
  40 + sudo rsync -bvza <DIRECTORY_TO_BACKUP>/files /opt/redmine/
... ...