Open D43m0n opened 14 hours ago
I managed to get a successful response. I'll leave my steps here for posterity.
After impersonating the app
user, change to the /app
directory. Then it may depend on what you've changed, but in /app/.env.template
I found my ENV variables. I exported them. The values here are examples, yours may differ. For my DJANGO_DATABASE_HOST
I tried the docker-compose value of localhost
but that didn't work. I named my database container for DSMR dsmrdb
, so tried that instead. When you've set a DJANGO_SECRET_KEY
yours may differ too.
export DJANGO_DATABASE_ENGINE=django.db.backends.postgresql
export DJANGO_DATABASE_HOST=dsmrdb
export DJANGO_DATABASE_PORT=5432
export DJANGO_DATABASE_NAME=dsmrreader
export DJANGO_DATABASE_USER=dsmrreader
export DJANGO_DATABASE_PASSWORD=dsmrreader
export DJANGO_SECRET_KEY="my-secret-key"
Then I ran ./manage.py dsmr_stats_recalculate_prices
from the /app
directory and got expected output:
- Recalculating prices for: 2020-05-18
- Recalculating prices for: 2020-05-19
- Recalculating prices for: 2020-05-20
- Recalculating prices for: 2020-05-21
- Recalculating prices for: 2020-05-22
- Recalculating prices for: 2020-05-23
- Recalculating prices for: 2020-05-24
- Recalculating prices for: 2020-05-25
- Recalculating prices for: 2020-05-26
- Recalculating prices for: 2020-05-27
- Recalculating prices for: 2020-05-28
- Recalculating prices for: 2020-05-29
- Recalculating prices for: 2020-05-30
- Recalculating prices for: 2020-05-31
- Recalculating prices for: 2020-06-01
- Recalculating prices for: 2020-06-02
- Recalculating prices for: 2020-06-03
- Recalculating prices for: 2020-06-04
- Recalculating prices for: 2020-06-05
- Recalculating prices for: 2020-06-06
- Recalculating prices for: 2020-06-07
- Recalculating prices for: 2020-06-08
- Recalculating prices for: 2020-06-09
- Recalculating prices for: 2020-06-10
- Recalculating prices for: 2020-06-11
- Recalculating prices for: 2020-06-12
- Recalculating prices for: 2020-06-13
- Recalculating prices for: 2020-06-14
---SNIP---
- Recalculating prices for: 2024-11-02
- Recalculating prices for: 2024-11-03
- Recalculating prices for: 2024-11-04
- Recalculating prices for: 2024-11-05
- Recalculating prices for: 2024-11-06
- Recalculating prices for: 2024-11-07
- Recalculating prices for: 2024-11-08
- Recalculating prices for: 2024-11-09
- Recalculating prices for: 2024-11-10
- Recalculating prices for: 2024-11-11
- Recalculating prices for: 2024-11-12
- Recalculating prices for: 2024-11-13
- Recalculating prices for: 2024-11-14
- Recalculating prices for: 2024-11-15
So, I've answered my own question/issue. Perhaps this might be turned into a supplemental part for the documentation of the docker version of DSMR?
Support guidelines
I've found an issue and checked that ...
Description
I've updated my contract prices/tariffs and want to perform a recalculate of the energy prices like described here. That explanation in that link is written for DSMR installed on a host OS, not in a docker container.
Expected behaviour
I enter the DSMR docker container using
docker exec -ti dsmr /bin/sh
. I then discover I need to allow theapp
user to login with a shell, instead of/bin/false
. Then I can perform an impersonation of theapp
user by runningsu - app
. I then expected to be able to run./manage.py dsmr_stats_recalculate_prices
from the/app
directory and get some feedback as intended for this function.Actual behaviour
After I allow the
app
user to login with a shell, login as theapp
user and change to the/app
directory I run the command./manage.py dsmr_stats_recalculate_prices
. I then get an error message:Steps to reproduce
docker exec -ti dsmr /bin/sh
app
user to login, usevipw
to change the shell from/bin/false
to/bin/sh
app
user:su - app
and change to the /app directory:cd /app
./manage.py dsmr_stats_recalculate_prices
Docker info
Version
docker-compose --version
):docker-compose version 1.29.2
uname -a
):Linux hostname 6.1.0-27-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.115-1 (2024-11-01) x86_64 GNU/Linux
Docker compose
Container logs
Additional info
No response