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

Fail to setup/start for PostgreSQL database #1039

Open gdm257 opened 2 months ago

gdm257 commented 2 months ago

Environment

Problem

Fail to setup/start warpgate with PostgreSQL database. I'm sure that postgres works well and other applications depending on postgres still work. Any idea for this problem?

docker-compose file:

services:
  warpgate:
    container_name: warpgate
    image: ghcr.io/warp-tech/warpgate:${VERSION:-latest}
    networks:
      - stack
      - services-network
    volumes:
      # you should generate config first
      # docker compose run --rm warpgate setup
      - ./data/warpgate:/data
networks:
  stack: {}
  services-network:
    external: true

Setup log

$ docker compose run --rm warpgate setup --database-url postgres://warpgate:xxxxxxxxxxxx@postgres:5432/warpgate?sslmode=disable
22:53:57  INFO Welcome to Warpgate 0.10.1
22:53:57  INFO Let's do some basic setup first.
22:53:57  INFO The new config will be written in /data/warpgate.yaml.
✔ Do you want to record user sessions? · yes
✔ Set a password for the Warpgate admin user · ********
22:54:24  INFO Generated configuration:
---
sso_providers: []
recordings:
  enable: true
  path: /data/recordings
external_host: ~
database_url: "postgres://warpgate:xxxxxxxxxxx@postgres:5432/warpgate?sslmode=disable"
ssh:
  enable: true
  listen: "0.0.0.0:2222"
  external_port: ~
  keys: /data/ssh-keys
  host_key_verification: prompt
  inactivity_timeout: 5m
http:
  enable: true
  listen: "0.0.0.0:8888"
  external_port: ~
  certificate: /data/tls.certificate.pem
  key: /data/tls.key.pem
  trust_x_forwarded_headers: false
  session_max_age: 30m
  cookie_max_age: 1day
mysql:
  enable: true
  listen: "0.0.0.0:33306"
  external_port: ~
  certificate: /data/tls.certificate.pem
  key: /data/tls.key.pem
log:
  retention: 7days
  send_to: ~
config_provider: database

22:54:24  INFO Saved into /data/warpgate.yaml
22:54:24  INFO Using config: "/data/warpgate.yaml"
22:54:24 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

Startup log

$ docker stack deploy -c warpgate/compose.yaml warpgate
$ docker logs warpgate_warpgate.1.yjwf4qex89ds28afpzha3ep77
23.08.2024 23:13:21  INFO warpgate::commands::run: Warpgate version=0.10.2
23.08.2024 23:13:21  INFO warpgate::config: Using config: "/data/warpgate.yaml"
23.08.2024 23:13:21 ERROR warpgate: 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
gdm257 commented 2 months ago

It seems some compatibility problems #982 for postgres

vjmax commented 3 weeks ago

We are Facing same issue in version=0.11.0 is this fixed ?

johannwagner commented 1 week ago

I experienced the same issues on 0.11.0. Postgres logs errors about the manual query done in a migration: https://github.com/warp-tech/warpgate/blob/main/warpgate-db-migrations/src/m00001_create_ticket.rs#L49