about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorFilesLines
2019-10-03 feat(server): Order layers in image manifest based on merge ratingVincent Ambo3-4/+20
Image layers in manifests are now sorted in a stable (descending) order based on their merge rating, meaning that layers more likely to be shared between images come first. The reason for this change is Docker's handling of image layers on overlayfs2: Images are condensed into a single representation on disk after downloading. Due to this Docker will constantly redownload all layers that are applied in a different order in different images (layer order matters in imperatively created images), based on something it calls the 'ChainID'. Sorting the layers this way raises the likelihood of a long chain of matching layers at the beginning of an image. This relates to #39.
2019-10-03 chore(build-image): Remove nixery-build-layersVincent Ambo3-70/+10
This functionality has been rolled into the server component and is no longer required.
2019-10-03 feat(server): Implement creation of layer tarballs in the serverVincent Ambo2-79/+158
This will create, upload and hash the layer tarballs in one disk read.
2019-10-03 fix(server): Do not invoke layer build if no layers are missingVincent Ambo1-1/+5
This previously invoked a Nix derivation that spent a few seconds on making an empty object in JSON ...
2019-10-03 feat(server): Fetch popularity data on launchVincent Ambo1-0/+37
The last missing puzzle piece for #50!
2019-10-03 feat(server): Reimplement local manifest cache backed by filesVincent Ambo5-51/+70
Implements a local manifest cache that uses the temporary directory to cache manifest builds. This is necessary due to the size of manifests: Keeping them entirely in-memory would quickly balloon the memory usage of Nixery, unless some mechanism for cache eviction is implemented.
2019-10-03 refactor(builder): Streamline layer creation & reintroduce cachingVincent Ambo1-28/+53
The functions used for layer creation are now easier to follow and have clear points at which the layer cache is checked and populated. This relates to #50.
2019-10-03 refactor: Remove remaining MD5-hash mentions and computationsVincent Ambo5-30/+18
2019-10-03 refactor(server): Cache manifest entries for layer buildsVincent Ambo2-31/+27
MD5 hash checking is no longer performed by Nixery (it does not seem to be necessary), hence the layer cache now only keeps the SHA256 hash and size in the form of the manifest entry. This makes it possible to restructure the builder code to perform cache-fetching and cache-populating for layers in the same place.
2019-10-03 feat(server): Reintroduce manifest caching to GCSVincent Ambo2-29/+29
The new builder now caches and reads cached manifests to/from GCS. The in-memory cache is disabled, as manifests are no longer written to local file and the caching of file paths does not work (unless we reintroduce reading/writing from temp files as part of the local cache).
2019-10-03 refactor(server): Clean up cache implementationVincent Ambo3-27/+26
A couple of minor fixes and improvements to the cache implementation.
2019-10-03 chore(server): Remove "layer seen" cacheVincent Ambo1-29/+5
This cache is no longer required as it is implicit because the layer cache (mapping store path hashes to layer hashes) implies that a layer has been seen.
2019-10-03 fix(server): Upload symlink layer created by first Nix buildVincent Ambo1-1/+6
This layer is needed in addition to those that are built in the second Nix build.
2019-10-03 fix(server): Specify correct authentication scope for GCSVincent Ambo1-1/+4
When retrieving tokens for service service accounts, some methods of retrieval require a scope to be specified.
2019-10-03 feat(server): Implement new build process coreVincent Ambo1-58/+52
Implements the new build process to the point where it can actually construct and serve image manifests. It is worth noting that this build process works even if the Nix sandbox is enabled! It is also worth nothing that none of the caching functionality that the new build process enables (such as per-layer build caching) is actually in use yet, hence running Nixery at this commit is prone to doing more work than previously. This relates to #50.
2019-10-03 fix(server): Minor fixes to updated new builder codeVincent Ambo2-8/+7
2019-10-03 fix(nix): Minor fixes to derivations for new build processVincent Ambo2-2/+3
2019-10-03 feat(server): Implement package for creating image manifestsVincent Ambo1-0/+114
The new manifest package creates image manifests and their configuration. This previously happened in Nix, but is now part of the server's workload. This relates to #50.
2019-10-03 feat(server): Reimplement creation & uploading of layersVincent Ambo3-87/+250
The new build process can now call out to Nix to create layers and upload them to the bucket if necessary. The layer cache is populated, but not yet used.
2019-10-03 refactor(server): Introduce a state type to carry runtime stateVincent Ambo2-11/+31
The state type contains things such as the bucket handle and Nixery's configuration which need to be passed around in the builder. This is only added for convenience.
2019-10-03 feat(server): Add cache for layer builds in GCS & local cacheVincent Ambo1-0/+86
This cache is going to be used for looking up whether a layer build has taken place already (based on a hash of the layer contents). See the caching section in the updated documentation for details. Relates to #50.
2019-10-03 feat(nix): Add derivation to create layer tars from a store path setVincent Ambo3-9/+69
This introduces a new Nix derivation that, given an attribute set of layer hashes mapped to store paths, will create a layer tarball for each of the store paths. This is going to be used by the builder to create layers that are not present in the cache. Relates to #50.
2019-10-03 docs(caching): Add information about Nixery's caching strategiesVincent Ambo2-0/+71
2019-10-03 feat(server): Introduce function to hash contents of a layerVincent Ambo1-0/+13
This creates a cache key which can be used to check if a layer has already been built.
2019-10-03 refactor(server): Expose layer grouping logic via a functionVincent Ambo1-55/+24
Refactors the layer grouping package (which previously compiled to a separate binary) to expose the layer grouping logic via a function instead. This is the next step towards creating layers inside of the server component instead of in Nix. Relates to #50.
2019-10-03 chore(server): Import layer grouping logic into server componentVincent Ambo2-0/+361
2019-10-03 chore(build-image): Simplify wrapper build & remove layer groupingVincent Ambo5-452/+21
Simplifies the wrapper script used to invoke Nix builds from Nixery to just contain the essentials, since the layer grouping logic is moving into the server itself.
2019-10-03 refactor(build-image): Do not assemble image layers in NixVincent Ambo1-162/+57
This is the first step towards a more granular build process where some of the build responsibility moves into the server component. Rather than assembling all layers inside of Nix, it will only create the symlink forest and return information about the runtime paths required by the image. The server is then responsible for grouping these paths into layers, and assembling the layers themselves. Relates to #50.
2019-09-22 refactor(build): Add group-layers to top-level Nix derivationsVincent Ambo1-5/+7
This makes CI build the group-layers tool (and cache it to Cachix!)
2019-09-22 refactor(build-image): Minor tweak to layer construction scriptVincent Ambo1-2/+2
2019-09-21 fix(build): Ensure launch script compatibility with other runtimesVincent Ambo1-1/+2
Fixes two launch script compatibility issues with other container runtimes (such as gvisor): * don't fail if /tmp already exists * don't fail if the environment becomes unset
2019-09-21 feat(server): Log Nix output live during the buildsVincent Ambo1-3/+12
Instead of dumping all Nix output as one at the end of the build process, stream it live as the lines come in. This is a lot more useful for debugging stuff like where manifest retrievals get stuck.
2019-09-21 fix(build-image): Use absolute paths in tarballsVincent Ambo1-2/+2
2019-09-21 fix(build): Ensure nixery-build-image is on Nixery's PATHVincent Ambo1-0/+1
This is useful when running Nixery locally.
2019-09-21 chore(build): Bump nixpkgs version used in TravisVincent Ambo1-1/+1
This version matches the updated popularity URL.
2019-09-21 feat: Add configuration option for popularity data URLVincent Ambo5-5/+12
2019-09-21 chore(docs): Remove mdbook overrideVincent Ambo1-18/+0
The change has been upstreamed in Nixpkgs.
2019-09-10 refactor(builder): Calculate image cache key only onceVincent Ambo2-17/+15
2019-09-10 feat(server): Cache built manifests to the GCS bucketVincent Ambo3-23/+96
Caches manifests under `manifests/$cacheKey` in the GCS bucket and introduces two-tiered retrieval of manifests from the caches (local first, bucket second). There is some cleanup to be done in this code, but the initial version works.
2019-09-10 refactor(server): Use package source specific cache keysVincent Ambo2-32/+21
Use the PackageSource.CacheKey function introduced in the previous commit to determine the key at which a manifest should be cached in the local cache. Due to this change, manifests for moving target sources are no longer cached and the recency threshold logic has been removed.
2019-09-10 refactor(server): Move package source management logic to serverVincent Ambo8-105/+192
Introduces three new types representing each of the possible package sources and moves the logic for specifying the package source to the server. Concrete changes: * Determining whether a specified git reference is a commit vs. a branch/tag is now done in the server, and is done more precisely by using a regular expression. * Package sources now have a new `CacheKey` function which can be used to retrieve a key under which a build manifest can be cached *if* the package source is not a moving target (i.e. a full git commit hash of either nixpkgs or a private repository). This function is not yet used. * Users *must* now specify a package source, Nixery no longer defaults to anything and will fail to launch if no source is configured.
2019-09-02 docs: Add information about NIX_TIMEOUT variableVincent Ambo2-1/+5
2019-09-02 feat(server): Add configuration option for Nix build timeoutsVincent Ambo2-6/+11
Adds a NIX_TIMEOUT environment variable which can be set to a number of seconds that is the maximum allowed time each Nix builder can run. By default this is set to 60 seconds, which should be plenty for most use-cases as Nixery is not expected to be performing builds of uncached binaries in most production cases. Currently the errors Nix throws on a build timeout are not separated from other types of errors, meaning that users will see a generic 500 server error in case of a timeout. This fixes #47
2019-09-02 refactor(build-image): Remove implicit import of entire package setVincent Ambo1-8/+5
Explicitly refer to where things come from, and also don't import dockerTools as it is no longer used for anything.
2019-09-02 refactor(build-image): Simplify customisation layer builderVincent Ambo1-15/+16
Moves the relevant parts of the customisation layer construction from dockerTools.mkCustomisationLayer into the Nixery code base. The version in dockerTools builds additional files (including via hashing of potentially large files) which are not required when serving an image over the registry protocol.
2019-08-21 chore(build): Add iana-etc to Nixery's own imageVincent Ambo1-0/+1
This package is used by a variety of programs that users may want to embed into Nixery in addition, for example cachix, but those packages don't refer to it explicitly.
2019-08-21 chore(docs): Update embedded nix-1p versionVincent Ambo1-2/+2
The new version of the document has syntactic fixes that render pipes in code blocks in tables correctly across dialects. Fixes #44
2019-08-19 fix(build): Force nix-env to use NIX_PATHVincent Ambo1-6/+5
Thanks to clever!
2019-08-19 chore(build): Pin nixpkgs to a specific commitVincent Ambo1-0/+2
This is the same commit for which Nixery has popularity data, but that isn't particularly relevant.
2019-08-19 feat(build): Add 'extraPackages' parameterVincent Ambo1-2/+4
This makes it possible to inject additional programs (e.g. Cachix) into a Nixery container.