### MQTT Adapter Configuration Examples Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/docs/adapters/mqtt.md Provides practical examples of valid MQTT adapter configurations, demonstrating both a minimal setup and a more complex scenario. These examples illustrate how to configure multiple brokers, set specific retention policies, and adjust data channel parameters. ```json { "AdapterType" : "MQTT", "Brokers": { "default-broker": { // MqttBrokerConfiguration properties here } } } ``` ```json { "AdapterType" : "MQTT", "Brokers": { "primary-broker": { // MqttBrokerConfiguration properties here }, "backup-broker": { // MqttBrokerConfiguration properties here } }, "ReadMode": "KeepAll", "MaxRetainSize" : 100, "MaxRetainPeriod" : 60000, "ReceivedDataChannelSize": 5000, "ReceivedDataChannelTimeout": 10000 } ``` -------------------------------- ### Target Configuration JSON Examples Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/docs/core/target-configuration.md Illustrative examples demonstrating various configurations for targets, including basic in-process setups with TargetType, and configurations utilizing TargetServer with credential providers. These examples show how to specify either a TargetType or a TargetServer, along with optional credential provider clients. ```json { "TargetType": "TargetTypeName" } ``` ```json { "TargetType": "TargetTypeName", "CredentialProviderClient": "IotCredentialsClientName" } ``` ```json { "TargetServer": "TrargetServerName", "CredentialProviderClient": "IotCredentialsClientName" } ``` -------------------------------- ### AWS Shopfloor Connectivity Greengrass Component Configuration Example Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/examples/greengrass-in-process/README.md A comprehensive configuration example for an AWS Greengrass component, demonstrating how to define OPC-UA data points, configure data targets like AWS S3 and IoT Core, specify custom target and adapter types, set up AWS IoT credential providers, and define component lifecycle scripts for installation and runtime. ```JSON "Name": "AbsoluteMachineOnTime", "NodeId": "ns=21;i=59050" }, "Machine1AbsolutePiecesIn": { "Name": "AbsolutePiecesIn", "NodeId": "ns=21;i=59068" }, "Machine1FeedSpeed": { "Name": "FeedSpeed", "NodeId": "ns=21;i=59039" } } } }, "Targets": { "DebugTarget": { "Active": true, "TargetType": "DEBUG-TARGET" }, "S3Target": { "Active": true, "TargetType": "AWS-S3", "Region": "[AWS BUCKET REGION]", "BucketName":"[REPLACE WITH YOUR S3 BUCKET FOR OPCUA DATA]", "CredentialProviderClient" :"AwsIotClient", "Interval": 10, "BufferSize": 1, "Prefix": "sfc", "Compression": "NONE" }, "IOTCore": { "Active": true, "TargetType": "AWS-IOT-MQTT", "Region": "[AWS IOT CORE REGION]", "TopicName":"sfc-greengrass", "Endpoint":"[AWS IOT DATA ENDPOINT]", "Certificate": "/greengrass/v2/thingCert.crt", "Key": "/greengrass/v2/privKey.key", "RootCA": "/greengrass/v2/rootCA.pem" } }, "TargetTypes": { "DEBUG-TARGET": { "JarFiles": [ "{com.amazon.sfc.debug-target:artifacts:path}/debug-target/lib" ], "FactoryClassName": "com.amazonaws.sfc.debugtarget.DebugTargetWriter" }, "AWS-S3": { "JarFiles": [ "{com.amazon.sfc.aws-s3-target:artifacts:path}/aws-s3-target/lib" ], "FactoryClassName": "com.amazonaws.sfc.awss3.AwsS3TargetWriter" }, "AWS-IOT-MQTT": { "JarFiles": [ "{com.amazon.sfc.aws-iot-mqtt-target:artifacts:path}/aws-iot-mqtt-target/lib" ], "FactoryClassName": "com.amazonaws.sfc.awsiot.mqtt.AwsIotMqttTargetWriter" } }, "AdapterTypes": { "OPCUA": { "JarFiles": [ "{com.amazon.sfc.opcua:artifacts:path}/opcua/lib" ], "FactoryClassName": "com.amazonaws.sfc.opcua.OpcuaAdapter" } }, "ProtocolAdapters": { "OPC-UA": { "AdapterType": "OPCUA", "OpcuaServers": { "OPCUA-SERVER-1": { "Address": "opc.tcp://localhost", "Path": "/", "Port": 4840, "ConnectTimeout": "10000", "ReadBatchSize": 500 } } } }, "AwsIotCredentialProviderClients": { "AwsIotClient": { "#ThingName": "", "#IotCredentialEndpoint": ".credentials.iot..amazonaws.com", "RoleAlias": "GreengrassV2TokenExchangeRoleAlias", "##Certificate": "[path to certificates here, commented out as GreenGrasDeploymentPath is set, so these are used]/Certificates/thingCert.crt", "##PrivateKey": "[path to certificates here, commented out as GreenGrasDeploymentPath is used]/privKey.key", "##RootCa": "[path to certificates here, commented out as GreenGrasDeploymentPath is used]/rootCA.pem", "SkipCredentialsExpiryCheck": false, "GreenGrasDeploymentPath": "/greengrass/v2" } } } } }, "Manifests": [ { "Platform": { "os": "linux" }, "Lifecycle": { "Install": { "RequiresPrivilege": true, "Script": "cd {artifacts:path} && tar -xvf sfc-main.tar.gz" }, "Run": { "RequiresPrivilege": true, "Script": "printf '{configuration:/SFC_CONFIG_JSON}' > {artifacts:path}/conf.json && {artifacts:path}/sfc-main/bin/sfc-main -config {artifacts:path}/conf.json", "Setenv": { "SFC_DEPLOYMENT_DIR": "{artifacts:path}" } } }, "Artifacts":[ { ``` -------------------------------- ### File Target Configuration JSON Examples Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/docs/targets/file.md Illustrative JSON configurations for file targets, demonstrating basic setup and usage with compression. ```json { "TargetType" : "FILE-TARGET", "Directory": "/data/logs", "Extension": ".json", "Json": true, "UtcTime": true, "Interval": 300, "BufferSize": 32 } ``` ```json { "TargetType" : "FILE-TARGET", "Directory": "/var/log/sensors", "Extension": ".json", "Compression": "GZip", "BufferSize": 64, "Interval": 600, "UtcTime": true } ``` -------------------------------- ### Illustrate MqttTargetConfiguration Usage Examples Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/docs/targets/mqtt.md These examples demonstrate various configurations for the MQTT target, including a basic setup with placeholders for credentials, a secure connection using Mutual TLS with certificates, and a configuration utilizing dynamic topic names based on metadata values. ```json { "TargetType" : "MQTT-TARGET", "EndPoint": "mqtt.example.com", "Port": 1883, "TopicName": "sensors/data", "QoS": 1, "Username": "${username}", "Password": "${password}", "ConnectionTimeout": 30000 } ``` ```json { "TargetType" : "MQTT-TARGET", "EndPoint": "secure-mqtt.example.com", "Port": 8883, "TopicName": "production/metrics", "Connection": "MutualTLS", "Certificate": "/path/to/client-cert.pem", "PrivateKey": "/path/to/private-key.pem", "RootCA": "/path/to/root-ca.pem", "QoS": 2, "Compression": "GZip", "BatchSize": 1024, "BatchInterval": 5000 } ``` ```json { "TargetType" : "MQTT-TARGET", "EndPoint": "mqtt.internal.com", "Port": 1883, "TopicName": "data/%location%/%line%/%source%", "AlternateTopicName": "data/sensors", "WarnAlternateTopicName": true } ``` -------------------------------- ### Example SLMP Adapter Configurations in JSON Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/docs/adapters/slmp.md These JSON examples provide complete configurations for the SLMP adapter. The first shows a basic setup with a single controller. The second demonstrates a more complex configuration including a custom `ProductData` structure, illustrating how to integrate controller and data structure definitions. ```json { "AdapterType": "SlmpAdapter", "Controllers": { "MainController": { "Address": "192.168.1.100", "Port": 1025, "NetworkNumber": 1, "StationNumber": 1 } } } ``` ```json { "Name": "BasicSlmpAdapter", "Controllers": { "MainController": { "Address": "192.168.1.100", "Port": 1025, "NetworkNumber": 1, "StationNumber": 1 } }, "Structures": { "ProductData": { "Fields": ["ItemCode", "Quantity", "Status"] } } } ``` -------------------------------- ### ClientProxyConfiguration JSON Examples Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/docs/core/client-proxy-configuration.md Provides various JSON configuration examples for ClientProxyConfiguration, demonstrating basic setup with only required fields, configurations with authentication credentials, setups including non-proxy addresses, and a comprehensive example showing all available fields. ```JSON { "ProxyHost": "proxy.example.com", "ProxyPort": 8080 } ``` ```JSON { "ProxyHost": "proxy.example.com", "ProxyPort": 8080, "Username": "${proxyuser}", "Password": "${proxypass}" } ``` ```JSON { "ProxyHost": "proxy.example.com", "ProxyPort": 8080, "NonProxyAddresses": "localhost,127.0.0.1,*.internal.example.com" } ``` ```JSON { "ProxyHost": "proxy.example.com", "ProxyPort": 8080, "Username": "${proxyuser}", "Password": "${proxypass}", "NonProxyAddresses": "localhost,127.0.0.1,*.internal.example.com,10.0.0.*" } ``` -------------------------------- ### Build SFC Custom API UI Config Provider with Gradle Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/examples/custom-api-ui-config-provider/README.md This command builds the `custom-api-ui-config-provider` project using Gradle. It assumes Gradle is installed and the current directory is within the project's example folder. The output will be a distributable artifact ready for deployment. ```shell ../../gradlew build ``` -------------------------------- ### Define SFC Version and Deployment Directory Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/README.md This shell script defines environment variables essential for the SFC framework's quick start. It dynamically fetches the latest release version tag from the official GitHub repository using `curl` and `jq`, and then sets a local directory path for SFC deployment. These variables are crucial for subsequent installation and setup procedures. ```Shell # Define sfc version and directory export VERSION=$(curl -s "https://api.github.com/repos/aws-samples/shopfloor-connectivity/tags" | jq -r '.[0].name') export SFC_DEPLOYMENT_DIR="./sfc" ``` -------------------------------- ### Set Up Local SFC Test Environment for CSV Adapter Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/examples/custom-adapter-csvfile/README.md This comprehensive shell script automates the setup of a local test environment for the SFC CSV adapter. It defines the SFC version, creates a deployment directory, downloads core SFC components from GitHub, copies the newly built CSV adapter, and includes sample CSV files for immediate testing. ```shell export VERSION="1.0.3" export SFC_DEPLOYMENT_DIR="sfc" mkdir $SFC_DEPLOYMENT_DIR && cd $SFC_DEPLOYMENT_DIR wget https://github.com/aws-samples/shopfloor-connectivity/releases/download/v$VERSION/\ {aws-s3-target,debug-target,opcua,sfc-main}.tar.gz cp ../distributions/csvfile.tar.gz . cp -r ../../src/main/resources/csv-samples . ``` -------------------------------- ### Start OPC-UA Sample Server Docker Container Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/examples/custom-api-ui-config-provider/README.md This command starts a Docker container running an OPC-UA sample server, which acts as a data source for the Shopfloor Connectivity (SFC) environment. It maps port 4840 from the container to the host, making the OPC-UA server accessible for SFC to connect to. ```shell docker run -d -p 4840:4840 ghcr.io/umati/sample-server:main ``` -------------------------------- ### JSON Configuration Example: Full Configuration Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/docs/core/tuning-configuration.md A comprehensive JSON configuration example showcasing all available parameters with custom values. This snippet illustrates how to set various channel sizes and timeouts across the Shopfloor Connectivity application, providing a complete operational setup. ```json { "AggregatorChannelSize": 1000, "AllSourcesReadTimeout": 1000, "ChannelSizePerMetricsProvider": 100, "MaxConcurrentSourceReaders": 16, "MetricsChannelTimeout": 1000, "ScheduleReaderResultsChannelSize": 1000, "ScheduleReaderResultsChannelTimeout": 1000, "TargetForwardingChannelSize": 1000, "TargetForwardingChannelTimeout": 1000, "TargetResubmitChannelSize": 1000, "TargetResubmitChannelTimeout": 1000, "TargetResultsChannelSize": 1000, "TargetResultsChannelTimeout": 1000, "WriterInputChannelSize": 1000, "WriterInputChannelSizeTimeout": 1000 } ``` -------------------------------- ### AWS IoT Core Target Configuration Examples Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/docs/targets/aws-iot-core.md Illustrative JSON configurations for the AWS IoT Core target, demonstrating various setups including credential provider usage, dynamic topic naming, and default AWS SDK credential chain. ```json { "TargetType" : "AWS-IOT-CORE", "TopicName": "device/data", "Region": "us-east-1", "BatchSize": 1024, "BatchCount": 100, "BatchInterval": 5000, "Compression": "GZIP", "Retain": true, "CredentialProviderClient": "aws-credentials-provider" } ``` ```json { "TargetType" : "AWS-IOT-CORE", "TopicName": "sensordata/%plant%/%line%/%source%", "Region": "us-east-1", "Compression": "ZIP", "Retain": true, "CredentialProviderClient": "aws-credentials-provider" } ``` ```json { "TargetType" : "AWS-IOT-CORE", "TopicName": "device/data", "Region": "us-east-1", "Compression": "GZIP", "Retain": true } ``` -------------------------------- ### Set Environment Variables for SFC Component Installation Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/examples/in-process-opcua-sitewise/README.md Defines essential environment variables, 'VERSION' for the Shopfloor Connectivity (SFC) component release and 'SFC_DEPLOYMENT_DIR' for its installation path. These variables are crucial for subsequent download and extraction steps. ```Shell export VERSION="1.0.3" export SFC_DEPLOYMENT_DIR="./sfc" ``` -------------------------------- ### AWS SNS Target Configuration Examples Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/docs/targets/aws-sns.md Illustrates practical configurations for an AWS SNS target, demonstrating setups with CredentialProviderClient and using the default AWS SDK credential provider chain. ```JSON { "TargetType" : "AWS-SNS", "TopicArn": "arn:aws:sns:us-east-1:123456789012:MyTopic", "Region": "us-east-1", "Subject": "Device Telemetry", "Compression": "None", "CredentialProviderClient": "aws-credentials-provider" } ``` ```JSON { "TargetType" : "AWS-SNS", "TopicArn": "arn:aws:sns:us-east-1:123456789012:MyTopic", "Region": "us-east-1", "Subject": "Device Telemetry", "Compression": "None" } ``` -------------------------------- ### Start SFC Main Service with Configuration Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/examples/ipc-ads-s3/README.md This command starts the central sfc-main module, which orchestrates data processing and distribution between adapters and targets. It requires a configuration file that specifies the network addresses and ports of the previously started adapter and target services. ```bash $ sfc-main/bin/sfc-main -config ipc-ads-s3/ipc-ads-s3.json 2023-11-10 17:22:48.230 INFO - Creating configuration provider of type ConfigProvider 2023-11-10 17:22:48.246 INFO - Waiting for configuration 2023-11-10 17:22:48.251 INFO - Sending initial configuration from file "in-process-ads-s3.json" 2023-11-10 17:22:48.816 INFO - Received configuration data from config provider 2023-11-10 17:22:48.819 INFO - Waiting for configuration 2023-11-10 17:22:48.819 INFO - Creating and starting new service instance 2023-11-10 17:22:49.03 INFO - Created instance of service MainControllerService 2023-11-10 17:22:49.03 INFO - Running service instance 2023-11-10 17:22:49.08 INFO - Creating an IPC process writer for target "DebugTarget", for server "DebugTargetServer" on server DebugTargetServer 2023-11-10 17:22:49.12 INFO - Creating an IPC process writer for target "S3Target", for server "S3TargetServer" on server S3TargetServer 2023-11-10 17:22:49.13 INFO - Creating client to connect to IPC service localhost:50002 using connection type PlainText 2023-11-10 17:22:49.13 INFO - Creating client to connect to IPC service localhost:50003 using connection type PlainText 2023-11-10 17:22:49.18 INFO - No adapter or target metrics are collected 2023-11-10 17:22:49.19 INFO - Initializing IPC source adapter service on localhost:50001 2023-11-10 17:22:49.19 INFO - Creating client to connect to IPC service localhost:50001 using connection type PlainText 2023-11-10 17:22:49.150 INFO - Initializing IPC target service for "DebugTarget" on server localhost:50003 2023-11-10 17:22:49.151 INFO - Initializing IPC target service for "S3Target" on server localhost:50002 2023-11-10 17:22:49.154 INFO - Sending configuration “{ EDITED }” to target "DebugTarget" 2023-11-10 17:22:49.169 INFO - Sending configuration “{ EDITED }” to target "S3Target" 2023-11-10 17:22:49.226 INFO - IPC server for target "S3Target" initialized 2023-11-10 17:22:49.226 INFO - IPC server for target "DebugTarget" initialized ``` -------------------------------- ### OPC UA Adapter Configuration JSON Examples Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/docs/adapters/opcua.md Provides two examples of OPC UA adapter configurations in JSON format. The first shows a basic setup with two servers, while the second demonstrates a more complex configuration including server profiles with custom event types. ```JSON { "AdapterType" : "OPCUA-TARGET", "OpcuaServers": { "Server1": { "Address": "site1.company.com", "Port": 4840 }, "Server2": { "Address": "site2.company.com", "Port": 4840 } } } ``` ```JSON { "AdapterType" : "OpcuaAdapterType", "OpcuaServers": { "Server1": { "Address": "site1.company.com", "Port": 4840, "ServerProfile" : "StandardProfile" }, "Server2": { "Address": "site2.company.com", "Port": 4840, "ServerProfile" : "StandardProfile" } }, "ServerProfiles": { "StandardProfile": { "EventTypes": { "ProcessEvent": { "NodeId": "ns=2;s=ProcessEventType", "Properties": ["ProcessId", "Value", "Timestamp", "Quality"] }, "SystemEvent": { "NodeId": "ns=2;s=SystemEventType", "Properties": ["EventId", "Severity", "Message"] } } } } } ``` -------------------------------- ### Execute AWS SFC Application with Configuration Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/examples/custom-adapter-csvfile/README.md This shell command starts the AWS Shopfloor Connectivity (SFC) main application, specifying the previously created `example.json` file as its configuration. This initiates the data processing pipeline as defined in the configuration, such as reading from CSV files and sending data to the debug target. ```shell sfc/sfc-main/bin/sfc-main -config sfc/example.json ``` -------------------------------- ### NATS Server Connection Configuration Examples Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/docs/targets/nats.md Provides practical JSON examples demonstrating various NATS server connection configurations, including basic setup, secure connections with TLS, token-based authentication, and authentication using credentials and NKey files. ```JSON { "TargetType" : "NATS-TARGET", "Url": "nats://localhost:4222", "Username": "${user}", "Password": "${password}", "ConnectRetries": 3, "WaitAfterConnectError": 5000 } ``` ```JSON { "Url": "nats://nats.example.com:4222", "Tls": { "CertificateFile": "/path/to/client-cert.pem", "PrivateKeyFile": "/path/to/private-key.pem" }, "ConnectRetries": 5, "WaitAfterConnectError": 10000 } ``` ```JSON { "Url": "nats://nats-server:4222", "Token": "${token}", "ConnectRetries": 3, "WaitAfterConnectError": 3000 } ``` ```JSON { "Url": "nats://prod.nats.com:4222", "CredentialsFile": "/path/to/credentials.creds", "NKeyFile": "/path/to/user.nkey" } ``` -------------------------------- ### Configure Protocol Adapter Service in SFC-Core Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/examples/ipc-slmp-s3/README.md Illustrates how to configure a protocol adapter to run as a service, specifying its server reference and defining the server's address and port in an external configuration file. This setup allows SFC-Core to communicate with the adapter service. ```APIDOC Protocol Adapter Service Configuration: 1. Main Configuration (e.g., config.json): ```json "ProtocolAdapters": { "SLMP": { "AdapterServer": "SlmpAdapterServer" } } ``` - `AdapterServer`: Specifies the name of the server definition to use from the `AdapterServers` section. 2. Adapter Servers Reference (e.g., config.json): ```json "AdapterServers": "@file:servers.json@Adapters" ``` - `AdapterServers`: References an external file (`servers.json`) and a specific section (`Adapters`) for server definitions. 3. Server Definition (e.g., servers.json - 'Adapters' section): ```json "Adapters" : { "SlmpAdapterServer": { "Address": "", "Port": "" } } ``` - `SlmpAdapterServer`: A named server definition. - `Address`: IP address or hostname of the adapter service. - `Port`: Port number of the adapter service. Must match the port used to start the adapter service. ``` -------------------------------- ### Start SFC Main Application with Custom Configuration Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/examples/custom-api-ui-config-provider/README.md This command launches the main AWS Shopfloor Connectivity (SFC) application, instructing it to use the `custom-api-ui-config-provider.json` file for its configuration. This initiates the SFC service with the custom log writer and config provider settings, enabling the custom functionalities. ```shell sfc/sfc-main/bin/sfc-main -config custom-api-ui-config-provider.json ``` -------------------------------- ### OPC UA Node Channel Configuration JSON Examples Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/docs/adapters/opcua.md Provides various JSON examples demonstrating how to configure OPC UA node channels for different scenarios, including basic node setup, applying change filters, monitoring events, and specifying array index ranges for data acquisition. ```json { "Name": "Temperature", "NodeId": "ns=2;i=1234", "Description": "Temperature sensor reading" } ``` ```json { "Name": "Pressure", "NodeId": "ns=3;s=Pressure_Sensor_01", "NodeChangeFilter": { "Type": "Percent", "Value": 5.0 }, "Description": "Pressure sensor with 5% change filter" } ``` ```json { "Name": "AlarmEvent", "NodeId": "ns=2;i=1000", "EventType": "AlarmType", "EventSamplingInterval": 1000, "Description": "Equipment alarm monitoring" } ``` ```json { "Name": "VibrationArray", "NodeId": "ns=4;s=VibrationSensors", "IndexRange": "0:3", "Description": "First 4 elements of vibration sensor array" } ``` -------------------------------- ### Initialize Application and Handle Page Unload Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/examples/custom-api-ui-config-provider/src/main/resources/static/editor.html This snippet orchestrates the initial setup of the application by calling functions to load configuration from the database, start the WebSocket connection, set the page title, and parse the URL. It also registers an event listener for the `beforeunload` event to gracefully close the WebSocket connection when the user navigates away from the page. ```JavaScript loadCfgFromDB(); startWebsocket(); setTitle(); parseUrl(); //close socket on page reload window.addEventListener('beforeunload', function (e) { e.preventDefault(); e.returnValue = ''; ws.close(); }); ``` -------------------------------- ### Download and Extract Shopfloor Connectivity Bundles Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/examples/in-process-opcua-sitewise/README.md Downloads precompiled Shopfloor Connectivity (SFC) component bundles from the official GitHub releases and extracts them into the specified deployment directory. This command prepares the necessary executables for the SFC component to run. ```Shell mkdir $SFC_DEPLOYMENT_DIR && cd $SFC_DEPLOYMENT_DIR wget https://github.com/aws-samples/shopfloor-connectivity/releases/download/v$VERSION/\ {aws-sitewise-target,debug-target,opcua,sfc-main}.tar.gz for file in *.tar.gz; do tar -xf "$file" rm "$file" done cd - ``` -------------------------------- ### Execute SFC Main with Configuration File Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/examples/in-process-iot-core-opcua-write/README.md This console command demonstrates how to execute the `sfc-main` application, passing the `iot-core-opcua-write.json` file as its configuration. This command initiates the SFC process using the defined settings for AWS IoT Core and OPC UA integration. Ensure that the `sfc-main` executable is located in the `sfc-main/bin` directory relative to the current working directory. ```console sfc-main/bin/sfc-main -config ./iot-core-opcua-write.json ``` -------------------------------- ### Illustrate Simulator Adapter Configuration Example Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/docs/adapters/simulator.md This JSON example shows a minimal configuration for the Simulator adapter, specifying its type as 'SIMULATOR'. It serves as a basic illustration of how to instantiate the adapter. ```json { "AdapterType": "SIMULATOR" } ``` -------------------------------- ### Examples of MQTT Topic Name Mapping Configuration Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/docs/adapters/mqtt.md Provides various examples of the 'TopicNameMappingConfiguration', ranging from a minimal setup to more complex scenarios involving multiple mappings, regular expressions with capturing groups, and the inclusion of unmapped topics. These examples demonstrate practical applications of topic transformation. ```json { "Mappings": { "source/topic": "target/topic" } } { "IncludeUnmappedTopics": false, "Mappings": { "device/(\\w+)/temperature": "sensors/temp/{1}" } } { "IncludeUnmappedTopics": true, "Mappings": { "device/(\\w+)/temperature": "sensors/tempe/{1}", "device/(\\w+)/humidity": "sensors//humid/{1}", "factory/line-(\\w+)": "production/line/{1}" } } ``` -------------------------------- ### Beckhoff PLC ADS Device Configuration Examples Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/docs/adapters/ads.md Illustrates how to configure Beckhoff PLC ADS devices using JSON. Includes a basic configuration example with essential parameters and a full configuration example demonstrating all available properties and their typical values for comprehensive setup. ```JSON { "Address": "192.168.1.100", "Port": 48898 } ``` ```JSON { "Address": "192.168.1.100", "Port": 48898, "CommandTimeout": 5000, "ConnectTimeout": 10000, "ReadTimeout": 1000, "WaitAfterConnectError": 5000, "WaitAfterReadError": 1000, "WaitAfterWriteError": 1000 } ``` -------------------------------- ### Start SFC Main Service with Configuration on Linux Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/examples/ipc-slmp-s3/README.md This command launches the core sfc-main service, which orchestrates data processing and communication between adapters and targets. It requires a configuration file (e.g., 'ipc-slmp-s3.json') that specifies the addresses and ports of the previously started adapter and target services. Upon startup, sfc-main distributes configuration to these services. ```bash $ sfc-main/bin/sfc-main -config ipc-slmp-s3.json Picked up JAVA_TOOL_OPTIONS: -Dlog4j2.formatMsgNoLookups=true 2024-07-22 19:31:56.895 INFO - Creating configuration provider of type ConfigProvider 2024-07-22 19:31:56.902 INFO - Waiting for configuration 2024-07-22 19:31:56.904 INFO - Sending initial configuration from file "ipc-slmp-s3.json" 2024-07-22 19:31:57.199 INFO - Received configuration data from config provider 2024-07-22 19:31:57.200 INFO - Waiting for configuration 2024-07-22 19:31:57.200 INFO - Creating and starting new service instance 2024-07-22 19:31:57.288 INFO - Created instance of service MainControllerService 2024-07-22 19:31:57.289 INFO - Running service instance 2024-07-22 19:31:57.292 INFO - Creating an IPC process writer for target "DebugTarget", for server "DebugTargetServer" on server DebugTargetServer 2024-07-22 19:31:57.294 INFO - Creating an IPC process writer for target "S3Target", for server "S3TargetServer" on server S3TargetServer 2024-07-22 19:31:57.295 INFO - Creating client to connect to IPC service localhost:50003 using connection type PlainText 2024-07-22 19:31:57.295 INFO - Creating client to connect to IPC service localhost:50002 using connection type PlainText 2024-07-22 19:31:57.298 INFO - No adapter or target metrics are collected 2024-07-22 19:31:57.299 INFO - Initializing IPC source adapter service on localhost:50001 2024-07-22 19:31:57.299 INFO - Creating client to connect to IPC service localhost:50001 using connection type PlainText 2024-07-22 19:31:57.349 INFO - Initializing IPC target service for "S3Target" on server localhost:50003 2024-07-22 19:31:57.349 INFO - Initializing IPC target service for "DebugTarget" on server localhost:50002 2024-07-22 19:31:57.351 INFO - Sending configuration "{ EDITED }" to target "DebugTarget" 2024-07-22 19:31:57.357 INFO - Sending configuration "{ EDITED }" to target "S3Target" 2024-07-22 19:31:57.387 INFO - IPC server for target "S3Target" initialized ``` -------------------------------- ### Example Configuration for IPC Metrics Writer Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/docs/core/metrics-configuration.md Illustrates a MetricsConfiguration setup using an IPC (Inter-Process Communication) writer. This example specifies common dimensions for metrics and configures the metrics server address and port for data transmission. ```json { "Writer": { "CommonDimensions": { "Environment": "Production", "Plant": "us-west" }, "Interval": 60, "MetricsServer": { "Address": "localhost", "Port": 50000 } } } ``` -------------------------------- ### J1939 Adapter Configuration Example: Virtual CAN Interfaces Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/docs/adapters/j1939.md An example configuration for the J1939 adapter demonstrating setup with two virtual CAN interfaces (vcan0, vcan1) for testing purposes. It specifies a temporary DBC file path. ```json { " "CanSockets": { "Can0" : { "SocketName" : "vcan0" }, "Can1" : { "SocketName" : "vcan1" } }, "DbcFile": "/tmp/test_j1939.dbc" } ``` -------------------------------- ### Start ADS Protocol Adapter Service Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/examples/ipc-ads-s3/README.md This command initiates the ADS protocol adapter service, which acts as a data source. It must be started before the sfc-main module and listens on a specified port (e.g., 50001) for configuration and data streaming. ```bash $ ads/bin/ads -port 50001 2023-11-10 17:03:17.814 INFO - Created instance of service IpcAdapterService 2023-11-10 17:03:17.815 INFO - Running service instance 2023-11-10 17:03:18.264 INFO - IPC protocol service started, listening on 192.168.1.65:50001, connection type is PlainText ``` -------------------------------- ### Start Test OPCUA Server with Docker Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/examples/greengrass-in-process/README.md This command starts a Docker container running a test OPCUA server. It exposes port 4840, allowing the Greengrass component to connect and read data from the server. ```bash docker run -d -p 4840:4840 ghcr.io/umati/sample-server:main ``` -------------------------------- ### Start SLMP Adapter Service on Linux Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/examples/ipc-slmp-s3/README.md This command initiates the SLMP protocol adapter service, which listens on a specified port (e.g., 50001) for configuration from the sfc-main module. It should be started before sfc-main to ensure it's ready to receive its operational parameters. ```bash $ slmp/bin/slmp -port 50001 2024-07-22 19:26:31.965 INFO - Created instance of service IpcAdapterService 2024-07-22 19:26:31.965 INFO - Running service instance 2024-07-22 19:26:32.385 INFO - IPC protocol serv ``` -------------------------------- ### Server Configuration with Server-Side TLS Example Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/docs/core/server-configuration.md An example JSON configuration for a server secured with server-side TLS, listening on port 443. It includes compression and a custom timeout for the results channel, showcasing a more robust secure setup for production environments. ```json { "Address": "server.example.com", "Port": 443, "ConnectionType": "ServerSideTLS", "Compression": true, "ServerResultsChannelTimeout": 2000 } ``` -------------------------------- ### Server Configuration with Mutual TLS Example Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/docs/core/server-configuration.md An example JSON configuration demonstrating a server setup with mutual TLS, including paths to CA, client certificates, and private key. This configuration provides the highest level of security by requiring both server and client authentication. ```json { "Address": "192.168.1.100", "Port": 8443, "ConnectionType": "MutualTLS", "CaCertificate": "/path/to/ca.crt", "ClientCertificate": "/path/to/client.crt", "ClientPrivateKey": "/path/to/client.key", "ExpirationWarningPeriod": 30, "Compression": true } ``` -------------------------------- ### Start SFC-Main Service with Configuration on Linux Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/examples/ipc-opcua-msk/README.md This command starts the sfc-main service, which acts as the central orchestrator for data flow between adapters and targets. It requires a configuration file (e.g., 'ipc-opcua-msk.json') that specifies the addresses and ports of the various adapter and target services. ```bash sfc-main/bin/sfc-main -config "ipc-opcua-msk.json" 2024-02-15 17:41:54.51 INFO - Creating configuration provider of type ConfigProvider 2024-02-15 17:41:54.62 INFO - Waiting for configuration 2024-02-15 17:41:54.65 INFO - Sending initial configuration from file "msk 3.json" 2024-02-15 17:41:54.577 INFO - Received configuration data from config provider 2024-02-15 17:41:54.578 INFO - Waiting for configuration 2024-02-15 17:41:54.579 INFO - Creating and starting new service instance 2024-02-15 17:41:54.744 INFO - Created instance of service MainControllerService 2024-02-15 17:41:54.744 INFO - Running service instance 2024-02-15 17:41:54.748 INFO - Creating an IPC process writer for target "DebugTarget", for server "DebugTargetServer" on server DebugTargetServer 2024-02-15 17:41:54.751 INFO - Creating an IPC process writer for target "MskTarget", for server "MskTargetServer" on server MskTargetServer 2024-02-15 17:41:54.752 INFO - Creating client to connect to IPC service localhost:50002 using connection type PlainText 2024-02-15 17:41:54.752 INFO - Creating client to connect to IPC service localhost:50001 using connection type PlainText 2024-02-15 17:41:54.756 INFO - No adapter or target metrics are collected 2024-02-15 17:41:54.757 INFO - Initializing IPC source adapter service on localhost:50000 2024-02-15 17:41:54.757 INFO - Creating client to connect to IPC service localhost:50000 using connection type PlainText 2024-02-15 17:41:54.861 INFO - Initializing IPC target service for "DebugTarget" on server localhost:50001 2024-02-15 17:41:54.861 INFO - Initializing IPC target service for "MskTarget" on server localhost:50002 2024-02-15 17:41:54.866 INFO - Sending configuration "{ ...EDITED... }" to target "DebugTarget" 2024-02-15 17:41:54.880 INFO - Sending configuration "{ ...EDITED... }" to target "MskTarget" 2024-02-15 17:41:54.934 INFO - IPC server for target "DebugTarget" initialized ``` -------------------------------- ### Basic PlainText Server Configuration Example Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/docs/core/server-configuration.md An example JSON configuration for a server using a plain text connection, listening on port 8080 with compression enabled. This demonstrates a minimal setup without advanced security features, suitable for development or internal networks. ```json { "Address": "localhost", "Port": 8080, "Compression": true } ``` -------------------------------- ### Example RestServerConfiguration JSON Payloads Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/docs/adapters/rest.md These examples illustrate how to configure a REST server using the defined schema. The first example shows a basic configuration with server URL, content headers, and a request timeout. The second demonstrates a more secure setup, including a specific port, authentication headers (API-Key, Authorization), maximum retries, and retry wait times. ```json { "Server": "https://api.example.com", "Headers": { "Content-Type": "application/json", "Accept": "application/json" }, "RequestTimeout": 5000 } ``` ```json { "Server": "https://secure-api.example.com", "Port": 443, "Headers": { "Content-Type": "application/json", "Accept": "application/json", "API-Key": "${key}", "Authorization": "${token}" }, "MaxRetries" : 5, "RequestTimeout": 5000, "WaitBeforeRetry": 1000 } ``` -------------------------------- ### Start OPCUA Adapter Service on Linux Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/examples/ipc-opcua-msk/README.md This command initiates the OPCUA adapter service, which listens on a specified port (e.g., 50000). This adapter is responsible for collecting data from OPCUA sources and streaming it to the sfc-main process. ```bash $ opcua/bin/opcua -port 50000 2024-02-15 17:35:01.739 INFO - Created instance of service IpcAdapterService 2024-02-15 17:35:01.739 INFO - Running service instance 2024-02-15 17:35:02.326 INFO - IPC protocol service started, listening on 192.168.1.65:50000, connection type is PlainText ``` -------------------------------- ### Server Configuration with Health Probe Example Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/docs/core/server-configuration.md An example JSON configuration for a plain text server that includes a health probe definition. This setup allows external systems to monitor the server's health status via a specified port and path, ensuring service availability. ```json { "Address": "192.168.1.100", "Port": 9000, "ConnectionType": "PlainText", "HealthProbe": { "Port": 8080, "Path": "/health" } } ``` -------------------------------- ### Example OPC UA Source Configuration JSON Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/docs/adapters/opcua.md An illustrative JSON example demonstrating a typical configuration for an OPC UA source, including its name, reading mode, protocol adapter, server reference, and definitions for multiple data channels (Temperature, Pressure). ```JSON { "Name": "ProductionLine1", "SourceReadingMode" : "Subscription", "ProtocolAdapter": "OpcuaAdapter", "AdapterOpcuaServer" : "OpcuaServer1", "Channels": { "Temperature": { "Name": "temperature", "NodeId": "ns=2;i=1234", "Description": "Temperature sensor reading" }, "Pressure": { "Name": "pressure", "NodeId": "ns=2;i=1235", "Description": "Pressure sensor reading" } } } ``` -------------------------------- ### Comprehensive Channel Configuration Example Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/docs/core/channel-configuration.md Presents a complete channel configuration demonstrating the combination of various properties including name, description, transformation, value filter, decompose, spread, and extensive metadata. This example showcases a robust setup for complex industrial data streams. ```json { "Name": "production_line_sensor", "Description": "Main production line monitoring sensor", "Transformation": "productionDataTransform", "ValueFilter": "validRangeFilter", "Decompose": true, "Spread": false, "Metadata": { "line_id": "PL-123", "location": "Factory-1", "department": "Assembly", "criticality": "high" } } ``` -------------------------------- ### Execute Shopfloor Connectivity (SFC) Application Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/examples/in-process-opcua-sitewise/README.md This command navigates to the user's environment directory and then executes the `sfc-main` application. It uses a specific configuration file, `inproc-sitewise_config.json`, to define the data ingestion parameters for AWS IoT SiteWise. ```bash cd ~/environment sfc/sfc-main/bin/sfc-main -config sfc/inproc-sitewise_config.json ``` -------------------------------- ### Example RoutesConfiguration JSON Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/docs/targets/router.md Provides various JSON examples for `RoutesConfiguration`, demonstrating basic routing with both alternate and success targets, failover-only configurations, and success-route-only configurations. ```json { "Alternate": "fallback-target", "Success": "archive-target" } ``` ```json { "Alternate": "fallback-target" } ``` ```json { "Success": "analytics-target" } ``` -------------------------------- ### AWS S3 Target Configuration JSON Examples Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/docs/targets/aws-s3.md Illustrative JSON configurations for the AWS S3 Target, demonstrating setup with a `CredentialProviderClient` and using the default AWS SDK credential provider chain. These examples showcase common property settings for S3 bucket integration. ```JSON { "TargetType" : "AWS-S3", "BucketName": "your-bucket-name", "Region": "us-east-1", "BufferSize": 10, "Interval": 60, "Compression": "GZip", "Prefix": "data/", "CredentialProviderClient": "aws-credentials-provider" } ``` ```JSON { "TargetType" : "AWS-S3", "BucketName": "your-bucket-name", "Region": "us-east-1", "BufferSize": 16, "Interval": 300, "Compression": "Zip", "Prefix": "data/" } ``` -------------------------------- ### JSON Examples for Square Wave Simulation Configuration Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/docs/adapters/simulator.md Illustrates various configurations for square wave simulations, demonstrating how to set minimum, maximum, and data type parameters for generating integer values within specified ranges. ```json { "SimulationType" : "Square", "DataType" : "Int", "Min" : 0, "Max" : 100 } ``` ```json { "SimulationType" : "Square", "DataType" : "Int", "Min" : 100, "Max" : 200 } ``` -------------------------------- ### AWS SFC Custom API and UI Configuration Example Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/examples/custom-api-ui-config-provider/README.md An example JSON configuration for AWS Shopfloor Connectivity, demonstrating the setup for a custom API and UI configuration provider. It includes definitions for log writer, config provider, schedules, OPC UA sources with specific channels, and debug targets, illustrating how to integrate custom components and define data acquisition parameters. ```JSON { "AWSVersion":"2022-04-02", "Name":"Custom SFC API and UX Config Provider Example", "LogWriter":{ "JarFiles":["${SFC_DEPLOYMENT_DIR}/custom-api-ui-config-provider/lib"], "FactoryClassName":"com.amazonaws.sfc.log.SocketLogWriter" }, "ConfigProvider":{ "Port":5000, "JarFiles":["${SFC_DEPLOYMENT_DIR}/custom-api-ui-config-provider/lib"], "FactoryClassName":"com.amazonaws.sfc.config.CustomApiUiConfigProvider" }, "Version":1, "LogLevel":"Info", "ElementNames":{ "Value":"value", "Timestamp":"timestamp", "Metadata":"metadata" }, "Schedules":[ { "Name":"OPCUA-INIT-Schedule", "Interval":500, "Description":"", "Active":true, "TimestampLevel":"Both", "Sources":{ "OPCUA-SOURCE":["*"] }, "Targets":["DebugTarget"] } ], "Sources":{ "OPCUA-SOURCE":{ "Name":"OPCUA-SOURCE", "ProtocolAdapter":"OPC-UA", "AdapterOpcuaServer":"OPCUA-SERVER-1", "Description":"OPCUA local test server", "SourceReadingMode":"Polling", "SubscribePublishingInterval":100, "Channels":{ "ServerStatus":{"Name":"ServerStatus","NodeId":"ns=0;i=2256"}, "ServerTime":{"Name":"ServerTime","NodeId":"ns=0;i=2256","Selector":"@.currentTime"}, "State":{"Name":"State","NodeId":"ns=0;i=2259"}, "Machine1AbsoluteErrorTime":{"Name":"AbsoluteErrorTime","NodeId":"ns=21;i=59048"}, "Machine1AbsoluteLength":{"Name":"AbsoluteLength","NodeId":"ns=21;i=59066"}, "Machine1AbsoluteMachineOffTime":{"Name":"AbsoluteMachineOffTime","NodeId":"ns=21;i=59041"}, "Machine1AbsoluteMachineOnTime":{"Name":"AbsoluteMachineOnTime","NodeId":"ns=21;i=59050"}, "Machine1AbsolutePiecesIn":{"Name":"AbsolutePiecesIn","NodeId":"ns=21;i=59068"}, "Machine1FeedSpeed":{"Name":"FeedSpeed","NodeId":"ns=21;i=59039"} } } }, "Targets":{ "DebugTarget":{ "Active":true, "TargetType":"DEBUG-TARGET" } }, "TargetTypes":{ "DEBUG-TARGET":{ "JarFiles":["${SFC_DEPLOYMENT_DIR}/debug-target/lib"], "FactoryClassName":"com.amazonaws.sfc.debugtarget.DebugTargetWriter" } }, "AdapterTypes":{ "OPCUA":{ "JarFiles":["${SFC_DEPLOYMENT_DIR}/opcua/lib"], "FactoryClassName":"com.amazonaws.sfc.opcua.OpcuaAdapter" } }, "ProtocolAdapters":{ "OPC-UA":{ "AdapterType":"OPCUA", "OpcuaServers":{ "OPCUA-SERVER-1":{ "Address":"opc.tcp://localhost", "Path":"/", "Port":4840, "ConnectTimeout":"10000", "ReadBatchSize":500 } } } } } ``` -------------------------------- ### Start Test OPCUA Server with Docker Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/examples/greengrass-ipc/README.md This command starts a Docker container running a test OPCUA server. It maps port 4840 from the container to the host, allowing external access to the server. This server is used to simulate an OPCUA data source for testing the AWS Shopfloor Connectivity solution. ```bash docker run -d -p 4840:4840 ghcr.io/umati/sample-server:main ``` -------------------------------- ### Example Store and Forward Target Configuration Source: https://github.com/aws-samples/shopfloor-connectivity/blob/mainline/docs/targets/store-and-forward-target.md A practical example demonstrating how to configure the Store and Forward Target using JSON. This snippet illustrates typical settings for directory, targets, FIFO behavior, and retention policies. ```JSON { "TargetType" : "STORE-FORWARD", "Directory": "./store", "Targets": ["s3-target", "iot-core-target"], "Fifo": true, "RetainSize": 10240, "RetainFiles": 1000, "CleanupInterval": 60 } ```