This repository has been archived by the owner on Jun 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
4,151 additions
and
10 deletions.
There are no files selected for viewing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
FROM centos:6.6 | ||
|
||
MAINTAINER David | ||
|
||
ENV GIT_URL_IOTACPP https://github.com/telefonicaid/fiware-IoTAgent-Cplusplus.git | ||
ENV GIT_REV_IOTACPP develop | ||
ENV GIT_PATH_IOTACPP /opt/iotacpp | ||
ENV IOTACPP_BUILD_TYPE Release | ||
ENV IOTACPP_USER iotagent | ||
|
||
RUN yum -y install tar gzip unzip file \ | ||
cpp gcc gcc-c++ \ | ||
automake autoconf libtool \ | ||
git scons cmake \ | ||
openssl-devel bzip2-devel zlib-devel \ | ||
rpm-build && \ | ||
git clone ${GIT_URL_IOTACPP} ${GIT_PATH_IOTACPP} && \ | ||
cd ${GIT_PATH_IOTACPP} && \ | ||
sed -i CMakeLists.txt \ | ||
-e 's|^add_test|#add_test|g' \ | ||
-e 's|^add_subdirectory(tests)|#add_subdirectory(tests)|g' \ | ||
-e 's|^enable_testing|#enable_testing|g' \ | ||
-e 's|git@github.com:mongodb/mongo-cxx-driver.git|https://github.com/mongodb/mongo-cxx-driver|g' && \ | ||
source tools/get_version_string.sh && \ | ||
mkdir -p build/${IOTACPP_BUILD_TYPE} && \ | ||
cd build/${IOTACPP_BUILD_TYPE} && \ | ||
cmake -DGIT_VERSION=`get_rpm_version_string | cut -d ' ' -f 1` \ | ||
-DGIT_COMMIT=`get_rpm_version_string | cut -d ' ' -f 2` \ | ||
-DMQTT=ON \ | ||
-DCMAKE_BUILD_TYPE=${IOTACPP_BUILD_TYPE} ../../ && \ | ||
make install && \ | ||
make package && \ | ||
cd pack/Linux/RPM | ||
|
||
RUN yum clean all | ||
|
||
RUN yum -y remove autoconf automake bzip2-devel \ | ||
cmake cpp file gcc gcc-c++ git \ | ||
libtool openssl-devel rpm-build \ | ||
scons zlib-devel bzip2 cloog-ppl \ | ||
elfutils elfutils-libs gdb glibc-devel \ | ||
glibc-headers kernel-headers \ | ||
keyutils-libs-devel krb5-devel \ | ||
libarchive libcom_err-devel libgomp \ | ||
libselinux-devel libsepol-devel \ | ||
libstdc++-devel m4 mpfr patch \ | ||
perl-Error perl-Git perl-Module-Pluggable \ | ||
perl-Pod-Escapes perl-Pod-Simple \ | ||
perl-libs perl-version \ | ||
ppl rsync | ||
|
||
|
||
RUN cd ${GIT_PATH_IOTACPP} && \ | ||
cd build/${IOTACPP_BUILD_TYPE} && \ | ||
cd pack/Linux/RPM && \ | ||
curl -kOL http://download.opensuse.org/repositories/home:/oojah:/mqtt/CentOS_CentOS-6/home:oojah:mqtt.repo && \ | ||
mv home:oojah:mqtt.repo /etc/yum.repos.d/ && \ | ||
yum localinstall -y iot-agent-*.rpm && \ | ||
yum clean all && \ | ||
chkconfig iotagent on | ||
|
||
RUN chkconfig mosquitto on | ||
|
||
COPY config.json /etc/iot/ | ||
RUN chown ${IOTACPP_USER}:${IOTACPP_USER} /etc/iot/config.json | ||
|
||
COPY docker-entrypoint.sh / | ||
RUN chmod +x /docker-entrypoint.sh | ||
ENTRYPOINT ["/docker-entrypoint.sh"] | ||
|
||
EXPOSE 8080 | ||
EXPOSE 8081 | ||
EXPOSE 1883 | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"ngsi_url": { | ||
"cbroker": "http://ORION_HOSTNAME:ORION_PORT", | ||
"updateContext": "/NGSI10/updateContext", | ||
"registerContext": "/NGSI9/registerContext", | ||
"queryContext": "/NGSI10/queryContext" | ||
}, | ||
"timeout": 10, | ||
"http_proxy": "PUBLIC_PROXY_PORT", | ||
"public_ip": "PUBLIC_IP_PORT", | ||
"dir_log": "/var/log/iot/", | ||
"timezones": "/etc/iot/date_time_zonespec.csv", | ||
"storage": { | ||
"host": "MONGODB_HOSTNAME", | ||
"type": "mongodb", | ||
"port": "MONGODB_PORT", | ||
"dbname": "iot" | ||
}, | ||
"resources": [ | ||
{ | ||
"resource": "/iot/d", | ||
"options": { | ||
"FileName": "UL20Service" | ||
} | ||
}, | ||
{ | ||
"resource": "/iot/mqtt", | ||
"options": { | ||
"ConfigFile" : "/etc/iot/MqttService.xml", | ||
"FileName": "MqttService" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/sh | ||
|
||
if [[ ${MONGODB_PORT} =~ ^tcp://(.*):(.*)+$ ]] ; then | ||
export MONGODB_PORT=${BASH_REMATCH[2]} | ||
export MONGODB_HOSTNAME=${BASH_REMATCH[1]} | ||
|
||
fi | ||
|
||
if [[ ${ORION_PORT} =~ ^tcp://(.*):(.*)+$ ]] ; then | ||
export ORION_PORT=${BASH_REMATCH[2]} | ||
export ORION_HOSTNAME=${BASH_REMATCH[1]} | ||
fi | ||
|
||
echo $PUBLIC_PROXY_PORT | ||
echo $PUBLIC_IP_PORT | ||
echo $MONGODB_HOSTNAME | ||
echo $MONGODB_PORT | ||
echo $ORION_HOSTNAME | ||
echo $ORION_PORT | ||
|
||
sed -i /etc/init.d/mosquitto \ | ||
-e "s|etc/mosquitto/mosquitto.conf|etc/iot/mosquitto.conf|g" | ||
|
||
sed -i /etc/iot/mosquitto.conf \ | ||
-e "s|user root|user iotagent|g" | ||
|
||
sed -i /etc/iot/config.json \ | ||
-e "s|ORION_HOSTNAME|${ORION_HOSTNAME}|g" \ | ||
-e "s|ORION_PORT|${ORION_PORT}|g" \ | ||
-e "s|MONGODB_HOSTNAME|${MONGODB_HOSTNAME}|g" \ | ||
-e "s|MONGODB_PORT|${MONGODB_PORT}|g" \ | ||
-e "s|PUBLIC_PROXY_PORT|${PUBLIC_PROXY_PORT}|g" \ | ||
-e "s|PUBLIC_IP_PORT|${PUBLIC_IP_PORT}|g" | ||
|
||
#cat /etc/iot/config.json | ||
|
||
exec /sbin/init | ||
|
||
|
||
|
||
|
||
#/bin/bash | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#Introduction | ||
Dockerfile to create a container with IoTAgent (MQTT and UL20). Using Docker-compose (iota.yaml fie) you could run multiple containers with IoTAgent, Orion Context-Broker and MongoDB Database all interconnected. | ||
|
||
#Use | ||
|
||
Run this command: | ||
``` | ||
docker-compose -f iota.yaml up -d iotacpp | ||
``` | ||
This command will build the IoTAgent docker image and it will run three different containers with Orion ContextBroker, MongoDB and IoTAgent all of them linked. The IoTAgent container will expose the 8080 (HTTP) port and 1883 for MQTT protocol. | ||
|
||
#Build just IoTAgent docker image | ||
``` | ||
docker build . | ||
``` | ||
|
||
This will create an image of the IoTAgent, but in order to properly start it, you need to run other containers for ContextBroker and MongoDB, hence the convenience of having a docker-compose file that will start up all three elements together. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
docker-compose -f iota.yaml stop | ||
docker rm -v $(docker ps -a -q -f status=exited) | ||
docker-compose -f iota.yaml up -d | ||
docker ps | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.