From 6f56b32e89603a4fe066de04d60a692983fbe7b4 Mon Sep 17 00:00:00 2001 From: Kai Jan Kriegel Date: Sun, 29 Nov 2020 20:54:26 +0100 Subject: [PATCH] added a dockerized version of the example --- docker-compose.yaml | 13 ------------- examples/docker/README.md | 10 ++++++++++ examples/docker/config.toml | 12 ++++++++++++ examples/docker/docker-compose.yaml | 13 +++++++++++++ examples/docker/machines.toml | 14 ++++++++++++++ examples/docker/roles.toml | 20 ++++++++++++++++++++ 6 files changed, 69 insertions(+), 13 deletions(-) delete mode 100644 docker-compose.yaml create mode 100644 examples/docker/README.md create mode 100644 examples/docker/config.toml create mode 100644 examples/docker/docker-compose.yaml create mode 100644 examples/docker/machines.toml create mode 100644 examples/docker/roles.toml diff --git a/docker-compose.yaml b/docker-compose.yaml deleted file mode 100644 index d8cd4f0..0000000 --- a/docker-compose.yaml +++ /dev/null @@ -1,13 +0,0 @@ -version: "3.8" -services: - bffh: - build: . - ports: - - "59661:59661" - volumes: - # generate a sample config.toml by running "docker run diflouroborane --print-default". You may have to delete the ipv6 listen section. - - "$PWD/config.toml:/etc/diflouroborane.toml" - links: - - mqtt - mqtt: - image: eclipse-mosquitto diff --git a/examples/docker/README.md b/examples/docker/README.md new file mode 100644 index 0000000..f5f5313 --- /dev/null +++ b/examples/docker/README.md @@ -0,0 +1,10 @@ +# API-Testsetup, aber mit Docker + +wirklich nur um das API zu testen. ATM implementiert: machine::read + +* Use included config.toml, or +* generate a sample config.toml by running "docker run registry.gitlab.com/fabinfra/fabaccess/bffh:dev-latest --print-default > config.toml". You may have to delete the ipv6 listen section. + 1. change mqtt-server hostname to `mqtt` in config.toml + 1. change machines path to `/etc/bffh/machines.toml` + +* run `docker-compose up` diff --git a/examples/docker/config.toml b/examples/docker/config.toml new file mode 100644 index 0000000..1da876c --- /dev/null +++ b/examples/docker/config.toml @@ -0,0 +1,12 @@ +machines = "/etc/bffh/machines.toml" + +[[listens]] +address = "127.0.0.1" +port = 59661 + +[[listens]] +address = "::1" +port = 59661 + +[shelly] +mqtt_url = "mqtt:1883" diff --git a/examples/docker/docker-compose.yaml b/examples/docker/docker-compose.yaml new file mode 100644 index 0000000..4442b18 --- /dev/null +++ b/examples/docker/docker-compose.yaml @@ -0,0 +1,13 @@ +version: "3.8" +services: + bffh: + image: registry.gitlab.com/fabinfra/fabaccess/bffh:dev-latest + ports: + - "59661:59661" + volumes: + # generate a sample config.toml by running "docker run registry.gitlab.com/fabinfra/fabaccess/bffh:dev-latest --print-default > examples/config.toml" from the project root. You may have to delete the ipv6 listen section. + - "$PWD/examples/docker:/etc/bffh" + links: + - mqtt + mqtt: + image: eclipse-mosquitto diff --git a/examples/docker/machines.toml b/examples/docker/machines.toml new file mode 100644 index 0000000..866aef1 --- /dev/null +++ b/examples/docker/machines.toml @@ -0,0 +1,14 @@ +[e5408099-d3e5-440b-a92b-3aabf7683d6b] +name = "Somemachine" +disclose = "lab.some.disclose" +read = "lab.some.read" +write = "lab.some.write" +manage = "lab.some.admin" + +[eaabebae-34d1-4a3a-912a-967b495d3d6e] +name = "Testmachine" +description = "An optional description" +disclose = "lab.test.read" +read = "lab.test.read" +write = "lab.test.write" +manage = "lab.test.admin" diff --git a/examples/docker/roles.toml b/examples/docker/roles.toml new file mode 100644 index 0000000..cc61b71 --- /dev/null +++ b/examples/docker/roles.toml @@ -0,0 +1,20 @@ +[testrole] +name = "Testrole" +permissions = [ + "lab.test.*" +] + +[somerole] +name = "Somerole" +parents = ["testparent%lmdb"] +permissions = [ + "lab.some.admin" +] + +[testparent] +name = "Testparent" +permissions = [ + "lab.some.write", + "lab.some.read", + "lab.some.disclose", +]