vitabaks / postgresql_cluster

PostgreSQL High-Availability Cluster (based on "Patroni" and DCS "etcd" or "consul"). Automating with Ansible.
MIT License
1.29k stars 352 forks source link

wal-g An unknown error occurred: URL can't contain control characters. (found at least '\n') #445

Closed rrrru closed 8 months ago

rrrru commented 8 months ago
TASK [wal-g : Download Go v1.21.0
time 2023-08-04T20:14:06Z] ********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
fatal: [23.88.61.10]: FAILED! => {"changed": false, "dest": "/tmp/", "elapsed": 0, "gid": 0, "group": "root", "mode": "01777", "msg": "An unknown error occurred: URL can't contain control characters. '/dl/go1.21.0\\ntime 2023-08-04T20:14:06Z.linux-amd64.tar.gz' (found at least '\\n')", "owner": "root", "size": 4096, "state": "directory", "uid": 0, "url": "https://go.dev/dl/go1.21.0\ntime 2023-08-04T20:14:06Z.linux-amd64.tar.gz"}
fatal: [78.47.240.239]: FAILED! => {"changed": false, "dest": "/tmp/", "elapsed": 0, "gid": 0, "group": "root", "mode": "01777", "msg": "An unknown error occurred: URL can't contain control characters. '/dl/go1.21.0\\ntime 2023-08-04T20:14:06Z.linux-amd64.tar.gz' (found at least '\\n')", "owner": "root", "size": 4096, "state": "directory", "uid": 0, "url": "https://go.dev/dl/go1.21.0\ntime 2023-08-04T20:14:06Z.linux-amd64.tar.gz"}
fatal: [5.75.129.55]: FAILED! => {"changed": false, "dest": "/tmp/", "elapsed": 0, "gid": 0, "group": "root", "mode": "01777", "msg": "An unknown error occurred: URL can't contain control characters. '/dl/go1.21.0\\ntime 2023-08-04T20:14:06Z.linux-amd64.tar.gz' (found at least '\\n')", "owner": "root", "size": 4096, "state": "directory", "uid": 0, "url": "https://go.dev/dl/go1.21.0\ntime 2023-08-04T20:14:06Z.linux-amd64.tar.gz"}

Looks like they change output for https://go.dev/VERSION?m=text, so wal_g_latest_version contain time now.

I suggest we do something like this

# roles/wal-g/tasks/main.yml
    - name: Check the latest available Go version
      ansible.builtin.shell: |
        set -o pipefail;
        curl -s https://go.dev/VERSION?m=text | head -n1 |tr -d 'go'
      args:
        executable: /bin/bash
      changed_when: false
      register: wal_g_latest_version

Variable: wal_g_install: true OS: Debian 12

Thanks!

rrrru commented 8 months ago

And the make package for dependencies seems to have been lost ( in roles/wal-g/tasks/main.yml )

TASK [wal-g : Build WAL-G deps] ************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
fatal: [23.88.61.10]: FAILED! => {"changed": false, "msg": "Failed to find required executable \"make\" in paths: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin"}
vitabaks commented 8 months ago

Thanks @rrrru

vitabaks commented 8 months ago

Fixed here https://github.com/vitabaks/postgresql_cluster/pull/446

vitabaks commented 8 months ago

And the make package for dependencies seems to have been lost ( in roles/wal-g/tasks/main.yml )

this is strange since we are installing the cmake package.

rrrru commented 8 months ago

And the make package for dependencies seems to have been lost ( in roles/wal-g/tasks/main.yml )

this is strange since we are installing the cmake package.

apt install cmake
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  cmake-data libarchive13 libjsoncpp25 librhash0
Suggested packages:
  cmake-doc cmake-format elpa-cmake-mode ninja-build lrzip
Recommended packages:
  gcc make
The following NEW packages will be installed:
  cmake cmake-data libarchive13 libjsoncpp25 librhash0
0 upgraded, 5 newly installed, 0 to remove and 34 not upgraded.
Need to get 11.3 MB of archives.
After this operation, 41.7 MB of additional disk space will be used.
Do you want to continue? [Y/n]
vitabaks commented 8 months ago

the build problem has not been reproduced

TASK [wal-g : Download WAL-G v2.0.1 source code] *******************************
changed: [10.172.0.21]
changed: [10.172.0.22]
changed: [10.172.0.20]

TASK [wal-g : Build WAL-G deps] ************************************************
changed: [10.172.0.20]
changed: [10.172.0.22]
changed: [10.172.0.21]

TASK [wal-g : Build and install WAL-G] *****************************************
changed: [10.172.0.22]
changed: [10.172.0.20]
changed: [10.172.0.21]
rrrru commented 8 months ago
jobs:
  test:
    runs-on: ubuntu-latest

̶A̶l̶l̶ ̶t̶e̶s̶t̶s̶ ̶u̶s̶e̶ ̶u̶b̶u̶n̶t̶u̶-̶l̶a̶t̶e̶s̶t̶?̶

rrrru commented 8 months ago

And make In dependencies, I use the base image to install without previously installed packages, used hetzner cloud and from base images

vitabaks commented 8 months ago

That makes sense, thanks.

I will add the make package

vitabaks commented 8 months ago

@rrrru please test walg-go branch

commit: https://github.com/vitabaks/postgresql_cluster/pull/446/commits/bac23b1b5986458979c631e5d54eb4b075ff3d20

rrrru commented 8 months ago
fatal: [xxxxx]: FAILED! => {"changed": false, "cmd": ["/usr/bin/pip3", "install", "-U", "--trusted-host=pypi.python.org", "--trusted-host=pypi.org", "--trusted-host=files.pythonhosted.org", "setuptools<66.0.0"], "msg": "\n:stderr: error: externally-managed-environment\n\n× This environment is externally managed\n╰─> To install Python packages system-wide, try apt install\n    python3-xyz, where xyz is the package you are trying to\n    install.\n    \n    If you wish to install a non-Debian-packaged Python package,\n    create a virtual environment using python3 -m venv path/to/venv.\n    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make\n    sure you have python3-full installed.\n    \n    If you wish to install a non-Debian packaged Python application,\n    it may be easiest to use pipx install xyz, which will manage a\n    virtual environment for you. Make sure you have pipx installed.\n    \n    See /usr/share/doc/python3.11/README.venv for more information.\n\nnote: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.\nhint: See PEP 668 for the detailed specification.\n"}

Wal-g tasks looks good.

Fix after exec rm -f /usr/lib/python3.11/EXTERNALLY-MANAGED

https://github.com/geerlingguy/docker-debian12-ansible/blob/2521096d575d1a2ac94d40d171650887ed3ba588/Dockerfile#L20

vitabaks commented 8 months ago

Wal-g tasks looks good.

Ok

Fix after exec rm -f /usr/lib/python3.11/EXTERNALLY-MANAGED

Yes, there is such a thing in new OS versions. I'm automating this part.

rrrru commented 8 months ago

Will it work if I disable pgbouncer in the variables?

vitabaks commented 8 months ago

I don't quite understand what pgbouncer has to do with it?

rrrru commented 8 months ago

I don't quite understand what pgbouncer has to do with it?

Right,it's another issue.