Remove autarco.toml from documentation and Docker files

* Fix up `docker-compose.yml` and Dockerfile
* Ensure that `README.md` makes it to the build Docker container so the
  build does not fail
* Update `README.md`
This commit is contained in:
Paul van Tilburg 2023-01-06 21:30:33 +01:00
parent 3c35c4fe72
commit 32a5fbc236
Signed by: paul
GPG key ID: C6DE073EDA9EEC4D
4 changed files with 34 additions and 28 deletions

View file

@ -12,7 +12,4 @@ docker-compose*
.gitignore
# TOML files
autarco.toml*
# Documentation
*.md
Rocket.toml

View file

@ -8,7 +8,7 @@ FROM docker.io/rust:1 as builder
# Build the dependencies first
RUN USER=root cargo new --bin autarco-scraper
WORKDIR ./autarco-scraper
WORKDIR /usr/src/autarco-scraper
COPY ./Cargo.* ./
RUN cargo build --release
RUN rm src/*.rs

View file

@ -5,16 +5,36 @@ Autarco site/API to get statistical data of your solar panels.
## Building & running
First you need to provide your My Autarco credentials in the file
`autarco.toml` by setting the username and password. You can copy and modify `autarco.toml.example` for this:
First, you need to provide your My Autarco credentials in the file
`Rocket.toml` by setting the username, password and site ID.
You can copy and modify `Rocket.toml.example` for this:
```toml
# Put your My Autarco credentials below
[default]
# ...
# Put your My Autarco credentials below and uncomment them
username = "foo@domain.tld"
password = "secret"
site_id = "abc123de"
```
Then, using Cargo, it is easy to build and run Autarco Scraper, just run:
You can also change this configuration to use a different address and/or port.
(Note that Rocket listens on `127.0.0.1:8000` by default for debug builds, i.e.
builds when you don't add `--release`.)
```toml
[default]
address = "0.0.0.0"
port = 8080
# ...
```
This will work independent of the type of build. For more about Rocket's
configuration, see: <https://rocket.rs/v0.5-rc/guide/configuration/>.
Finally, using Cargo, it is easy to build and run Autarco Scraper, just run:
```shell
$ cargo run --release
@ -24,21 +44,6 @@ $ cargo run --release
Running `/path/to/autarco-scraper/target/release/autarco-scraper`
```
(Note that Rocket listens on `127.0.0.1:8000` by default for debug builds, i.e.
builds when you don't add `--release`.)
You can provide Rocket with configuration to use a different address and/or port.
Just create a `Rocket.toml` file that contains (or copy `Rocket.toml.example`):
```toml
[default]
address = "0.0.0.0"
port = 8080
```
This will work independent of the type of build. For more about Rocket's
configuration, see: <https://rocket.rs/v0.5-rc/guide/configuration/>.
## API endpoint
The `/` API endpoint provides the current statistical data of your solar panels
@ -54,7 +59,7 @@ GET /
A response uses the JSON format and typically looks like this:
```json
{"current_w":23, "total_kwh":6159, "last_updated":1661194620}
{"current_w":23,"total_kwh":6159,"last_updated":1661194620}
```
This contains the current production power (`current_w`) in Watt,

View file

@ -6,10 +6,14 @@ services:
build: .
restart: unless-stopped
ports:
- 8066:8000
- 2356:8000
# Use a `Rocket.toml` or configure the credentials using environment variables below
volumes:
- ./autarco.toml:/autarco-scraper/autarco.toml
- ./Rocket.toml:/autarco-scraper/Rocket.toml
environment:
ROCKET_ADDRESS: 0.0.0.0
ROCKET_LOG_LEVEL: normal # Available levels are: off, debug, normal, critical
# Put your My Autarco credentials below and uncomment them
# ROCKET_USERNAME: foo@domain.tld
# ROCKET_PASSWORD: secret
# ROCKET_SITE_ID: abc123de
shm_size: '2gb'