As of...
20-Dec-23: Attention: please see
below notes in Setup
steps for the Fritzbox. And RaspberryPi Image updated on
up-to-date OS, Traefik 2.10.7 and evcc 0.122.1
07-Aug-23: Server setup based on RaspberryPi Image
containing all software and configuration - please see below.
Please
find below my setup, which is driving the SolVecConMon Apple Watch
app on the server site. I did my best to figure out the minimum
necessary configuration steps.
This was very time consuming - and will save much your
investigations and setup time : - )
Please feel free to let me know what could be improved.
Solar
Charging evcc - https://evcc.io,
which needs to be installed on a server in your local network is a
perfect system to control the battery loading for cars and
bicycles.
It also shows all relevant power production and consuming values
of your solar grid and devices - this with a nice UI on Internet
browsers and mobiles.
With no other extra services installed - you have access only in
the local network or via a VPN connection from outside.
To setup a small and cheap server that provides a direct and save access on https://evcc.io from anywhere in the world, which is used by SolVecConMon to provide below items on your Apple Watch with a finger tip.
REAL TIME TRACKING
Make a
https port forwarding -
port 443 - and http port forwarding - port 80 - to
the Raspberry PI 4 ( the setup image is using hostname
raspberrypi2 )
Disable IPv6 - Let's encrypt doesn't like it. At least
with Fritzbox OS in my setup.
In the recent FritzOS update - status 20-December-23 - a bug
with DNSSEC validation was introduced. There is a patch
available, which needs to be installed.
(as of
20-December-23 up-to-date Raspian version)
Download the files xaa
and xab
into an empty directory. Then open a Terminal and concatenate xaa
and xab into RaspiPi4-8-64-delivery-image.zip with the command
"cat x* > RaspiPi4-8-64-delivery-image.zip"
Now unzip RaspiPI4-8-64-delivery-image.img.zip with a double click
and restore it on a 64 GB SD Card by using e.g. ApplePiBaker.
Insert SD Card into raspi and power up. It boots without the need of entering raspiuser/raspipw.
You would not need to connect a keyboard and a mouse since VNC and ssh is enabled.
(as of
20-December-23 evcc version 0.122.1)
With raspiuser there is no change necessary in
/home/raspiuser/Docker-Compose/evcc/docker-compose.yml.
(as of
20-December-23 Traefik version 2.10.7)
Adapt
/home/raspiuser/Docker-Compose/reverse-proxy/docker-compose.yml
and modify ../rules/rules.yml on your environment - please see
below.
Continue with System start below.
Prepare SD Card via RaspberryPI Imager Raspberry PI OS: https://www.raspberrypi.com/software/
Boot and run the setup programm: https://www.raspberrypi.com/documentation/computers/getting-started.html
In the setup you need to enter a user and password. In my case I have used raspiuser with raspipw
!! If you go for another user you need to change below configuration files where raspiuser is !!
Follow the instructions in https://bangertech.de/docker-docker-compose-auf-dem-raspberrypi/
For the RaspberryPI image based setup below folders and files already exist.
Otherwise create in /home/raspiuser a directory Docker-Compose and in there the directories evcc and reverse-proxy. In reverse-proxy create the directory rules.
home --- raspiuser --- Docker-Compose
I --- evcc
I --- reverse-proxy
I --- rules
In evcc create a file called docker-compose.yml with below content
version: "3"
services:
evcc:
command:
- evcc
network_mode: host
container_name: myevcc
image: evcc/evcc:latest
volumes:
- /etc/evcc.yaml:/etc/evcc.yaml
- /home/raspiuser/.evcc:/root/.evcc # !! to be adapted if not having used raspiuser !!
restart: unless-stopped
In reverse-proxy create another file also called docker-compose.yml with below content
!! You need to add your email adress !!
version: "3"
services:
reverse-proxy:
container_name: reverse-proxy
image: "traefik:v2.9"
command:
- "--log.level=DEBUG"
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--providers.file.directory=/rules"
- "--entrypoints.web.address=:80" # a must for Let's Encrypt
- "--entrypoints.https.address=:443" # SolVecConMon via https
# Let's encrypt with certification resolver etc.
- "--entrypoints.https.http.tls.certResolver=le"
- "--certificatesresolvers.le.acme.tlschallenge=true"
- "--certificatesresolvers.le.acme.email=xxxxxxxx@xxxxx.xxx" # !! YOUR EMAIL !!
- "--certificatesresolvers.le.acme.storage=/letsencrypt/acme.json"
ports:
- "80:80" # Let's Encrypt
- "443:443" # SolVecConMon
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "./rules:/rules:ro"
- "./letsencrypt:/letsencrypt" # a must for Let's Encrypt
In rules create a file called rules.yml with below content
!! You need to enter your global IP address !! For Fritzbox users it's the global IP provided by the FritzBox
!! For
Basic Authentication you need to enter user:password with password
encrypted via https://htpasswdgenerator.de
In the sample below watchevcc and pwevcc are used (this is
independent of the raspi user)
!! In htpasswdgenerator press Password Generation as long as there
is a password not having a / (slash) - see below sample.
!! The clean text user and clean text password need to be entered
in Apple Watch SolVecConMon's configuration tab.
## Rules configuration
http:
routers
evcc-https:
rule:
"Host(`xxxxxxxxxxxxxxxxx.myfritz.net`)" # !! YOUR GLOBAL
IP - dyndns, myfritz !!
service: "evcc"
middlewares:
- "evcc-auth"
services:
evcc:
Loadbalancer:
servers:
- url:
"http://raspberrypi2:7070" # !! to be changed if other
hostname and/or other evcc port !!
middlewares:
evcc-auth:
basicAuth:
# headerField:
"X-WebAuth-User"
# removeHeader: true
users:
-
"watchevcc:$apr1$7deyab8u$ULbGI8e8DQ7Jg60vA5Nle0" # !! to
be changed if not watchevcc:pwevcc !!
Continue with System start below.
Before launching the myevcc container copy your
system's evcc.yaml into /etc - without that evcc will start in
demo mode, which would be also fine for a first step.
Open a terminal and enter /home/raspiuser/Docker-Compose/evcc
and execute: sudo docker-compose up -d
With the first execution docker is pulling the evcc image and
then launch it
Check successful starting with: docker logs myevcc
Open terminal and go into
home/raspiuser/Docker-Compose/reverse-proxy and execute: sudo
docker-compose up -d
With the first execution docker is pulling the traefik image and then launch it.
And with
first traefik's launch automatically a folder should be created
called letsencrypt within reverse-proxy folder.
And automatically a file called acme.json should have been created
in there.
Check successful starting with: docker logs reverse-proxy
The clean text user and clean text password need
to be entered in Apple Watch SolVecConMon's configuration tab.
If users in rules.yml still is
"watchevcc:$apr1$7deyab8u$ULbGI8e8DQ7Jg60vA5Nle0" then
SolVecConMon's configuration tab expects watchevcc:pwevcc for
that.
The evcc configuration is not part of this description. Please follow https://evcc.io documentation for that.
docker-compose up -d / lauch container and load image if necessary
docker ps / monitor the running containers
docker
logs {CONTAINER} / show container log e.g. docker logs myevcc or
docker logs reverse-proxy
docker
stop
{CONTAINER} / stop container
docker kill {CONTAINER} / kill container
docker images / show images repository
docker rmi -f {IMAGE} / delete image (e.g. for new version download)
docker pull {IMAGE} / download a new image
docker run {IMAGE} / run an image and download if not existing
docker
search {X} / search for an image in the docker repository
docker stats / show statistics (CPU, memory usage..)
docker help / display list of all Docker commands
Please have a look into with docker logs {CONTAINER} for myevcc and reverse-proxy.