Skip to content

Commit

Permalink
docs: Update Docker Setup Instructions and Refactor Toy Example Secti…
Browse files Browse the repository at this point in the history
…on (#896)

* Remove duplicated installation section

* Separate code block in toy example setup

* Clarify container setup and restart process in Docker tutorial

---------

Co-authored-by: Nicolas Höning <nicolas@seita.nl>
  • Loading branch information
briskdust and nhoening committed Nov 8, 2023
1 parent 39e0022 commit ffc3f36
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 0 additions & 1 deletion documentation/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ The platform operator of FlexMeasures can be an Aggregator.
tut/toy-example-expanded
tut/toy-example-process
tut/toy-example-reporter
tut/installation
tut/posting_data
tut/forecasting_scheduling
tut/building_uis
Expand Down
11 changes: 11 additions & 0 deletions documentation/tut/toy-example-setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,18 @@ Install Flexmeasures and the database
$ docker pull lfenergy/flexmeasures:latest
$ docker pull postgres
$ docker network create flexmeasures_network
After running these commands, we can start the Postgres database and the FlexMeasures app with the following commands:

.. code-block:: bash
$ docker run --rm --name flexmeasures-tutorial-db -e POSTGRES_PASSWORD=fm-db-passwd -e POSTGRES_DB=flexmeasures-db -d --network=flexmeasures_network postgres:latest
$ docker run --rm --name flexmeasures-tutorial-fm --env SQLALCHEMY_DATABASE_URI=postgresql://postgres:fm-db-passwd@flexmeasures-tutorial-db:5432/flexmeasures-db --env SECRET_KEY=notsecret --env FLASK_ENV=development --env LOGGING_LEVEL=INFO -d --network=flexmeasures_network -p 5000:5000 lfenergy/flexmeasures
To upgrade the FlexMeasures database, execute:

.. code-block:: bash
$ docker exec flexmeasures-tutorial-fm bash -c "flexmeasures db upgrade"
.. note:: A tip on Linux/macOS ― You might have the ``docker`` command, but need `sudo` rights to execute it. ``alias docker='sudo docker'`` enables you to still run this tutorial.
Expand Down Expand Up @@ -168,6 +178,7 @@ If you want, you can inspect what you created:
2 toy-battery battery (52.374, 4.88969)
3 toy-solar solar (52.374, 4.88969)
.. code-block:: bash
$ flexmeasures show asset --id 2
Expand Down

0 comments on commit ffc3f36

Please sign in to comment.