Skip to content

Instantly share code, notes, and snippets.

@MosesMendoza
Created June 7, 2012 23:34
Show Gist options
  • Save MosesMendoza/2892421 to your computer and use it in GitHub Desktop.
Save MosesMendoza/2892421 to your computer and use it in GitHub Desktop.
General:
Currently, there are several cases regarding database setup in the PE installer. Note that the database setup routines only occur if the console is selected for install.
1) the installer checks for the existence of mysql.
* If it is found, the installer asks if the mysql server is running on a remote host. if it is remote, the user is prompted to enter host
and port information. if it is not remote, the installer assumes the mysql server is hosted on the current stations.
* If it is not found, the installer asks if the user would like to install MySQL server. If yes, the installer proceeds directly to step 3, below, skipping step 2.
Note: the install *will exit* if the user opts not to install MySQL server at this point. The installer does not support installing MySQL client only.
2) the installer asks if the user would like the installer to create the databases and users automatically.
* if no, the installer assumes the databases and users exist or will exist,
and queries the user for the names of the existing databases and users. After getting all the info, the installer checks the validity of the submissions. If they are not set up
correctly, the installer prints out instructions for creating them, and exits.
* if yes, the installer asks for the existing mysql root user password. it tries to connect to the server using this, and fails if it can't connect. if connection succeeds, it proceeds
with the interview
3) this is where the behavior changes from the previous installer:
* Previously, the user was interviewed for the console and console_auth database names, users, and passwords, and then later in the install creates all of these
* As of PE 2.5.2, instead of interviewing, at this point the installer assumes the following:
console database name will be "console"
console auth database name will be "console_auth"
inventory service database name will be "console_inventory_service"
console user will be "console"
console auth user name will be "console_auth"
All database users are created automatically. The database passwords are 20 character pseudo-random alpha-numeric strings.
If the user opted to install MySQL server earlier, the root password is also among those generated automatically.
* The installer checks if any of the databases and users it is about to create are already present on the mysql server.
If any of them exist already, the user is prompted for a new, unique, name for that item. The installer will verify the "new" name is available. if is not,
the user is prompted a second time, and their answer checked for availability. If the 3rd check fails, the installer fails.
There is a confusing edge-case possibility where the console_inventory_service database exists already, and the user is asked to enter a new one. The way the
installer and uninstaller are written, the inventory service database *has* to be named by appending "_inventory_service" to the name of the console database.
E.g., if the console database is named "my_console_db," the inventory service database has to be named "my_console_db_inventory_service." So, if either the
proposed console OR inventory service databases exist already, the user is prompted to enter a new console database name such that neither the new console database
name nor the new console database name appended with "_inventory_service" exist on the mysql server.
* If the db setup is occurring on a remote MySQL server, the same checks occur, except that the user names include the hostname of the connecting client, instead
of 'localhost'. E.g. if installing PE on pe-centos6 and using a remote database server pe-debian6, the console user checked for and created on pe-debian6 will be
'console'@'pe-centos6' instead of 'console'@'localhost.'
3) Once verification is complete, the install proceeds normally, creating the database and users.
4) All database information, including database names, user names, and passwords, are stored in the saved answers file. The answers file is normally saved to
the installer directory. If, for some reason, this fails, the installer tries to save the answers file in /tmp. If this fails, the installer will proceed
to save an answers file in /etc/puppetlabs/installer/answers.install, but with all password information removed, because this file may be pulled in by the
support script.
Because the passwords are never printed to standard out, in order to prevent the loss of auto-generated database info/passwords in the remote case that the
installer fails to save an answer file, the installer will create a seperate file /etc/puppetlabs/installer/database_info.install. In either case, the user
is now notified at the end of the install of the file that contains the database info, and warned to secure it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment