15 Commits

Author SHA1 Message Date
7tobias
cacb21529b
fix(docker): make EOSDash accessible in Docker containers (#656)
Some checks failed
docker-build / platform-excludes (push) Has been cancelled
docker-build / build (push) Has been cancelled
docker-build / merge (push) Has been cancelled
pre-commit / pre-commit (push) Has been cancelled
Run Pytest on Pull Request / test (push) Has been cancelled
Close stale pull requests/issues / Find Stale issues and PRs (push) Has been cancelled
Fixes the issue where EOSDash is not accessible when running EOS in a
Docker container. The problem was that EOSDash was binding to 127.0.0.1
(localhost) by default, making it inaccessible from outside the container.

The fix adds a minimal default configuration file during the Docker image
build that sets both the EOS server and EOSDash to bind to 0.0.0.0,
allowing external access while maintaining security through Docker's
network isolation.

- Add default EOS.config.json in Dockerfile with server bindings set to 0.0.0.0
- No changes required to docker-compose.yaml
- Ensures EOSDash works out of the box for Docker users

Fixes: #629
Closes: https://github.com/Akkudoktor-EOS/EOS/issues/629

Co-authored-by: Tobias Welz <tobias.welz@wiznet.eu>
2025-08-21 15:30:27 +02:00
Christian Hohlfeld
e2a0b8b564 fix(docker): enable BuildKit to support --mount (closes #493) 2025-04-22 01:20:46 +02:00
Dominique Lasserre
5eb6d84572 Dockerfile: Set default for EOS_SERVER__EOSDASH_SESSKEY Closes #447 (#467)
* This allows to start the container without any extra settings
   (potentially unsafe).
   It is recommended to set EOS_SERVER__EOSDASH_SESSKEY.
2025-04-06 14:46:52 +02:00
Dominique Lasserre
437d38f508 Fix EOSdash startup (docker)
* Docker: Copy the same directory structure (src/) to support the
   lifespan startup of EOSdash.
   Use EOS_SERVER_EOSDASH_SESSKEY environment variable to provide
   EOSdash with session key.
2025-01-24 20:08:48 +01:00
Dominique Lasserre
f09658578a Fix docker access. Closes #278
Some checks failed
docker-build / platform-excludes (push) Has been cancelled
pre-commit / pre-commit (push) Has been cancelled
Run Pytest on Pull Request / test (push) Has been cancelled
docker-build / build (push) Has been cancelled
docker-build / merge (push) Has been cancelled
* Need to start within container with host 0.0.0.0 to access it later
   on host.
2025-01-24 07:45:40 +01:00
Dominique Lasserre
b6111517ca
workflow: docker-build upload to DockerHub (#318) (#363)
Some checks are pending
docker-build / platform-excludes (push) Waiting to run
docker-build / build (push) Blocked by required conditions
docker-build / merge (push) Blocked by required conditions
* workflow: docker-build upload to DockerHub
   - Upload on release, tag, push to main.
   - Build on pr to main (amd64 only).
 * docker:
   - Update documentation.
   - Temporarily set akkudoktor/eos:main in compose.yml (with
     releases/tags it should be replaced by latest again)
2025-01-12 00:52:42 +01:00
Dominique Lasserre
75987db9e1 Reasonable defaults, isolate tests, EOS_LOGGING_LEVEL, EOS_CONFIG_DIR
* Add EOS_CONFIG_DIR to set config dir (relative path to EOS_DIR or
   absolute path).
    - config_folder_path read-only
    - config_file_path read-only
 * Default values to support app start with empty config:
    - latitude/longitude (Berlin)
    - optimization_ev_available_charge_rates_percent (null, so model
      default value is used)
    - Enable Akkudoktor electricity price forecast (docker-compose).
 * Fix some endpoints (empty data, remove unused params, fix types).
 * cacheutil: Use cache dir. Closes #240
 * Support EOS_LOGGING_LEVEL environment variable to set log level.
 * tests: All tests use separate temporary config
    - Add pytest switch --check-config-side-effect to check user
      config file existence after each test. Will also fail if user config
      existed before test execution (but will only check after the test has
      run).
      Enable flag in github workflow.
    - Globally mock platformdirs in config module. Now no longer required
      to patch individually.
      Function calls to config instance (e.g. merge_settings_from_dict)
      were unaffected previously.
 * Set Berlin as default location (default config/docker-compose).
2024-12-30 13:41:39 +01:00
Dominique Lasserre
f61665669f Migrate from Flask to FastAPI (#163)
* Migrate from Flask to FastAPI

 * FastAPI migration:
    - Use pydantic model classes as input parameters to the
      data/calculation classes.
    - Interface field names changed to constructor parameter names (for
      simplicity only during transition, should be updated in a followup
      PR).
    - Add basic interface requirements (e.g. some values > 0, etc.).
 * Update tests for new data format.
 * Python requirement down to 3.9 (TypeGuard no longer needed)
 * Makefile: Add helpful targets (e.g. development server with reload)

* Move API doc from README to pydantic model classes (swagger)

 * Link to swagger.io with own openapi.yml.
 * Commit openapi.json and check with pytest for changes so the
   documentation is always up-to-date.

* Streamline docker

* FastAPI: Run startup action on dev server

 * Fix config for /strompreis, endpoint still broken however.

* test_openapi: Compare against docs/.../openapi.json

* Move fastapi to server/ submodule

 * See #187 for new repository structure.
2024-11-15 22:27:25 +01:00
Dominique Lasserre
a71eab3bd0 Streamline Dockerfile, remove unused deps
* Dockerfile: Use non-root user, buildx cache, setup for readonly
   container, remove unused apt deps.
   For now don't install pip package and keep development flask server
   as this will be replaced in the future (fastapi). Then a proper
   webserver (e.g. nginx) should be used and the pip package can be
   created and deployed just to the run-stage (with the webserver).
 * docker-compose: Set to readonly (anonymous volumes declared in
   Dockerfile should maintain all writable data).
   Mount config.py for easier development. Should be replaced by
   environment support for all config file variables.
 * Remove unused runtime dependencies: mariadb, joblib, pytest,
   pytest-cov.
 * Move pytest-cov to dev dependencies.
 * Add output_dir to config.py.
 * Fix visualization_results.pdf endpoint.
 * Update docs.
2024-10-11 08:39:14 +02:00
Bobby Noelte
7c13cb6e1c Adapt Dockerfile to package directory structure.
Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
2024-10-07 08:12:33 +02:00
Sebastian Struß
3fb564d2db Add docker multi-arch build with github package push and cleaned up Dockerfile for smaller builds 2024-10-05 08:53:14 +02:00
Michael Osthege
c3f10df277 Manual edits to remove remaining code style errors 2024-10-03 17:28:49 +02:00
Dominik Siebel
3cfd5beb1f expose flask port 2024-09-17 09:06:56 +02:00
Dominik Siebel
216a0467d4 ci: don't upgrade pip 2024-09-17 09:06:56 +02:00
Dominik Siebel
db80e260c6 ci: dockerize setup 2024-09-17 09:06:56 +02:00