Skip to content

Commit

Permalink
Add custom requirements to docker compose (#528)
Browse files Browse the repository at this point in the history
Allow extra requirements to be freshly installed when running ``docker-compose up``.


* Pin postgres in docker-compose.yml to 14

Signed-off-by: F.N. Claessen <felix@seita.nl>

* Refactor docker-compose.yml command for server setup

Signed-off-by: F.N. Claessen <felix@seita.nl>

* pip install from additional custom requirements file

Signed-off-by: F.N. Claessen <felix@seita.nl>

* Revert "Pin postgres in docker-compose.yml to 14"

This reverts commit 220aa15.

* Add documentation

Signed-off-by: F.N. Claessen <felix@seita.nl>

* changelog entry

Signed-off-by: F.N. Claessen <felix@seita.nl>

Signed-off-by: F.N. Claessen <felix@seita.nl>
  • Loading branch information
Flix6x committed Nov 11, 2022
1 parent b1bd21d commit 78b7e5e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
11 changes: 7 additions & 4 deletions docker-compose.yml
Expand Up @@ -53,10 +53,13 @@ services:
# a place for config and plugin code - the mount point is for running the FlexMeasures CLI, the 2nd for gunicorn
- ./flexmeasures-instance/:/usr/var/flexmeasures-instance/:ro
- ./flexmeasures-instance/:/app/instance/:ro
command: >
bash -c "flexmeasures db upgrade
&& flexmeasures add toy-account --name 'Docker Toy Account'
&& gunicorn --bind 0.0.0.0:5000 --worker-tmp-dir /dev/shm --workers 2 --threads 4 wsgi:application"
entrypoint: ["/bin/sh", "-c"]
command:
- |
pip install -r instance/requirements.txt
flexmeasures db upgrade
flexmeasures add toy-account --name 'Docker Toy Account'
gunicorn --bind 0.0.0.0:5000 --worker-tmp-dir /dev/shm --workers 2 --threads 4 wsgi:application
worker:
build:
context: .
Expand Down
1 change: 1 addition & 0 deletions documentation/changelog.rst
Expand Up @@ -24,6 +24,7 @@ Infrastructure / Support
----------------------

* Reduce size of Docker image (from 2GB to 1.4GB) [see `PR #512 <http://www.github.com/FlexMeasures/flexmeasures/pull/512>`_]
* Allow extra requirements to be freshly installed when running ``docker-compose up`` [see `PR #528 <http://www.github.com/FlexMeasures/flexmeasures/pull/528>`_]
* Remove bokeh dependency and obsolete UI views [see `PR #476 <http://www.github.com/FlexMeasures/flexmeasures/pull/476>`_]
* Fix ``flexmeasures db-ops dump`` and ``flexmeasures db-ops restore`` not working in docker containers [see `PR #530 <http://www.github.com/FlexMeasures/flexmeasures/pull/530>`_] and incorrectly reporting a success when `pg_dump` and `pg_restore` are not installed [see `PR #526 <http://www.github.com/FlexMeasures/flexmeasures/pull/526>`_]
* Plugins can save BeliefsSeries, too, instead of just BeliefsDataFrames [see `PR #523 <http://www.github.com/FlexMeasures/flexmeasures/pull/523>`_]
Expand Down
2 changes: 2 additions & 0 deletions documentation/dev/docker-compose.rst
Expand Up @@ -65,6 +65,8 @@ Configuration

You can pass in your own configuration (e.g. for MapBox access token, or db URI, see below) like we described in :ref:`docker_configuration` ― put a file ``flexmeasures.cfg`` into a local folder called ``flexmeasures-instance`` (the volume should be already mapped).

In case your configuration loads FlexMeasures plugins that have additional dependencies, you can add a requirements.txt file to the same local folder. The dependencies listed in that file will be freshly installed each time you run ``docker-compose up``.


Data
-------
Expand Down

0 comments on commit 78b7e5e

Please sign in to comment.