Fixes and starts working on Ubuntu Core compatibility

This commit is contained in:
Patrick McDonagh
2018-02-01 11:51:05 -06:00
parent 363be407e1
commit 9937550d01
13 changed files with 87 additions and 6 deletions

Binary file not shown.

Binary file not shown.

0
db_coils.csv Normal file
View File

0
db_discrete_inputs.csv Normal file
View File

0
db_holding_registers.csv Normal file
View File

0
db_input_registers.csv Normal file
View File

View File

@@ -1,19 +1,23 @@
version : '2'
services:
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:
- "27017:27017"
restart: on-failure
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:
- modbus_server
restart: on-failure
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:
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:
- mongodb
links:

View File

@@ -23,7 +23,7 @@ log.setLevel(logging.INFO)
# ---------------------------------------------------------------------------#
# Modbus Client Setup
# ---------------------------------------------------------------------------#
modbus_client = ModbusClient('localhost', port=502)
modbus_client = ModbusClient('modbus.theta.poconsole.net', port=502)
# ---------------------------------------------------------------------------#
# Mongo DB Setup

22
resources/preparemongo Executable file
View 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
View 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
View 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
View 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

View File

@@ -23,7 +23,7 @@ log.setLevel(logging.INFO)
# ---------------------------------------------------------------------------#
# Modbus Client Setup
# ---------------------------------------------------------------------------#
modbus_client = ModbusClient('localhost', port=502)
modbus_client = ModbusClient('modbus.theta.poconsole.net', port=502)
# ---------------------------------------------------------------------------#
# Mongo DB Setup