Initial commit
This commit is contained in:
commit
3de474fbd2
4
.env.example
Normal file
4
.env.example
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
DOCKER_INFLUXDB_INIT_USERNAME=username
|
||||
DOCKER_INFLUXDB_INIT_PASSWORD=password
|
||||
DOCKER_INFLUXDB_INIT_ORG=orgName
|
||||
DOCKER_INFLUXDB_INIT_BUCKET=bucketName
|
||||
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
.env
|
||||
node_modules/
|
||||
dist/
|
||||
19
.woodpecker.yaml
Normal file
19
.woodpecker.yaml
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
variables:
|
||||
- &app_name "surf-hub"
|
||||
|
||||
when:
|
||||
event: [push]
|
||||
branch: main
|
||||
|
||||
steps:
|
||||
deploy:
|
||||
image: docker:28-cli
|
||||
privileged: true
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- /home/george:/home/george
|
||||
environment:
|
||||
APP_NAME: *app_name
|
||||
commands:
|
||||
- cp -r . /home/george/$APP_NAME/
|
||||
- docker compose -p $APP_NAME -f /home/george/$APP_NAME/docker-compose.yaml up -d --pull always --force-recreate
|
||||
67
README.md
Normal file
67
README.md
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
# 🌊 Surf-Hub
|
||||
|
||||
A self-hosted observability stack built to monitor and visualize real-time surf conditions.
|
||||
|
||||
**Surf-Hub** demonstrates a "DevOps approach" to a personal hobby. Instead of checking manual forecasts, this project automates data collection and visualization using industry-standard tools like **Grafana**, **InfluxDB**, and **Node.js**.
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Overview
|
||||
|
||||
The goal of this project is to create a persistent, historical record of local surf conditions (swell height, period, and wind) and display them in a high-visibility dashboard.
|
||||
|
||||
### 🛠️ The Tech Stack
|
||||
* **Backend:** Node.js (Service-oriented architecture)
|
||||
* **Database:** InfluxDB 2.x (Time-series data storage)
|
||||
* **Visualization:** Grafana
|
||||
* **Deployment:** Docker / Docker Compose
|
||||
* **Architecture:** Multi-platform builds via `docker buildx` for `linux/amd64` compatibility.
|
||||
|
||||
---
|
||||
|
||||
## 📊 Dashboard Preview
|
||||
*(Tip: Replace this with a screenshot of your Grafana dashboard once it's live!)*
|
||||
> 
|
||||
|
||||
---
|
||||
|
||||
## ⚙️ How It Works
|
||||
|
||||
1. **Data Ingestion:** A Node.js service polls a weather/surf API (e.g., Open-Meteo) every hour.
|
||||
2. **Time-Series Storage:** The data is normalized and pushed to **InfluxDB**, allowing for historical trend analysis.
|
||||
3. **Visualization:** **Grafana** queries InfluxDB to render "Live Condition" tiles and time-series graphs.
|
||||
4. **Containerization:** The entire stack is orchestrated via Docker Compose for easy deployment to any server.
|
||||
|
||||
---
|
||||
|
||||
## 🛠️ Setup & Installation
|
||||
|
||||
### Prerequisites
|
||||
* Docker & Docker Compose
|
||||
* An API key from your chosen surf/weather data provider
|
||||
|
||||
### Quick Start
|
||||
1. **Clone the repo:**
|
||||
```bash
|
||||
git clone [https://github.com/your-username/surf-hub.git](https://github.com/your-username/surf-hub.git)
|
||||
cd surf-hub
|
||||
2. **Configure environment:**
|
||||
Create a .env file with your API credentials and InfluxDB tokens.
|
||||
3. **Deploy the stack:**
|
||||
Create a .env file with your API credentials and InfluxDB tokens.
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
4. **Build the Fetcher (Cross-Platform):**
|
||||
Create a .env file with your API credentials and InfluxDB tokens.
|
||||
```bash
|
||||
docker buildx build --platform linux/amd64 -t surf-fetcher:latest ./fetcher --load
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Lessons Learned
|
||||
|
||||
- Implementing time-series data structures for fluctuating environmental data.
|
||||
- Managing containerized environments and cross-architecture builds using buildx.
|
||||
- Designing intuitive dashboards that provide "glanceable" information.
|
||||
34
docker-compose.yaml
Normal file
34
docker-compose.yaml
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
services:
|
||||
influxdb:
|
||||
image: influxdb:2.7
|
||||
container_name: influxdb
|
||||
restart: always
|
||||
networks:
|
||||
- web_traffic
|
||||
volumes:
|
||||
- influxdb_data:/var/lib/influxdb2
|
||||
environment:
|
||||
- DOCKER_INFLUXDB_INIT_MODE=setup
|
||||
- DOCKER_INFLUXDB_INIT_USERNAME=${DOCKER_INFLUXDB_INIT_USERNAME}
|
||||
- DOCKER_INFLUXDB_INIT_PASSWORD=${DOCKER_INFLUXDB_INIT_PASSWORD}
|
||||
- DOCKER_INFLUXDB_INIT_ORG=${DOCKER_INFLUXDB_INIT_ORG}
|
||||
- DOCKER_INFLUXDB_INIT_BUCKET=${DOCKER_INFLUXDB_INIT_BUCKET}
|
||||
|
||||
grafana:
|
||||
image: grafana/grafana-oss:latest
|
||||
container_name: grafana
|
||||
restart: always
|
||||
networks:
|
||||
- web_traffic
|
||||
depends_on:
|
||||
- influxdb
|
||||
volumes:
|
||||
- grafana_data:/var/lib/grafana
|
||||
|
||||
volumes:
|
||||
influxdb_data:
|
||||
grafana_data:
|
||||
|
||||
networks:
|
||||
web_traffic:
|
||||
external: true
|
||||
Loading…
Reference in a new issue