Closed PAStheLoD closed 6 years ago
This may be possible using an external settings.json.... this needs to be documented but is already supported. I have an open issue for this, and will update this when I've tested it. #407
That'd require mounting and maintaining an external settings file.
I currently use this "one liner" to put the DB file into a directory. ("db" already exists, it's just empty for some reason.)
docker run --detach \
--restart=always \
--net host \
--volume elastichq:/src/db \
--name elastichq \
elastichq/elasticsearch-hq \
sh -x -c 'sed -i -r -e "s/_sqlalchemy_database_uri =.*/_sqlalchemy_database_uri = \"sqlite:\/\/\/\" + os.path.join(BASEPATH, \"db\" , \"elastichq.db\")/" /src/elastichq/config/settings.py && exec supervisord -c /etc/supervisor/supervisord.conf'
That's a heck of a one-liner. I will add this to the docs as well.
docker run -d -p 5000:5000 --mount type=bind,source="$(pwd)"/elastichq.db,target=/src/elastichq.db elastichq/elasticsearch-hq:release-v3.5.12
General information
Issue Description
Currently recreating a docker container containing an elastichq.db results in the loss of that file, and without an ugly workaround it's hard to relocate that file.
Source Code / Logs
The location of elastichq.db is hardcoded into ProdSettings: https://github.com/ElasticHQ/elasticsearch-HQ/blob/master/elastichq/config/settings.py#L117
Probable drawbacks
Of course, maybe this might require SQL Alchemy migrations.