Creating backup indico server

We would like to create a backup indico server. We have a pretty much
vanilla install of 2.1.

Every several minutes, we will
copy a database dump from the server to the backup
systemctl stop indico-celery.service
systemctl stop uwsgi.service
createdb -O indico indico
psql indico -c “CREATE EXTENSION unaccent; CREATE \
EXTENSION pg_trgm”
psql -d indico -f /usr/local/adm/aac2018Backup/every5mins/indico-pgsql-backup.0.sql
{restart services}

The script can be run as root or indico or postgres.

I am having trouble with “DROP DATABASE indico”:

[root@aacbackup adm]# psql indico -c “DROP DATABASE indico”
psql: FATAL: role “root” does not exist
[root@aacbackup adm]# su - indico
Last login: Thu Aug 2 17:04:53 MDT 2018 on pts/1
[indico@aacbackup ~]$ psql -c “DROP DATABASE indico”
ERROR: cannot drop the currently open database

The Indico Celery service is not running.

Thank you for any assistance.

In fact, as indico I can CLOSE indico and DROP indico (without error)

indico=> CLOSE indico
indico-> DROP DATABASE indico
indico-> \l
                                  List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileg
 indico    | indico   | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 

Run the psql commands as the postgres user (or the user that owns the database, e.g. indico), not as root. Also, Postgres has a dropdb command for this; no need to use raw SQL.

PS: Make sure you never run Celery on your backup instance. Otherwise you get duplicate reminders emails etc.

Thank you ThiefMaster!

[root@aacbackup adm]# su - postgres -c “dropdb indico”
[root@aacbackup adm]# su - postgres -c ‘psql --list’
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileg

postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres
| | | | | postgres=CTc/post
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres
| | | | | postgres=CTc/post
(3 rows)

Thank you for the advice about not running the celery service on the
backup, resulting in duplicate emails.

How can I test that the backup is working without bringing up the
celery service?

Could I disable emails on the backup?

Besides sending emails and doing some other periodic tasks Indico works fine without running Celery. I’d just start Celery when you have to failover to the backup server.

Against your advice, I did start Celery just to check it, and then stopped it
right away.

A red bar appeared at the top:

The Celery task scheduler does not seem to be running. This means that email sending and periodic tasks such as event reminders do not work.

[root@aacbackup adm]# systemctl status indico-celery.service
● indico-celery.service - Indico Celery
Loaded: loaded (/etc/systemd/system/indico-celery.service; disabled; vendor preset: disabled)
Active: active (running) since Fri 2018-08-03 12:51:40 MDT; 1min 14s ago
Main PID: 8372 (indico)

I stopped it right away.

on a backup/test system you can safely ignore that warning or disable it in indico.conf


So I need to not start the indico-celery.service on the backup/test system.

But if the original fails, and I bring up the backup system, how do I fix
the error message? We definitely want it to be sending email and
doing periodic tasks.

The production server is 2.0 and the clone is 2.1.

After loading the db, I do

su - indico -c 'source /opt/indico/.venv/bin/activate; indico db upgrade'
su - indico -c 'source /opt/indico/.venv/bin/activate; indico db --all-plugins upgrade

only admins see the warning. when you failover to the backup, simply start celery.

That’s good to know. Thank you so much.

But just to confirm, when I got that warning, celery was started.

I will try it again.

after a few moments it should disappear - assuming celery is running properly! in case both servers were talking to the same redis instance (same host, port and dbnum) that would result in things not working properly since both workers would take tasks from the queue, so your production one might have handled the heartbeat that takes care of not showing the message

1 Like

Thank you very much.

I just started celery again and no warnings. Hopefully we did not send out
emails in the few seconds it was started.

We have the first live meeting managed by indico starting in one week.
There are 300 participants, so very anxious to have this working correctly.
And to have a backup plan.

Thank you again.