5 Commits
0.0.1 ... 0.0.5

6 changed files with 33 additions and 19 deletions

3
.gitignore vendored
View File

@ -6,5 +6,6 @@ cube/pubsubc.a
test test
.bash_history .bash_history
.vscode .vscode
.dccache
sink/.dccache

View File

@ -1,13 +1,25 @@
stages: stages:
- check
- build - build
- deploy - deploy
include: variables:
- project: dockerized/commons IMAGE_NAME: $CI_REGISTRY/$CI_PROJECT_PATH
ref: master
file: gitlab-ci-template.yml
build:
image: registry.hottis.de/dockerized/docker-bash:latest
stage: build
tags:
- hottis
- linux
- docker
script:
- docker build --tag $IMAGE_NAME:${CI_COMMIT_SHORT_SHA} .
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY;
- docker push $IMAGE_NAME:${CI_COMMIT_SHORT_SHA}
- if [ "$CI_COMMIT_TAG" != "" ]; then
docker tag $IMAGE_NAME:${CI_COMMIT_SHORT_SHA} $IMAGE_NAME:${CI_COMMIT_TAG};
docker push $IMAGE_NAME:${CI_COMMIT_TAG};
fi
deploy: deploy:
image: registry.hottis.de/dockerized/docker-bash:latest image: registry.hottis.de/dockerized/docker-bash:latest
stage: deploy stage: deploy
@ -23,5 +35,14 @@ deploy:
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 -d --network docker-server --ip 172.16.10.42 -v sink_config:/etc/sink --name $CONTAINER_NAME --restart always $IMAGE_NAME:$CI_COMMIT_TAG - docker run
-d
--network docker-server
--ip 172.16.10.42
-v sink_config:/etc/sink
--name $CONTAINER_NAME
--restart always
$IMAGE_NAME:$CI_COMMIT_TAG
environment:
name: production

View File

@ -1,4 +1,4 @@
FROM alpine:3.13 AS builder FROM alpine:3.18.3 AS builder
ARG VERSION="dockerized" ARG VERSION="dockerized"
@ -13,7 +13,7 @@ RUN \
make VERSION=${VERSION} make VERSION=${VERSION}
FROM alpine:3.13 FROM alpine:3.18.3
COPY --from=builder /tmp/sink/build/sink20169 /usr/local/bin/ COPY --from=builder /tmp/sink/build/sink20169 /usr/local/bin/

View File

@ -32,3 +32,4 @@ Measurement is visualized at https://grafana.mainscnt.eu.
The projects of the three current variants are at [RPi](https://home.hottis.de/gitlab/wolutator/mains-frequency-counter-rpi), [STM32](https://home.hottis.de/gitlab/wolutator/mains-frequency-counter-stm32) and [ESP32](https://home.hottis.de/gitlab/wolutator/mains-frequency-counter-esp32). The projects of the three current variants are at [RPi](https://home.hottis.de/gitlab/wolutator/mains-frequency-counter-rpi), [STM32](https://home.hottis.de/gitlab/wolutator/mains-frequency-counter-stm32) and [ESP32](https://home.hottis.de/gitlab/wolutator/mains-frequency-counter-esp32).

View File

@ -1,9 +0,0 @@
CREATE SEQUENCE device_s START WITH 1 INCREMENT BY 1;
CREATE TABLE device_t (
id integer PRIMARY KEY DEFAULT NEXTVAL('device_s'),
deviceid varchar(16) UNIQUE NOT NULL,
sharedsecret varchar(31) NOT NULL CHECK(char_length(sharedSecret) = 31),
location varchar(128) NOT NULL,
active boolean NOT NULL DEFAULT false
);

View File

@ -367,7 +367,7 @@ int main(int argc, char **argv) {
bool doFork = false; bool doFork = false;
int c; int c;
while ((c = getopt(argc, argv, "f:vs:hn:b")) != -1) { while ((c = getopt(argc, argv, "f:vds:hn:b")) != -1) {
switch (c) { switch (c) {
case 'f': case 'f':
configFilename = strdup(optarg); configFilename = strdup(optarg);