Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Ubuntu 24.04; Install Patroni via deb/rpm package #642

Merged
merged 12 commits into from
Aug 8, 2024

Conversation

vitabaks
Copy link
Owner

@vitabaks vitabaks commented Apr 26, 2024

Add support for Ubuntu 24.04

UPD:

To ensure compatibility with Ubuntu 22.04 (and Python 3.12), the Patroni package will be installed from the deb/rpm package by default. The latest available version of the package will be installed from the Postgres repository.

You also have the option to choose the installation method using the pip package (variable patroni_installation_method) if you prefer this installation method or, for example, want to have better control over the version of the Patroni package that you install on the cluster.

Note: Consul package for OracleLinux missing in HashiCorp repository. Only the installation of a binary file is supported (consul_install_from_repo: false, patroni_installation_method: "pip")

@vitabaks vitabaks self-assigned this Apr 26, 2024
@vitabaks
Copy link
Owner Author

vitabaks commented Apr 26, 2024

The python-etcd-0.4.5 and ydiff-1.3 packages are not compatible with Python 3.12

root@pgnode01:/# pip3 install -r /tmp/requirements.txt 
Collecting urllib3>=1.25.9 (from -r /tmp/requirements.txt (line 1))
  Using cached urllib3-2.2.1-py3-none-any.whl.metadata (6.4 kB)
Collecting boto3 (from -r /tmp/requirements.txt (line 2))
  Using cached boto3-1.34.92-py3-none-any.whl.metadata (6.6 kB)
Requirement already satisfied: PyYAML in /usr/lib/python3/dist-packages (from -r /tmp/requirements.txt (line 3)) (6.0.1)
Collecting requests>=2.25.1 (from -r /tmp/requirements.txt (line 4))
  Using cached requests-2.31.0-py3-none-any.whl.metadata (4.6 kB)
