hapostgres / pg_auto_failover

Postgres extension and service for automated failover and high-availability
Other
1.1k stars 115 forks source link

git-version not found #976

Closed lgammo closed 1 year ago

lgammo commented 1 year ago

I am following the tutorial https://pg-auto-failover.readthedocs.io/en/main/tutorial.html on a redhat 8 VM.

The first issue is that docker-compose is not available but docker compose is. Not a big issue I think.

Following the tutorial

  1. cd pg_auto_failover/docs/tutorial
  2. docker compose build I get these errors: => ERROR [build 4/5] COPY ./src/bin/pg_autoctl/git-version.h ./src/bin/pg_autoctl/git-version.h 0.0s failed to solve: failed to compute cache key: "/src/bin/pg_autoctl/git-version.h" not found: not found

There is no git-version.h in the entire cloned repo. However, I see in commit 20c1264 this line in Dockerfile.docs: RUN touch src/bin/pg_autoctl/git-version.h

and indeed it is in the Dockerfile.docs file, but not in Dockerfile.

Did I miss a step?

Thanks.

lgammo commented 1 year ago

git-version was introduced in 5a99c5a. But I do not see where it is created.

DimCitus commented 1 year ago

Hi @lgammo ; the only build system supported for the project is the Makefile. Please see about using the Makefile to drive your work there, or at least to create the git version files. See make version for instance.

lgammo commented 1 year ago

Thanks for the reply.

  1. I was following the tutorial, which did not mention anything about building anything.
  2. I commented out the line that copies git-version.h in the top Dockerfile. That seems to get things to compile and build.
  3. I did build using make at the top of the repo.
  4. The build system expects postgres to be installed natively for some reason.
  5. Once I disabled the copy of git-version.h in the Dockerfile, the tutorial did build and I got the images and contains and I managed to get them started.
  6. HOWEVER, the monitor container failed. When I did this step:
  7. docker compose exec app psql' from the tutorial, I got: psql: error: connection to server at "node1" (172.21.0.3), port 5432 failed: FATAL: no pg_hba.conf entry for host "172.21.0.2", user "tutorial", database "tutorial", SSL encryption

Any ideas?

DimCitus commented 1 year ago
  1. I was following the tutorial, which did not mention anything about building anything.

Oh I see. That's where the docker-compose build comes from. Did you run that command from the docs/tutorial sub-directory of the source checkout like the tutorial sayth you should? It seems to me that the errors you had could be explained easily if you mistakenly ran that command at the top-level directory from the checkout.

  1. The build system expects postgres to be installed natively for some reason.

Sure, the source code for pg_auto_failover has some build-time dependencies with PostgreSQL development headers and libs. Depending on your packaging system and OS of choice, that might mean installing all of the Postgres packages is required.

  1. docker compose exec app psql' from the tutorial, I got: psql: error: connection to server at "node1" (172.21.0.3), port 5432 failed: FATAL: no pg_hba.conf entry for host "172.21.0.2", user "tutorial", database "tutorial", SSL encryption

I will need more information to be able to debug that one. First, let's make sure you are running the actual tutorial commands from the right place.

lgammo commented 1 year ago

I am running the tutorial from pg_auto_failover/docs/tutorial. In one terminal I do ' docker compose up app monitor node1 node2 ', and in an other terminal I do ' docker compose exec app psql' and that's when I get: psql: error: connection to server at "node1" (172.21.0.4), port 5432 failed: FATAL: no pg_hba.conf entry for host "172.21.0.2", user "tutorial", database "tutorial", SSL encryption

lgammo commented 1 year ago

tutorial.log

Logs from the 'docker compose up app monitor node1 node2' command.

lgammo commented 1 year ago

node2.log monitor.log node1.log

lgammo commented 1 year ago

I put the logs from the entire set of dockers images in the hope they are useful. The logs from the 'docker logs tutorial-app-1' container are like this: ...logs removed... 2023-01-26 12:52:19.060851 2023-01-26 13:02:19.121722 2023-01-26 13:12:19.210549 2023-01-26 13:22:19.264046 2023-01-26 13:32:19.293530 2023-01-26 13:42:19.342018 2023-01-26 13:52:19.432689 2023-01-26 14:02:19.513564 2023-01-26 14:12:19.613798 2023-01-26 14:22:19.714192 2023-01-26 14:32:19.787126 2023-01-26 14:42:19.887374 2023-01-26 14:52:19.959306 2023-01-26 15:02:20.026578 2023-01-26 15:12:20.037634 2023-01-26 15:22:20.119609 2023-01-26 15:32:20.189649 2023-01-26 15:42:20.289967

And it stopped after that.

lgammo commented 1 year ago

The tutorial docker images appear to be fine and I am able to perform switchover and other tests.

Thanks.