Skip to content
This repository was archived by the owner on Dec 17, 2024. It is now read-only.

Conversation

@frastr
Copy link
Contributor

@frastr frastr commented Feb 20, 2023

See on my 4 commit messages for description my fixes and optimizations for build docker image postgres and create/run as docker container.

Best regards,
Frank

Frank Streitzig added 4 commits February 20, 2023 12:07
Fix error on create postgresql cluster:
  install: cannot change permissions of 'pg_stat_tmp': No such file or directory
  Error: /usr/lib/postgresql/15/bin/pg_ctl/usr/lib/postgresql/15/bin/pg_ctl start -D /var/lib/postgresql/15/main-l /var/log/postgresql/postgresql-15-main.log --wait -s -o  -cconfig_file="/etc/postgresql/15/main/postgresql.conf"  exited withstatus 1:
  LOG:  unrecognizedconfiguration parameter "stats_temp_directory" in file"/etc/postgresql/15/main/pgwatch_postgresql.conf" line 15
  FATAL:  configuration file"/etc/postgresql/15/main/pgwatch_postgresql.conf" contains errors
…esql v15

Use 9.4 instead of 9.2

Error message on version 9.2:
psql:/pgwatch2/metrics/00_helpers/get_stat_statements/9.2/metric.sql:36: ERROR:  column s.total_time does not exist
LINE 11:    s.query, s.calls, s.total_time, s.rows, s.shared_blks_hit...
                              ^
psql:/pgwatch2/metrics/00_helpers/get_stat_statements/9.2/metric.sql:38: ERROR:  current transaction is aborted, commands ignored until end of transaction block
psql:/pgwatch2/metrics/00_helpers/get_stat_statements/9.2/metric.sql:39: ERROR:  current transaction is aborted, commands ignored until end of transaction block
psql:/pgwatch2/metrics/00_helpers/get_stat_statements/9.2/metric.sql:63: ERROR:  current transaction is aborted, commands ignored until end of transaction block
Error message:
  mkdir: cannot create directory '/var/run/grafana': File exists
Missing permission if /var/lib/grafana is a local directory and not a
docker volume.
@pashagolub
Copy link
Collaborator

What exactly image produces this error?

Fix error on create postgresql cluster:
  install: cannot change permissions of 'pg_stat_tmp': No such file or directory
  Error: /usr/lib/postgresql/15/bin/pg_ctl/usr/lib/postgresql/15/bin/pg_ctl start -D /var/lib/postgresql/15/main-l /var/log/postgresql/postgresql-15-main.log --wait -s -o  -cconfig_file="/etc/postgresql/15/main/postgresql.conf"  exited withstatus 1:
  LOG:  unrecognizedconfiguration parameter "stats_temp_directory" in file"/etc/postgresql/15/main/pgwatch_postgresql.conf" line 15
  FATAL:  configuration file"/etc/postgresql/15/main/pgwatch_postgresql.conf" contains errors

@frastr
Copy link
Contributor Author

frastr commented Feb 20, 2023

Hello Pavlo,

on docker hub:

$ docker images
REPOSITORY                       TAG                 IMAGE ID       CREATED       SIZE
cybertec/pgwatch2-postgres       latest              0fa947105e45   2 days ago    1.17GB

And my development:

$ git log -1 HEAD
commit 4ace90381bfccbd370e8b10cb116132820b9de34 (HEAD -> master, frastr/master)
Merge: 7e6caf7 c5af43e
Author: Pavlo Golub <[email protected]>
Date:   Fri Feb 17 15:22:40 2023 +0100

    Merge pull request #592 from dtmdl/timescale-bootstrap
    
    [-] ensure bootstrap of a timescale metrics db includes necessary metric-time function


$ ./build-docker-postgres.sh

My test docker compose:

version: "3.9"

services:
  server:
    image: cybertec/pgwatch2-postgres:latest
    container_name: pgwatch2
    network_mode: bridge
    ports:
      - 127.0.0.1:6010:3000
      - 127.0.0.1:6011:8080
      - 127.0.0.1:6012:8081
      - 127.0.0.1:6013:5432
    volumes:
      - ./data/pg:/var/lib/postgresql
      - ./data/grafana:/var/lib/grafana
      - ./data/pw2:/pgwatch2/persistent-config

@frastr
Copy link
Contributor Author

frastr commented Feb 22, 2023

I have tested with the new docker image:

$ docker images | grep pgwatch2
cybertec/pgwatch2-postgres   latest            d4e17244e72e   26 hours ago   1.17GB

With docker volumes ...

...
    volumes:                                                                                                                                                                                                                                                                      
      - pg:/var/lib/postgresql                                                                                                                                                                                                                                                    
      - grafana:/var/lib/grafana                                                                                                                                                                                                                                                  
      - pw2:/pgwatch2/persistent-config                                                                                                                                                                                                                                           
                                                                                                                                                                                                                                                                                  
volumes:                                                                                                                                                                                                                                                                          
  pg:                                                                                                                                                                                                                                                                             
  grafana:                                                                                                                                                                                                                                                                        
  pw2:

it looks ok.
Just one error:

BEGIN
CREATE EXTENSION
psql:/pgwatch2/metrics/00_helpers/get_stat_statements/9.2/metric.sql:36: ERROR:  column s.total_time does not exist
LINE 11:    s.query, s.calls, s.total_time, s.rows, s.shared_blks_hit...
                              ^
psql:/pgwatch2/metrics/00_helpers/get_stat_statements/9.2/metric.sql:38: ERROR:  current transaction is aborted, commands ignored until end of transaction block
psql:/pgwatch2/metrics/00_helpers/get_stat_statements/9.2/metric.sql:39: ERROR:  current transaction is aborted, commands ignored until end of transaction block
psql:/pgwatch2/metrics/00_helpers/get_stat_statements/9.2/metric.sql:63: ERROR:  current transaction is aborted, commands ignored until end of transaction block
ROLLBACK

See here my commit 1e5d0582f9

But with volumes as local directory,

    volumes:
      - ./data/pg:/var/lib/postgresql
      - ./data/grafana:/var/lib/grafana
      - ./data/pw2:/pgwatch2/persistent-config

i still get the same errors.

pashagolub added a commit to cybertec-postgresql/pgwatch that referenced this pull request Feb 22, 2023
pashagolub added a commit to cybertec-postgresql/pgwatch that referenced this pull request Feb 22, 2023
@pashagolub pashagolub changed the title Bugfix docker postgres [-] fix pgwatch2-postgres Docker image Feb 23, 2023
@pashagolub
Copy link
Collaborator

Thanks for your help

@pashagolub pashagolub merged commit 7629335 into cybertec-postgresql:master Feb 23, 2023
@frastr
Copy link
Contributor Author

frastr commented Feb 23, 2023

Thanks for merging and this great project

@frastr frastr deleted the bugfix-docker-postgres branch February 24, 2023 11:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants