We have been using Foreman for quite a while and we're very happy with it
This may be the first time we try to do something that is not already
documented.
We're currently using Foreman 1.10.1 in a CentOS 6 machine, but now time
comes to upgrade to CentOS 7 since we're standardizing all machines in the
new OS.
I tried to migrate the server, with the backup - restore process as shown
in the documentation (0). The result is not 100% correct, although I would
say it mostly works since our installation is pretty simple (we use Foreman
for the ENC and report visualization mostly).
I've got a bunch of database errors when importing the backup like:
pg_restore: [archiver (db)] could not execute query: ERROR: constraint
"user_roles_role_id_fk" for relation "user_roles" already exists
Command was: ALTER TABLE ONLY user_roles
ADD CONSTRAINT user_roles_role_id_fk FOREIGN KEY (role_id) REFERENCES
roles(id);
I wasn't able to find any documentation or experiences, so would anyone
have some experience with that kind of upgrade? May I had been impacted by
the PostgreSQL migration (8.4 to 9.2)?
That does sound like a issue with Postgresql migration, although not one
I've seen before. Assuming you have db backups available, I'd suggest
importing the backup into a clean 8.4 psql instance, upgrading psql to 9.2,
and then dumping it back out to give you something clean to import into
your new Foreman node.
You might also need to use the sequence fixing script in Foreman :: Manual as I'm not
sure if that will be included in the db dumps
Shutdown services (not PostgreSQL) on the CentOS 6 server
On the CentOS 6 server, extract this tar and zipped PostgreSQL
distribution into a directory named '/usr/local/src/pgsql/'
Backup the CentOS 6 Foreman server as described in the foreman
documentation, except for PostgreSQL
Next, backup The Foreman's PostgreSQL database on the CentOS 6 server
with the following command series (Postgres calls -Fc a "custom dump")
···
-
- su postgres
- /usr/local/src/pgsql/bin/pg_dump -Fc foreman >
/tmp/pg_centos6server_foremanFc-20170814.dump
8. restore the postgres dump to centos 7 postgres server (Restoring the
dump file wants to create the database, but it doesn't, so we create it and
endure the resulting error message during the restore operation as shown
here)
- su - postgres
- dropdb foreman
- createdb foreman
- g_restore -C -d foreman
/tmp/pg_centos6server_foremanFc-20170814.dump
-
- You will see the following output, but the restore will still
complete:
- could not change directory to "/root"
- pg_restore: [archiver (db)] Error while PROCESSING TOC:
- pg_restore: [archiver (db)] Error from TOC entry 2897; 1262
16385 DATABASE foreman foreman
- pg_restore: [archiver (db)] could not execute query: ERROR:
database "foreman" already exists
- Command was: CREATE DATABASE foreman WITH TEMPLATE =
template0 ENCODING = 'SQL_ASCII' LC_COLLATE = 'C' LC_CTYPE = 'C';
- WARNING: errors ignored on restore: 1
9. Your Foreman server is now migrated from CentOS 6 to CentOS 7.
If this is your puppet master and/or certificate authority, you may want to
perform these additional steps
copy over the host configuration from centos 6 to 7 server, if you do
not want them to be rebuilt
On Puppet Slaves, if necessary, create a new SSL Certificate with DNS
Alt Name
add dns_alt_names to [main] section in /etc/puppet/puppet.conf
change the puppet master server to the yourcentos7server in
/etc/puppet/puppet.conf
puppet agent -t (generates new cert)
sign this cert on the master, if not autosigned
restart services
On CentOS 7 server, ensure the httpd, foreman, and foreman-proxy
services are enabled; also ensure firewalld settings are correct
-RG
On Monday, February 8, 2016 at 10:09:50 AM UTC-6, Gato Pardo wrote:
Hello!
We have been using Foreman for quite a while and we’re very happy with it
This may be the first time we try to do something that is not already
documented.
We’re currently using Foreman 1.10.1 in a CentOS 6 machine, but now time
comes to upgrade to CentOS 7 since we’re standardizing all machines in the
new OS.
I tried to migrate the server, with the backup - restore process as shown
in the documentation (0). The result is not 100% correct, although I would
say it mostly works since our installation is pretty simple (we use Foreman
for the ENC and report visualization mostly).
I’ve got a bunch of database errors when importing the backup like:
pg_restore: [archiver (db)] could not execute query: ERROR: constraint
“user_roles_role_id_fk” for relation “user_roles” already exists
Command was: ALTER TABLE ONLY user_roles
ADD CONSTRAINT user_roles_role_id_fk FOREIGN KEY (role_id) REFERENCES
roles(id);
I wasn’t able to find any documentation or experiences, so would anyone
have some experience with that kind of upgrade? May I had been impacted by
the PostgreSQL migration (8.4 to 9.2)?