Fixes and starts working on Ubuntu Core compatibility
This commit is contained in:
Binary file not shown.
BIN
Modbus Map.xlsx
BIN
Modbus Map.xlsx
Binary file not shown.
0
db_coils.csv
Normal file
0
db_coils.csv
Normal file
|
|
0
db_discrete_inputs.csv
Normal file
0
db_discrete_inputs.csv
Normal file
|
|
0
db_holding_registers.csv
Normal file
0
db_holding_registers.csv
Normal file
|
|
0
db_input_registers.csv
Normal file
0
db_input_registers.csv
Normal file
|
|
@@ -1,19 +1,23 @@
|
|||||||
version : '2'
|
version : '2'
|
||||||
services:
|
services:
|
||||||
mongodb:
|
mongodb:
|
||||||
image: docker.henrypump.cloud/poc_modbus/mongodb
|
# image: docker.henrypump.cloud/poc_modbus/mongodb
|
||||||
|
image: 860246592755.dkr.ecr.us-east-1.amazonaws.com/mongodb
|
||||||
ports:
|
ports:
|
||||||
- "27017:27017"
|
- "27017:27017"
|
||||||
restart: on-failure
|
restart: on-failure
|
||||||
scraper:
|
scraper:
|
||||||
image: docker.henrypump.cloud/poc_modbus/scraper
|
# image: docker.henrypump.cloud/poc_modbus/scraper
|
||||||
|
image: 860246592755.dkr.ecr.us-east-1.amazonaws.com/poc-modbus/poc-scraper
|
||||||
depends_on:
|
depends_on:
|
||||||
- modbus_server
|
- modbus_server
|
||||||
restart: on-failure
|
restart: on-failure
|
||||||
environment:
|
environment:
|
||||||
- PLC_IP_ADDRESS=192.168.1.10
|
# - PLC_IP_ADDRESS=192.168.1.10
|
||||||
|
- PLC_IP_ADDRESS=1609.denise.henryres.cloudcnx.net
|
||||||
modbus_server:
|
modbus_server:
|
||||||
image: docker.henrypump.cloud/poc_modbus/modbus_server
|
# image: docker.henrypump.cloud/poc_modbus/modbus_server
|
||||||
|
image: 860246592755.dkr.ecr.us-east-1.amazonaws.com/poc-modbus/poc-modbus-server
|
||||||
depends_on:
|
depends_on:
|
||||||
- mongodb
|
- mongodb
|
||||||
links:
|
links:
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ log.setLevel(logging.INFO)
|
|||||||
# ---------------------------------------------------------------------------#
|
# ---------------------------------------------------------------------------#
|
||||||
# Modbus Client Setup
|
# Modbus Client Setup
|
||||||
# ---------------------------------------------------------------------------#
|
# ---------------------------------------------------------------------------#
|
||||||
modbus_client = ModbusClient('localhost', port=502)
|
modbus_client = ModbusClient('modbus.theta.poconsole.net', port=502)
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------#
|
# ---------------------------------------------------------------------------#
|
||||||
# Mongo DB Setup
|
# Mongo DB Setup
|
||||||
|
|||||||
22
resources/preparemongo
Executable file
22
resources/preparemongo
Executable file
@@ -0,0 +1,22 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
if [[ $(uname -m) == "x86_64" ]]
|
||||||
|
then
|
||||||
|
wget --backups=0 "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1604-3.2.7.tgz"
|
||||||
|
tar -zxf ./mongodb-linux-x86_64-ubuntu1604-3.2.7.tgz --strip-components=1
|
||||||
|
else
|
||||||
|
IFS=" " read -a links <<< $(apt-get -y --print-uris install mongodb | egrep -o "https?://[^']+")
|
||||||
|
for link in ${links[@]}
|
||||||
|
do
|
||||||
|
wget --backups=0 ${link}
|
||||||
|
done
|
||||||
|
|
||||||
|
IFS=" " read -a deb_pkgs <<< $(ls ./ | egrep "\.deb")
|
||||||
|
for pkg in ${deb_pkgs[@]}
|
||||||
|
do
|
||||||
|
echo "Extracting ${pkg}..."
|
||||||
|
dpkg-deb -R ${pkg} ./
|
||||||
|
done
|
||||||
|
|
||||||
|
mv usr/bin bin
|
||||||
|
fi
|
||||||
5
resources/preparescraper
Normal file
5
resources/preparescraper
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
pip install requests pymongo pymodbus cryptography pyasn1
|
||||||
|
pip install git+https://github.com/Henry-Pump/Pycomm-Helper.git
|
||||||
|
pip install git+https://github.com/ruscito/pycomm.git
|
||||||
2
resources/startmongo
Executable file
2
resources/startmongo
Executable file
@@ -0,0 +1,2 @@
|
|||||||
|
env LC_ALL=C mongod --bind_ip 127.0.0.1 --pidfilepath $SNAP_COMMON/mongod.pid --smallfiles --journal --dbpath=$SNAP_COMMON --replSet rs0
|
||||||
|
|
||||||
48
snap/snapcraft.yaml
Normal file
48
snap/snapcraft.yaml
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
name: poc-modbus
|
||||||
|
version: '0.1'
|
||||||
|
summary: Modbus TCP Server for Henry POC
|
||||||
|
description: Serves POC data from the Henry POC over Modbus TCP
|
||||||
|
assumes: [snapd2.21]
|
||||||
|
grade: devel
|
||||||
|
confinement: devmode
|
||||||
|
|
||||||
|
apps:
|
||||||
|
poc-mongo:
|
||||||
|
command: startmongo
|
||||||
|
daemon: simple
|
||||||
|
plugs: [network, network-bind]
|
||||||
|
mongo:
|
||||||
|
command: env LC_ALL=C mongo
|
||||||
|
plugs: [network]
|
||||||
|
poc-scraper:
|
||||||
|
command: pocscraper
|
||||||
|
daemon: simple
|
||||||
|
plugs: [network, network-bind]
|
||||||
|
|
||||||
|
parts:
|
||||||
|
mongodb:
|
||||||
|
build-packages:
|
||||||
|
- wget
|
||||||
|
source: ./
|
||||||
|
prepare: ./resources/preparemongo
|
||||||
|
plugin: dump
|
||||||
|
stage-packages:
|
||||||
|
- libssl1.0.0
|
||||||
|
prime:
|
||||||
|
- usr
|
||||||
|
- bin
|
||||||
|
- lib
|
||||||
|
poc-scraper:
|
||||||
|
source: ./
|
||||||
|
prepare: ./resources/preparescraper
|
||||||
|
plugin: python
|
||||||
|
python-version: python2
|
||||||
|
source: poc_scraper/poc_scraper
|
||||||
|
scripts:
|
||||||
|
plugin: dump
|
||||||
|
source: resources/
|
||||||
|
organize:
|
||||||
|
startmongo: bin/startmongo
|
||||||
|
startscraper: bin/startscraper
|
||||||
|
prime:
|
||||||
|
- bin
|
||||||
2
test.py
2
test.py
@@ -23,7 +23,7 @@ log.setLevel(logging.INFO)
|
|||||||
# ---------------------------------------------------------------------------#
|
# ---------------------------------------------------------------------------#
|
||||||
# Modbus Client Setup
|
# Modbus Client Setup
|
||||||
# ---------------------------------------------------------------------------#
|
# ---------------------------------------------------------------------------#
|
||||||
modbus_client = ModbusClient('localhost', port=502)
|
modbus_client = ModbusClient('modbus.theta.poconsole.net', port=502)
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------#
|
# ---------------------------------------------------------------------------#
|
||||||
# Mongo DB Setup
|
# Mongo DB Setup
|
||||||
|
|||||||
Reference in New Issue
Block a user