mirror of
https://github.com/daniviga/bite.git
synced 2024-11-25 06:16:13 +01:00
Compare commits
No commits in common. "cc93c5ae7596f1553f78d4e35bcff7f643844396" and "f120fac87804a1bdeb3c2a06b93eb1d1fd4dfcc0" have entirely different histories.
cc93c5ae75
...
f120fac878
15
README.md
15
README.md
|
@ -35,21 +35,6 @@ but it is advised to directly use a minimal Linux VM instead
|
|||
|
||||
`podman`, with `podman-docker` is the recommended way to run BITE, in rootless mode.
|
||||
|
||||
Requirements are:
|
||||
|
||||
- `podman`
|
||||
- `podman-docker`
|
||||
- `catatonit`
|
||||
- `docker-compose`
|
||||
|
||||
On Fedora 33+:
|
||||
|
||||
```bash
|
||||
sudo dnf install -y podman podman-docker catatonit docker-compose
|
||||
```
|
||||
|
||||
To setup `podman` run:
|
||||
|
||||
```bash
|
||||
systemctl start --user podman.socket
|
||||
export DOCKER_HOST=unix://run/user/$UID/podman/podman.sock
|
||||
|
|
|
@ -30,10 +30,8 @@ const byte mac[] = {
|
|||
const char serial[] = SERIAL;
|
||||
|
||||
struct netConfig {
|
||||
IPAddress iot_address = IOT_IP;
|
||||
unsigned int iot_port = IOT_PORT;
|
||||
IPAddress ntp_address = NTP_IP;
|
||||
unsigned int ntp_port = NTP_PORT;
|
||||
IPAddress address = REMOTE_IP;
|
||||
unsigned int port = REMOTE_PORT;
|
||||
} config;
|
||||
|
||||
void setup() {
|
||||
|
|
|
@ -19,7 +19,5 @@
|
|||
*/
|
||||
|
||||
#define SERIAL "uno_1"
|
||||
#define IOT_IP {192, 168, 10, 1}
|
||||
#define IOT_PORT 80
|
||||
#define NTP_IP {192, 168, 10, 1}
|
||||
#define NTP_PORT 123
|
||||
#define REMOTE_IP {192, 168, 0, 1}
|
||||
#define REMOTE_PORT 80
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
#define TELEMETRY_DELAY 10 // second between telemetry samples
|
||||
#define AREF_VOLTAGE 3.3 // set aref voltage to 3.3v instead of default 5v
|
||||
|
||||
char serial[9];
|
||||
|
||||
// const String serverName = "sensor.server.domain";
|
||||
const size_t capacity = 2 * JSON_OBJECT_SIZE(3) + JSON_OBJECT_SIZE(2) + 20;
|
||||
|
||||
|
@ -48,13 +50,11 @@ EthernetClient ethClient;
|
|||
PubSubClient clientMQTT(ethClient);
|
||||
|
||||
struct netConfig {
|
||||
IPAddress iot_address;
|
||||
unsigned int iot_port;
|
||||
IPAddress ntp_address;
|
||||
unsigned int ntp_port; // not used
|
||||
} config;
|
||||
IPAddress address;
|
||||
unsigned int port;
|
||||
};
|
||||
netConfig config;
|
||||
|
||||
char serial[9];
|
||||
const String apiURL = "/api/device/subscribe/";
|
||||
const String telemetryURL = "/telemetry/";
|
||||
|
||||
|
@ -89,17 +89,15 @@ void setup(void) {
|
|||
Serial.println(Ethernet.localIP());
|
||||
Serial.println();
|
||||
Serial.print("Connecting to: ");
|
||||
Serial.print(config.iot_address);
|
||||
Serial.print(config.address);
|
||||
Serial.print(":");
|
||||
Serial.print(config.iot_port);
|
||||
Serial.print(config.port);
|
||||
Serial.print(" every ");
|
||||
Serial.print(TELEMETRY_DELAY);
|
||||
Serial.println("s");
|
||||
|
||||
#if USE_INTERNAL_NTP
|
||||
Serial.print("Using NTP: ");
|
||||
Serial.println(config.ntp_address);
|
||||
timeClient.setPoolServerIP(config.ntp_address);
|
||||
timeClient.setPoolServerIP(config.address);
|
||||
#endif
|
||||
timeClient.begin();
|
||||
if (timeClient.update()) {
|
||||
|
@ -117,7 +115,7 @@ void setup(void) {
|
|||
// payload["id"] = serverName;
|
||||
|
||||
#if USE_MQTT
|
||||
clientMQTT.setServer(config.iot_address, 1883);
|
||||
clientMQTT.setServer(config.address, 1883);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -177,14 +175,14 @@ void publishData(const netConfig &mqtt, const DynamicJsonDocument &json) {
|
|||
#endif
|
||||
|
||||
void postData(const netConfig &postAPI, const String &URL, const DynamicJsonDocument &json) {
|
||||
if (ethClient.connect(postAPI.iot_address, postAPI.iot_port)) {
|
||||
if (ethClient.connect(postAPI.address, postAPI.port)) {
|
||||
ethClient.print("POST ");
|
||||
ethClient.print(URL);
|
||||
ethClient.println(" HTTP/1.1");
|
||||
ethClient.print("Host: ");
|
||||
ethClient.print(postAPI.iot_address);
|
||||
ethClient.print(postAPI.address);
|
||||
ethClient.print(":");
|
||||
ethClient.println(postAPI.iot_port);
|
||||
ethClient.println(postAPI.port);
|
||||
ethClient.println("Content-Type: application/json");
|
||||
ethClient.print("Content-Length: ");
|
||||
ethClient.println(measureJson(json));
|
||||
|
|
|
@ -43,7 +43,7 @@ services:
|
|||
|
||||
timescale:
|
||||
<<: *service_default
|
||||
image: timescale/timescaledb:latest-pg14
|
||||
image: timescale/timescaledb:latest-pg12
|
||||
environment:
|
||||
POSTGRES_USER: "bite"
|
||||
POSTGRES_PASSWORD: "password"
|
||||
|
|
|
@ -24,7 +24,7 @@ services:
|
|||
image: docker:dind
|
||||
privileged: true
|
||||
environment:
|
||||
DOCKER_TLS_CERTDIR: ""
|
||||
DOCKER_TLS_CERTDIR:
|
||||
networks:
|
||||
- net
|
||||
ports:
|
||||
|
|
|
@ -31,10 +31,8 @@ const char* ssid = SECRET_SSID;
|
|||
const char* password = SECRET_PASSWORD;
|
||||
|
||||
struct netConfig {
|
||||
IPAddress iot_address = IOT_IP;
|
||||
unsigned int iot_port = IOT_PORT;
|
||||
IPAddress ntp_address = NTP_IP;
|
||||
unsigned int ntp_port = NTP_PORT;
|
||||
IPAddress address = REMOTE_IP;
|
||||
unsigned int port = REMOTE_PORT;
|
||||
} config;
|
||||
|
||||
void setup() {
|
||||
|
|
|
@ -19,9 +19,7 @@
|
|||
*/
|
||||
|
||||
#define SERIAL "<fillme>"
|
||||
#define IOT_IP {192, 168, 10, 1}
|
||||
#define IOT_PORT 80
|
||||
#define NTP_IP {192, 168, 10, 1}
|
||||
#define NTP_PORT 123
|
||||
#define REMOTE_IP {192, 168, 0, 1}
|
||||
#define REMOTE_PORT 80
|
||||
#define SECRET_SSID "<fillme>"
|
||||
#define SECRET_PASSWORD "<fillme>"
|
||||
|
|
|
@ -48,10 +48,8 @@ WiFiClient ethClient;
|
|||
PubSubClient clientMQTT(ethClient);
|
||||
|
||||
struct netConfig {
|
||||
IPAddress iot_address;
|
||||
unsigned int iot_port;
|
||||
IPAddress ntp_address;
|
||||
unsigned int ntp_port; // not used
|
||||
IPAddress address;
|
||||
unsigned int port;
|
||||
} config;
|
||||
|
||||
char* serial;
|
||||
|
@ -96,17 +94,15 @@ void setup(void) {
|
|||
Serial.println(WiFi.localIP());
|
||||
Serial.println();
|
||||
Serial.print("Connecting to: ");
|
||||
Serial.print(config.iot_address.toString());
|
||||
Serial.print(config.address.toString());
|
||||
Serial.print(":");
|
||||
Serial.print(config.iot_port);
|
||||
Serial.print(config.port);
|
||||
Serial.print(" every ");
|
||||
Serial.print(TELEMETRY_DELAY);
|
||||
Serial.println("s");
|
||||
|
||||
#if USE_INTERNAL_NTP
|
||||
Serial.print("Using NTP: ");
|
||||
Serial.println(config.ntp_address.toString());
|
||||
timeClient.setPoolServerIP(config.ntp_address);
|
||||
timeClient.setPoolServerIP(config.address);
|
||||
#endif
|
||||
timeClient.begin();
|
||||
if (timeClient.update()) {
|
||||
|
@ -124,7 +120,7 @@ void setup(void) {
|
|||
// payload["id"] = serverName;
|
||||
|
||||
#if USE_MQTT
|
||||
clientMQTT.setServer(config.iot_address, 1883);
|
||||
clientMQTT.setServer(config.address, 1883);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -176,14 +172,14 @@ void publishData(const netConfig &mqtt, const DynamicJsonDocument &json) {
|
|||
#endif
|
||||
|
||||
void postData(const netConfig &postAPI, const String &URL, const DynamicJsonDocument &json) {
|
||||
if (ethClient.connect(postAPI.iot_address, postAPI.iot_port)) {
|
||||
if (ethClient.connect(postAPI.address, postAPI.port)) {
|
||||
ethClient.print("POST ");
|
||||
ethClient.print(URL);
|
||||
ethClient.println(" HTTP/1.1");
|
||||
ethClient.print("Host: ");
|
||||
ethClient.print(postAPI.iot_address.toString());
|
||||
ethClient.print(postAPI.address.toString());
|
||||
ethClient.print(":");
|
||||
ethClient.println(postAPI.iot_port);
|
||||
ethClient.println(postAPI.port);
|
||||
ethClient.println("Content-Type: application/json");
|
||||
ethClient.print("Content-Length: ");
|
||||
ethClient.println(measureJson(json));
|
||||
|
|
Loading…
Reference in New Issue
Block a user