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

fix: use dhis2/docker-compose instead of amcgee/dhis2-backend as default #61

Merged
merged 2 commits into from
Jun 13, 2019

Conversation

varl
Copy link
Contributor

@varl varl commented Jun 6, 2019

I forked https://github.com/amcgee/dhis2-backend to https://github.com/dhis2/docker-compose as I figure it's time for the Docker Compose setup to be under the official org on GitHub.

This PR updates the configuration default to the DHIS2 docker-compose repo.

@varl varl requested a review from amcgee June 6, 2019 09:17
@amcgee
Copy link
Member

amcgee commented Jun 6, 2019

@varl thanks for pushing this forward! Two questions:

  1. Should we move instead of fork? That's what I've done in the past, and it has the added benefit of automatically redirecting any requests to amcgee/dhis2-backend to the new home
  2. docker-compose is a bit opaque and maybe (gulp...) we'd want more than one docker-compose setup in the future? We already have one used for e2e tests in dhis2/dhis2-core. What about a name that describes what it's used for, like d2-cluster-docker-compose or cluster-docker-compose or something?

@varl
Copy link
Contributor Author

varl commented Jun 6, 2019

  1. Sure, that's cool. I'll remove the fork and you can transfer it.

    edit: Done

  2. I thought a bit about that, and I think it would be nice to have them all in dhis2/docker-compose E.g.

docker-compose/
├── app-store
│   └── docker-compose.yml
├── cluster
│   └── docker-compose.yml
└── e2e
    └── docker-compose.yml

@amcgee
Copy link
Member

amcgee commented Jun 7, 2019

2. I thought a bit about that, and I think it would be nice to have them all in dhis2/docker-compose E.g.

Yeah, I think I like that better too, but unfortunately it complicates the technical process of downloading the archive - github only supports downloading and caching whole-repo archives (see dear-github/dear-github#95). We could download the whole thing and then reference different sub-dirs for different cases, but that makes it less generic (harder to host your own compose repo somewhere). Doable though, might be worth it!

For now I think just moving the repo to dhis2/docker-compose will probably be a good first step and then we can add sub-dir support later, I'll do that.

@varl
Copy link
Contributor Author

varl commented Jun 7, 2019

Yeah, I think I like that better too, but unfortunately it complicates the technical process of downloading the archive

It does. I do think it might be worth it, and there is the option of forking the dhis2/docker-compose repo, then just removing unused subdirs leaving only cluster/docker-compose.yml, etc.

One variant could be that once we extracted the archive and see that there is no docker-compose.yml in the root of the archive, we can prompt the user for what sub-directory to use.

For example:

d2 cluster up smth
Initializing Docker Compose repository...
Docker Compose repo doesn't have a root docker-compose file...
Select a sub-directory (use `?` for a list): ?
cluster, e2e, custom
Select a sub-directory (use `?` for a list): cluster
Selected: cluster/docker-compose.yml
Spinning up cluster smth

@amcgee
Copy link
Member

amcgee commented Jun 11, 2019

I've moved amcgee/dhis2-backend to dhis2/docker-compose, for now it's still a single config (flat, no sub-directories).

Thinking about this a little more just now, though, maybe it would make more sense to keep amcgee/dhis2-backend around as the flat option, and support sub-directories in dhis2/docker-compose as well as this PR. I realize that's backtracking a bit on the changes already made to this PR, but I think it will improve the upgrade experience because:

  1. Users of the current d2 release will still be able to download the amcgee/dhis2-backend release and have it work
  2. Users of the next d2 release triggered by this PR merge (which will be at least a minor bump) will use the dhis2/docker-compose/cluster repo sub-dir.
  3. If we migrate the amcgee/dhis2-backend repo to a multi-subdir layout (even after moving it to dhis2/docker-compose) we will inadvertently break older versions of d2

Thought @varl?

@varl
Copy link
Contributor Author

varl commented Jun 12, 2019

Sounds good to me!

Edit:

  • Will you fork dhis2/docker-compose from dhis2 to your user before we merge chore: move to cluster subdir d2-cluster-docker-compose#4?

  • I can implement the subdir in two places, either in cli-helpers-engine or in cli-cluster. I think cli-cluster makes more sense, so I'll do it there.

  • It will have to support both subdirs and non-subdirs for now.

@amcgee
Copy link
Member

amcgee commented Jun 12, 2019

Yep https://github.com/amcgee/dhis2-backend

  • I can implement the subdir in two places, either in cli-helpers-engine or in cli-cluster. I think cli-cluster makes more sense, so I'll do it there.

I think so too

  • It will have to support both subdirs and non-subdirs for now.

Why is that?

@amcgee
Copy link
Member

amcgee commented Jun 12, 2019

Merged dhis2/d2-cluster-docker-compose#4 so we should be ready to add support for subdirs here

@varl
Copy link
Contributor Author

varl commented Jun 12, 2019

Why is that?

I might have misunderstood the following quote:

Thinking about this a little more just now, though, maybe it would make more sense to keep amcgee/dhis2-backend around as the flat option, and support sub-directories in dhis2/docker-compose as well as this PR.

I interpreted the part about keeping it around as a flat option as in that it should be an option going forward as well, not just keeping it around for old versions of d2. So a user could use a flat docker-compose repo with d2-cluster as well as a sub-directory based docker-compose repo.

If we are only keeping amcgee/dhis2-backend around as a backwards compatible thing for old versions of d2-cluster, then we can scratch that requirement and only support sub-directory based docker-compose repos going forward.

@amcgee
Copy link
Member

amcgee commented Jun 12, 2019

@varl got it, yep I just meant for backwards compatibility!

@varl varl force-pushed the update-default-docker-compose-repo branch from c79533a to 3e6be26 Compare June 12, 2019 17:38
@varl
Copy link
Contributor Author

varl commented Jun 12, 2019

@amcgee This is as simple as I could make it. The cluster/ subdir is configurable, but depends on #53 to actually be configurable by a user. It's not something we should expose through a switch, though it is possible to set up clusters using the ~/.config/d2/config.js file, and using that mechanism it is possible to override the docker-compose repo and the subdirectory we look in.

If you set dockerComposeDirectory: '' it should even work with flat docker-compose repositories out of the box... Bonus feature.

Copy link
Member

@amcgee amcgee left a comment

Choose a reason for hiding this comment

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

Nice @varl, looks good! Haven't tested but approving based on code review.

There's actually a super-secret hack which means this is configurable on the command line, since the config is resolved from argv. Yargs doesn't whitelist options, so you could technically do d2 cluster up 2.32.0 --dockerComposeRepository <url> --dockerComposeDirectory myCustomDir. I don't actually love the loosey-goosey yargs approach, but it's a bonus (undocumented and unpromoted) feature for now!

Copy link
Member

@amcgee amcgee left a comment

Choose a reason for hiding this comment

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

One thing to consider.... this will create duplicates of the full multi-docker-compose repo for every named cluster in the cache, which might be something we should avoid in the future.

@varl
Copy link
Contributor Author

varl commented Jun 13, 2019

Yeah, but I'll see if I can handle that in the #53, or, if I cannot, it's not that many duplicated bytes.

@varl varl merged commit 85d708f into master Jun 13, 2019
@varl varl deleted the update-default-docker-compose-repo branch June 13, 2019 14:03
dhis2-bot pushed a commit that referenced this pull request Jun 13, 2019
## [1.2.4](v1.2.3...v1.2.4) (2019-06-13)

### Bug Fixes

* use dhis2/docker-compose instead of amcgee/dhis2-backend as default ([#61](#61)) ([85d708f](85d708f))
@dhis2-bot
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

None yet

3 participants