@@ -9,19 +9,36 @@ POSTGRES_IMAGE="docker.io/library/postgres:10.12"
9
9
REDIS_IMAGE=" docker.io/library/redis:5.0.7"
10
10
QUAY_IMAGE=" quay.io/microshift/quay:v3.11.7-$( uname -m) "
11
11
QUAY_CONFIG_DIR=" ${MIRROR_REGISTRY_DIR} /config"
12
+ QUAY_STORAGE_DIR=" ${MIRROR_REGISTRY_DIR} /storage"
12
13
13
14
PULL_SECRET=${PULL_SECRET:- ${HOME} / .pull-secret.json}
14
15
QUAY_PULL_SECRET=" ${QUAY_CONFIG_DIR} /pull_secret.json"
15
16
17
+ reset_storage_permissions () {
18
+ # Ensure that permissions are open for the current user on the mirror registry
19
+ # directories and files
20
+ if [ -d " ${MIRROR_REGISTRY_DIR} " ] ; then
21
+ sudo chgrp -R " $( id -gn) " " ${MIRROR_REGISTRY_DIR} "
22
+ sudo find " ${MIRROR_REGISTRY_DIR} " -type d -exec chmod a+rx ' {}' +
23
+ sudo find " ${MIRROR_REGISTRY_DIR} " -type f -exec chmod a+r ' {}' +
24
+ fi
25
+ # Quay storage directory expects 1001 owner ID
26
+ if [ -d " ${QUAY_STORAGE_DIR} " ] ; then
27
+ sudo chown -R 1001 " ${QUAY_STORAGE_DIR} "
28
+ fi
29
+ }
30
+
16
31
setup_prereqs () {
17
32
# Install packages if not yet available locally
18
33
if ! rpm -q podman skopeo jq & > /dev/null ; then
19
34
" ${SCRIPTDIR} /../../scripts/dnf_retry.sh" " install" " podman skopeo jq"
20
35
fi
21
36
22
- # Create registry repository base directory structure
37
+ # Create registry repository base directory structure and reset permissions
38
+ # if downloaded from cache
23
39
mkdir -p " ${MIRROR_REGISTRY_DIR} "
24
40
mkdir -p " ${QUAY_CONFIG_DIR} "
41
+ reset_storage_permissions
25
42
26
43
# Create a new pull secret file containing authentication information for both
27
44
# remote (from PULL_SECRET environment) and local registries
227
244
fi
228
245
229
246
# See https://docs.projectquay.io/deploy_quay.html#preparing-local-storage
230
- if [ ! -d " ${MIRROR_REGISTRY_DIR} /storage " ] ; then
231
- mkdir -p " ${MIRROR_REGISTRY_DIR} /storage "
232
- setfacl -m u:1001:-wx " ${MIRROR_REGISTRY_DIR} /storage "
247
+ if [ ! -d " ${QUAY_STORAGE_DIR} " ] ; then
248
+ mkdir -p " ${QUAY_STORAGE_DIR} "
249
+ setfacl -m u:1001:-wx " ${QUAY_STORAGE_DIR} "
233
250
fi
234
251
235
252
# Run Quay container
240
257
-p " ${MIRROR_REGISTRY_PORT} :8080" \
241
258
-p " [::]:${MIRROR_REGISTRY_PORT} :8080" \
242
259
-v " ${QUAY_CONFIG_DIR} :/conf/stack:Z" \
243
- -v " ${MIRROR_REGISTRY_DIR} /storage :/datastorage:Z" \
260
+ -v " ${QUAY_STORAGE_DIR} :/datastorage:Z" \
244
261
" ${QUAY_IMAGE} " > /dev/null
245
262
246
263
# Wait until the Quay instance is started
268
285
}
269
286
270
287
finalize_registry () {
271
- # Ensure that permissions are open for the current user on the mirror registry
272
- # directories and files. This is necessary to avoid 'find' command errors.
273
- sudo chgrp -R " $( id -gn) " " ${MIRROR_REGISTRY_DIR} "
274
- sudo find " ${MIRROR_REGISTRY_DIR} " -type d -exec chmod a+rx ' {}' +
275
- sudo find " ${MIRROR_REGISTRY_DIR} " -type f -exec chmod a+r ' {}' +
288
+ reset_storage_permissions
276
289
# Delete the combined pull secret file
277
290
rm -f " ${QUAY_PULL_SECRET} "
278
291
}
0 commit comments