From 35f793c7ce3cb8552f5b5feb0dfb84d428e46dfe Mon Sep 17 00:00:00 2001 From: joyja Date: Sat, 26 Sep 2020 23:05:21 +0000 Subject: [PATCH] Added LXD profiles and exported updated graphql documentation (using graphql markdown) --- README.md | 93 ++++++++++++++++--------- lxd profiles/README.md | 3 + lxd profiles/tentacle-docker.yaml | 109 ++++++++++++++++++++++++++++++ 3 files changed, 174 insertions(+), 31 deletions(-) create mode 100644 lxd profiles/README.md create mode 100644 lxd profiles/tentacle-docker.yaml diff --git a/README.md b/README.md index 7c18b33..0598235 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,8 @@ A nodejs industrial automation edge gateway with a GraphQL API. ## Installation +The best way to get a full featured tentacle install (which includes tentacle-ui and exposes everything on port 80) is using LXD and applying the [tentacle-docker](https://github.com/joyja/tentacle/lxd) profile. + To install tentacle as a global module with all of it's dependencies: ```bash @@ -76,7 +78,7 @@ The easiest way is to use [PM2](https://github.com/Unitech/pm2). -### Schema Types +# Schema Types
Table of Contents @@ -111,7 +113,7 @@ The easiest way is to use [PM2](https://github.com/Unitech/pm2).
-#### Query +## Query Read only queries @@ -182,7 +184,7 @@ Requires a valid authorization token. List of all services configured in this ga
-#### Mutation +## Mutation Read/Write queries @@ -346,6 +348,11 @@ Requires a valid authorization token. Creates a new tag + + + + + @@ -400,6 +407,11 @@ Requires a valid authorization token. Updates an existing tag + + + + + @@ -799,7 +811,7 @@ Requires a valid authorization token. Creates an MQTT Sparkplug B service (tied - + @@ -892,7 +904,7 @@ Requires a valid authorization token. Updates an MQTT Sparkplug B service and re - + - +
deadbandFloat
units String
deadbandFloat
units String
devices[Int!]![ID!]!
addMqttDeviceaddMqttSource Service @@ -911,7 +923,7 @@ Requires a valid authorization token. Adds a device to an MQTT service. All the
deleteMqttDevicedeleteMqttSource Service @@ -984,9 +996,9 @@ Requires a valid authorization token. Deletes an MQTT Service. All devices assig
-#### Objects +## Objects -##### AuthPayload +### AuthPayload The data returned after a successful login attempt. @@ -1021,7 +1033,7 @@ User that successfully logged in. -##### Device +### Device A Device is a something that can serve data to be used for updating tag values, such as a modbus TCP or Ethernet/IP server. @@ -1088,7 +1100,7 @@ Date/time the tag was created. -##### EthernetIP +### EthernetIP Ethernet/IP is a device config allowing for access to data for updating tag values per the ODVA Ethernet/IP specification. @@ -1155,7 +1167,7 @@ Status of the Ethernet/IP device connection. Will be connected if connection is -##### EthernetIPSource +### EthernetIPSource An Ethernet/IP source reads an tag from an Ethernet/IP device and updates a tag value per the tags scan class. @@ -1204,7 +1216,7 @@ The tagname of the tag in the Ethernet/IP device (not to be confused with the na -##### Modbus +### Modbus Modbus is a device config allowing for access to data for updating tag values per the Modbus TCP specification. @@ -1316,7 +1328,7 @@ Milliseconds between retries when connection is interrupted. -##### ModbusSource +### ModbusSource A Mobus source reads a register from a modbus TCP device and updates a tag value per the tags scan class. @@ -1374,7 +1386,7 @@ The register type per the modbus specification. Can be `HOLDING_REGISTER`, `INPU -##### Mqtt +### Mqtt MQTT is a service that allows for publishing tag values to an MQTT broker using the sparkplug B specification, which will server data to other subscribing nodes. One broker per service. @@ -1495,7 +1507,7 @@ Primary host IDs. This is used for store and forward to detect if the consumers -##### MqttPrimaryHost +### MqttPrimaryHost MQTT is a service that allows for publishing tag values to an MQTT broker using the sparkplug B specification, which will server data to other subscribing nodes. One broker per service. @@ -1544,7 +1556,7 @@ Number of historical records stored, awaiting forwarding -##### MqttSource +### MqttSource An MQTT source publishes data from all tags with the same device source. The device name will be used as the `Device` field in sparkplug B. @@ -1593,7 +1605,7 @@ Number of historical records stored, awaiting forwarding -##### ScanClass +### ScanClass A scan class allows for groups of tags to be updated at the same pre-defined rate. @@ -1660,7 +1672,7 @@ The number of times this scan class has been scanned since the scan class scan s -##### Service +### Service A service makes data available to external services by acting as a server or publishing the data as is done with MQTT. @@ -1727,7 +1739,7 @@ Date/time the service was created. -##### Subscription +### Subscription @@ -1744,10 +1756,20 @@ Date/time the service was created. + + + + + + + + + +
Tag
deviceUpdateDevice
serviceUpdateService
-##### Tag +### Tag A Tag stores data point values. It's value can be updated from a device source per it's scan class, and it's value can be made available to external services like MQTT. @@ -1854,6 +1876,15 @@ Maximum tag value (meant for use if the tag is numeric). Can be used to generate Minimum tag value (meant for use if the tag is numeric). Can be used to generate out of range indication and for graphical displays + + + +deadband +Float + + +Deadband, used to determine whether to publish a change or write to history. If the change in value is less than the deadband, the update is ignored. If this value is zero, all changes are published and write to history. + @@ -1868,7 +1899,7 @@ Engineering units of the tag. Meant to be used for user displays to give context -##### User +### User Credentials used to identify who is logging into the gateway. @@ -1895,9 +1926,9 @@ Credentials used to identify who is logging into the gateway. -#### Enums +## Enums -##### Datatype +### Datatype Tag datatypes allowing for clients to properly parse tag values. @@ -1926,7 +1957,7 @@ Tag datatypes allowing for clients to properly parse tag values. -##### ModbusRegisterType +### ModbusRegisterType Modbus register types for use with modbus sources per the modbus specification. @@ -1955,29 +1986,29 @@ Modbus register types for use with modbus sources per the modbus specification. -#### Scalars +## Scalars -##### Boolean +### Boolean The `Boolean` scalar type represents `true` or `false`. -##### DateTime +### DateTime Used to deliver timestamp values. -##### Float +### Float The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point). -##### ID +### ID The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"4"`) or integer (such as `4`) input value will be accepted as an ID. -##### Int +### Int The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1. -##### String +### String The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text. diff --git a/lxd profiles/README.md b/lxd profiles/README.md new file mode 100644 index 0000000..05b1494 --- /dev/null +++ b/lxd profiles/README.md @@ -0,0 +1,3 @@ +# LXD Profiles + +The tentacle-docker profile sets up docker and docker compose, then installs the latest stable version of tentacle, tentacle-ui, and an nginx container. Using docker-compose, it creates an upstream network for the containers to communicate with one another and two volumes: one for the nginx configuration and one for the tentacle database. Port 80 is exposed and the tentacle graphql api is at the /api endpoint. \ No newline at end of file diff --git a/lxd profiles/tentacle-docker.yaml b/lxd profiles/tentacle-docker.yaml new file mode 100644 index 0000000..850c88e --- /dev/null +++ b/lxd profiles/tentacle-docker.yaml @@ -0,0 +1,109 @@ +config: + security.nesting: "true" + user.user-data: | + #cloud-config + package_update: true + package_upgrade: true + apt: + sources: + docker: + source: "deb [arch=amd64] https://download.docker.com/linux/ubuntu $RELEASE stable" + keyid: 0EBFCD88 + packages: + - apt-transport-https + - ca-certificates + - curl + - gnupg-agent + - software-properties-common + - docker-ce + write_files: + - path: /etc/environment + content: | + COMPOSE_HTTP_TIMEOUT=300 + DOCKER_CLIENT_TIMEOUT=300 + - path: /root/docker-compose.yml + permissions: 0644 + content: | + version: '3' + services: + tentacle: + restart: always + container_name: 'tentacle' + image: 'joyja/tentacle:version-0.0.31' + volumes: + - tentacleDB:/database + networks: + - upstream + tentacle-ui: + restart: always + container_name: 'tentacle-ui' + image: 'joyja/tentacle-ui:version-0.0.19' + networks: + - upstream + nginx: + container_name: 'nginx' + image: 'nginx' + volumes: + - /root/nginx.conf:/etc/nginx/conf.d/default.conf + ports: + - 80:80 + networks: + - upstream + depends_on: + - tentacle + - tentacle-ui + networks: + upstream: {} + volumes: + tentacleDB: {} + - path: /root/nginx.conf + permissions: 0644 + content: | + server { + listen 80; + listen [::]:80; + server_name _; + + location /api/ { + proxy_http_version 1.1; + proxy_cache_bypass $http_upgrade; + + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Port $server_port; + + proxy_pass http://tentacle:4000/; + } + + location / { + proxy_http_version 1.1; + proxy_cache_bypass $http_upgrade; + + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Port $server_port; + + proxy_pass http://tentacle-ui:3000/; + } + } + runcmd: + - 'sudo curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose' + - 'chmod +x /usr/local/bin/docker-compose' + - 'usermod -aG docker ubuntu' + - 'export DOCKER_CLIENT_TIMEOUT=300' + - 'export COMPOSE_HTTP_TIMEOUT=300' + - 'systemctl restart docker' + - '/usr/local/bin/docker-compose -f /root/docker-compose.yml up -d' + +description: Tentacle LXD Profile +name: tentacle \ No newline at end of file