mirror of
https://github.com/excaliburpartners/OmniLinkBridge
synced 2024-12-22 10:42:24 +00:00
- Fix SQL logging error for areas and units
This commit is contained in:
parent
fe66f608ec
commit
dbad9ea3ce
27
Dockerfile
27
Dockerfile
|
@ -1,17 +1,30 @@
|
||||||
FROM mono:latest
|
FROM mono:latest AS build
|
||||||
|
|
||||||
COPY . /build
|
RUN apt-get update && \
|
||||||
|
apt-get install -y unixodbc
|
||||||
|
|
||||||
|
WORKDIR /build
|
||||||
|
ADD https://dev.mysql.com/get/Downloads/Connector-ODBC/8.0/mysql-connector-odbc-8.0.18-linux-debian9-x86-64bit.tar.gz /build
|
||||||
|
RUN tar zxf mysql-connector-odbc-8.0.18-linux-debian9-x86-64bit.tar.gz && \
|
||||||
|
mkdir -p /usr/lib/odbc/ && \
|
||||||
|
cp mysql-connector-odbc-8.0.18-linux-debian9-x86-64bit/lib/* /usr/lib/odbc/ && \
|
||||||
|
mysql-connector-odbc-8.0.18-linux-debian9-x86-64bit/bin/myodbc-installer -d -a -n "MySQL" -t "DRIVER=/usr/lib/odbc/libmyodbc8w.so"
|
||||||
|
|
||||||
|
COPY . .
|
||||||
RUN nuget restore /build/OmniLinkBridge.sln
|
RUN nuget restore /build/OmniLinkBridge.sln
|
||||||
RUN msbuild /build/OmniLinkBridge.sln /t:Build /p:Configuration=Release
|
RUN msbuild /build/OmniLinkBridge.sln /t:Build /p:Configuration=Release
|
||||||
|
|
||||||
RUN mv /build/OmniLinkBridge/bin/Release /app
|
RUN mv /build/OmniLinkBridge/bin/Release /app
|
||||||
RUN rm -rf /build
|
|
||||||
|
FROM mono:latest AS runtime
|
||||||
|
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y unixodbc
|
||||||
|
|
||||||
|
COPY --from=build /usr/lib/odbc /usr/lib/odbc
|
||||||
|
COPY --from=build /etc/odbcinst.ini /etc/odbcinst.ini
|
||||||
|
|
||||||
EXPOSE 8000/tcp
|
EXPOSE 8000/tcp
|
||||||
|
|
||||||
VOLUME /config
|
VOLUME /config
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
COPY --from=build /app .
|
||||||
CMD [ "mono", "OmniLinkBridge.exe", "-i", "-c", "/config/OmniLinkBridge.ini", "-s", "/config/WebSubscriptions.json" ]
|
CMD [ "mono", "OmniLinkBridge.exe", "-i", "-c", "/config/OmniLinkBridge.ini", "-s", "/config/WebSubscriptions.json" ]
|
|
@ -37,10 +37,23 @@ CREATE TABLE IF NOT EXISTS `log_areas` (
|
||||||
`duress` varchar(10) NOT NULL,
|
`duress` varchar(10) NOT NULL,
|
||||||
`security` varchar(20) NOT NULL,
|
`security` varchar(20) NOT NULL,
|
||||||
PRIMARY KEY (`log_area_id`)
|
PRIMARY KEY (`log_area_id`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=287 ;
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Table structure for table `log_events`
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `log_events` (
|
||||||
|
`log_event_id` int(10) unsigned NOT NULL auto_increment,
|
||||||
|
`timestamp` datetime NOT NULL,
|
||||||
|
`name` varchar(12) NOT NULL,
|
||||||
|
`status` varchar(10) NOT NULL,
|
||||||
|
PRIMARY KEY (`log_event_id`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
|
||||||
|
|
||||||
|
-- --------------------------------------------------------
|
||||||
--
|
--
|
||||||
-- Table structure for table `log_messages`
|
-- Table structure for table `log_messages`
|
||||||
--
|
--
|
||||||
|
@ -52,7 +65,7 @@ CREATE TABLE IF NOT EXISTS `log_messages` (
|
||||||
`name` varchar(12) NOT NULL,
|
`name` varchar(12) NOT NULL,
|
||||||
`status` varchar(10) NOT NULL,
|
`status` varchar(10) NOT NULL,
|
||||||
PRIMARY KEY (`log_message_id`)
|
PRIMARY KEY (`log_message_id`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=139 ;
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
@ -76,7 +89,7 @@ CREATE TABLE IF NOT EXISTS `log_thermostats` (
|
||||||
`fan` varchar(5) NOT NULL,
|
`fan` varchar(5) NOT NULL,
|
||||||
`hold` varchar(5) NOT NULL,
|
`hold` varchar(5) NOT NULL,
|
||||||
PRIMARY KEY (`log_tstat_id`)
|
PRIMARY KEY (`log_tstat_id`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=67544 ;
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
@ -93,7 +106,7 @@ CREATE TABLE IF NOT EXISTS `log_units` (
|
||||||
`statusvalue` smallint(6) NOT NULL,
|
`statusvalue` smallint(6) NOT NULL,
|
||||||
`statustime` smallint(6) NOT NULL,
|
`statustime` smallint(6) NOT NULL,
|
||||||
PRIMARY KEY (`log_unit_id`)
|
PRIMARY KEY (`log_unit_id`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1245 ;
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
@ -108,7 +121,7 @@ CREATE TABLE IF NOT EXISTS `log_zones` (
|
||||||
`name` varchar(16) NOT NULL,
|
`name` varchar(16) NOT NULL,
|
||||||
`status` varchar(10) NOT NULL,
|
`status` varchar(10) NOT NULL,
|
||||||
PRIMARY KEY (`log_zone_id`)
|
PRIMARY KEY (`log_zone_id`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=10298 ;
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
|
||||||
|
|
||||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||||
|
|
|
@ -190,7 +190,7 @@ namespace OmniLinkBridge.Modules
|
||||||
status = "TRIPPED " + status;
|
status = "TRIPPED " + status;
|
||||||
|
|
||||||
DBQueue(@"
|
DBQueue(@"
|
||||||
INSERT INTO log_areas (timestamp, e.AreaID, name,
|
INSERT INTO log_areas (timestamp, id, name,
|
||||||
fire, police, auxiliary,
|
fire, police, auxiliary,
|
||||||
duress, security)
|
duress, security)
|
||||||
VALUES ('" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + e.ID.ToString() + "','" + e.Area.Name + "','" +
|
VALUES ('" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + e.ID.ToString() + "','" + e.Area.Name + "','" +
|
||||||
|
@ -263,7 +263,7 @@ namespace OmniLinkBridge.Modules
|
||||||
status = "ON";
|
status = "ON";
|
||||||
|
|
||||||
DBQueue(@"
|
DBQueue(@"
|
||||||
INSERT INTO log_e.Units (timestamp, id, name,
|
INSERT INTO log_units (timestamp, id, name,
|
||||||
status, statusvalue, statustime)
|
status, statusvalue, statustime)
|
||||||
VALUES ('" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + e.ID + "','" + e.Unit.Name + "','" +
|
VALUES ('" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + e.ID + "','" + e.Unit.Name + "','" +
|
||||||
status + "','" + e.Unit.Status + "','" + e.Unit.StatusTime + "')");
|
status + "','" + e.Unit.Status + "','" + e.Unit.StatusTime + "')");
|
||||||
|
|
|
@ -22,7 +22,7 @@ verbose_message = yes
|
||||||
|
|
||||||
# mySQL Logging (yes/no)
|
# mySQL Logging (yes/no)
|
||||||
mysql_logging = no
|
mysql_logging = no
|
||||||
mysql_connection =
|
mysql_connection = DRIVER={MySQL};SERVER=localhost;DATABASE=OmniLinkBridge;USER=root;PASSWORD=myPassword;OPTION=3;
|
||||||
|
|
||||||
# Web Service (yes/no)
|
# Web Service (yes/no)
|
||||||
# Can be used for integration with Samsung SmartThings
|
# Can be used for integration with Samsung SmartThings
|
||||||
|
|
|
@ -211,7 +211,7 @@ At this point we need to open MySQL Workbench to create the database (called a s
|
||||||
Lastly in OmniLinkBridge.ini set mysql_connection. This should get you up and running. The MySQL Workbench can also be used to view the data that OmniLink Bridge inserts into the tables.
|
Lastly in OmniLinkBridge.ini set mysql_connection. This should get you up and running. The MySQL Workbench can also be used to view the data that OmniLink Bridge inserts into the tables.
|
||||||
|
|
||||||
```
|
```
|
||||||
mysql_connection = DRIVER={MySQL ODBC 8.0 Driver};SERVER=localhost;DATABASE=OmniLinkBridge;USER=root;PASSWORD=myPassword;OPTION=3;
|
mysql_connection = DRIVER={MySQL};SERVER=localhost;DATABASE=OmniLinkBridge;USER=root;PASSWORD=myPassword;OPTION=3;
|
||||||
```
|
```
|
||||||
|
|
||||||
## Change Log
|
## Change Log
|
||||||
|
|
Loading…
Reference in a new issue