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

Make production docker-compose.yml generated #1704

Merged
merged 12 commits into from
Sep 28, 2020
Merged

Conversation

Twixes
Copy link
Collaborator

@Twixes Twixes commented Sep 23, 2020

Changes

This is a proposal to make docker-compose.yml configurable with docker-compose-config.py. As various users have various needs (for example some are hosting directly off of the posthog Docker image, while others through a reverse proxy), the included config needs to be edited manually, which isn't really explained. With a guided config generation approach this is all smoother for the deploying user.
A downside here is that this requires the external pyyaml, since YAML suport isn't in the Python stdlib.

@timgl timgl temporarily deployed to posthog-docker-compose--dt26bi September 23, 2020 14:48 Inactive
@Twixes
Copy link
Collaborator Author

Twixes commented Sep 23, 2020

CC @yakkomajuri per emails & Slack

@Twixes Twixes temporarily deployed to posthog-docker-compose--dt26bi September 23, 2020 14:51 Inactive
@Twixes Twixes temporarily deployed to posthog-docker-compose--dt26bi September 23, 2020 14:55 Inactive
Copy link
Member

@fuziontech fuziontech left a comment

Choose a reason for hiding this comment

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

Looks good. I would just not ignore the pre-built docker-compose.yml so that we have a safe failover file

Comment on lines 10 to 15
def generate_secret_key() -> str:
"""Generate securely random 50 ASCII letters and digits."""
return "".join(
secrets.choice(string.ascii_letters + string.digits) for _ in range(50)
) # random 50 ASCII letters and digits

Copy link
Member

Choose a reason for hiding this comment

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

💯

.gitignore Outdated
@@ -27,3 +27,4 @@ yarn-error.log
yalc.lock
cypress/screenshots/*
docker-compose.prod.yml
docker-compose.yml
Copy link
Member

Choose a reason for hiding this comment

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

We don't want to ignore docker-compose.yml do we? I feel like we should include a safe fail-safe docker-compose config in case someone doesn't know how to run the script to generate one.

Comment on lines 18 to 19
with open("docker-compose.yml", "w") as file:
yaml.dump(
Copy link
Member

Choose a reason for hiding this comment

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

This could just overwrite the prebaked docker-compose.yml that ships with the repo right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It'd be a bit more brittle, but it could

@yakkomajuri
Copy link
Contributor

Echoing @fuziontech here - I'm up for keeping the file and just overwriting it if you run the script

@Twixes Twixes temporarily deployed to posthog-docker-compose--dt26bi September 23, 2020 16:30 Inactive
@Twixes Twixes temporarily deployed to posthog-docker-compose--dt26bi September 23, 2020 16:31 Inactive
@Twixes
Copy link
Collaborator Author

Twixes commented Sep 23, 2020

Alright, changed the approach to editing a default docker-compose.yml based on your feedback.

@Twixes Twixes temporarily deployed to posthog-docker-compose--dt26bi September 23, 2020 16:34 Inactive
@Twixes Twixes temporarily deployed to posthog-docker-compose--dt26bi September 23, 2020 16:45 Inactive
@Twixes Twixes temporarily deployed to posthog-docker-compose--dt26bi September 23, 2020 21:36 Inactive
@Twixes Twixes temporarily deployed to posthog-docker-compose--dt26bi September 23, 2020 21:55 Inactive
@Twixes Twixes temporarily deployed to posthog-docker-compose--dt26bi September 23, 2020 21:56 Inactive
@Twixes Twixes temporarily deployed to posthog-docker-compose--dt26bi September 25, 2020 11:35 Inactive
@Twixes Twixes merged commit 9d7dae2 into master Sep 28, 2020
@Twixes Twixes deleted the docker-compose-gen branch September 28, 2020 18:50
@yakkomajuri yakkomajuri mentioned this pull request Oct 1, 2020
3 tasks
knubie added a commit to knubie/posthog.com that referenced this pull request Jan 28, 2021
yakkomajuri added a commit to PostHog/posthog.com that referenced this pull request Feb 5, 2021
* Remove reference to docker-compose.proxy.yml

This file was removed in PostHog/posthog#1704

* Remove reference from deploy-docker.md

* minor update

Co-authored-by: yakkomajuri <yakko.majuri@gmail.com>
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.

None yet

4 participants