Requirement already satisfied: six>=1.7 in /usr/lib/python3/dist-packages (from -r /tmp/requirements.txt (line 5)) (1.16.0)
Collecting python-etcd<0.5,>=0.4.3 (from -r /tmp/requirements.txt (line 6))
  Using cached python-etcd-0.4.5.tar.gz (37 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [11 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 14, in <module>
        File "/usr/local/lib/python3.12/dist-packages/setuptools/__init__.py", line 16, in <module>
          import setuptools.version
        File "/usr/local/lib/python3.12/dist-packages/setuptools/version.py", line 1, in <module>
          import pkg_resources
        File "/usr/local/lib/python3.12/dist-packages/pkg_resources/__init__.py", line 2191, in <module>
          register_finder(pkgutil.ImpImporter, find_on_path)
                          ^^^^^^^^^^^^^^^^^^^
      AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
Collecting urllib3>=1.25.9 (from -r /tmp/requirements.txt (line 1))
  Using cached urllib3-2.2.1-py3-none-any.whl.metadata (6.4 kB)
Collecting boto3 (from -r /tmp/requirements.txt (line 2))
  Using cached boto3-1.34.92-py3-none-any.whl.metadata (6.6 kB)
Requirement already satisfied: PyYAML in /usr/lib/python3/dist-packages (from -r /tmp/requirements.txt (line 3)) (6.0.1)
Collecting requests>=2.25.1 (from -r /tmp/requirements.txt (line 4))
  Using cached requests-2.31.0-py3-none-any.whl.metadata (4.6 kB)
Requirement already satisfied: six>=1.7 in /usr/lib/python3/dist-packages (from -r /tmp/requirements.txt (line 5)) (1.16.0)
Collecting python-consul>=0.7.1 (from -r /tmp/requirements.txt (line 6))
  Downloading python_consul-1.1.0-py2.py3-none-any.whl.metadata (11 kB)
Collecting click>=4.1 (from -r /tmp/requirements.txt (line 7))
  Downloading click-8.1.7-py3-none-any.whl.metadata (3.0 kB)
Collecting prettytable>=0.7 (from -r /tmp/requirements.txt (line 8))
  Downloading prettytable-3.10.0-py3-none-any.whl.metadata (30 kB)
Collecting python-dateutil (from -r /tmp/requirements.txt (line 9))
  Downloading python_dateutil-2.9.0.post0-py2.py3-none-any.whl.metadata (8.4 kB)
Collecting psutil>=2.0.0 (from -r /tmp/requirements.txt (line 10))
  Downloading psutil-5.9.8-cp36-abi3-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (21 kB)
Collecting ydiff>=1.2.0 (from -r /tmp/requirements.txt (line 11))
  Downloading ydiff-1.3.tar.gz (74 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 74.1/74.1 kB 1.8 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [11 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 14, in <module>
        File "/usr/local/lib/python3.12/dist-packages/setuptools/__init__.py", line 16, in <module>
          import setuptools.version
        File "/usr/local/lib/python3.12/dist-packages/setuptools/version.py", line 1, in <module>
          import pkg_resources
        File "/usr/local/lib/python3.12/dist-packages/pkg_resources/__init__.py", line 2191, in <module>
          register_finder(pkgutil.ImpImporter, find_on_path)
                          ^^^^^^^^^^^^^^^^^^^
      AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

@vitabaks vitabaks changed the title Add support for Ubuntu 2404 Add support for Ubuntu 24.04 Apr 26, 2024
@rcknr
Copy link
Contributor

rcknr commented May 2, 2024

Could this be helpful?
It looks like in 24.04 you are forced to create a virtual environment.
By the way, the bug you referenced here was caused by a related problem: version conflicts between Python packages installed by apt and pip. It appears to be fixed.

@vitabaks
Copy link
Owner Author

vitabaks commented May 2, 2024

Perhaps we will switch from pip to rpm/deb (patroni_installation_method) by default for patroni packages.

@JohnTheNerd
Copy link

JohnTheNerd commented Jul 7, 2024

I was able to successfully set up the cluster on Ubuntu 24.04 by:

  • checking out the Git branch for this PR, and rebasing it off master
  • connecting to each node, and:
    • installing the following packages via APT:
      • python3-packaging
      • python3-pycparser
      • python3-consul
    • running python3 -m pip install --upgrade setuptools --break-system-packages as root
    • installing patroni[dependencies] via pip, using the --break-system-packages option, which should now succeed
  • commenting out the part where patroni dependencies are installed in the Ansible playbook
  • running the playbook with the parts commented out
  • setting the file permissions for /etc/postgresql/16/main/postgresql.conf to 644 on each node
  • rebooting all nodes

not sure how much of this is necessary, but I hope it at least helps! FWIW, I set up the basic failover cluster.

@vitabaks
Copy link
Owner Author

vitabaks commented Aug 2, 2024

I was able to successfully set up the cluster on Ubuntu 24.04 by

In your case, the key is that you are using consul and you did not need to install the outdated python-etcd package.

@vitabaks
Copy link
Owner Author

vitabaks commented Aug 2, 2024

To ensure compatibility with Ubuntu 22.04 (and Python 3.12), the Patroni package will be installed from the deb/rpm package by default.

@vitabaks vitabaks added enhancement Improvement of the current functionality in progress labels Aug 2, 2024
@vitabaks vitabaks changed the title Add support for Ubuntu 24.04 Add support for Ubuntu 24.04; Install Patroni from the deb/rpm package Aug 8, 2024
@vitabaks vitabaks changed the title Add support for Ubuntu 24.04; Install Patroni from the deb/rpm package Support Ubuntu 24.04; Install Patroni via deb/rpm package Aug 8, 2024
@vitabaks vitabaks merged commit dd07f08 into master Aug 8, 2024
17 checks passed
@vitabaks vitabaks deleted the ubuntu-2404 branch August 8, 2024 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement of the current functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants