Startup and shutdown script for foreman and katello

Problem:
New to foreman/katello. Looking for the commands to shutdown and restart foreman and katello during our backup window, including the default database. Can see via systemctl -a foreman has it’s own service but see nothing regarding Katello or the mongo database. Running the latest versions of foreman and katello
Expected outcome:
Note: It would be helpful to know the recomended shutdown and startup order of the particular processes, plan to create and cron a couple of bash scripts one for shutdown and one for startup
Foreman and Proxy versions:

Foreman and Proxy plugin versions:

Distribution and version:

Other relevant data:

Thank you in advance for any and all input

Now I’m curious. Would we actually need to “stop” to backup? My understanding is foreman is pretty stateless sans db so no big deal backing up running if you want.

I’ve also done hot db backups with Mariabackup/perconabackup for years and saved/backed those up, never shutting anything down.
I’ve even restored those backups with no known issues.

Is this a postgres limitation I should be aware of as I finalize our cutover where the db needs to be “offline” to take consistent backups?

Hi @nlong, welcome!

The commands you’re looking for are foreman-maintain service stop and foreman-maintain service start. They will automatically stop and start all the needed services.

(list, status, and restart are also available if you need them.)

Hi Jason,
Let me see if I can explain why the need to have startup and shutdown
scripts. Our environment is based on vmware and because of this we use
Rubrick as our backup software, which simply takes a snapshot of each vm
and backups up contents of the vm to Azure. While Rubrick provides a
backup agent for sql which enables a sql restore there is no such provision
for Mongo databases, hence the need to shutdown all related Foreman/Katello
services on the VM prior to backup. Maybe I’m a bit ignorant and too
cautious but want to make sure if there is ever a need to restore
Foreman/Katello we don’t run into any unforeseen opportunities restoring
from a vm actively running httpd, mongo databases. Hope this explanation
makes sense. Would you mind sharing your backup scripts for Mongodb?

Norm

1 Like

If you’re now on MySQL you’re not using Katello. That means all of this is irrelevant to you.

With vanilla Foreman you essentially only have the database. Foreman :: Manual mentions the db:dump rake task, but that’s a very thin wrapper around pg_dump. Then there are also some files in /etc/foreman but those rarely change so having them exactly in sync is not really needed.

Adding Katello to the mix complicates things. Katello and Pulp need to be in sync. Since Pulp (2) stores its data in MongoDB, that needs to be backed up at the same time and the best way is to stop the services.

It should be noted that Pulp 3 is moving its database to PostgreSQL. They probably still need to be in sync. Pulp also has various files on disk that need to be in sync with the DB.

1 Like