Skip to content

Commit b43efc8

Browse files
authored
docs(mkdocs): update the documentation site (#248)
1 parent 912d68f commit b43efc8

12 files changed

+157
-34
lines changed

Diff for: assets/tutorials/images/constraints-result.png

-52.1 KB
Loading

Diff for: assets/tutorials/images/full-ui.png

-82 KB
Loading

Diff for: assets/tutorials/images/indexes-result.png

-9.63 KB
Loading

Diff for: assets/tutorials/images/left-menu.png

-10.6 KB
Loading

Diff for: assets/tutorials/images/rows-result.png

-12.6 KB
Loading

Diff for: assets/tutorials/images/structure-result.png

-59.8 KB
Loading

Diff for: assets/tutorials/images/tab-menu.png

-18.8 KB
Binary file not shown.

Diff for: docs/index.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@ Cross-platform, zero dependencies, terminal based UI application for your Data B
1616

1717
## Overview
1818

19-
**dblab** is a fast and lightweight interactive terminal based UI application for PostgreSQL, MySQL and SQLite3, written in Go and works on OSX, Linux and Windows machines.
20-
21-
The main idea behind using Go for backend development is to utilize the ability of the compiler to produce zero-dependency binaries for multiple platforms.
22-
23-
dblab was created as an attempt to build a very simple and portable application to interact with local or remote PostgreSQL/MySQL/SQLite3 databases.
19+
dblab is a fast and lightweight interactive terminal based UI application for PostgreSQL, MySQL and SQLite3,
20+
written in Go and works on OSX, Linux and Windows machines. Main idea behind using Go for backend development
21+
is to utilize ability of the compiler to produce zero-dependency binaries for
22+
multiple platforms. dblab was created as an attempt to build very simple and portable
23+
application to work with local or remote PostgreSQL/MySQL/SQLite3/Oracle/SQL Server databases.
2424

25-
The key features are:
25+
26+
## Features
2627

2728
* Cross-platform support OSX/Linux/Windows 32/64-bit
2829
* Simple installation (distributed as a single binary)

Diff for: docs/quickstart.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
You can start the app without passing flags or parameters, so then an interactive command prompt will ask for the connection details.
44

5-
![Alt Text](https://raw.githubusercontent.com/danvergara/dblab/main/screenshots/dblab-default-form.gif){ width="500" : .center }
5+
![Alt Text](https://raw.githubusercontent.com/danvergara/dblab/main/screenshots/dblab-demo.gif){ width="500" : .center }
66

77
Otherwise, you can explicitly include the connection details using multiple parameters:
88

Diff for: docs/tutorials/index.md

-2
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,3 @@ If everything went well you should see the UI
3535
![dblab](https://raw.githubusercontent.com/danvergara/dblab/main/assets/tutorials/images/full-ui.png){ width="700" : .center }
3636
3737
For further knowledge on the navigation of the UI you can check this [first steps in navigation](https://dblab.danvergara.com/tutorials/navigation/)
38-
39-

Diff for: docs/tutorials/navigation.md

-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
One of the main features of dblab is to be a simple but very useful UI to interact with your database.
22
![dblab](https://raw.githubusercontent.com/danvergara/dblab/main/assets/tutorials/images/full-ui.png){ width="700" : .center }
33

4-
In the top right you can find a tab menu were you can navigate through the different panels using:
5-
6-
![dblab](https://raw.githubusercontent.com/danvergara/dblab/main/assets/tutorials/images/tab-menu.png){ width="500" : .center }
7-
84
- <kbd>Ctrl+I</kbd> to move from Rows to Indexes and backwards.
95
- <kbd>Ctrl+F</kbd> to move from Rows to Constraints and backwards.
106
- <kbd>Ctrl+S</kbd> to move from Rows to Structure and backwards.

Diff for: docs/usage.md

+149-21
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,52 @@ $ dblab [command]
2121

2222
### Flags
2323

24-
| Flag | Type | Description |
25-
|:----------------:|:-----------:|:----------------------------------------------------------------------------------------------------------------------------------|
26-
| `--cfg-name` | `string` | Database config name section |
27-
| `--config` | | Get the connection data from a config file (default is $HOME/.dblab.yaml or the current directory) |
28-
| `--db` | `string` | Database name |
29-
| `--driver` | `string` | Database driver |
30-
| `-h, --help` | | help for dblab |
31-
| `--host` | `string` | Server host name or IP |
32-
| `--limit` | `int` | Size of the result set from the table content query (should be greater than zero, otherwise the app will error out) (default 100) |
33-
| `--pass` | `string` | Password for user |
34-
| `--port` | `string` | Server port |
35-
| `--schema` | `string` | Database schema (postgres only) |
36-
| `--socket` | `string ` | Path to a Unix socket file |
37-
| `--ssl` | `string` | SSL mode |
38-
| `-u, --url` | `string` | Database connection string |
39-
| `--user` | `string` | Database user |
40-
41-
Use `dblab [command] --help` for more information about a command.
42-
24+
```
25+
dblab is a terminal UI based interactive database client for Postgres, MySQL and SQLite3.
26+
27+
Usage:
28+
dblab [flags]
29+
dblab [command]
30+
31+
Available Commands:
32+
help Help about any command
33+
version The version of the project
34+
35+
Flags:
36+
--cfg-name string Database config name section
37+
--config Get the connection data from a config file (default locations are: current directory, $HOME/.dblab.yaml or $XDG_CONFIG_HOME/.dblab.yaml)
38+
--db string Database name (optional)
39+
--driver string Database driver
40+
--encrypt string [strict|disable|false|true] data sent between client and server is encrypted or not
41+
-h, --help help for dblab
42+
--host string Server host name or IP
43+
--limit uint Size of the result set from the table content query (should be greater than zero, otherwise the app will error out) (default 100)
44+
--pass string Password for user
45+
--port string Server port
46+
--schema string Database schema (postgres only)
47+
--socket string Path to a Unix socket file
48+
--ssh-host string SSH Server Hostname/IP
49+
--ssh-key string File with private key for SSH authentication
50+
--ssh-key-pass string Supports connections with protected private keys with passphrase
51+
--ssh-pass string SSH Password (Empty string for no password)
52+
--ssh-port string SSH Port
53+
--ssh-user string SSH User
54+
--ssl string SSL mode
55+
--ssl-verify string [enable|disable] or [true|false] enable ssl verify for the server
56+
--sslcert string This parameter specifies the file name of the client SSL certificate, replacing the default ~/.postgresql/postgresql.crt
57+
--sslkey string This parameter specifies the location for the secret key used for the client certificate. It can either specify a file name that will be used instead of the default ~/.postgresql/postgresql.key, or it can specify a key obtained from an external “engine”
58+
--sslpassword string This parameter specifies the password for the secret key specified in sslkey
59+
--sslrootcert string This parameter specifies the name of a file containing SSL certificate authority (CA) certificate(s) The default is ~/.postgresql/root.crt
60+
--timeout string in seconds (default is 0 for no timeout), set to 0 for no timeout. Recommended to set to 0 and use context to manage query and connection timeouts
61+
--trace-file string File name for trace log
62+
--trust-server-certificate string [false|true] server certificate is checked or not
63+
-u, --url string Database connection string
64+
--user string Database user
65+
-v, --version version for dblab
66+
--wallet string Path for auto-login oracle wallet
67+
68+
Use "dblab [command] --help" for more information about a command.
69+
```
4370

4471
## Navigation
4572

@@ -89,7 +116,7 @@ Key | Description
89116

90117
You can start the app without passing flags or parameters, so then an interactive command prompt will ask for the connection details.
91118

92-
![Alt Text](https://raw.githubusercontent.com/danvergara/dblab/main/screenshots/dblab-default-form.gif){ width="500" : .center }
119+
![Alt Text](https://raw.githubusercontent.com/danvergara/dblab/main/screenshots/dblab-demo.gif){ width="500" : .center }
93120

94121
Otherwise, you can explicitly include the connection details using multiple parameters:
95122

@@ -99,6 +126,12 @@ dblab --host localhost --user myuser --db users --pass password --ssl disable --
99126
```{ .sh .copy }
100127
dblab --db path/to/file.sqlite3 --driver sqlite
101128
```
129+
```{ .sh .copy }
130+
dblab --host localhost --user system --db FREEPDB1 --pass password --port 1521 --driver oracle --limit 50
131+
```
132+
```{ .sh .copy }
133+
dblab --host localhost --user SA --db msdb --pass '5@klkbN#ABC' --port 1433 --driver sqlserver --limit 50
134+
```
102135

103136
Connection URL scheme is also supported:
104137

@@ -111,6 +144,12 @@ dblab --url mysql://user:password@tcp(host:port)/db
111144
```{ .sh .copy }
112145
dblab --url file:test.db?cache=shared&mode=memory
113146
```
147+
```{ .sh .copy }
148+
dblab --url 'oracle://user:password@localhost:1521/db'
149+
```
150+
```{ .sh .copy }
151+
dblab --url 'sqlserver://SA:myStrong(!)Password@localhost:1433?database=tempdb&encrypt=true&trustservercertificate=false&connection+timeout=30'
152+
```
114153

115154
if you're using PostgreSQL, you have the option to define the schema you want to work with, the default value is `public`.
116155

@@ -130,12 +169,72 @@ dblab --url "mysql://user:password@unix(/path/to/socket/mysql.sock)/dbname?chars
130169
dblab --socket /path/to/socket/mysql.sock --user user --db dbname --pass password --ssl disable --port 5432 --driver mysql --limit 50
131170
```
132171

172+
Postgres connection through Unix sockets:
173+
174+
```sh
175+
$ dblab --url "postgres://user:password@/dbname?host=/path/to/socket"
176+
$ dblab --socket /path/to/socket --user user --db dbname --pass password --ssl disable --port 5432 --driver postgres --limit 50
177+
```
178+
133179
Now, it is possible to ensure SSL connections with `PostgreSQL` databases. SSL related parameters has been added, such as `--sslcert`, `--sslkey`, `--sslpassword`, `--sslrootcert`. More information on how to use such connection flags can be found [here](https://www.postgresql.org/docs/current/libpq-connect.html).
134180

135181
```{ .sh .copy }
136182
dblab --host db-postgresql-nyc3-56456-do-user-foo-0.fake.db.ondigitalocean.com --user myuser --db users --pass password --schema myschema --port 5432 --driver postgres --limit 50 --ssl require --sslrootcert ~/Downloads/foo.crt
137183
```
138184

185+
### SSH Tunnel
186+
187+
Now, it's possible to connect to Postgres or MySQL (more to come later) databases on a server via SSH using password or a ssh key files.
188+
189+
To do so, 6 new flags has been added to the dblab command:
190+
191+
| Flag | Description |
192+
|----------------------|-------------------------------------------------------------------|
193+
| --ssh-host | SSH Server Hostname/IP |
194+
| --ssh-port | SSH Port |
195+
| --ssh-user | SSH User |
196+
| --ssh-pass | SSH Password (Empty string for no password) |
197+
| --ssh-key | File with private key for SSH authentication |
198+
| --ssh-key-pass | Passphrase for protected private key files |
199+
200+
#### Examples
201+
202+
Postgres connection via ssh tunnel using password:
203+
204+
```{ .sh .copy }
205+
dblab --host localhost --user postgres --pass password --schema public --ssl disable --port 5432 --driver postgres --limit 50 --ssh-host example.com --ssh-port 22 --ssh-user root --ssh-pass root
206+
```
207+
208+
Postgres connection via ssh tunnel using ssh private key file:
209+
210+
```{ .sh .copy }
211+
dblab --host localhost --user postgres --pass password --schema public --ssl disable --port 5432 --driver postgres --limit 50 --ssh-host example.com --ssh-port 22 --ssh-user root --ssh-key my_ssh_key --ssh-key-pass password
212+
```
213+
214+
Postgres connection using the url parameter via ssh tunnel using password:
215+
216+
```{ .sh .copy }
217+
dblab --url postgres://postgres:password@localhost:5432/users?sslmode=disable --schema public --ssh-host example.com --ssh-port 22 --ssh-user root --ssh-pass root
218+
```
219+
220+
MySQL connection via ssh tunnel using password:
221+
222+
```{ .sh .copy }
223+
dblab --host localhost --user myuser --db mydb --pass 5@klkbN#ABC --ssl enable --port 3306 --driver mysql --limit 50 --ssh-host example.com --ssh-port 22 --ssh-user root --ssh-pass root
224+
```
225+
226+
MySQL connection via ssh tunnel using ssh private key file:
227+
228+
```{ .sh .copy }
229+
dblab --host localhost --user postgres --pass password --ssl enable --port 3306 --driver mysql --limit 50 --ssh-host example.com --ssh-port 22 --ssh-user root --ssh-key my_ssh_key --ssh-key-pass passphrase
230+
```
231+
232+
MySQL connection using the url parameter via ssh tunnel using password:
233+
234+
```{ .sh .copy }
235+
dblab --url "mysql://myuser:5@klkbN#ABC@mysql+tcp(localhost:3306)/mydb" --driver mysql --ssh-host example.com --ssh-port 22 --ssh-user root --ssh-pass root
236+
```
237+
139238
### Configuration
140239

141240
Entering the parameters and flags every time you want to use it is tedious,
@@ -186,6 +285,35 @@ database:
186285
driver: "postgres"
187286
ssl: "require"
188287
sslrootcert: "~/.postgresql/root.crt."
288+
- name: "oracle"
289+
host: "localhost"
290+
port: 1521
291+
db: "FREEPDB1 "
292+
password: "password"
293+
user: "system"
294+
driver: "oracle"
295+
ssl: "enable"
296+
wallet: "path/to/wallet"
297+
ssl-verify: true
298+
- name: "sqlserver"
299+
driver: "sqlserver"
300+
host: "localhost"
301+
port: 1433
302+
db: "msdb"
303+
password: "5@klkbN#ABC"
304+
user: "SA"
305+
- name: "ssh-tunnel"
306+
host: "localhost"
307+
port: 5432
308+
db: "users"
309+
password: "password"
310+
user: "postgres"
311+
schema: "public"
312+
driver: "postgres"
313+
ssh-host: "example.com"
314+
ssh-port: 22
315+
ssh-user: "ssh-user"
316+
ssh-pass: "password"
189317
# should be greater than 0, otherwise the app will error out
190318
limit: 50
191319
```
@@ -199,4 +327,4 @@ database:
199327
driver: "sqlite"
200328
```
201329

202-
Only the `host` and `ssl` fields are optionals. `127.0.0.1` and `disable`, respectively.
330+
only the `host` and `ssl` fields are optionals. `127.0.0.1` and `disable`, respectively.

0 commit comments

Comments
 (0)