-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into docker-update
- Loading branch information
Showing
22 changed files
with
274 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
--- | ||
name: build-docker-image | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
name: Build Docker Image | ||
runs-on: ubuntu-latest | ||
services: | ||
postgres: | ||
env: | ||
POSTGRES_DB: flexmeasures_test | ||
POSTGRES_PASSWORD: flexmeasures_test | ||
POSTGRES_USER: flexmeasures_test | ||
image: postgres:latest | ||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s | ||
--health-retries 5 | ||
ports: | ||
- 5432:5432 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Build Docker Image | ||
run: docker build -t flexmeasures:latest -f Dockerfile . | ||
- name: Generate random secret key | ||
run: echo "SECRET_KEY=$(python3 -c 'import secrets; print(secrets.token_hex(24))')" | ||
>> .env | ||
- name: Export SQLALCHEMY_DATABASE_URI | ||
run: echo "SQLALCHEMY_DATABASE_URI=postgresql://flexmeasures_test:flexmeasures_test@127.0.0.1:5432/flexmeasures_test" | ||
>> .env | ||
- name: Keep running flexmeasures container in background | ||
run: docker run -t -d --env-file .env --network=host --name fm-container flexmeasures:latest | ||
- name: Execute database upgrade | ||
run: docker exec --env-file .env fm-container flexmeasures | ||
db upgrade | ||
- name: Add toy user | ||
run: docker exec --env-file .env fm-container flexmeasures | ||
add toy-account | ||
- name: Generate prices dummy data | ||
run: .github/workflows/generate-dummy-price.sh | ||
- name: Copy prices dummy data | ||
run: docker cp prices-tomorrow.csv fm-container:/app/prices-tomorrow.csv | ||
- name: Add beliefs | ||
run: docker exec --env-file .env fm-container flexmeasures | ||
add beliefs --sensor-id 1 --source toy-user prices-tomorrow.csv --timezone Europe/Amsterdam | ||
- name: Export TOMORROW | ||
run: echo "TOMORROW=$(date --date="next day" '+%Y-%m-%d')" | ||
>> $GITHUB_ENV | ||
- name: Add schedule | ||
run: docker exec --env-file .env fm-container flexmeasures | ||
add schedule for-storage --sensor-id 2 --consumption-price-sensor 1 | ||
--start ${TOMORROW}T07:00+01:00 --duration PT12H | ||
--soc-at-start 50% --roundtrip-efficiency 90% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
set -x | ||
|
||
TOMORROW=$(date --date="next day" '+%Y-%m-%d') | ||
|
||
echo "Hour,Price | ||
${TOMORROW}T00:00:00,10 | ||
${TOMORROW}T01:00:00,11 | ||
${TOMORROW}T02:00:00,12 | ||
${TOMORROW}T03:00:00,15 | ||
${TOMORROW}T04:00:00,18 | ||
${TOMORROW}T05:00:00,17 | ||
${TOMORROW}T06:00:00,10.5 | ||
${TOMORROW}T07:00:00,9 | ||
${TOMORROW}T08:00:00,9.5 | ||
${TOMORROW}T09:00:00,9 | ||
${TOMORROW}T10:00:00,8.5 | ||
${TOMORROW}T11:00:00,10 | ||
${TOMORROW}T12:00:00,8 | ||
${TOMORROW}T13:00:00,5 | ||
${TOMORROW}T14:00:00,4 | ||
${TOMORROW}T15:00:00,4 | ||
${TOMORROW}T16:00:00,5.5 | ||
${TOMORROW}T17:00:00,8 | ||
${TOMORROW}T18:00:00,12 | ||
${TOMORROW}T19:00:00,13 | ||
${TOMORROW}T20:00:00,14 | ||
${TOMORROW}T21:00:00,12.5 | ||
${TOMORROW}T22:00:00,10 | ||
${TOMORROW}T23:00:00,7" > prices-tomorrow.csv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.