warp-tech / warpgate

Smart SSH, HTTPS and MySQL bastion that requires no additional client-side software
Apache License 2.0
3.88k stars 120 forks source link

How define the connection to database postgres in the configuration file #1118

Open vitaaaaa1 opened 1 day ago

vitaaaaa1 commented 1 day ago

Hi, How should I define the url format for connecting to the postgres database in the configuration file?

I use

 database_url: "postgres://user_name:password@postgres_host:5432/warpgate"

This format of configuration, program startup error

this is error logs

07:16:30  INFO Warpgate version=0.11.0
07:16:30  INFO Using config: "/data/warpgate.yaml"
07:16:30  WARN Looks like your `external_host` config option contains a port - it will be ignored.
07:16:30  WARN Set the external port via the `http.external_port`, `ssh.external_port` or `mysql.external_port` options.
07:16:30 ERROR Fatal error error=Execution Error: error returned from database: current transaction is aborted, commands ignored until end of transaction block

Caused by:
    0: error returned from database: current transaction is aborted, commands ignored until end of transaction block
    1: error returned from database: current transaction is aborted, commands ignored until end of transaction block
    2: current transaction is aborted, commands ignored until end of transaction block
vitaaaaa1 commented 1 day ago

Seems incompatible with postgres?

Eugeny commented 1 day ago

Run it with --debug for more verbose logs

vitaaaaa1 commented 1 day ago

Run it with --debug for more verbose logs使用“for”命令可以获得更详细的日志信息。 This is my docker compose file

version: '3'
services:
warpgate:
image: ghcr.io/warp-tech/warpgate:v0.10.2
ports:
- 2222:2222
- 8888:8888
- 33306:33306
volumes:
- ../data:/data
stdin_open: true
tty: true
command: ['--debug', 'run']

But there doesn't seem to be any output in the log

warpgate-1  | 09:06:40  INFO Warpgate version=0.10.2
warpgate-1  | 09:06:40  INFO Using config: "/data/warpgate.yaml"
warpgate-1  | 09:06:40  WARN Looks like your `external_host` config option contains a port - it will be ignored.
warpgate-1  | 09:06:40  WARN Set the external port via the `http.external_port`, `ssh.external_port` or `mysql.external_port` options.
warpgate-1  | 09:06:40 ERROR Fatal error error=Execution Error: error returned from database: current transaction is aborted, commands ignored until end of transaction block
warpgate-1  | 
warpgate-1  | Caused by:
warpgate-1  |     0: error returned from database: current transaction is aborted, commands ignored until end of transaction block
warpgate-1  |     1: error returned from database: current transaction is aborted, commands ignored until end of transaction block
warpgate-1  |     2: current transaction is aborted, commands ignored until end of transaction block
vitaaaaa1 commented 1 day ago

Run it with --debug for more verbose logs

I retested with mariadb and the connection is fine, but is there any good way to migrate data to mariadb