Skip to content

Commit 70e92f2

Browse files
committed
fix(registry): use empty strings and not nil in config
In #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 #2833
1 parent 579748b commit 70e92f2

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

deisctl/cmd/cmd.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,11 @@ func startDefaultServices(b backend.Backend, wg *sync.WaitGroup, outchan chan st
184184
wg.Wait()
185185

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

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

271274
outchan <- fmt.Sprintf("Control plane...")
272-
b.Stop([]string{"controller", "builder", "cache", "database", "registry@1"}, wg, outchan, errchan)
275+
b.Stop([]string{"controller", "builder", "database", "registry@1"}, wg, outchan, errchan)
276+
wg.Wait()
277+
b.Stop([]string{"cache"}, wg, outchan, errchan)
273278
wg.Wait()
274279

275280
outchan <- fmt.Sprintf("Logging subsystem...")

registry/templates/config.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@ common: &common
2626
tags_cache_ttl: _env:MIRROR_TAGS_CACHE_TTL:172800 # seconds
2727

2828
cache:
29-
host: {{ or (.deis_cache_host) "~" }}
30-
port: {{ or (.deis_cache_port) "~" }}
29+
host: {{ or (.deis_cache_host) "" }}
30+
port: {{ or (.deis_cache_port) "" }}
3131
password: _env:CACHE_REDIS_PASSWORD
3232
db: 1
3333

3434
# Enabling LRU cache for small files
3535
# This speeds up read/write on small files
3636
# when using a remote storage backend (like S3).
3737
cache_lru:
38-
host: {{ or (.deis_cache_host) "~" }}
39-
port: {{ or (.deis_cache_port) "~" }}
38+
host: {{ or (.deis_cache_host) "" }}
39+
port: {{ or (.deis_cache_port) "" }}
4040
password: _env:CACHE_LRU_REDIS_PASSWORD
4141
db: 2
4242

0 commit comments

Comments
 (0)