Compare commits
10 Commits
e5f9d3e3c8
...
cacb1c0254
Author | SHA1 | Date | |
---|---|---|---|
cacb1c0254 | |||
8afcfef5e8 | |||
f798ef400d | |||
a17ef7b6ec | |||
104be55bdf | |||
19eb9325ca | |||
5a34c3079f | |||
e4177eeb27 | |||
c78c93db8a | |||
4119765a87 |
@ -26,29 +26,30 @@ build:
|
|||||||
- docker push ${HUB_IMAGE_NAME}:${CI_COMMIT_SHORT_SHA}
|
- docker push ${HUB_IMAGE_NAME}:${CI_COMMIT_SHORT_SHA}
|
||||||
|
|
||||||
|
|
||||||
deploy:
|
# deploy:
|
||||||
image: registry.hottis.de/dockerized/docker-bash:latest
|
# image: registry.hottis.de/dockerized/docker-bash:latest
|
||||||
stage: deploy
|
# stage: deploy
|
||||||
tags:
|
# tags:
|
||||||
- hottis
|
# - hottis
|
||||||
- linux
|
# - linux
|
||||||
- docker
|
# - docker
|
||||||
only:
|
# only:
|
||||||
- tags
|
# - tags
|
||||||
variables:
|
# variables:
|
||||||
GIT_STRATEGY: none
|
# GIT_STRATEGY: none
|
||||||
CONTAINER_NAME: sink
|
# CONTAINER_NAME: sink
|
||||||
script:
|
# script:
|
||||||
- docker stop $CONTAINER_NAME || echo "container not running, never mind"
|
# - docker stop $CONTAINER_NAME || echo "container not running, never mind"
|
||||||
- docker rm $CONTAINER_NAME || echo "container not existing, never mind"
|
# - docker rm $CONTAINER_NAME || echo "container not existing, never mind"
|
||||||
- docker run
|
# - docker run
|
||||||
-d
|
# -d
|
||||||
--network docker-server
|
# --network docker-server
|
||||||
--ip 172.16.10.42
|
# --ip 172.16.10.42
|
||||||
-v sink_config:/etc/sink
|
# -v sink_config:/etc/sink
|
||||||
--name $CONTAINER_NAME
|
# --name $CONTAINER_NAME
|
||||||
--restart always
|
# --restart always
|
||||||
$IMAGE_NAME:$CI_COMMIT_TAG
|
# $IMAGE_NAME:$CI_COMMIT_TAG
|
||||||
environment:
|
# environment:
|
||||||
name: production
|
# name: production
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@ COPY sink/ /tmp/sink
|
|||||||
RUN \
|
RUN \
|
||||||
apk update && \
|
apk update && \
|
||||||
apk add alpine-sdk && \
|
apk add alpine-sdk && \
|
||||||
apk add libconfig-dev && \
|
|
||||||
apk add postgresql-dev && \
|
apk add postgresql-dev && \
|
||||||
cd /tmp/sink && \
|
cd /tmp/sink && \
|
||||||
make VERSION=${VERSION}
|
make VERSION=${VERSION}
|
||||||
@ -26,13 +25,12 @@ ENV UPPER_BOUND="56000"
|
|||||||
COPY --from=builder /tmp/sink/build/sink20169 /usr/local/bin/
|
COPY --from=builder /tmp/sink/build/sink20169 /usr/local/bin/
|
||||||
|
|
||||||
RUN \
|
RUN \
|
||||||
apk add --no-cache libpq && \
|
apk add --no-cache libpq
|
||||||
apk add --no-cache libconfig
|
|
||||||
|
|
||||||
EXPOSE 20169/udp
|
EXPOSE 20169/udp
|
||||||
USER nobody
|
USER nobody
|
||||||
|
|
||||||
CMD [ "/usr/local/bin/sink20169", "-v" ]
|
CMD [ "/usr/local/bin/sink20169", "-v", "-d" ]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,8 +1,30 @@
|
|||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: NetworkPolicy
|
||||||
|
metadata:
|
||||||
|
namespace: mainscnt
|
||||||
|
name: deny-all-but-dns
|
||||||
|
spec:
|
||||||
|
podSelector:
|
||||||
|
matchLabels: {}
|
||||||
|
policyTypes:
|
||||||
|
- Egress
|
||||||
|
- Ingress
|
||||||
|
egress:
|
||||||
|
- to:
|
||||||
|
- namespaceSelector:
|
||||||
|
matchLabels:
|
||||||
|
kubernetes.io/metadata.name: kube-system
|
||||||
|
ports:
|
||||||
|
- protocol: UDP
|
||||||
|
port: 53
|
||||||
|
- protocol: TCP
|
||||||
|
port: 53
|
||||||
---
|
---
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: sinkserver
|
name: sinkserver
|
||||||
|
namespace: mainscnt
|
||||||
labels:
|
labels:
|
||||||
app: sinkserver
|
app: sinkserver
|
||||||
spec:
|
spec:
|
||||||
@ -15,11 +37,9 @@ spec:
|
|||||||
labels:
|
labels:
|
||||||
app: sinkserver
|
app: sinkserver
|
||||||
spec:
|
spec:
|
||||||
imagePullSecrets:
|
|
||||||
- name: hottis-registry-creds
|
|
||||||
containers:
|
containers:
|
||||||
- name: sinkserver
|
- name: sinkserver
|
||||||
image: registry.hottis.de/mainscnt/sinkserver:314b9a42
|
image: wollud1969/sinkserver:e5f9d3e3
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 20169
|
- containerPort: 20169
|
||||||
protocol: UDP
|
protocol: UDP
|
||||||
@ -39,6 +59,7 @@ apiVersion: v1
|
|||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: sinkserver
|
name: sinkserver
|
||||||
|
namespace: mainscnt
|
||||||
labels:
|
labels:
|
||||||
app: sinkserver
|
app: sinkserver
|
||||||
spec:
|
spec:
|
||||||
@ -49,6 +70,72 @@ spec:
|
|||||||
- protocol: UDP
|
- protocol: UDP
|
||||||
port: 20169
|
port: 20169
|
||||||
targetPort: 20169
|
targetPort: 20169
|
||||||
|
---
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: NetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: allow-database-sinkserver
|
||||||
|
namespace: database
|
||||||
|
spec:
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: timescaledb
|
||||||
|
policyTypes:
|
||||||
|
- Ingress
|
||||||
|
ingress:
|
||||||
|
- from:
|
||||||
|
- podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: sinkserver
|
||||||
|
- namespaceSelector:
|
||||||
|
matchLabels:
|
||||||
|
kubernetes.io/metadata.name: mainscnt
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 5432
|
||||||
|
---
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: NetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: allow-sinkserver-database
|
||||||
|
namespace: mainscnt
|
||||||
|
spec:
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: sinkserver
|
||||||
|
policyTypes:
|
||||||
|
- Egress
|
||||||
|
egress:
|
||||||
|
- to:
|
||||||
|
- podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: timescaledb
|
||||||
|
- namespaceSelector:
|
||||||
|
matchLabels:
|
||||||
|
kubernetes.io/metadata.name: database
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 5432
|
||||||
|
---
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: NetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: allow-sinkserver-ingress
|
||||||
|
namespace: mainscnt
|
||||||
|
spec:
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: sinkserver
|
||||||
|
policyTypes:
|
||||||
|
- Ingress
|
||||||
|
ingress:
|
||||||
|
- from:
|
||||||
|
- ipBlock:
|
||||||
|
cidr: 0.0.0.0/0
|
||||||
|
ports:
|
||||||
|
- protocol: UDP
|
||||||
|
port: 20169
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
4
deployment/namespace.yml
Normal file
4
deployment/namespace.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: mainscnt
|
30
schema/create.sql
Normal file
30
schema/create.sql
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
create sequence device_s;
|
||||||
|
|
||||||
|
CREATE TABLE device_t (
|
||||||
|
id integer DEFAULT nextval('device_s') NOT NULL,
|
||||||
|
deviceid character varying(64) NOT NULL,
|
||||||
|
sharedsecret character varying(31) NOT NULL,
|
||||||
|
location character varying(128) NOT NULL,
|
||||||
|
active boolean DEFAULT false NOT NULL,
|
||||||
|
contact character varying(128),
|
||||||
|
flaky boolean DEFAULT false NOT NULL,
|
||||||
|
CONSTRAINT device_t_sharedsecret_check CHECK ((char_length((sharedsecret)::text) = 31))
|
||||||
|
);
|
||||||
|
|
||||||
|
ALTER TABLE ONLY device_t
|
||||||
|
ADD CONSTRAINT device_t_deviceid_key UNIQUE (deviceid);
|
||||||
|
|
||||||
|
ALTER TABLE ONLY device_t
|
||||||
|
ADD CONSTRAINT device_t_pkey PRIMARY KEY (id);
|
||||||
|
|
||||||
|
CREATE TABLE mainsfrequency (
|
||||||
|
"time" timestamp without time zone NOT NULL,
|
||||||
|
host text,
|
||||||
|
location text,
|
||||||
|
freq double precision,
|
||||||
|
valid smallint DEFAULT 1 NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
select create_hypertable('mainsfrequency', 'time');
|
||||||
|
|
||||||
|
|
@ -9,10 +9,10 @@ VERSION ?= $(shell git rev-parse --short=8 HEAD)
|
|||||||
UNAME_S := $(shell uname -s)
|
UNAME_S := $(shell uname -s)
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CFLAGS = $(shell pkg-config --cflags libpq libconfig) -I. \
|
CFLAGS = $(shell pkg-config --cflags libpq) -I. \
|
||||||
-Wall -Werror -std=c99 \
|
-Wall -Werror -std=c99 \
|
||||||
-D$(UNAME_S)=1 -DVERSION="\"$(VERSION)\""
|
-D$(UNAME_S)=1 -DVERSION="\"$(VERSION)\""
|
||||||
LDFLAGS = $(shell pkg-config --libs libpq libconfig)
|
LDFLAGS = $(shell pkg-config --libs libpq)
|
||||||
TARGET = sink20169
|
TARGET = sink20169
|
||||||
|
|
||||||
all: $(BUILD_DIR)/$(TARGET)
|
all: $(BUILD_DIR)/$(TARGET)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user