Added clean exit hooks to npm registry script

This patch adds the openstack-registry-hooks project, which will
check the current update sequence of the mirror after every package
has been downloaded, and exit the process cleanly if the update
sequence matches the latest sequence from the registry.

This will effectively de-daemonize the registry-static script,
assuming that it can update in a reasonable amount of time.

Note: When this lands, the index of the registry should be cleaned,
and the entire index should be rebuilt. This should not impact the
tarballs, only the json files, as shasums are checked before
downloading.


Change-Id: Ia94187f1f1d60ad2cbb3e71f76502bec75e228ae
This commit is contained in:
Michael Krotscheck 2016-04-20 15:54:41 -07:00
parent b53c69cfb2
commit 96230945a7
2 changed files with 10 additions and 1 deletions

View File

@ -49,4 +49,13 @@ class openstack_project::npm_mirror (
Class['nodejs'],
]
}
# Common registry hooks
package { 'openstack-registry-hooks':
ensure => '1.1.0',
provider => 'npm',
require => [
Class['nodejs'],
]
}
}

View File

@ -17,7 +17,7 @@
set -e
CMD="/usr/bin/registry-static"
CMD_ARGS="-d <%= @uri_rewrite %> -o <%= @data_directory %> --blobstore afs-blob-store"
CMD_ARGS="-d <%= @uri_rewrite %> -o <%= @data_directory %> --blobstore afs-blob-store --hooks openstack-registry-hooks"
echo "Obtaining npm tokens and running registry-static."
k5start -t -f /etc/npm.keytab service/npm -- timeout -k 2m 30m $CMD $CMD_ARGS