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

feat: add odoo 17.0 #260

Merged
merged 2 commits into from
Nov 2, 2023
Merged

feat: add odoo 17.0 #260

merged 2 commits into from
Nov 2, 2023

Conversation

vrenaville
Copy link
Member

No description provided.

@vrenaville vrenaville force-pushed the odoo_17 branch 2 times, most recently from 4220049 to f07bd32 Compare October 30, 2023 14:18
@@ -0,0 +1,85 @@
# Odoo dependencies
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

out of curiosity, how do you decide which package version to freeze ?

@@ -86,7 +86,7 @@ if [ ! -f "${CONFIG_TARGET}" ]; then
fi

# Wait until postgres is up
pg_isready
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, sorry about this. I proposed the use of pg_isready (#255), but after seeing this red build I realize it's not working as expected.

It seems pg_isready is not enough: https://stackoverflow.com/questions/35069027/docker-wait-for-postgresql-to-be-running

There's a 100% dockerized solution to this, but it requires changes in the docker compose files, basically:

  db:
    ...
    healthcheck:
      test: [ "CMD", "pg_isready", "-q", "-h", "localhost" ]
      interval: 5s
      timeout: 5s
      retries: 5
  odoo:
    ...
    depends_on:
      db:
        condition: service_healthy

NOTE: -h localhost seems to be very important when running pg_isready in the db container, as it otherwise may lead to false positives due to the db that's started in the init process.

With this solution we wouldn't really need to wait in the odoo container like we do now, as everything would be handled by docker. However, it's not such a bad idea to wait here too.. but, unfortunately, pg_isready is not enough 😢

We'd need a wrapper like this it seems:

#!/bin/bash
set -e

# Default value (set to 0 to disable)
PGTIMEOUT=${PGTIMEOUT:-10}

if [ ${PGTIMEOUT:-10} -le 0 ]; then
    exit 0
fi

if [ -z "$PGHOST" ]; then
    echo "ERROR: PGHOST is not defined" 1>&2
    exit 1
fi

echo -n "Waiting for PostgreSQL to be ready ..."
start_time=$(date +%s)
until pg_isready -q -t 1 >/dev/null; do
    current_time=$(date +%s)
    elapsed_time=$((current_time - start_time))
    if [ "$elapsed_time" -ge "$PGTIMEOUT" ]; then
        echo "."
        echo "Unable to reach PostgreSQL server" 1>&2
        exit 1
    fi
    echo -n "."
done

echo " [OK]"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently I have just revert, you fix, I will open a PR to use pg_isready as you describe

@vrenaville vrenaville marked this pull request as ready for review November 2, 2023 14:20
@vrenaville vrenaville merged commit fc4c1cc into camptocamp:master Nov 2, 2023
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants