mirror of
https://github.com/shlinkio/shlink.git
synced 2024-12-23 07:33:58 -06:00
Documented how to use maria db with docker image
This commit is contained in:
parent
42e84e526e
commit
9dc6ea9eeb
@ -35,7 +35,7 @@
|
|||||||
"predis/predis": "^1.1",
|
"predis/predis": "^1.1",
|
||||||
"shlinkio/shlink-common": "^2.0",
|
"shlinkio/shlink-common": "^2.0",
|
||||||
"shlinkio/shlink-event-dispatcher": "^1.0",
|
"shlinkio/shlink-event-dispatcher": "^1.0",
|
||||||
"shlinkio/shlink-installer": "^2.0",
|
"shlinkio/shlink-installer": "^2.1",
|
||||||
"shlinkio/shlink-ip-geolocation": "^1.0",
|
"shlinkio/shlink-ip-geolocation": "^1.0",
|
||||||
"symfony/console": "^4.3",
|
"symfony/console": "^4.3",
|
||||||
"symfony/filesystem": "^4.3",
|
"symfony/filesystem": "^4.3",
|
||||||
|
@ -56,16 +56,16 @@ docker exec -it shlink_container shlink
|
|||||||
|
|
||||||
The image comes with a working sqlite database, but in production you will probably want to usa a distributed database.
|
The image comes with a working sqlite database, but in production you will probably want to usa a distributed database.
|
||||||
|
|
||||||
It is possible to use a set of env vars to make this shlink instance interact with an external MySQL or PostgreSQL database.
|
It is possible to use a set of env vars to make this shlink instance interact with an external MySQL, MariaDB or PostgreSQL database.
|
||||||
|
|
||||||
* `DB_DRIVER`: **[Mandatory]**. Use the value **mysql** or **postgres** to prevent the sqlite database to be used.
|
* `DB_DRIVER`: **[Mandatory]**. Use the value **mysql**, **maria** or **postgres** to prevent the sqlite database to be used.
|
||||||
* `DB_NAME`: [Optional]. The database name to be used. Defaults to **shlink**.
|
* `DB_NAME`: [Optional]. The database name to be used. Defaults to **shlink**.
|
||||||
* `DB_USER`: **[Mandatory]**. The username credential for the database server.
|
* `DB_USER`: **[Mandatory]**. The username credential for the database server.
|
||||||
* `DB_PASSWORD`: **[Mandatory]**. The password credential for the database server.
|
* `DB_PASSWORD`: **[Mandatory]**. The password credential for the database server.
|
||||||
* `DB_HOST`: **[Mandatory]**. The host name of the server running the database engine.
|
* `DB_HOST`: **[Mandatory]**. The host name of the server running the database engine.
|
||||||
* `DB_PORT`: [Optional]. The port in which the database service is running.
|
* `DB_PORT`: [Optional]. The port in which the database service is running.
|
||||||
* Default value is based on the driver:
|
* Default value is based on the driver:
|
||||||
* **mysql** -> `3306`
|
* **mysql** or **maria** -> `3306`
|
||||||
* **postgres** -> `5432`
|
* **postgres** -> `5432`
|
||||||
|
|
||||||
> PostgreSQL is supported since v1.16.1 of this image. Do not try to use it with previous versions.
|
> PostgreSQL is supported since v1.16.1 of this image. Do not try to use it with previous versions.
|
||||||
@ -93,7 +93,7 @@ This is the complete list of supported env vars:
|
|||||||
* `SHORT_DOMAIN_HOST`: The custom short domain used for this shlink instance. For example **doma.in**.
|
* `SHORT_DOMAIN_HOST`: The custom short domain used for this shlink instance. For example **doma.in**.
|
||||||
* `SHORT_DOMAIN_SCHEMA`: Either **http** or **https**.
|
* `SHORT_DOMAIN_SCHEMA`: Either **http** or **https**.
|
||||||
* `SHORTCODE_CHARS`: A charset to use when building short codes. Only needed when using more than one shlink instance ([Multi instance considerations](#multi-instance-considerations)).
|
* `SHORTCODE_CHARS`: A charset to use when building short codes. Only needed when using more than one shlink instance ([Multi instance considerations](#multi-instance-considerations)).
|
||||||
* `DB_DRIVER`: **sqlite** (which is the default value), **mysql** or **postgres**.
|
* `DB_DRIVER`: **sqlite** (which is the default value), **mysql**, **maria** or **postgres**.
|
||||||
* `DB_NAME`: The database name to be used when using an external database driver. Defaults to **shlink**.
|
* `DB_NAME`: The database name to be used when using an external database driver. Defaults to **shlink**.
|
||||||
* `DB_USER`: The username credential to be used when using an external database driver.
|
* `DB_USER`: The username credential to be used when using an external database driver.
|
||||||
* `DB_PASSWORD`: The password credential to be used when using an external database driver.
|
* `DB_PASSWORD`: The password credential to be used when using an external database driver.
|
||||||
|
@ -11,6 +11,7 @@ use function explode;
|
|||||||
use function file_exists;
|
use function file_exists;
|
||||||
use function file_get_contents;
|
use function file_get_contents;
|
||||||
use function file_put_contents;
|
use function file_put_contents;
|
||||||
|
use function Functional\contains;
|
||||||
use function implode;
|
use function implode;
|
||||||
use function Shlinkio\Shlink\Common\env;
|
use function Shlinkio\Shlink\Common\env;
|
||||||
use function sprintf;
|
use function sprintf;
|
||||||
@ -22,10 +23,12 @@ $helper = new class {
|
|||||||
private const BASE62 = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
private const BASE62 = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||||
private const DB_DRIVERS_MAP = [
|
private const DB_DRIVERS_MAP = [
|
||||||
'mysql' => 'pdo_mysql',
|
'mysql' => 'pdo_mysql',
|
||||||
|
'maria' => 'pdo_mysql',
|
||||||
'postgres' => 'pdo_pgsql',
|
'postgres' => 'pdo_pgsql',
|
||||||
];
|
];
|
||||||
private const DB_PORTS_MAP = [
|
private const DB_PORTS_MAP = [
|
||||||
'mysql' => '3306',
|
'mysql' => '3306',
|
||||||
|
'maria' => '3306',
|
||||||
'postgres' => '5432',
|
'postgres' => '5432',
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -85,7 +88,7 @@ $helper = new class {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
$driverOptions = $driver !== 'mysql' ? [] : [
|
$driverOptions = ! contains(['maria', 'mysql'], $driver) ? [] : [
|
||||||
// PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
|
// PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
|
||||||
1002 => 'SET NAMES utf8',
|
1002 => 'SET NAMES utf8',
|
||||||
];
|
];
|
||||||
|
Loading…
Reference in New Issue
Block a user