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

Docker-Compose: Avoid setting hostname to '' #1365

Merged
merged 1 commit into from Mar 14, 2022

Conversation

glensc
Copy link
Contributor

@glensc glensc commented Mar 8, 2022

The hostname is literally set to '':

Before:

# docker-compose exec smtp hostname
''

After:

# docker-compose exec smtp hostname
c531c19841de

Copy link
Collaborator

@aminvakil aminvakil left a comment

Choose a reason for hiding this comment

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

I think there was a reason this has been added in 6c92774 which was in #1116.

Investigating further...

@aminvakil
Copy link
Collaborator

I just tested your change with docker-compose 2.3.2 and after this, snuba container keeps restarting without any log.

@glensc
Copy link
Contributor Author

glensc commented Mar 8, 2022

@aminvakil in any case, the used syntax is incorrect. it's already well known (to me at least) that docker compose doesn't like extra quoting. it's not shell script. for example if you place a variable with spaces to .env YOU MAU NOT QUOTE THE VALUE, or you get quotes in env value itself.

anyway, after my fix, if env is missing the valuer is set to empty (rather apostrhophes), and then default hostname will be set, which is generated name. as seen in example I provided

@glensc
Copy link
Contributor Author

glensc commented Mar 8, 2022

I fail to see how "smtp" container "hostname" is related to "snuba" container :D

If you insist on quoting, then this might work (not tested):

  smtp:
    <<: *restart_policy
    image: tianon/exim4
    hostname: "${SENTRY_MAIL_HOST:-}"

but that's just yaml syntax, shouldn't affect the variables expansion.

@aminvakil
Copy link
Collaborator

I just tested your change with docker-compose 2.3.2 and after this, snuba container keeps restarting without any log.

Ok, reverting this PR change results in sentry-self-hosted-snuba-subscription-consumer-transactions-1 container restarting over and over again.

@aminvakil
Copy link
Collaborator

I fail to see how "smtp" container "hostname" is related to "snuba" container :D

If you insist on quoting, then this might work (not tested):

  smtp:
    <<: *restart_policy
    image: tianon/exim4
    hostname: "${SENTRY_MAIL_HOST:-}"

but that's just yaml syntax, shouldn't affect the variables expansion.

Yeah, it was a mistake, it's not related. But I still want to understand why it has been added at the first place.

@aminvakil
Copy link
Collaborator

Right now our CI is failing (#1341) I will close and open this PR to retrigger 2.0.1 at least to see if this leads to any problem.

@aminvakil aminvakil closed this Mar 8, 2022
@aminvakil aminvakil reopened this Mar 8, 2022
@BYK
Copy link
Collaborator

BYK commented Mar 8, 2022

GitHub did something to how they use Docker across matrix jobs and I think this is causing issues. We may want to scope the project name with the job name in docker-compose setups to avoid the issues. The failure on 1.29.2 seems related to that.

@aminvakil
Copy link
Collaborator

@glensc As de81299 has been merged, can you please rebase your branch to retrigger the CI?

It should pass now.

@glensc
Copy link
Contributor Author

glensc commented Mar 13, 2022

@aminvakil, you can do that yourself, really:

image

@aminvakil
Copy link
Collaborator

@glensc Do you see "maintainer" here?

image

@aminvakil aminvakil requested a review from BYK March 13, 2022 13:08
Copy link
Collaborator

@aminvakil aminvakil left a comment

Choose a reason for hiding this comment

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

LGTM.

Closing and reopening to trigger the CI.

@aminvakil aminvakil closed this Mar 14, 2022
@aminvakil aminvakil reopened this Mar 14, 2022
@aminvakil
Copy link
Collaborator

And CI is green. 🎉
(At least the part that must be)

@chadwhitacre
Copy link
Member

Sadly needs another rebase once #1375 lands.

@chadwhitacre
Copy link
Member

I landed #1375. Can you rebase again @glensc? 🙏

@glensc
Copy link
Contributor Author

glensc commented Mar 14, 2022

image

Why do you need me to do the rebases? Makes only useless ping-pongs!

@chadwhitacre
Copy link
Member

/gcbrun

@chadwhitacre
Copy link
Member

@glensc Do you see "member" here?

Screen Shot 2022-03-14 at 12 42 59 PM

Oh wait ... 😬 🙈 😅

@glensc
Copy link
Contributor Author

glensc commented Mar 14, 2022

Build flakiness due to multiple versions in same docker instance still not resolved:

 Container self-hosted-0-nginx-1  Recreated
  Error response from daemon: Renaming a container with the same name as its current name
  ++ teardown ERR 45

The fix didn't apparently work:

@chadwhitacre
Copy link
Member

Build flakiness due to multiple versions in same docker instance still not resolved:

#1294 ftr

The fix didn't apparently work

de81299 was for #1341, not #1294. We have several open CI issues. 😞

@chadwhitacre
Copy link
Member

/gcbrun

@chadwhitacre
Copy link
Member

@glensc I'll force-merge if we hit CI flakiness again.

@aminvakil
Copy link
Collaborator

We have hit #1171 now :)
Let's merge this IMO.

@glensc
Copy link
Contributor Author

glensc commented Mar 14, 2022

I thought this was to solve container name collisions:

COMPOSE_PROJECT_NAME: self-hosted-${{ strategy.job-index }}

@glensc
Copy link
Contributor Author

glensc commented Mar 14, 2022

hey. CI green. merge fast before someone requests rebase! :D

@chadwhitacre chadwhitacre merged commit 06d6666 into getsentry:master Mar 14, 2022
@chadwhitacre
Copy link
Member

Close one! Thanks @glensc! 😁

@glensc glensc deleted the patch-1 branch March 14, 2022 22:01
@github-actions github-actions bot locked and limited conversation to collaborators Mar 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants