Configure the Database and Artifacts Repository
This topic covers the storage options in Deploy, which uses a database to store all data, including configuration items (CIs), deployment packages, logging, and more. Deploy can use either the filesystem or a database for storing binary artifacts (deployment packages), CIs, and CI history.
Supported Databases
See Installation Prerequisites.
Using a Database Server
- When you install (or upgrade Deploy to a latest version), Deploy creates and maintains the database schema. The database administrator requires the following permissions on the database: REFERENCES, INDEX, CREATE, DROP, in addition to the permissions used in operation: SELECT, INSERT, UPDATE, DELETE.
- Table definitions in Deploy use limited column sizes. To prevent these limits from restricting users in how they use Deploy, you must configure this for all the supported databases. For example, the ID of a CI is a path-like structure and consists of the concatenation of the names of all the parent folders for the CI. A restriction is set on the length of this combined structure. The maximum character length for all the supported databases is set to 850 chars.
- Deploy can be configured to use two different database connections: one for primary Deploy data and one for the task archive. Both database connections can be configured in the
XL_DEPLOY_SERVER_HOME/centralConfiguration/deploy-repository.yaml
file. The operational database connection can be configured under therepository
key and the database connection for the task archive can be configured under thereporting
key. By default, the default configuration for therepository
database connection is also used for thereporting
connection.
Also see...
The Database Configuration File—deploy-repository.yaml
Use the XL_DEPLOY_SERVER_HOME/centralConfiguration/deploy-repository.yaml
file for configuring the database settings.
After the first run, sensitive values in the XL_DEPLOY_SERVER_HOME/centralConfiguration/deploy-repository.yaml
file such as passwords are encrypted with base64-encoded encryption.
In addition, use the XL_DEPLOY_SERVER_HOME/centralConfiguration/deploy-repository.yaml
file for configuring the artifacts settings.
Artifacts in Deploy
Deploy stores user supplied artifacts in the filesystem, such as scripts or deployment packages (jar
or war
files). These are, by default, stored in the filesystem. You can store these artifacts in the database, if required. Deploy can use only one of these options at any time. You must configure where to store the artifacts in the XL_DEPLOY_SERVER_HOME/centralConfiguration/deploy-repository.yaml
file.
Specify the type of artifact storage to use. Valid values are:
file
: uses the filesystem for storing artifactsdb
: uses the database for storing artifacts
Set the type
property to file
to store the artifacts in the filesystem: type: file
xl.repository:
artifacts:
root: artifacts
type: file
Set the type
property to db
to store the artifacts in the database: type: db
xl.repository:
artifacts:
type: db
Preparing the database and repository
Before installing Deploy, create an empty database. Deploy will create the database schema during installation.
The account that accesses the database must have permissions to create tables during the initial installation and, later, it must have permissions to write, read, and delete from tables.
There are no requirements for the character set of the database.
Deploy must initialize the repository before it can be used. You must run The Deploy setup wizard and initialize the repository after making any changes to the repository configuration. For more information, see Run the server setup wizard.
The following set of SQL privileges are required.
During installation / upgrade:
- REFERENCES
- INDEX
- CREATE
- DROP
During operation:
- SELECT
- INSERT
- UPDATE
- DELETE
Configure schema name
Optionally, you can configure the database schema name in the XL_DEPLOY_SERVER_HOME/centralConfiguration/deploy-repository.yaml
file.
Use the xl.repository.database.db-schema-name
property for the main database configuration and the xl.reporting.database.db-schema-name
property for the reporting database.
Using Deploy with MySQL
To use Deploy with MySQL, ensure that the JDBC driver for MySQL JAR file is located in XL_DEPLOY_SERVER_HOME/lib
or on the Java classpath.
The user ID accessing the MySQL database must have the following permissions:
- GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, REFERENCES, DROP, and INDEX on
dbname
.todbuser*@host for database initialization and for Deploy version upgrades. - GRANT SELECT, INSERT, UPDATE, and DELETE on
dbname
.todbuser*@host for ongoing usage.
Configure the XL_DEPLOY_SERVER_HOME/centralConfiguration/deploy-repository.yaml
to point to the database schema.
Here is a sample configuration for MySQL:
xl.repository:
database:
db-driver-classname: com.mysql.jdbc.Driver
db-url: jdbc:mysql://localhost:3316/xld?autoReconnect=true&useLegacyDatetimeCode=false
db-password: samplepassword
db-username: sample-user
connection-timeout: 30000
max-pool-size: 10
Notes:
- Name the database created in mysql (that will connect with xl-deploy) as xld.
- The MySQL database does not support full unicode character set. For more information, see MySQL documentation.
- If you are using Deploy version 8.5 or earlier, the
db-url
isjdbc:mysql://localhost:3306/xldrepo?autoReconnect=true&useSSL=false&useLegacyDatetimeCode=false
. - For MySQL, Deploy versions 8.5 and earlier require the
innodb_large_prefix
option to beON
. For more information, see the MySQL version specific documentation. - MySQL version 5.7 default
max_allowed_packet
setting needs to be changed to64M
. For other recommended settings please see Production Environment Installation section.
connection-timeout
allows you to specify the connection timeout value for the Hikari connection pool. The timeout value should always be greater than 250 milliseconds. The default value is 30000 milliseconds.
As of version 8.6, Deploy officially supports database configuration with MySQL versions 5.7 and 8.0. Starting with MySQL version 8.0, the innodb_large_prefix
option is no longer supported. If you want to upgrade your database to MySQL version 8.0, you must first upgrade Deploy to version 8.6 or later.
To upgrade to MySQL version 8.0:
-
After you upgraded Deploy to version 8.6 or later, stop your Deploy instance.
-
Back up your database and follow the steps from the upgrade procedure in the MySQL documentation.
-
Run the following SQL commands:
update `DATABASECHANGELOG` set `MD5SUM` = '8:9bad926a268f4ce1b8e4c9a47cfe6f82' where `AUTHOR` = 'XebiaLabs' and `FILENAME` = 'SOURCE_ARTIFACTS' and `MD5SUM` = '8:489e9467592bebcb1ec822ea94e1d28b';
drop index `XLD_FILE_ART_LOCATION_IDX` on `XLD_FILE_ARTIFACTS`;
alter table `XLD_FILE_ARTIFACTS` modify column location varchar(255) not null;
create index XLD_FILE_ART_LOCATION_IDX on `XLD_FILE_ARTIFACTS` (location); -
Start the Deploy server.
Deploy Collation and Character Set
Digital.ai Deploy supports unicode character set utf8mb4
and utf8mb3
.
utf8mb4
charset with collationutf8mb4_0900_as_cs
orutf8mb4_0900_ai_ci
utf8mb3
withutf8mb3_general_ci
(deprecated in MySQL 8.0)
For more information, see MySQL Documentation
To specify the character set and collation at server start up, use the --character-set-server
and --collation-server
options.
For example:
-
If you are running a MySQL server, add the following options to
mysql.cnf
file.[mysqld]
character-set-server = utf8mb4
collation-server = utf8mb4_0900_ai_ci -
If you are running MySQL in a Docker container, either build your own MySQL image with the updated
mysql.cnf
file (as shown in the earlier example), or update the docker-compose file with the following command to start the MySQL daemon.mysql:
image: mysql:8.0
..
command: ['--character-set-server=utf8mb4', '--collation-server=utf8mb4_0900_ai_ci']