Skip to content

Commit

Permalink
Merge pull request #563 from bareos/dev/fbergkemper/master/s3793
Browse files Browse the repository at this point in the history
MySQL/SQLite deprecation
  • Loading branch information
fbergkemper committed Aug 5, 2020
2 parents 799ea9c + ecc8c3e commit f383677
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 418 deletions.
11 changes: 4 additions & 7 deletions core/src/cats/create_bareos_database.in
Expand Up @@ -81,15 +81,12 @@ fi

case ${db_type} in
sqlite3)
sqlite3 $* ${working_dir}/${db_name}.db ".tables"
# Allow non root access
chown ${dir_user}:${dir_group} ${working_dir}/${db_name}.db
chmod 0640 ${working_dir}/${db_name}.db
retval=0
echo "The SQLite database backend is deprecated. Please use PostgreSQL instead."
retval=1
;;
mysql)
mysql $* -e "CREATE DATABASE ${db_name};"
retval=$?
echo "The MySQL database backend is deprecated. Please use PostgreSQL instead."
retval=1
;;
postgresql)
#
Expand Down
16 changes: 6 additions & 10 deletions core/src/cats/make_bareos_tables.in
Expand Up @@ -110,18 +110,14 @@ fi

case ${db_type} in
sqlite3)
sqlite3 $* ${working_dir}/${db_name}.db < ${temp_sql_schema}
chmod 640 ${working_dir}/${db_name}.db
retval=0
echo "The SQLite database backend is deprecated. Please use PostgreSQL instead."
echo "Creation of Bareos SQLite tables aborted."
retval=1
;;
mysql)
mysql $* --database=${db_name} -f < ${temp_sql_schema}
retval=$?
if test $retval = 0; then
echo "Creation of Bareos MySQL tables succeeded."
else
echo "Creation of Bareos MySQL tables failed."
fi
echo "The MySQL database backend is deprecated. Please use PostgreSQL instead."
echo "Creation of Bareos MySQL tables aborted."
retval=1
;;
postgresql)
PGOPTIONS='--client-min-messages=warning' psql -f ${temp_sql_schema} -d ${db_name} $*
Expand Down
33 changes: 5 additions & 28 deletions docs/manuals/source/IntroductionAndTutorial/InstallingBareos.rst
Expand Up @@ -60,7 +60,9 @@ MariaDB/MySQL
It is contained in package **bareos-database-mysql**.
**This is not the right choice for a new deployment.**

Sqlite
SQLite
.. deprecated:: 20.0.0

This backend is for testing purposes only.
It is contained in package **bareos-database-sqlite3**.
**Do not use this in production.**
Expand Down Expand Up @@ -358,9 +360,8 @@ If you are not interested in this additional functionality, the commands describ
Prepare Bareos database
-----------------------

We assume that you have already your database installed and basically running. Using the PostgreSQL database backend is recommended.

The easiest way to set up a database is using an system account that have passwordless local access to the database. Often this is the user **root** for MySQL and the user **postgres** for PostgreSQL.
We assume that you have already your database installed and basically running.
Using the PostgreSQL database backend is recommended.

For details, see chapter :ref:`CatMaintenanceChapter`.

Expand Down Expand Up @@ -403,30 +404,6 @@ If your are using PostgreSQL and your PostgreSQL administration user is **postgr
su postgres -c /usr/lib/bareos/scripts/make_bareos_tables
su postgres -c /usr/lib/bareos/scripts/grant_bareos_privileges
MySQL/MariaDB
^^^^^^^^^^^^^

Make sure, that **root** has direct access to the local MySQL server. Check if the command :command:`mysql` connects to the database without defining the password. This is the default on RedHat and SUSE distributions. On other systems (Debian, Ubuntu), create the file :file:`~/.my.cnf` with your authentication informations:

.. code-block:: cfg
:caption: MySQL credentials file .my.cnf
[client]
host=localhost
user=root
password=<input>YourPasswordForAccessingMysqlAsRoot</input>
It is recommended to secure the Bareos database connection with a password. See :ref:`Catalog Maintenance -- MySQL <catalog-maintenance-mysql>` on how to achieve this. For testing, using a password-less MySQL connection is probably okay. Setup the Bareos database tables using the following commands:

.. code-block:: shell-session
:caption: Setup Bareos catalog with MySQL
/usr/lib/bareos/scripts/create_bareos_database
/usr/lib/bareos/scripts/make_bareos_tables
/usr/lib/bareos/scripts/grant_bareos_privileges
As some Bareos updates require a database schema update, the file :file:`/root/.my.cnf` might also be useful in the future.

.. _section-StartDaemons:

Start the daemons
Expand Down

0 comments on commit f383677

Please sign in to comment.