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

Remove packages from registry Docker build #583

Merged
merged 4 commits into from
Jul 3, 2020

Conversation

ruflin
Copy link
Contributor

@ruflin ruflin commented Jul 2, 2020

The Dockerfile for the registry itself should not contain any packages. Instead it should be empty and there are other distributions with packages, see elastic/package-storage#86. This removes the packages from the default Docker build.

Few additional changes in the this PR:

  • Split up the Dockerfile in two stages to reduce the size of the image. Thanks @jsoriano for the contribution
  • Switch over to production packages instead of master
  • Select /packages as default path

@ruflin ruflin requested a review from mtojek July 2, 2020 16:52
@ruflin ruflin self-assigned this Jul 2, 2020
@ruflin
Copy link
Contributor Author

ruflin commented Jul 2, 2020

Opening as draft as the change is not complete and it needs to be checked if this maybe effect the integrations repository.

@ruflin
Copy link
Contributor Author

ruflin commented Jul 2, 2020

@mtojek I checked the integrations repo and it seems this will not effect it as in all places I could find, you mount your own volume and your own config with your own packages. Is this correct?

@elasticmachine
Copy link

elasticmachine commented Jul 2, 2020

💚 Build Succeeded

Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [Pull request #583 updated]

  • Start Time: 2020-07-03T07:48:15.509+0000

  • Duration: 8 min 59 sec

Test stats 🧪

Test Results
Failed 0
Passed 163
Skipped 0
Total 163

@ruflin
Copy link
Contributor Author

ruflin commented Jul 2, 2020

I also opened elastic/integrations#156 to attach integrations to a specific version of the registry.

Copy link
Member

@jsoriano jsoriano left a comment

Choose a reason for hiding this comment

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

I like the direction this is taking 🙂

Dockerfile Outdated Show resolved Hide resolved
@ruflin ruflin marked this pull request as ready for review July 2, 2020 20:24
The Dockerfile for the registry itself should not contain any packages. Instead it should be empty and there are other distributions with packages, see elastic/package-storage#86. This removes the packages from the default Docker build.

Few additional changes in the this PR:

* Split up the Dockerfile in two stages to reduce the size of the image. Thanks @jsoriano for the contribution
* Switch over to production packages instead of master
* Select /packages as default path
@ruflin ruflin force-pushed the remove-packages branch from f3166bf to a9c898d Compare July 2, 2020 20:25
@ruflin
Copy link
Contributor Author

ruflin commented Jul 2, 2020

Update the PR with all recommendations, should now be ready for a round of reviews.

@jsoriano Your contribution will directly make our production images much smaller as they depend on this on here.

@ruflin ruflin requested a review from ph July 2, 2020 20:27

# Change to new working directory
WORKDIR /registry
WORKDIR /package-registry
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it. Assuming we get elastic/integrations#156 in first, we could roll it out in two steps? I will update elastic/integrations#156 to also adjust the k8s one to a fix registry.

@@ -1,6 +1,6 @@
public_dir: ./public
package_paths:
- ./packages/package-storage
- /packages
Copy link
Contributor

Choose a reason for hiding this comment

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

Let me explain why was there a reference to the package-storage.

In integrations we mount the second path for packages, so that we have:

./packages/package-storage
./packages/integrations

so that all packages are stored in the same /packages directory. Using a single directory prevents from simply loading another path with packages without replacing existing ones.

If you plan to change the current behavior here, I believe you need to update the testing/environment in integrations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My assumption was this keeps working as in https://github.com/elastic/integrations/blob/master/testing/environments/snapshot.yml#L47 you overwrite the default config?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to use /packages/package-registry as default and added a note to the dockerfile and config what users should do about it.

@@ -23,6 +23,12 @@ import (
// and the setup command works as expected.
func TestSetup(t *testing.T) {

// Mage build is needed to pull in the packages from package-storage
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this is correct.

test shouldn't build any code. That's why you've dependencies between targets (not sure if mage supports it) or you call it build test

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to only use fetchPackageStorage instead to prevent the building of the binary.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm afraid that this is something we won't skip.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mtojek Not sure I can follow your last comment. What part will we not skip?

Copy link
Contributor

Choose a reason for hiding this comment

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

not to fetch packages

@mtojek
Copy link
Contributor

mtojek commented Jul 3, 2020

For reference: #367 (comment) We talked about multi-stage built images a couple of weeks ago. I'm glad we have it finally!

Copy link
Contributor

@mtojek mtojek left a comment

Choose a reason for hiding this comment

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

LGTM

@ruflin ruflin merged commit 0579a6e into elastic:master Jul 3, 2020
@ruflin ruflin deleted the remove-packages branch July 3, 2020 07:56
ruflin added a commit to ruflin/package-storage that referenced this pull request Jul 3, 2020
In elastic/package-registry#583 the package-registry was updated to not contain any packages anymore and the Dockerfile path for the config was adjusted. This updates the production registry accordingly.
ruflin added a commit to elastic/package-storage that referenced this pull request Jul 3, 2020
In elastic/package-registry#583 the package-registry was updated to not contain any packages anymore and the Dockerfile path for the config was adjusted. This updates the production registry accordingly.
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.

4 participants