mirror of
https://gitlab.com/sfz.aalen/infra/fabaccess.git
synced 2025-03-12 15:01:47 +01:00
Merge
This commit is contained in:
parent
0a06c36dd1
commit
30494c89e6
2
Dockerfile-DB
Normal file
2
Dockerfile-DB
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
FROM mysql:5.7
|
||||||
|
ADD FabAccess.sql /docker-entrypoint-initdb.d
|
54
Jenkinsfile
vendored
54
Jenkinsfile
vendored
@ -1,54 +0,0 @@
|
|||||||
pipeline {
|
|
||||||
agent any
|
|
||||||
post {
|
|
||||||
failure {
|
|
||||||
updateGitlabCommitStatus name: 'build', state: 'failed'
|
|
||||||
}
|
|
||||||
success {
|
|
||||||
updateGitlabCommitStatus name: 'build', state: 'success'
|
|
||||||
}
|
|
||||||
aborted {
|
|
||||||
updateGitlabCommitStatus name: 'build', state: 'canceled'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
options {
|
|
||||||
gitLabConnection('GitLab')
|
|
||||||
}
|
|
||||||
triggers {
|
|
||||||
gitlab(triggerOnPush: true, triggerOnMergeRequest: true, branchFilterType: 'All')
|
|
||||||
}
|
|
||||||
stages {
|
|
||||||
stage("build") {
|
|
||||||
steps {
|
|
||||||
updateGitlabCommitStatus name: 'build', state: 'running'
|
|
||||||
podTemplate(
|
|
||||||
containers: [
|
|
||||||
containerTemplate(name: 'docker-image-build', image: 'mgoltzsche/podman', ttyEnabled: true, command: 'cat', privileged: true),
|
|
||||||
]) {
|
|
||||||
node(POD_LABEL) {
|
|
||||||
updateGitlabCommitStatus name: 'build', state: 'pending'
|
|
||||||
checkout([$class: 'GitSCM', branches: [
|
|
||||||
[name: '*/main']
|
|
||||||
], userRemoteConfigs: [
|
|
||||||
[url: 'https://gitlab.com/luca_lutz/fabaccess.git']
|
|
||||||
]])
|
|
||||||
container('docker-image-build') {
|
|
||||||
withCredentials([
|
|
||||||
usernamePassword(credentialsId: 'docker.credentials',
|
|
||||||
usernameVariable: 'DOCKER_USERNAME',
|
|
||||||
passwordVariable: 'DOCKER_PASSWORD')
|
|
||||||
]) {
|
|
||||||
sh 'echo $(date +%s) > /time'
|
|
||||||
sh 'echo "nameserver 10.12.42.2" > /etc/resolv.conf'
|
|
||||||
sh 'podman build --tag docker.sfz-aalen.space/hackwerk/fabaccess:$(cat /time) .'
|
|
||||||
sh 'podman login -u ${DOCKER_USERNAME} -p ${DOCKER_PASSWORD} docker.sfz-aalen.space'
|
|
||||||
sh 'podman push docker.sfz-aalen.space/hackwerk/fabaccess:$(cat /time)'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -19,5 +19,7 @@ MQTT_USERNAME=user
|
|||||||
MQTT_PASSWORD=password
|
MQTT_PASSWORD=password
|
||||||
MQTT_BROKER=mqtt
|
MQTT_BROKER=mqtt
|
||||||
MQTT_CLIENT=FabMan
|
MQTT_CLIENT=FabMan
|
||||||
|
|
||||||
|
MACHINES=[[1,"lasercutter","sfz.lasercutter.trotec"],[2,"sfz.holzwerkstatt.kreissaege","kreissaege"]]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
from paho.mqtt import client as mqtt_client
|
|
||||||
|
|
||||||
import config
|
|
||||||
|
|
||||||
|
|
||||||
def on_connect(client, userdata, flags, rc):
|
|
||||||
if rc == 0:
|
|
||||||
print("Connected to MQTT Broker!")
|
|
||||||
else:
|
|
||||||
raise Exception("Failed to connect, return code %d\n", rc)
|
|
||||||
|
|
||||||
|
|
||||||
class MQTTHelper():
|
|
||||||
def __init__(self, client_name: str, username: str, password: str, broker: str, port: int):
|
|
||||||
client = mqtt_client.Client(client_name)
|
|
||||||
if username and password:
|
|
||||||
client.username_pw_set(username, password)
|
|
||||||
else:
|
|
||||||
print("Connecting to MQTT without credentials")
|
|
||||||
client.on_connect = on_connect
|
|
||||||
try:
|
|
||||||
client.connect(broker, port)
|
|
||||||
except Exception as e:
|
|
||||||
raise Exception(f"Error connecting to MQTT {broker}:{port}") from e
|
|
||||||
self.client = client
|
|
||||||
|
|
||||||
def subscribe(self, topic: str, handler):
|
|
||||||
self.client.subscribe(topic)
|
|
||||||
self.client.on_message = handler
|
|
||||||
|
|
||||||
def loop_forever(self):
|
|
||||||
self.client.loop_forever()
|
|
@ -1,11 +0,0 @@
|
|||||||
CREATE TABLE ReaderPlug(
|
|
||||||
ReaderID INT NOT NULL,
|
|
||||||
PlugName VARCHAR(255) NOT NULL,
|
|
||||||
PermissionPath VARCHAR(255) NOT NULL,
|
|
||||||
Status BOOLEAN NOT NULL,
|
|
||||||
LastUser VARCHAR(255) NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
INSERT INTO ReaderPlug(
|
|
||||||
ReaderID, PlugName, PermissionPath, Status, LastUser
|
|
||||||
) VALUES (1, 'lasercutter', 'sfz.lasercutter.trotec', false, 'luca.lutz');
|
|
Loading…
x
Reference in New Issue
Block a user