Skip to content

Commit

Permalink
fix(registry): use empty strings and not nil in config
Browse files Browse the repository at this point in the history
In deis#1858, the LRU cache was activated for registry. This exposed
an issue with how config settings are handled by docker-registry -
specifically, it doesn't appear to handle the YAML nil (`~`) value
properly. In the config parser logic in docker-registry
(see: https://github.com/deis/docker-registry/blob/2d50c1c6f396ac68858135be05dbfe41fe1898e2/docker_registry/lib/config.py#L61),
values are expected to be strings, dicts, or non-existent. The default value
when an option exists but is unset is an empty string.
This commit changes the cache config settings in
registry to use an empty string instead of ~.

Additionally, this commit also ensures that deisctl starts cache
before registry to ensure the registry is using the LRU cache.

closes deis#2833
  • Loading branch information
carmstrong committed Jan 5, 2015
1 parent 579748b commit 70e92f2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
9 changes: 7 additions & 2 deletions deisctl/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,11 @@ func startDefaultServices(b backend.Backend, wg *sync.WaitGroup, outchan chan st
wg.Wait()

// optimization: start all remaining services in the background
// cache is a special case because it must start before registry
b.Start([]string{"cache"}, &_wg, _outchan, _errchan)
wg.Wait()
b.Start([]string{
"cache", "database", "registry@1", "controller", "builder",
"database", "registry@1", "controller", "builder",
"publisher", "router@1", "router@2", "router@3"},
&_wg, _outchan, _errchan)

Expand Down Expand Up @@ -269,7 +272,9 @@ func stopDefaultServices(b backend.Backend, wg *sync.WaitGroup, outchan chan str
wg.Wait()

outchan <- fmt.Sprintf("Control plane...")
b.Stop([]string{"controller", "builder", "cache", "database", "registry@1"}, wg, outchan, errchan)
b.Stop([]string{"controller", "builder", "database", "registry@1"}, wg, outchan, errchan)
wg.Wait()
b.Stop([]string{"cache"}, wg, outchan, errchan)
wg.Wait()

outchan <- fmt.Sprintf("Logging subsystem...")
Expand Down
8 changes: 4 additions & 4 deletions registry/templates/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ common: &common
tags_cache_ttl: _env:MIRROR_TAGS_CACHE_TTL:172800 # seconds

cache:
host: {{ or (.deis_cache_host) "~" }}
port: {{ or (.deis_cache_port) "~" }}
host: {{ or (.deis_cache_host) "" }}
port: {{ or (.deis_cache_port) "" }}
password: _env:CACHE_REDIS_PASSWORD
db: 1

# Enabling LRU cache for small files
# This speeds up read/write on small files
# when using a remote storage backend (like S3).
cache_lru:
host: {{ or (.deis_cache_host) "~" }}
port: {{ or (.deis_cache_port) "~" }}
host: {{ or (.deis_cache_host) "" }}
port: {{ or (.deis_cache_port) "" }}
password: _env:CACHE_LRU_REDIS_PASSWORD
db: 2

Expand Down

0 comments on commit 70e92f2

Please sign in to comment.