183 | | To resolve this |
| 183 | To resolve this: |
| 184 | * Take site down (I did this the ugly way!) |
| 185 | {{{ |
| 186 | vim /etc/crontab |
| 187 | /etc/init.d/apache2 stop |
| 188 | }}} |
| 189 | * Backup all Data |
| 190 | {{{ |
| 191 | cd /home/haiti/prod |
| 192 | mkdir databases2 |
| 193 | cp -ar databases/* databases2 |
| 194 | rm -rf databases |
| 195 | }}} |
| 196 | * Copy data down locally to be able to analyse easily, export as CSV |
| 197 | {{{ |
| 198 | tar cvf prod_db.tar databases2 |
| 199 | gzip -9 prod_db.tar |
| 200 | sz prod_db.tar.gz |
| 201 | }}} |
| 202 | * Allow model to recreate databases (owned as www-data) |
| 203 | * http://haiti.sahanafoundation.org |
| 204 | * Restore Data |
| 205 | * Edit CSV file using a text editor (not MS Excel!) |
| 206 | * remove reference tables & intiial records which are created by {{{models/zzz_1st_run.py}}} (NB This didn't seem to work properly on this occasion!) |
| 207 | * Import CSV segments to see which parts work: |
| 208 | {{{ |
| 209 | cd /home/haiti/web2py |
| 210 | python web2py.py -S prod -M -N |
| 211 | db.import_from_csv_file(open('prod_part1.csv','rb')) |
| 212 | db.commit() |
| 213 | Ctrl+D |
| 214 | }}} |