Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bcd956d11a | ||
|
|
9f99d132e3 | ||
|
|
669e8ff005 |
@@ -29,12 +29,16 @@
|
|||||||
path: "{{ data_dir }}"
|
path: "{{ data_dir }}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: "0777"
|
mode: "0777"
|
||||||
|
owner: "10001"
|
||||||
|
group: "10001"
|
||||||
|
|
||||||
- name: Create warehouse directory (T3 host path inside the k3d node)
|
- name: Create warehouse directory (T3 host path inside the k3d node)
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ warehouse_dir }}"
|
path: "{{ warehouse_dir }}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: "0777"
|
mode: "0777"
|
||||||
|
owner: "10001"
|
||||||
|
group: "10001"
|
||||||
|
|
||||||
- name: List existing clusters
|
- name: List existing clusters
|
||||||
ansible.builtin.command: k3d cluster list -o json
|
ansible.builtin.command: k3d cluster list -o json
|
||||||
|
|||||||
@@ -298,8 +298,12 @@ resource "kubernetes_config_map" "grafana_provisioning" {
|
|||||||
data = {
|
data = {
|
||||||
"datasource.yml" = <<-EOT
|
"datasource.yml" = <<-EOT
|
||||||
apiVersion: 1
|
apiVersion: 1
|
||||||
|
deleteDatasources:
|
||||||
|
- name: Prometheus
|
||||||
|
orgId: 1
|
||||||
datasources:
|
datasources:
|
||||||
- name: Prometheus
|
- name: Prometheus
|
||||||
|
uid: swarm-prom
|
||||||
type: prometheus
|
type: prometheus
|
||||||
access: proxy
|
access: proxy
|
||||||
url: http://prometheus:9090
|
url: http://prometheus:9090
|
||||||
|
|||||||
@@ -20,24 +20,24 @@ export interface LivePose {
|
|||||||
// latest battery reading from telemetry. arg_max keeps it a single scan.
|
// latest battery reading from telemetry. arg_max keeps it a single scan.
|
||||||
const LIVE_SQL = `
|
const LIVE_SQL = `
|
||||||
WITH pose AS (
|
WITH pose AS (
|
||||||
SELECT drone_id,
|
SELECT drone,
|
||||||
arg_max(pos_x, ts_ns) AS x,
|
arg_max(pos_x, ts_ns) AS x,
|
||||||
arg_max(pos_y, ts_ns) AS y,
|
arg_max(pos_y, ts_ns) AS y,
|
||||||
arg_max(yaw, ts_ns) AS yaw,
|
arg_max(yaw, ts_ns) AS yaw,
|
||||||
max(ts_ns) AS ts_ns
|
max(ts_ns) AS ts_ns
|
||||||
FROM state
|
FROM state
|
||||||
WHERE direction = 'sent'
|
WHERE direction = 'sent'
|
||||||
GROUP BY drone_id
|
GROUP BY drone
|
||||||
),
|
),
|
||||||
batt AS (
|
batt AS (
|
||||||
SELECT drone_id, arg_max(level_pct, ts_ns) AS battery
|
SELECT drone, arg_max(level_pct, ts_ns) AS battery
|
||||||
FROM telemetry
|
FROM telemetry
|
||||||
WHERE sensor = 'battery'
|
WHERE sensor = 'battery'
|
||||||
GROUP BY drone_id
|
GROUP BY drone
|
||||||
)
|
)
|
||||||
SELECT p.drone_id, p.x, p.y, p.yaw, p.ts_ns, b.battery
|
SELECT p.drone, p.x, p.y, p.yaw, p.ts_ns, b.battery
|
||||||
FROM pose p LEFT JOIN batt b USING (drone_id)
|
FROM pose p LEFT JOIN batt b USING (drone)
|
||||||
ORDER BY p.drone_id`;
|
ORDER BY p.drone`;
|
||||||
|
|
||||||
interface QueryResponse {
|
interface QueryResponse {
|
||||||
columns?: string[];
|
columns?: string[];
|
||||||
|
|||||||
@@ -7,6 +7,10 @@ COPY virtual_drone ./virtual_drone
|
|||||||
COPY monitoring ./monitoring
|
COPY monitoring ./monitoring
|
||||||
COPY explorer ./explorer
|
COPY explorer ./explorer
|
||||||
COPY tests ./tests
|
COPY tests ./tests
|
||||||
|
RUN groupadd --gid 10001 swarm \
|
||||||
|
&& useradd --uid 10001 --gid swarm --home-dir /app --shell /usr/sbin/nologin swarm \
|
||||||
|
&& chown -R swarm:swarm /app
|
||||||
|
USER swarm
|
||||||
RUN pytest tests/ -q
|
RUN pytest tests/ -q
|
||||||
|
|
||||||
FROM python:3.12-slim
|
FROM python:3.12-slim
|
||||||
@@ -19,6 +23,11 @@ COPY virtual_drone ./virtual_drone
|
|||||||
# them without bind mounts (Compose overrides these with live mounts)
|
# them without bind mounts (Compose overrides these with live mounts)
|
||||||
COPY monitoring ./monitoring
|
COPY monitoring ./monitoring
|
||||||
COPY explorer ./explorer
|
COPY explorer ./explorer
|
||||||
|
RUN groupadd --gid 10001 swarm \
|
||||||
|
&& useradd --uid 10001 --gid swarm --home-dir /app --shell /usr/sbin/nologin swarm \
|
||||||
|
&& mkdir -p /data \
|
||||||
|
&& chown -R swarm:swarm /app /data
|
||||||
|
|
||||||
ENV DATA_DIR=/data
|
ENV DATA_DIR=/data
|
||||||
|
USER swarm
|
||||||
CMD ["python", "-m", "virtual_drone.main"]
|
CMD ["python", "-m", "virtual_drone.main"]
|
||||||
|
|||||||
Reference in New Issue
Block a user