Skip to content
This repository was archived by the owner on Sep 12, 2018. It is now read-only.

Commit 32f19cb

Browse files
committed
Merge pull request #655 from wking/document-preload
README.md: Document --preload for the SQLAlchemy search index
2 parents 0dd4fc8 + 972ecc4 commit 32f19cb

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,9 @@ common:
183183
search_backend: foo.registry.index.xapian
184184
```
185185

186+
In this case, the module is imported, and an instance of its `Index`
187+
class is used as the search backend.
188+
186189
#### sqlalchemy
187190

188191
Use [SQLAlchemy][] as the search backend.
@@ -198,8 +201,14 @@ common:
198201
sqlalchemy_index_database: sqlite:////tmp/docker-registry.db
199202
```
200203

201-
In this case, the module is imported, and an instance of its `Index`
202-
class is used as the search backend.
204+
On initialization, the `SQLAlchemyIndex` class checks the database
205+
version. If the database doesn't exist yet (or does exist, but lacks
206+
a `version` table), the `SQLAlchemyIndex` creates the database and
207+
required tables. To avoid several Gunicorn workers racing to create
208+
the database, you should launch your registry with
209+
[--preload][gunicorn-preload]. For example:
210+
211+
$ docker run -e GUNICORN_OPTS='[--preload]' -p 5000:5000 registry
203212

204213
### Mirroring Options
205214

@@ -338,3 +347,4 @@ Read [contributing](CONTRIBUTING.md)
338347
[search-endpoint]: http://docs.docker.com/reference/api/docker-io_api/#search
339348
[SQLAlchemy]: http://docs.sqlalchemy.org/
340349
[create_engine]: http://docs.sqlalchemy.org/en/latest/core/engines.html#sqlalchemy.create_engine
350+
[gunicorn-preload]: http://gunicorn-docs.readthedocs.org/en/latest/settings.html#preload-app

0 commit comments

Comments
 (0)