Skip to content

Commit

Permalink
docs: update sql instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr committed Oct 20, 2020
1 parent 51d9390 commit bfed7f2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 70 deletions.
2 changes: 1 addition & 1 deletion docs/docs/5min-tutorial.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ need to have the latest [Docker](https://www.docker.com) and
We will use the Docker Compose configuration in the ORY Hydra code base. Getting
the Hydra source code is easy:

- if you have Go 1.12+ installed: `go get -d github.com/ory/hydra`
- if you have Go 1.15+ installed: `go get -d github.com/ory/hydra`
- if you have Git installed: `git clone https://github.com/ory/hydra.git`
- otherwise: download the
[Hydra source code](https://github.com/ory-am/hydra/archive/master.zip). and
Expand Down
77 changes: 8 additions & 69 deletions docs/docs/dependencies-environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,18 @@ limited to OSX, Linux, Windows, ARM, FreeBSD and more.
ORY Hydra has two operational modes:

- In-memory: This mode does not work with more than one instance ("cluster") and
any state is lost after restarting the instance.
any state is lost after restarting the instance. ORY Hydra uses SQLite with
in-memory mode to achieve this.
- SQL: This mode works with more than one instance and state is not lost after
restarts.

No further dependencies are required for a production-ready instance.

## SQL
## Database Configuration

The SQL adapter supports two DBMS: PostgreSQL 9.6+ and MySQL 5.7+. Please note
For more information on configuring

The SQL adapter supports PostgreSQL 9.6+, MySQL 5.7+ and SQLite. Please note
that older MySQL versions have issues with ORY Hydra's database schema. For more
information [go here](https://github.com/ory/hydra/issues/377).

Expand All @@ -42,69 +45,5 @@ example to see how we did it!

### Configuration

Both MySQL and PostgreSQL adapters support the following settings. You can
modify these settings by appending query parameters to your DSN
(`postgres://user:pw@host:port/database?setting1=foo&setting2=bar`):

- `max_conns` sets the maximum number of open connections to the database.
Defaults to the number of CPUs. Example
`postgres://user:pw@host:port/database?max_conns=10`.
- `max_idle_conns` sets the maximum number of connections in the idle connection
pool. Defaults to the number of CPUs. Example
`postgres://user:pw@host:port/database?max_idle_conns=5`.
- `max_conn_lifetime` sets the maximum amount of time (`ms`, `s`, `m`, `h`) a
connection may be reused. Defaults to 0. Example
`postgres://user:pw@host:port/database?max_conn_lifetime=10s`.

#### MySQL

> DSN Layout:
> `mysql://user:pw@tcp(host:port)/database?someSetting=value&foo=bar`.
On top of the settings above, MySQL supports additional settings:

- `sql_notes`, if set to `false`, ignores MySQL notices. If left empty or set to
`true`, they will be treated as warnings. Example
`mysql://user:pw@tcp(host:port)/database?sql_notes=false`.
- `sql_mode` sets the server-side strict mode. Read more about possible values
[here](https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html).

#### PostgreSQL

> DSN Layout: `postgres://user:pw@host:port/database?someSetting=value&foo=bar`.
On top of the settings above, PostgreSQL supports additional settings:

- `sslmode` sets whether or not to use SSL (default is require, this is not the
default for libpq). Valid values for sslmode are: _ `disable` - No SSL _
`require` - Always SSL (skip verification) _ `verify-ca` - Always SSL (verify
that the certificate presented by the server was signed by a trusted CA) _
`verify-full` - Always SSL (verify that the certification presented by the
server was signed by a trusted CA and the server host name matches the one in
the certificate)
- `fallback_application_name` - An application_name to fall back to if one isn't
provided.
- `connect_timeout` - Maximum wait for connection, in seconds. Zero or not
specified means wait indefinitely.
- `sslcert` - Cert file location. The file must contain PEM encoded data.
- `sslkey` - Key file location. The file must contain PEM encoded data.
- `sslrootcert` - The location of the root certificate file. The file must
contain PEM encoded data.

## Plugin

It is possible to implement your own DBAL using Go Plugins.

> We strongly discourage you from implementing your own DBAL. Special knowledge
> is required and internal interfaces will break without notice and migration
> guides. This can lead to serious security issues and vulnerabilities. USE AT
> YOUR OWN RISK.
Your plugin must implement interface `github.com/ory/hydra/driver.Registry`. You
can load the plugin as follows:

```yaml
dsn: plugin:///path/to/file.so
```
We strongly discourage you from using this feature.
For more information on configuring the DSN (Data-Source-Name), head over
to [Deployment Fundamentals and Requirements](https://www.ory.sh/docs/ecosystem/deployment).

0 comments on commit bfed7f2

Please sign in to comment.