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

Odoo only depends on db if not using external db #159

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

joao-p-marques
Copy link
Contributor

Odoo can't always depend on db because we don't always have it. This fixes that bug.

Fixes #150 (comment)

Copy link
Contributor

@yajo yajo left a comment

Choose a reason for hiding this comment

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

The patch is good, just one detail please.

devel.yaml.jinja Outdated
@@ -48,7 +48,9 @@ services:
- ./odoo/auto:/opt/odoo/auto:rw,z
depends_on:
- cdnjs_cloudflare_proxy
{% if postgres_version -%}
Copy link
Contributor

Choose a reason for hiding this comment

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

Our code standard here for these kind of blocks is {%- ... %}.

Whitespace is weird in jinja and important in yaml.

Please follow it wherever possible (and here is possible). Same for all others.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. I actually did this following your suggestion in abad703
I guess it doesn't apply the same here, as we are modifying a yaml array, and not adding the service, as before, right?

Choose a reason for hiding this comment

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

Shouldn't we put the same condition on 'pgweb' dependency and on the 'db' under volumes as well?

Copy link
Contributor

@yajo yajo Oct 28, 2020

Choose a reason for hiding this comment

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

I guess it doesn't apply the same here, as we are modifying a yaml array, and not adding the service, as before, right?

Well, your code is not wrong here, but it was wrong there. 😋

the - is telling jinja to remove all whitespace from (or to) that boundary. Wherever possible, the code standard here is to remove previous whitespace, and here it is possible. In the other code you link, it was not possible (it removed one extra line).

Shouldn't we put the same condition on 'pgweb' dependency and on the 'db' under volumes as well?

Yes, on every service that depends on db actually

Nope. Only on prod.yaml.

Choose a reason for hiding this comment

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

In that case, IMOH below choice should be removed from copier question:

I will use an external PostgreSQL server: null

And also it is not clear in docs that how to change DB parameters when deploying in production. It will be good to add some help for that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope. Only on prod.yaml.

In that case, if the db service should always exist in devel and test, maybe we should end up with a different copier answer or mechanism to set up the case when we want an external DB on prod. If we set this var to null, we can't know which version to use in devel and test, right?

Maybe add another question with "Whether or not ti use external server?", that would override the db configuration only in prod.

Copy link

@ska-ibees ska-ibees Oct 29, 2020

Choose a reason for hiding this comment

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

Maybe add another question with "Whether or not ti use external server?", that would override the db configuration only in prod.

Or maybe split db questions for prod and dev/test. For instance, there are separate questions for production (domains_prod) and test domains (domains_test).

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, we have to rethink the UX with this question.

prod.yaml.jinja Outdated Show resolved Hide resolved
test.yaml.jinja Outdated Show resolved Hide resolved
devel.yaml.jinja Outdated Show resolved Hide resolved
@joao-p-marques
Copy link
Contributor Author

@yajo I'm trying to ressurect this old PR with a different approach to the UX, following the suggestions above. WDYT?

…l db

Fixes #150 (comment)

The DB service is always created in common and imported in devel and test, but not in prod. The dependency between services also reflects that.
By default, the devel and test environments will use the latest PG version.
@yajo
Copy link
Contributor

yajo commented Feb 15, 2021

Possibly all will be easier with copier 6 and when clause. IMHO we can wait until then.

@yajo yajo changed the base branch from devel to main May 25, 2021 08:44
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