mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore(docs): update docs for correct use of shell and console and enforce linewidth (#9245)
This commit is contained in:
+19
-11
@@ -1,11 +1,12 @@
|
||||
## Recommendation
|
||||
|
||||
For production deployments, we recommend using an external [PostgreSQL](https://www.postgresql.org/) database (version 13 or higher).
|
||||
For production deployments, we recommend using an external
|
||||
[PostgreSQL](https://www.postgresql.org/) database (version 13 or higher).
|
||||
|
||||
## Basic configuration
|
||||
|
||||
Before starting the Coder server, prepare the database server by creating a role and a database.
|
||||
Remember that the role must have access to the created database.
|
||||
Before starting the Coder server, prepare the database server by creating a role
|
||||
and a database. Remember that the role must have access to the created database.
|
||||
|
||||
With `psql`:
|
||||
|
||||
@@ -19,8 +20,9 @@ With `psql -U coder`:
|
||||
CREATE DATABASE coder;
|
||||
```
|
||||
|
||||
Coder configuration is defined via [environment variables](../admin/configure.md).
|
||||
The database client requires the connection string provided via the `CODER_PG_CONNECTION_URL` variable.
|
||||
Coder configuration is defined via
|
||||
[environment variables](../admin/configure.md). The database client requires the
|
||||
connection string provided via the `CODER_PG_CONNECTION_URL` variable.
|
||||
|
||||
```console
|
||||
export CODER_PG_CONNECTION_URL="postgres://coder:secret42@localhost/coder?sslmode=disable"
|
||||
@@ -28,7 +30,9 @@ export CODER_PG_CONNECTION_URL="postgres://coder:secret42@localhost/coder?sslmod
|
||||
|
||||
## Custom schema
|
||||
|
||||
For installations with elevated security requirements, it's advised to use a separate [schema](https://www.postgresql.org/docs/current/ddl-schemas.html) instead of the public one.
|
||||
For installations with elevated security requirements, it's advised to use a
|
||||
separate [schema](https://www.postgresql.org/docs/current/ddl-schemas.html)
|
||||
instead of the public one.
|
||||
|
||||
With `psql -U coder`:
|
||||
|
||||
@@ -53,8 +57,10 @@ In this case the database client requires the modified connection string:
|
||||
export CODER_PG_CONNECTION_URL="postgres://coder:secret42@localhost/coder?sslmode=disable&search_path=myschema"
|
||||
```
|
||||
|
||||
The `search_path` parameter determines the order of schemas in which they are visited while looking for a specific table.
|
||||
The first schema named in the search path is called the current schema. By default `search_path` defines the following schemas:
|
||||
The `search_path` parameter determines the order of schemas in which they are
|
||||
visited while looking for a specific table. The first schema named in the search
|
||||
path is called the current schema. By default `search_path` defines the
|
||||
following schemas:
|
||||
|
||||
```sql
|
||||
SHOW search_path;
|
||||
@@ -64,7 +70,8 @@ search_path
|
||||
"$user", public
|
||||
```
|
||||
|
||||
Using the `search_path` in the connection string corresponds to the following `psql` command:
|
||||
Using the `search_path` in the connection string corresponds to the following
|
||||
`psql` command:
|
||||
|
||||
```sql
|
||||
ALTER ROLE coder SET search_path = myschema;
|
||||
@@ -74,8 +81,9 @@ ALTER ROLE coder SET search_path = myschema;
|
||||
|
||||
### Coder server fails startup with "current_schema: converting NULL to string is unsupported"
|
||||
|
||||
Please make sure that the schema selected in the connection string `...&search_path=myschema` exists
|
||||
and the role has granted permissions to access it. The schema should be present on this listing:
|
||||
Please make sure that the schema selected in the connection string
|
||||
`...&search_path=myschema` exists and the role has granted permissions to access
|
||||
it. The schema should be present on this listing:
|
||||
|
||||
```console
|
||||
psql -U coder -c '\dn'
|
||||
|
||||
Reference in New Issue
Block a user