diff --git a/daq/Dockerfile b/daq/Dockerfile new file mode 100644 index 0000000..5dd228b --- /dev/null +++ b/daq/Dockerfile @@ -0,0 +1,14 @@ +FROM python:latest + +# Copy source files +RUN mkdir /root/tag-logger +COPY taglogger.py /root/tag-logger/taglogger.py +COPY pycomm-master /tmp/pycomm +COPY Pycomm-Helper /tmp/pycomm_helper + +# Install some python packages +RUN pip install requests +RUN cd /tmp/pycomm && python setup.py install && cd / +RUN cd /tmp/pycomm_helper && python setup.py install && cd / + +CMD ["python", "/root/tag-logger/taglogger.py"] diff --git a/daq/pycomm_helper b/daq/pycomm_helper deleted file mode 160000 index a3b6c08..0000000 --- a/daq/pycomm_helper +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a3b6c088c52a839c93e92493fd108b26ab235c70 diff --git a/daq/taglogger.py b/daq/taglogger.py index 2688a54..bb9288a 100644 --- a/daq/taglogger.py +++ b/daq/taglogger.py @@ -14,7 +14,7 @@ import requests from pycomm_helper.tag import Tag # DEFAULTS -db_address = "10.10.10.10:3000" +db_address = "web_db:3000" db_url = "https://{}".format(db_address) scan_rate = 30 # seconds save_all = "test" # use True, False, or any string diff --git a/docker-compose.yml b/docker-compose.yml index 7b4fbf2..bd94853 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,26 +1,23 @@ version : '2' services: web_db: - image: henrypump/logger/web_db + image: docker.henrypump.cloud/datalogger/web_db ports: - "443:5000" - networks: - poconsole: - ipv4_address: 10.10.10.10 - daq_sample: - image: henrypump/logger/daq_sample - networks: - - poconsole + daq: + image: docker.henrypump.cloud/datalogger/daq depends_on: - web_db + links: + - web_db -networks: - poconsole: - driver: bridge - driver_opts: - com.docker.network.enable_ipv4: "true" - ipam: - driver: default - config: - - subnet: 10.10.10.0/24 +# networks: +# poconsole: +# driver: bridge +# driver_opts: +# com.docker.network.enable_ipv4: "true" +# ipam: +# driver: default +# config: +# - subnet: 10.10.10.0/24 diff --git a/web_db/Dockerfile b/web_db/Dockerfile new file mode 100644 index 0000000..56dfefb --- /dev/null +++ b/web_db/Dockerfile @@ -0,0 +1,23 @@ +FROM python:latest + +RUN apt-get -y update +COPY mysql-install.sh /tmp/mysql-install.sh +RUN chmod +x /tmp/mysql-install.sh && /tmp/mysql-install.sh + +RUN mkdir /root/tag-logger +COPY flask /root/tag-logger/flask + +COPY mysql-connector-python-2.1.4 /tmp/mysql +RUN cd /tmp/mysql && python setup.py install && cd ~ + +COPY startup.sh /root/startup.sh +RUN chmod +x /root/startup.sh + +RUN pip install flask flask-restless flask-sqlalchemy pyopenssl + +RUN apt-get clean +RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +RUN service mysql restart && python /root/tag-logger/flask/setupdb.py + +CMD '/root/startup.sh'