kizniche / Mycodo

An environmental monitoring and regulation system
http://kylegabriel.com/projects/
GNU General Public License v3.0
2.89k stars 486 forks source link

Dockerized Mycodo #637

Open kizniche opened 5 years ago

kizniche commented 5 years ago

This is my experiment with using docker and docker-compose to run Mycodo. Thus far I successfully have Mycodo running fully in docker containers. This includes the Flask/Gunicorn frontend, Nginx, Influxdb, and the Mycodo daemon (additionally with Grafana and Telegraf for further data acquisition/presentation). This issue can serve as a discussion thread and a way I can keep users updated on the progress and where this is going. For current information about setup/building, see the docker/README.md.

Current state (check means working):

More will be added as they are found

kizniche commented 5 years ago

Below are commands to get it up and running on your system (any linux system, not just a Raspberry Pi).

If you have Mycodo already running from a standard install, first stop the services with these commands:

sudo service mycodo stop
sudo service mycodoflask stop
sudo service nginx stop
sudo service influxdb stop

Checkout the mycodo_docker branch and install prerequisites (docker, docker-compose):

git clone https://github.com/kizniche/Mycodo
cd Mycodo
git checkout mycodo_docker
sudo /bin/bash ./mycodo.sh install-dependencies

Add your user to the docker group so you can run without root privileges (replacing USER with your user):

sudo usermod -aG docker ${USER}

Log out and back in for the changes to take affect, then build:

make build

Once it's built and running, you can navigate to https://127.0.0.1/ to access the web UI.

Theoi-Meteoroi commented 5 years ago

I did this. On the stretch distro for a long run node. This is my CO2 and particle detector station.

pi@CO2mon:~ $ sudo mv ./Mycodo ./645_Mycodo.saved
pi@CO2mon:~ $ sudo apt-get update
...
pi@CO2mon:~ $ sudo rpi-update
 ...
Got this (good to know because I use that on Pi.) ``` apt-listchanges: News --------------------- wpasupplicant (2:2.6-19) unstable; urgency=medium With this release, wpasupplicant no longer respects the system default minimum TLS version, defaulting to TLSv1.0, not TLSv1.2. If you're sure you will never connect to EAP networks requiring anything less than 1.2, add this to your wpasupplicant configuration: tls_disable_tlsv1_0=1 tls_disable_tlsv1_1=1 wpasupplicant also defaults to a security level 1, instead of the system default 2. Should you need to change that, change this setting in your wpasupplicant configuration: openssl_ciphers=DEFAULT@SECLEVEL=2 Unlike wpasupplicant, hostapd still respects system defaults. -- Andrej Shadura Sat, 15 Dec 2018 14:22:18 +0100 ``` 15.8 mb on my system. And reboot once more. Be patient. New baby. I'm a couple of beers into this so I'll cut and paste what Kyle wrote above. Hold my beer, please. ``` pi@CO2mon:~ $ git clone https://github.com/kizniche/Mycodo Cloning into 'Mycodo'... remote: Enumerating objects: 287, done. remote: Counting objects: 100% (287/287), done. remote: Compressing objects: 100% (220/220), done. remote: Total 38725 (delta 145), reused 137 (delta 67), pack-reused 38438 Receiving objects: 100% (38725/38725), 72.92 MiB | 4.80 MiB/s, done. Resolving deltas: 100% (31011/31011), done. pi@CO2mon:~ $ cd Mycodo pi@CO2mon:~/Mycodo $ git checkout mycodo_docker Branch mycodo_docker set up to track remote branch mycodo_docker from origin. Switched to a new branch 'mycodo_docker' pi@CO2mon:~/Mycodo $ sudo /bin/bash ./mycodo.sh install-dependencies #### Installing docker ... #### Installing docker-compose ... #### Dependencies installed pi@CO2mon:~/Mycodo $ make build docker-compose up --build -d ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running? If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable. Makefile:2: recipe for target 'build' failed make: *** [build] Error 1 pi@CO2mon:~/Mycodo $ sudo docker engine activate you must be logged in to access licenses. Please use 'docker login' then try again pi@CO2mon:~/Mycodo $ make build docker-compose up --build -d ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running? If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable. Makefile:2: recipe for target 'build' failed make: *** [build] Error 1 ``` I had added the user Pi to the docker group. This went on for awhile. Something is wrong with my docker account. Or this needs docker enterprise. Mkay. I'm game. I sign up on the pi. Big mistake it seems. Gonna need another beer and new music. That has not resolved the issue. I have some problem with my Docker account. Going away to fix that. I'll be back. Probably a good idea to check your docker account, first. I log in fine in a browser but still getting kicked to the curb in a cli. -reboot- (because there are times that you gotta) Beauty. cd ~/Mycodo make build Getting another beer. ``` pi@CO2mon:~/Mycodo $ make build docker-compose up --build -d Creating network "mycodo_default" with the default driver Creating volume "mycodo_mycodo_var" with default driver Building influxdb ... Running setup.py install for cffi: started Running setup.py install for cffi: finished with status 'error' Complete output from command /usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-_fa39_s9/cffi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-9unz3ez9/install-record.txt --single-version-externally-managed --compile: unable to execute 'gcc': No such file or directory unable to execute 'gcc': No such file or directory No working compiler found, or bogus compiler options passed to the compiler from Python's standard "distutils" module. See the error messages above. Likely, the problem is not related to CFFI but generic to the setup.py of any Python package that tries to compile C code. (Hints: on OS/X 10.8, for errors about -mno-fused-madd see http://stackoverflow.com/questions/22313407/ Otherwise, see https://wiki.python.org/moin/CompLangPython or the IRC channel #python on irc.freenode.net.) Trying to continue anyway. If you are trying to install CFFI from a build done in a different context, you can ignore this warning. running install running build running build_py creating build creating build/lib.linux-armv7l-3.6 creating build/lib.linux-armv7l-3.6/cffi copying cffi/backend_ctypes.py -> build/lib.linux-armv7l-3.6/cffi copying cffi/vengine_cpy.py -> build/lib.linux-armv7l-3.6/cffi copying cffi/error.py -> build/lib.linux-armv7l-3.6/cffi copying cffi/__init__.py -> build/lib.linux-armv7l-3.6/cffi copying cffi/cffi_opcode.py -> build/lib.linux-armv7l-3.6/cffi copying cffi/vengine_gen.py -> build/lib.linux-armv7l-3.6/cffi copying cffi/ffiplatform.py -> build/lib.linux-armv7l-3.6/cffi copying cffi/model.py -> build/lib.linux-armv7l-3.6/cffi copying cffi/recompiler.py -> build/lib.linux-armv7l-3.6/cffi copying cffi/verifier.py -> build/lib.linux-armv7l-3.6/cffi copying cffi/cparser.py -> build/lib.linux-armv7l-3.6/cffi copying cffi/pkgconfig.py -> build/lib.linux-armv7l-3.6/cffi copying cffi/commontypes.py -> build/lib.linux-armv7l-3.6/cffi copying cffi/api.py -> build/lib.linux-armv7l-3.6/cffi copying cffi/lock.py -> build/lib.linux-armv7l-3.6/cffi copying cffi/setuptools_ext.py -> build/lib.linux-armv7l-3.6/cffi copying cffi/_cffi_include.h -> build/lib.linux-armv7l-3.6/cffi copying cffi/parse_c_type.h -> build/lib.linux-armv7l-3.6/cffi copying cffi/_embedding.h -> build/lib.linux-armv7l-3.6/cffi copying cffi/_cffi_errors.h -> build/lib.linux-armv7l-3.6/cffi running build_ext building '_cffi_backend' extension creating build/temp.linux-armv7l-3.6 creating build/temp.linux-armv7l-3.6/c gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include/ffi -I/usr/include/libffi -I/usr/local/include/python3.6m -c c/_cffi_backend.c -o build/temp.linux-armv7l-3.6/c/_cffi_backend.o unable to execute 'gcc': No such file or directory error: command 'gcc' failed with exit status 1 ---------------------------------------- Command "/usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-_fa39_s9/cffi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-9unz3ez9/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-_fa39_s9/cffi/ ERROR: Service 'flask' failed to build: The command '/bin/sh -c pip install --no-cache-dir -r /home/mycodo/requirements.txt' returned a non-zero code: 1 Makefile:2: recipe for target 'build' failed make: *** [build] Error 1 pi@CO2mon:~/Mycodo $ ``` Your move, Kyle. I'll leave this as it is and await better ideas to continue further. Almost is pretty good in my book. I hear that some other embedded applications are going to containers because they are also being built on linux and obscure isn't good enough for security anymore. People around you are already driving those applications. A Tesla isn't just a big battery, with wheels.
kizniche commented 5 years ago

Looks like gcc is needed. I just recently took it out of the install process, but hadn't built on the Pi to verify it was still working. I'll push a fix shortly.

kizniche commented 5 years ago

Sorry your first build experience was a flop. I pushed a fix for the issue building on Pis. I also updated my second comment with more detailed commands to shutdown any previously-installed Mycodo to free up ports and adding the user to the docker group. These should be all the commands possibly needed to get it up and running. I'm currently building on a Pi right now, so if I encounter any issues, I'll push another fix shortly.

Theoi-Meteoroi commented 5 years ago

No worries Kyle, I still had a good time while trying. I'll follow your suggestions and try some more. Its worthwhile to do, I think. Thank you for giving containers a go with Mycodo!

Theoi-Meteoroi commented 5 years ago

Full Moon coming. Guess it is time.

pi@everlast:~ $ sudo apt-get update
Get:1 http://archive.raspberrypi.org/debian stretch InRelease [25.4 kB]
Get:2 http://raspbian.raspberrypi.org/raspbian stretch InRelease [15.0 kB]
Get:3 http://archive.raspberrypi.org/debian stretch/main armhf Packages [214 kB]
Get:4 http://raspbian.raspberrypi.org/raspbian stretch/main armhf Packages [11.7 MB]                                     
Get:5 http://archive.raspberrypi.org/debian stretch/ui armhf Packages [44.5 kB]  
Fetched 12.0 MB in 1min 32s (129 kB/s)                                                                                   
Reading package lists... Done
pi@everlast:~ $ sudo rpi-update
 *** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom
 *** Performing self-update
 *** Relaunching after update
 *** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom
#############################################################
WARNING: This update bumps to rpi-4.19.y linux tree
Be aware there could be compatibility issues with some drivers
Discussion here:
https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=224931
##############################################################
Would you like to proceed? (y/N)

 *** Downloading specific firmware revision (this will take a few minutes)
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   168    0   168    0     0    423      0 --:--:-- --:--:-- --:--:--   424
100 58.4M  100 58.4M    0     0  3960k      0  0:00:15  0:00:15 --:--:-- 3268k
 *** Updating firmware
 *** Updating kernel modules
 *** depmod 4.19.29-v7+
 *** depmod 4.19.29+
 *** Updating VideoCore libraries
 *** Using HardFP libraries
 *** Updating SDK
 *** Running ldconfig
 *** Storing current firmware revision
 *** Deleting downloaded files
 *** Syncing changes to disk
 *** If no errors appeared, your firmware was successfully updated to 3f0ecd1fca450c2cacd429c96b78cc4be96acd51
 *** A reboot is needed to activate the new firmware
pi@everlast:~ $ 
< rebooted >

pi@everlast:~ $ sudo service mycodo stop
Failed to stop mycodo.service: Unit mycodo.service not loaded.
pi@everlast:~ $ sudo service mycodoflask stop
Failed to stop mycodoflask.service: Unit mycodoflask.service not loaded.
pi@everlast:~ $ sudo service nginx stop
pi@everlast:~ $ sudo service influxdb stop
pi@everlast:~ $ git clone https://github.com/kizniche/Mycodo
Cloning into 'Mycodo'...
remote: Enumerating objects: 22, done.
remote: Counting objects: 100% (22/22), done.
remote: Compressing objects: 100% (16/16), done.
remote: Total 38960 (delta 10), reused 13 (delta 6), pack-reused 38938
Receiving objects: 100% (38960/38960), 71.42 MiB | 6.54 MiB/s, done.
Resolving deltas: 100% (31298/31298), done.
pi@everlast:~ $ cd Mycodo
pi@everlast:~/Mycodo $ git checkout mycodo_docker
Branch mycodo_docker set up to track remote branch mycodo_docker from origin.
Switched to a new branch 'mycodo_docker'
pi@everlast:~/Mycodo $ sudo /bin/bash ./mycodo.sh install-dependencies
#### Installing docker
# Executing docker install script, commit: cfba462
+ sh -c apt-get update -qq >/dev/null
+ sh -c apt-get install -y -qq apt-transport-https ca-certificates curl >/dev/null
W: APT had planned for dpkg to do more than it reported back (18 vs 22).
   Affected packages: nginx-full:armhf
+ sh -c curl -fsSL "https://download.docker.com/linux/raspbian/gpg" | apt-key add -qq - >/dev/null
Warning: apt-key output should not be parsed (stdout is not a terminal)
+ sh -c echo "deb [arch=armhf] https://download.docker.com/linux/raspbian stretch stable" > /etc/apt/sources.list.d/docker.list
+ sh -c apt-get update -qq >/dev/null
+ sh -c apt-get install -y -qq --no-install-recommends docker-ce >/dev/null
+ sh -c docker version
Client:
 Version:           18.09.0
 API version:       1.39
 Go version:        go1.10.4
 Git commit:        4d60db4
 Built:             Wed Nov  7 00:57:21 2018
 OS/Arch:           linux/arm
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.0
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.4
  Git commit:       4d60db4
  Built:            Wed Nov  7 00:17:57 2018
  OS/Arch:          linux/arm
  Experimental:     false
If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like:

  sudo usermod -aG docker your-user

Remember that you will have to log out and back in for this to take effect!

WARNING: Adding a user to the "docker" group will grant the ability to run
         containers which can be used to obtain root privileges on the
         docker host.
         Refer to https://docs.docker.com/engine/security/security/#docker-daemon-attack-surface
         for more information.

** DOCKER ENGINE - ENTERPRISE **

Test drive additional security features by activating Docker Engine - Enterprise.

  * Leverage FIPS 140-2 validated encryption
  * Run only trusted images with digital signature enforcement

** Learn more at https://dockr.ly/engine1 **

ACTIVATE your own engine to Docker Engine - Enterprise using:

  sudo docker engine activate

#### Installing docker-compose
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting docker-compose
  Downloading https://files.pythonhosted.org/packages/1e/6c/bf9879305530c4b765ef4eb3be76202788ca1037aec74d2c0ec73191d467/docker_compose-1.23.2-py2.py3-none-any.whl (131kB)
    100% |████████████████████████████████| 133kB 1.7MB/s 
Collecting PyYAML<4,>=3.10 (from docker-compose)
  Downloading https://files.pythonhosted.org/packages/9e/a3/1d13970c3f36777c583f136c136f804d70f500168edc1edea6daa7200769/PyYAML-3.13.tar.gz (270kB)
    100% |████████████████████████████████| 276kB 2.9MB/s 
Collecting backports.ssl-match-hostname>=3.5; python_version < "3.5" (from docker-compose)
  Downloading https://www.piwheels.org/simple/backports-ssl-match-hostname/backports.ssl_match_hostname-3.7.0.1-py2.py3-none-any.whl
Collecting websocket-client<1.0,>=0.32.0 (from docker-compose)
  Downloading https://files.pythonhosted.org/packages/29/19/44753eab1fdb50770ac69605527e8859468f3c0fd7dc5a76dd9c4dbd7906/websocket_client-0.56.0-py2.py3-none-any.whl (200kB)
    100% |████████████████████████████████| 204kB 2.7MB/s 
Collecting docker<4.0,>=3.6.0 (from docker-compose)
  Downloading https://files.pythonhosted.org/packages/fb/d8/8242b8fb3bd3000274fbf5ac1a06cdba8a5ccbcf4e2a8c05f0ab37999fd8/docker-3.7.1-py2.py3-none-any.whl (134kB)
    100% |████████████████████████████████| 143kB 3.4MB/s 
Requirement already satisfied: ipaddress>=1.0.16; python_version < "3.3" in /usr/lib/python2.7/dist-packages (from docker-compose) (1.0.17)
Collecting dockerpty<0.5,>=0.4.1 (from docker-compose)
  Downloading https://files.pythonhosted.org/packages/8d/ee/e9ecce4c32204a6738e0a5d5883d3413794d7498fe8b06f44becc028d3ba/dockerpty-0.4.1.tar.gz
Collecting texttable<0.10,>=0.9.0 (from docker-compose)
  Downloading https://files.pythonhosted.org/packages/02/e1/2565e6b842de7945af0555167d33acfc8a615584ef7abd30d1eae00a4d80/texttable-0.9.1.tar.gz
Requirement already satisfied: enum34<2,>=1.0.4; python_version < "3.4" in /usr/lib/python2.7/dist-packages (from docker-compose) (1.1.6)
Requirement already satisfied: requests!=2.11.0,!=2.12.2,!=2.18.0,<2.21,>=2.6.1 in /usr/lib/python2.7/dist-packages (from docker-compose) (2.12.4)
Requirement already satisfied: six<2,>=1.3.0 in /usr/lib/python2.7/dist-packages (from docker-compose) (1.10.0)
Collecting jsonschema<3,>=2.5.1 (from docker-compose)
  Downloading https://files.pythonhosted.org/packages/77/de/47e35a97b2b05c2fadbec67d44cfcdcd09b8086951b331d82de90d2912da/jsonschema-2.6.0-py2.py3-none-any.whl
Collecting docopt<0.7,>=0.6.1 (from docker-compose)
  Downloading https://www.piwheels.org/simple/docopt/docopt-0.6.2-py2.py3-none-any.whl
Collecting cached-property<2,>=1.2.0 (from docker-compose)
  Downloading https://files.pythonhosted.org/packages/3b/86/85c1be2e8db9e13ef9a350aecd6dea292bd612fa288c2f40d035bb750ded/cached_property-1.5.1-py2.py3-none-any.whl
Collecting docker-pycreds>=0.4.0 (from docker<4.0,>=3.6.0->docker-compose)
  Downloading https://files.pythonhosted.org/packages/f5/e8/f6bd1eee09314e7e6dee49cbe2c5e22314ccdb38db16c9fc72d2fa80d054/docker_pycreds-0.4.0-py2.py3-none-any.whl
Collecting functools32; python_version == "2.7" (from jsonschema<3,>=2.5.1->docker-compose)
  Downloading https://files.pythonhosted.org/packages/c5/60/6ac26ad05857c601308d8fb9e87fa36d0ebf889423f47c3502ef034365db/functools32-3.2.3-2.tar.gz
docker 3.7.1 has requirement requests!=2.18.0,>=2.14.2, but you'll have requests 2.12.4 which is incompatible.
Installing collected packages: PyYAML, backports.ssl-match-hostname, websocket-client, docker-pycreds, docker, dockerpty, texttable, functools32, jsonschema, docopt, cached-property, docker-compose
  Running setup.py install for PyYAML ... done
  Running setup.py install for dockerpty ... done
  Running setup.py install for texttable ... done
  Running setup.py install for functools32 ... done
Successfully installed PyYAML-3.13 backports.ssl-match-hostname-3.7.0.1 cached-property-1.5.1 docker-3.7.1 docker-compose-1.23.2 docker-pycreds-0.4.0 dockerpty-0.4.1 docopt-0.6.2 functools32-3.2.3.post2 jsonschema-2.6.0 texttable-0.9.1 websocket-client-0.56.0
#### Dependencies installed
pi@everlast:~/Mycodo $ sudo usermod -aG docker pi
pi@everlast:~/Mycodo $ make build
docker-compose up --build -d
ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running?

If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
Makefile:2: recipe for target 'build' failed
make: *** [build] Error 1
pi@everlast:~/Mycodo $ ps -ef  | grep docker
root     18781     1  0 00:14 ?        00:00:01 /usr/bin/dockerd -H unix://
pi       19055   859  0 00:18 pts/0    00:00:00 grep --color=auto docker
pi@everlast:~/Mycodo $ sudo make build
docker-compose up --build -d
Creating network "mycodo_default" with the default driver
Creating volume "mycodo_mycodo_var" with default driver
Building influxdb
Step 1/9 : FROM influxdb:latest
latest: Pulling from library/influxdb
ec43a77fdcf3: Pull complete
8a0128678cc4: Pull complete
d5b2e6712f41: Pull complete
93b7da03244c: Pull complete
934e98004036: Pull complete
aaf10ef85fb0: Pull complete
9bc7c4250200: Pull complete
57dad2272f99: Pull complete
Digest: sha256:9d727ada4098eb2729d3891bef1a5e8a67e55da5476d2c2877c5e1f6576ae19f
Status: Downloaded newer image for influxdb:latest
 ---> b4b8eb2bbbe3
Step 2/9 : RUN mkdir -pv /var/influxdb/data
 ---> Running in 03054bdc2705
mkdir: created directory '/var/influxdb'
mkdir: created directory '/var/influxdb/data'
Removing intermediate container 03054bdc2705
 ---> a7cad8c50f77
Step 3/9 : ADD run.sh /run.sh
 ---> 855dd2035d7b
Step 4/9 : RUN chmod +x /*.sh
 ---> Running in 92ae630accbd
Removing intermediate container 92ae630accbd
 ---> bf82f5dee886
Step 5/9 : ENV PRE_CREATE_DB mycodo_db
 ---> Running in c59f83754fc6
Removing intermediate container c59f83754fc6
 ---> c3e41f23f127
Step 6/9 : ENV ADMIN_USER mycodo
 ---> Running in b7e39137d389
Removing intermediate container b7e39137d389
 ---> 117d99e0192e
Step 7/9 : ENV PASS mmdu77sj3nIoiajjs
 ---> Running in 55990e202d84
Removing intermediate container 55990e202d84
 ---> ef81d8d2d3cf
Step 8/9 : EXPOSE 8086
 ---> Running in 97a3d61931b0
Removing intermediate container 97a3d61931b0
 ---> c6321a1c6070
Step 9/9 : CMD /run.sh
 ---> Running in 555ebe537a63
Removing intermediate container 555ebe537a63
 ---> ddda8ff53613

Successfully built ddda8ff53613
Successfully tagged mycodo_influxdb:latest
Building flask
Step 1/10 : FROM python:3.6-slim-stretch
3.6-slim-stretch: Pulling from library/python
ecad9bd7ef0c: Pull complete
91c7faf04446: Pull complete
c4887ffeef28: Pull complete
08f4b324a752: Pull complete
db3c40d03bc5: Pull complete
Digest: sha256:3603dd0f95c7e04974c2eaaf0427470c342ea7284ae45401674fd490c8ce83f4
Status: Downloaded newer image for python:3.6-slim-stretch
 ---> 2da3a01acc0a
Step 2/10 : RUN mkdir -pv /home/mycodo
 ---> Running in ca2fa2bbe95a
mkdir: created directory '/home/mycodo'
Removing intermediate container ca2fa2bbe95a
 ---> ed467cc09495
Step 3/10 : COPY . /home/mycodo
 ---> d541290b5553
Step 4/10 : WORKDIR /home/mycodo/mycodo
 ---> Running in 41e155de3053
Removing intermediate container 41e155de3053
 ---> c52526637701
Step 5/10 : RUN /home/mycodo/mycodo/scripts/upgrade_commands.sh create-files-directories
 ---> Running in 986437aaad3a

#### Creating files and directories
mkdir: created directory '/var/mycodo'
mkdir: created directory '/var/mycodo/log'
mkdir: created directory '/var/mycodo/database'
mkdir: created directory '/var/mycodo/lock'
mkdir: created directory '/var/mycodo/ssl_certs'
mkdir: created directory '/var/mycodo/custom_inputs'
mkdir: created directory '/var/mycodo/Mycodo-backups'
mkdir: created directory '/var/mycodo/note_attachments'
Removing intermediate container 986437aaad3a
 ---> dc7007cea875
Step 6/10 : RUN /home/mycodo/mycodo/scripts/upgrade_commands.sh update-apt-packages
 ---> Running in 1fb174ac669e

#### Installing prerequisite apt packages and update pip
Ign:1 http://deb.debian.org/debian stretch InRelease
Get:2 http://security.debian.org/debian-security stretch/updates InRelease [94.3 kB]
Get:3 http://deb.debian.org/debian stretch-updates InRelease [91.0 kB]
Get:4 http://deb.debian.org/debian stretch Release [118 kB]
Get:5 http://deb.debian.org/debian stretch Release.gpg [2434 B]
Get:6 http://security.debian.org/debian-security stretch/updates/main armhf Packages [464 kB]
Get:7 http://deb.debian.org/debian stretch-updates/main armhf Packages [10.8 kB]
Get:8 http://deb.debian.org/debian stretch/main armhf Packages [6913 kB]
Fetched 7694 kB in 5s (1324 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  binutils cpp cpp-6 gcc-6 git-man krb5-locales less libasan3 libatomic1
  libbsd0 libc-dev-bin libc6-dev libcc1-0 libcurl3-gnutls libedit2
  liberror-perl libgcc-6-dev libgmp10 libgnutls30 libgomp1 libgpm2
  libgssapi-krb5-2 libhogweed4 libidn11 libidn2-0 libio-pty-perl
  libipc-run-perl libisl15 libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0
  libldap-2.4-2 libldap-common libmpc3 libmpfr4 libncurses5 libnettle6
  libnghttp2-14 libp11-kit0 libperl5.24 libpopt0 libpsl5 librtmp1 libsasl2-2
  libsasl2-modules libsasl2-modules-db libssh2-1 libssl1.0.2 libtasn1-6
  libubsan0 libunistring0 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6
  libxext6 libxmuu1 linux-libc-dev manpages manpages-dev openssh-client patch
  perl perl-modules-5.24 publicsuffix rename rsync xauth
Suggested packages:
  binutils-doc cpp-doc gcc-6-locales gcc-multilib make autoconf automake
  libtool flex bison gdb gcc-doc gcc-6-doc libgcc1-dbg libgomp1-dbg
  libitm1-dbg libatomic1-dbg libasan3-dbg liblsan0-dbg libtsan0-dbg
  libubsan0-dbg libcilkrts5-dbg libmpx2-dbg libquadmath0-dbg gettext-base
  git-daemon-run | git-daemon-sysvinit git-doc git-el git-email git-gui gitk
  gitweb git-arch git-cvs git-mediawiki git-svn glibc-doc gnutls-bin gpm
  krb5-doc krb5-user libsasl2-modules-gssapi-mit
  | libsasl2-modules-gssapi-heimdal libsasl2-modules-ldap libsasl2-modules-otp
  libsasl2-modules-sql man-browser libtime-duration-perl libtimedate-perl
  keychain libpam-ssh monkeysphere ssh-askpass ed diffutils-doc perl-doc
  libterm-readline-gnu-perl | libterm-readline-perl-perl openssh-server
The following NEW packages will be installed:
  binutils cpp cpp-6 gcc gcc-6 git git-man krb5-locales less libasan3
  libatomic1 libbsd0 libc-dev-bin libc6-dev libcc1-0 libcurl3-gnutls libedit2
  liberror-perl libffi-dev libgcc-6-dev libgmp10 libgnutls30 libgomp1 libgpm2
  libgssapi-krb5-2 libhogweed4 libidn11 libidn2-0 libio-pty-perl
  libipc-run-perl libisl15 libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0
  libldap-2.4-2 libldap-common libmpc3 libmpfr4 libncurses5 libnettle6
  libnghttp2-14 libp11-kit0 libperl5.24 libpopt0 libpsl5 librtmp1 libsasl2-2
  libsasl2-modules libsasl2-modules-db libssh2-1 libssl1.0.2 libtasn1-6
  libubsan0 libunistring0 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6
  libxext6 libxmuu1 linux-libc-dev manpages manpages-dev moreutils
  openssh-client patch perl perl-modules-5.24 publicsuffix rename rsync wget
  xauth
0 upgraded, 75 newly installed, 0 to remove and 0 not upgraded.
Need to get 43.4 MB of archives.
After this operation, 155 MB of additional disk space will be used.
Get:1 http://deb.debian.org/debian stretch/main armhf perl-modules-5.24 all 5.24.1-3+deb9u5 [2722 kB]
Get:2 http://deb.debian.org/debian stretch/main armhf libperl5.24 armhf 5.24.1-3+deb9u5 [2850 kB]
Get:3 http://deb.debian.org/debian stretch/main armhf perl armhf 5.24.1-3+deb9u5 [219 kB]
Get:4 http://deb.debian.org/debian stretch/main armhf libgmp10 armhf 2:6.1.2+dfsg-1 [195 kB]
Get:5 http://deb.debian.org/debian stretch/main armhf libnettle6 armhf 3.3-1+b2 [211 kB]
Get:6 http://deb.debian.org/debian stretch/main armhf libhogweed4 armhf 3.3-1+b2 [126 kB]
Get:7 http://deb.debian.org/debian stretch/main armhf libidn11 armhf 1.33-1 [112 kB]
Get:8 http://deb.debian.org/debian stretch/main armhf libp11-kit0 armhf 0.23.3-2 [96.7 kB]
Get:9 http://deb.debian.org/debian stretch/main armhf libtasn1-6 armhf 4.10-1.1+deb9u1 [45.7 kB]
Get:10 http://deb.debian.org/debian stretch/main armhf libgnutls30 armhf 3.5.8-5+deb9u4 [841 kB]
Get:11 http://deb.debian.org/debian stretch/main armhf libkeyutils1 armhf 1.5.9-9 [11.8 kB]
Get:12 http://deb.debian.org/debian stretch/main armhf libkrb5support0 armhf 1.15-1+deb9u1 [58.0 kB]
Get:13 http://deb.debian.org/debian stretch/main armhf libk5crypto3 armhf 1.15-1+deb9u1 [117 kB]
Get:14 http://deb.debian.org/debian stretch/main armhf libkrb5-3 armhf 1.15-1+deb9u1 [267 kB]
Get:15 http://deb.debian.org/debian stretch/main armhf libgssapi-krb5-2 armhf 1.15-1+deb9u1 [133 kB]
Get:16 http://deb.debian.org/debian stretch/main armhf libunistring0 armhf 0.9.6+really0.9.3-0.1 [255 kB]
Get:17 http://deb.debian.org/debian stretch/main armhf libidn2-0 armhf 0.16-1+deb9u1 [58.8 kB]
Get:18 http://deb.debian.org/debian stretch/main armhf libsasl2-modules-db armhf 2.1.27~101-g0780600+dfsg-3 [66.7 kB]
Get:19 http://deb.debian.org/debian stretch/main armhf libsasl2-2 armhf 2.1.27~101-g0780600+dfsg-3 [98.2 kB]
Get:20 http://deb.debian.org/debian stretch/main armhf libldap-common all 2.4.44+dfsg-5+deb9u2 [85.5 kB]
Get:21 http://deb.debian.org/debian stretch/main armhf libldap-2.4-2 armhf 2.4.44+dfsg-5+deb9u2 [197 kB]
Get:22 http://deb.debian.org/debian stretch/main armhf libnghttp2-14 armhf 1.18.1-1 [69.1 kB]
Get:23 http://deb.debian.org/debian stretch/main armhf libpsl5 armhf 0.17.0-3 [40.7 kB]
Get:24 http://deb.debian.org/debian stretch/main armhf librtmp1 armhf 2.4+20151223.gitfa8646d.1-1+b1 [55.1 kB]
Get:25 http://deb.debian.org/debian stretch/main armhf libssh2-1 armhf 1.7.0-1 [128 kB]
Get:26 http://deb.debian.org/debian stretch/main armhf libcurl3-gnutls armhf 7.52.1-5+deb9u9 [262 kB]
Get:27 http://deb.debian.org/debian stretch/main armhf liberror-perl all 0.17024-1 [26.9 kB]
Get:28 http://deb.debian.org/debian stretch/main armhf git-man all 1:2.11.0-3+deb9u4 [1433 kB]
Get:29 http://deb.debian.org/debian stretch/main armhf git armhf 1:2.11.0-3+deb9u4 [3661 kB]
Get:30 http://security.debian.org/debian-security stretch/updates/main armhf libssl1.0.2 armhf 1.0.2r-1~deb9u1 [925 kB]
Get:31 http://security.debian.org/debian-security stretch/updates/main armhf openssh-client armhf 1:7.4p1-10+deb9u6 [742 kB]
Get:32 http://deb.debian.org/debian stretch/main armhf libxau6 armhf 1:1.0.8-1 [19.5 kB]
Get:33 http://deb.debian.org/debian stretch/main armhf libpopt0 armhf 1.16-10+b2 [46.1 kB]
Get:34 http://deb.debian.org/debian stretch/main armhf wget armhf 1.18-5+deb9u2 [781 kB]
Get:35 http://deb.debian.org/debian stretch/main armhf krb5-locales all 1.15-1+deb9u1 [93.8 kB]
Get:36 http://deb.debian.org/debian stretch/main armhf less armhf 481-2.1 [121 kB]
Get:37 http://deb.debian.org/debian stretch/main armhf libbsd0 armhf 0.8.3-1 [89.6 kB]
Get:38 http://deb.debian.org/debian stretch/main armhf libncurses5 armhf 6.0+20161126-1+deb9u2 [74.7 kB]
Get:39 http://deb.debian.org/debian stretch/main armhf libedit2 armhf 3.1-20160903-3 [69.9 kB]
Get:40 http://deb.debian.org/debian stretch/main armhf libgpm2 armhf 1.20.4-6.2+b1 [33.3 kB]
Get:41 http://deb.debian.org/debian stretch/main armhf manpages all 4.10-2 [1222 kB]
Get:42 http://deb.debian.org/debian stretch/main armhf binutils armhf 2.28-5 [3900 kB]
Get:43 http://deb.debian.org/debian stretch/main armhf libisl15 armhf 0.18-1 [441 kB]
Get:44 http://deb.debian.org/debian stretch/main armhf libmpfr4 armhf 3.1.5-1 [536 kB]
Get:45 http://deb.debian.org/debian stretch/main armhf libmpc3 armhf 1.0.3-1+b2 [32.6 kB]
Get:46 http://deb.debian.org/debian stretch/main armhf cpp-6 armhf 6.3.0-18+deb9u1 [5239 kB]
Get:47 http://deb.debian.org/debian stretch/main armhf cpp armhf 4:6.3.0-4 [18.7 kB]
Get:48 http://deb.debian.org/debian stretch/main armhf libcc1-0 armhf 6.3.0-18+deb9u1 [25.2 kB]
Get:49 http://deb.debian.org/debian stretch/main armhf libgomp1 armhf 6.3.0-18+deb9u1 [64.6 kB]
Get:50 http://deb.debian.org/debian stretch/main armhf libatomic1 armhf 6.3.0-18+deb9u1 [6010 B]
Get:51 http://deb.debian.org/debian stretch/main armhf libasan3 armhf 6.3.0-18+deb9u1 [284 kB]
Get:52 http://deb.debian.org/debian stretch/main armhf libubsan0 armhf 6.3.0-18+deb9u1 [92.9 kB]
Get:53 http://deb.debian.org/debian stretch/main armhf libgcc-6-dev armhf 6.3.0-18+deb9u1 [531 kB]
Get:54 http://deb.debian.org/debian stretch/main armhf gcc-6 armhf 6.3.0-18+deb9u1 [5511 kB]
Get:55 http://deb.debian.org/debian stretch/main armhf gcc armhf 4:6.3.0-4 [5212 B]
Get:56 http://deb.debian.org/debian stretch/main armhf libc-dev-bin armhf 2.24-11+deb9u4 [253 kB]
Get:57 http://deb.debian.org/debian stretch-updates/main armhf linux-libc-dev armhf 4.9.144-3.1 [1370 kB]
Get:58 http://deb.debian.org/debian stretch/main armhf libc6-dev armhf 2.24-11+deb9u4 [1995 kB]
Get:59 http://deb.debian.org/debian stretch/main armhf libffi-dev armhf 3.2.1-6 [160 kB]
Get:60 http://deb.debian.org/debian stretch/main armhf libio-pty-perl armhf 1:1.08-1.1+b2 [32.9 kB]
Get:61 http://deb.debian.org/debian stretch/main armhf libipc-run-perl all 0.94-1+deb9u1 [99.1 kB]
Get:62 http://deb.debian.org/debian stretch/main armhf libsasl2-modules armhf 2.1.27~101-g0780600+dfsg-3 [96.0 kB]
Get:63 http://deb.debian.org/debian stretch/main armhf libxdmcp6 armhf 1:1.1.2-3 [24.9 kB]
Get:64 http://deb.debian.org/debian stretch/main armhf libxcb1 armhf 1.12-1 [129 kB]
Get:65 http://deb.debian.org/debian stretch/main armhf libx11-data all 2:1.6.4-3+deb9u1 [287 kB]
Get:66 http://deb.debian.org/debian stretch/main armhf libx11-6 armhf 2:1.6.4-3+deb9u1 [692 kB]
Get:67 http://deb.debian.org/debian stretch/main armhf libxext6 armhf 2:1.3.3-1+b2 [48.1 kB]
Get:68 http://deb.debian.org/debian stretch/main armhf libxmuu1 armhf 2:1.1.2-2 [22.9 kB]
Get:69 http://deb.debian.org/debian stretch/main armhf manpages-dev all 4.10-2 [2145 kB]
Get:70 http://deb.debian.org/debian stretch/main armhf moreutils armhf 0.60-1 [67.9 kB]
Get:71 http://deb.debian.org/debian stretch/main armhf patch armhf 2.7.5-1+deb9u1 [106 kB]
Get:72 http://deb.debian.org/debian stretch/main armhf rename all 0.20-4 [12.5 kB]
Get:73 http://deb.debian.org/debian stretch/main armhf rsync armhf 3.1.2-1+deb9u1 [380 kB]
Get:74 http://deb.debian.org/debian stretch/main armhf xauth armhf 1:1.0.9-1+b2 [36.7 kB]
Get:75 http://deb.debian.org/debian stretch/main armhf publicsuffix all 20181003.1334-0+deb9u1 [104 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 43.4 MB in 13s (3308 kB/s)
Selecting previously unselected package perl-modules-5.24.
(Reading database ... 6703 files and directories currently installed.)
Preparing to unpack .../00-perl-modules-5.24_5.24.1-3+deb9u5_all.deb ...
Unpacking perl-modules-5.24 (5.24.1-3+deb9u5) ...
Selecting previously unselected package libperl5.24:armhf.
Preparing to unpack .../01-libperl5.24_5.24.1-3+deb9u5_armhf.deb ...
Unpacking libperl5.24:armhf (5.24.1-3+deb9u5) ...
Selecting previously unselected package perl.
Preparing to unpack .../02-perl_5.24.1-3+deb9u5_armhf.deb ...
Unpacking perl (5.24.1-3+deb9u5) ...
Selecting previously unselected package libgmp10:armhf.
Preparing to unpack .../03-libgmp10_2%3a6.1.2+dfsg-1_armhf.deb ...
Unpacking libgmp10:armhf (2:6.1.2+dfsg-1) ...
Selecting previously unselected package libnettle6:armhf.
Preparing to unpack .../04-libnettle6_3.3-1+b2_armhf.deb ...
Unpacking libnettle6:armhf (3.3-1+b2) ...
Selecting previously unselected package libhogweed4:armhf.
Preparing to unpack .../05-libhogweed4_3.3-1+b2_armhf.deb ...
Unpacking libhogweed4:armhf (3.3-1+b2) ...
Selecting previously unselected package libidn11:armhf.
Preparing to unpack .../06-libidn11_1.33-1_armhf.deb ...
Unpacking libidn11:armhf (1.33-1) ...
Selecting previously unselected package libp11-kit0:armhf.
Preparing to unpack .../07-libp11-kit0_0.23.3-2_armhf.deb ...
Unpacking libp11-kit0:armhf (0.23.3-2) ...
Selecting previously unselected package libtasn1-6:armhf.
Preparing to unpack .../08-libtasn1-6_4.10-1.1+deb9u1_armhf.deb ...
Unpacking libtasn1-6:armhf (4.10-1.1+deb9u1) ...
Selecting previously unselected package libgnutls30:armhf.
Preparing to unpack .../09-libgnutls30_3.5.8-5+deb9u4_armhf.deb ...
Unpacking libgnutls30:armhf (3.5.8-5+deb9u4) ...
Selecting previously unselected package libkeyutils1:armhf.
Preparing to unpack .../10-libkeyutils1_1.5.9-9_armhf.deb ...
Unpacking libkeyutils1:armhf (1.5.9-9) ...
Selecting previously unselected package libkrb5support0:armhf.
Preparing to unpack .../11-libkrb5support0_1.15-1+deb9u1_armhf.deb ...
Unpacking libkrb5support0:armhf (1.15-1+deb9u1) ...
Selecting previously unselected package libk5crypto3:armhf.
Preparing to unpack .../12-libk5crypto3_1.15-1+deb9u1_armhf.deb ...
Unpacking libk5crypto3:armhf (1.15-1+deb9u1) ...
Selecting previously unselected package libkrb5-3:armhf.
Preparing to unpack .../13-libkrb5-3_1.15-1+deb9u1_armhf.deb ...
Unpacking libkrb5-3:armhf (1.15-1+deb9u1) ...
Selecting previously unselected package libgssapi-krb5-2:armhf.
Preparing to unpack .../14-libgssapi-krb5-2_1.15-1+deb9u1_armhf.deb ...
Unpacking libgssapi-krb5-2:armhf (1.15-1+deb9u1) ...
Selecting previously unselected package libunistring0:armhf.
Preparing to unpack .../15-libunistring0_0.9.6+really0.9.3-0.1_armhf.deb ...
Unpacking libunistring0:armhf (0.9.6+really0.9.3-0.1) ...
Selecting previously unselected package libidn2-0:armhf.
Preparing to unpack .../16-libidn2-0_0.16-1+deb9u1_armhf.deb ...
Unpacking libidn2-0:armhf (0.16-1+deb9u1) ...
Selecting previously unselected package libsasl2-modules-db:armhf.
Preparing to unpack .../17-libsasl2-modules-db_2.1.27~101-g0780600+dfsg-3_armhf.deb ...
Unpacking libsasl2-modules-db:armhf (2.1.27~101-g0780600+dfsg-3) ...
Selecting previously unselected package libsasl2-2:armhf.
Preparing to unpack .../18-libsasl2-2_2.1.27~101-g0780600+dfsg-3_armhf.deb ...
Unpacking libsasl2-2:armhf (2.1.27~101-g0780600+dfsg-3) ...
Selecting previously unselected package libldap-common.
Preparing to unpack .../19-libldap-common_2.4.44+dfsg-5+deb9u2_all.deb ...
Unpacking libldap-common (2.4.44+dfsg-5+deb9u2) ...
Selecting previously unselected package libldap-2.4-2:armhf.
Preparing to unpack .../20-libldap-2.4-2_2.4.44+dfsg-5+deb9u2_armhf.deb ...
Unpacking libldap-2.4-2:armhf (2.4.44+dfsg-5+deb9u2) ...
Selecting previously unselected package libnghttp2-14:armhf.
Preparing to unpack .../21-libnghttp2-14_1.18.1-1_armhf.deb ...
Unpacking libnghttp2-14:armhf (1.18.1-1) ...
Selecting previously unselected package libpsl5:armhf.
Preparing to unpack .../22-libpsl5_0.17.0-3_armhf.deb ...
Unpacking libpsl5:armhf (0.17.0-3) ...
Selecting previously unselected package librtmp1:armhf.
Preparing to unpack .../23-librtmp1_2.4+20151223.gitfa8646d.1-1+b1_armhf.deb ...
Unpacking librtmp1:armhf (2.4+20151223.gitfa8646d.1-1+b1) ...
Selecting previously unselected package libssh2-1:armhf.
Preparing to unpack .../24-libssh2-1_1.7.0-1_armhf.deb ...
Unpacking libssh2-1:armhf (1.7.0-1) ...
Selecting previously unselected package libcurl3-gnutls:armhf.
Preparing to unpack .../25-libcurl3-gnutls_7.52.1-5+deb9u9_armhf.deb ...
Unpacking libcurl3-gnutls:armhf (7.52.1-5+deb9u9) ...
Selecting previously unselected package liberror-perl.
Preparing to unpack .../26-liberror-perl_0.17024-1_all.deb ...
Unpacking liberror-perl (0.17024-1) ...
Selecting previously unselected package git-man.
Preparing to unpack .../27-git-man_1%3a2.11.0-3+deb9u4_all.deb ...
Unpacking git-man (1:2.11.0-3+deb9u4) ...
Selecting previously unselected package git.
Preparing to unpack .../28-git_1%3a2.11.0-3+deb9u4_armhf.deb ...
Unpacking git (1:2.11.0-3+deb9u4) ...
Selecting previously unselected package libxau6:armhf.
Preparing to unpack .../29-libxau6_1%3a1.0.8-1_armhf.deb ...
Unpacking libxau6:armhf (1:1.0.8-1) ...
Selecting previously unselected package libpopt0:armhf.
Preparing to unpack .../30-libpopt0_1.16-10+b2_armhf.deb ...
Unpacking libpopt0:armhf (1.16-10+b2) ...
Selecting previously unselected package libssl1.0.2:armhf.
Preparing to unpack .../31-libssl1.0.2_1.0.2r-1~deb9u1_armhf.deb ...
Unpacking libssl1.0.2:armhf (1.0.2r-1~deb9u1) ...
Selecting previously unselected package wget.
Preparing to unpack .../32-wget_1.18-5+deb9u2_armhf.deb ...
Unpacking wget (1.18-5+deb9u2) ...
Selecting previously unselected package krb5-locales.
Preparing to unpack .../33-krb5-locales_1.15-1+deb9u1_all.deb ...
Unpacking krb5-locales (1.15-1+deb9u1) ...
Selecting previously unselected package less.
Preparing to unpack .../34-less_481-2.1_armhf.deb ...
Unpacking less (481-2.1) ...
Selecting previously unselected package libbsd0:armhf.
Preparing to unpack .../35-libbsd0_0.8.3-1_armhf.deb ...
Unpacking libbsd0:armhf (0.8.3-1) ...
Selecting previously unselected package libncurses5:armhf.
Preparing to unpack .../36-libncurses5_6.0+20161126-1+deb9u2_armhf.deb ...
Unpacking libncurses5:armhf (6.0+20161126-1+deb9u2) ...
Selecting previously unselected package libedit2:armhf.
Preparing to unpack .../37-libedit2_3.1-20160903-3_armhf.deb ...
Unpacking libedit2:armhf (3.1-20160903-3) ...
Selecting previously unselected package libgpm2:armhf.
Preparing to unpack .../38-libgpm2_1.20.4-6.2+b1_armhf.deb ...
Unpacking libgpm2:armhf (1.20.4-6.2+b1) ...
Selecting previously unselected package manpages.
Preparing to unpack .../39-manpages_4.10-2_all.deb ...
Unpacking manpages (4.10-2) ...
Selecting previously unselected package openssh-client.
Preparing to unpack .../40-openssh-client_1%3a7.4p1-10+deb9u6_armhf.deb ...
Unpacking openssh-client (1:7.4p1-10+deb9u6) ...
Selecting previously unselected package binutils.
Preparing to unpack .../41-binutils_2.28-5_armhf.deb ...
Unpacking binutils (2.28-5) ...
Selecting previously unselected package libisl15:armhf.
Preparing to unpack .../42-libisl15_0.18-1_armhf.deb ...
Unpacking libisl15:armhf (0.18-1) ...
Selecting previously unselected package libmpfr4:armhf.
Preparing to unpack .../43-libmpfr4_3.1.5-1_armhf.deb ...
Unpacking libmpfr4:armhf (3.1.5-1) ...
Selecting previously unselected package libmpc3:armhf.
Preparing to unpack .../44-libmpc3_1.0.3-1+b2_armhf.deb ...
Unpacking libmpc3:armhf (1.0.3-1+b2) ...
Selecting previously unselected package cpp-6.
Preparing to unpack .../45-cpp-6_6.3.0-18+deb9u1_armhf.deb ...
Unpacking cpp-6 (6.3.0-18+deb9u1) ...
Selecting previously unselected package cpp.
Preparing to unpack .../46-cpp_4%3a6.3.0-4_armhf.deb ...
Unpacking cpp (4:6.3.0-4) ...
Selecting previously unselected package libcc1-0:armhf.
Preparing to unpack .../47-libcc1-0_6.3.0-18+deb9u1_armhf.deb ...
Unpacking libcc1-0:armhf (6.3.0-18+deb9u1) ...
Selecting previously unselected package libgomp1:armhf.
Preparing to unpack .../48-libgomp1_6.3.0-18+deb9u1_armhf.deb ...
Unpacking libgomp1:armhf (6.3.0-18+deb9u1) ...
Selecting previously unselected package libatomic1:armhf.
Preparing to unpack .../49-libatomic1_6.3.0-18+deb9u1_armhf.deb ...
Unpacking libatomic1:armhf (6.3.0-18+deb9u1) ...
Selecting previously unselected package libasan3:armhf.
Preparing to unpack .../50-libasan3_6.3.0-18+deb9u1_armhf.deb ...
Unpacking libasan3:armhf (6.3.0-18+deb9u1) ...
Selecting previously unselected package libubsan0:armhf.
Preparing to unpack .../51-libubsan0_6.3.0-18+deb9u1_armhf.deb ...
Unpacking libubsan0:armhf (6.3.0-18+deb9u1) ...
Selecting previously unselected package libgcc-6-dev:armhf.
Preparing to unpack .../52-libgcc-6-dev_6.3.0-18+deb9u1_armhf.deb ...
Unpacking libgcc-6-dev:armhf (6.3.0-18+deb9u1) ...
Selecting previously unselected package gcc-6.
Preparing to unpack .../53-gcc-6_6.3.0-18+deb9u1_armhf.deb ...
Unpacking gcc-6 (6.3.0-18+deb9u1) ...
Selecting previously unselected package gcc.
Preparing to unpack .../54-gcc_4%3a6.3.0-4_armhf.deb ...
Unpacking gcc (4:6.3.0-4) ...
Selecting previously unselected package libc-dev-bin.
Preparing to unpack .../55-libc-dev-bin_2.24-11+deb9u4_armhf.deb ...
Unpacking libc-dev-bin (2.24-11+deb9u4) ...
Selecting previously unselected package linux-libc-dev:armhf.
Preparing to unpack .../56-linux-libc-dev_4.9.144-3.1_armhf.deb ...
Unpacking linux-libc-dev:armhf (4.9.144-3.1) ...
Selecting previously unselected package libc6-dev:armhf.
Preparing to unpack .../57-libc6-dev_2.24-11+deb9u4_armhf.deb ...
Unpacking libc6-dev:armhf (2.24-11+deb9u4) ...
Selecting previously unselected package libffi-dev:armhf.
Preparing to unpack .../58-libffi-dev_3.2.1-6_armhf.deb ...
Unpacking libffi-dev:armhf (3.2.1-6) ...
Selecting previously unselected package libio-pty-perl.
Preparing to unpack .../59-libio-pty-perl_1%3a1.08-1.1+b2_armhf.deb ...
Unpacking libio-pty-perl (1:1.08-1.1+b2) ...
Selecting previously unselected package libipc-run-perl.
Preparing to unpack .../60-libipc-run-perl_0.94-1+deb9u1_all.deb ...
Unpacking libipc-run-perl (0.94-1+deb9u1) ...
Selecting previously unselected package libsasl2-modules:armhf.
Preparing to unpack .../61-libsasl2-modules_2.1.27~101-g0780600+dfsg-3_armhf.deb ...
Unpacking libsasl2-modules:armhf (2.1.27~101-g0780600+dfsg-3) ...
Selecting previously unselected package libxdmcp6:armhf.
Preparing to unpack .../62-libxdmcp6_1%3a1.1.2-3_armhf.deb ...
Unpacking libxdmcp6:armhf (1:1.1.2-3) ...
Selecting previously unselected package libxcb1:armhf.
Preparing to unpack .../63-libxcb1_1.12-1_armhf.deb ...
Unpacking libxcb1:armhf (1.12-1) ...
Selecting previously unselected package libx11-data.
Preparing to unpack .../64-libx11-data_2%3a1.6.4-3+deb9u1_all.deb ...
Unpacking libx11-data (2:1.6.4-3+deb9u1) ...
Selecting previously unselected package libx11-6:armhf.
Preparing to unpack .../65-libx11-6_2%3a1.6.4-3+deb9u1_armhf.deb ...
Unpacking libx11-6:armhf (2:1.6.4-3+deb9u1) ...
Selecting previously unselected package libxext6:armhf.
Preparing to unpack .../66-libxext6_2%3a1.3.3-1+b2_armhf.deb ...
Unpacking libxext6:armhf (2:1.3.3-1+b2) ...
Selecting previously unselected package libxmuu1:armhf.
Preparing to unpack .../67-libxmuu1_2%3a1.1.2-2_armhf.deb ...
Unpacking libxmuu1:armhf (2:1.1.2-2) ...
Selecting previously unselected package manpages-dev.
Preparing to unpack .../68-manpages-dev_4.10-2_all.deb ...
Unpacking manpages-dev (4.10-2) ...
Selecting previously unselected package moreutils.
Preparing to unpack .../69-moreutils_0.60-1_armhf.deb ...
Unpacking moreutils (0.60-1) ...
Selecting previously unselected package patch.
Preparing to unpack .../70-patch_2.7.5-1+deb9u1_armhf.deb ...
Unpacking patch (2.7.5-1+deb9u1) ...
Selecting previously unselected package rename.
Preparing to unpack .../71-rename_0.20-4_all.deb ...
Unpacking rename (0.20-4) ...
Selecting previously unselected package rsync.
Preparing to unpack .../72-rsync_3.1.2-1+deb9u1_armhf.deb ...
Unpacking rsync (3.1.2-1+deb9u1) ...
Selecting previously unselected package xauth.
Preparing to unpack .../73-xauth_1%3a1.0.9-1+b2_armhf.deb ...
Unpacking xauth (1:1.0.9-1+b2) ...
Selecting previously unselected package publicsuffix.
Preparing to unpack .../74-publicsuffix_20181003.1334-0+deb9u1_all.deb ...
Unpacking publicsuffix (20181003.1334-0+deb9u1) ...
Setting up libncurses5:armhf (6.0+20161126-1+deb9u2) ...
Setting up libgomp1:armhf (6.3.0-18+deb9u1) ...
Setting up libatomic1:armhf (6.3.0-18+deb9u1) ...
Setting up perl-modules-5.24 (5.24.1-3+deb9u5) ...
Setting up manpages (4.10-2) ...
Setting up libperl5.24:armhf (5.24.1-3+deb9u5) ...
Setting up libnettle6:armhf (3.3-1+b2) ...
Setting up git-man (1:2.11.0-3+deb9u4) ...
Setting up libpopt0:armhf (1.16-10+b2) ...
Setting up libcc1-0:armhf (6.3.0-18+deb9u1) ...
Setting up less (481-2.1) ...
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
Setting up libasan3:armhf (6.3.0-18+deb9u1) ...
Setting up libnghttp2-14:armhf (1.18.1-1) ...
Setting up libgpm2:armhf (1.20.4-6.2+b1) ...
Setting up libldap-common (2.4.44+dfsg-5+deb9u2) ...
Setting up libubsan0:armhf (6.3.0-18+deb9u1) ...
Setting up libsasl2-modules-db:armhf (2.1.27~101-g0780600+dfsg-3) ...
Setting up linux-libc-dev:armhf (4.9.144-3.1) ...
Setting up libsasl2-2:armhf (2.1.27~101-g0780600+dfsg-3) ...
Setting up libffi-dev:armhf (3.2.1-6) ...
Setting up libbsd0:armhf (0.8.3-1) ...
Setting up libtasn1-6:armhf (4.10-1.1+deb9u1) ...
Setting up rsync (3.1.2-1+deb9u1) ...
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of restart.
Setting up perl (5.24.1-3+deb9u5) ...
update-alternatives: using /usr/bin/prename to provide /usr/bin/rename (rename) in auto mode
update-alternatives: warning: skip creation of /usr/share/man/man1/rename.1.gz because associated file /usr/share/man/man1/prename.1.gz (of link group rename) doesn't exist
Setting up libssl1.0.2:armhf (1.0.2r-1~deb9u1) ...
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
Setting up libgmp10:armhf (2:6.1.2+dfsg-1) ...
Setting up libssh2-1:armhf (1.7.0-1) ...
Setting up patch (2.7.5-1+deb9u1) ...
Setting up krb5-locales (1.15-1+deb9u1) ...
Processing triggers for libc-bin (2.24-11+deb9u4) ...
Setting up publicsuffix (20181003.1334-0+deb9u1) ...
Setting up libunistring0:armhf (0.9.6+really0.9.3-0.1) ...
Setting up libp11-kit0:armhf (0.23.3-2) ...
Setting up libmpfr4:armhf (3.1.5-1) ...
Setting up libmpc3:armhf (1.0.3-1+b2) ...
Setting up binutils (2.28-5) ...
Setting up libc-dev-bin (2.24-11+deb9u4) ...
Setting up libxdmcp6:armhf (1:1.1.2-3) ...
Setting up libkeyutils1:armhf (1.5.9-9) ...
Setting up libsasl2-modules:armhf (2.1.27~101-g0780600+dfsg-3) ...
Setting up manpages-dev (4.10-2) ...
Setting up libc6-dev:armhf (2.24-11+deb9u4) ...
Setting up libx11-data (2:1.6.4-3+deb9u1) ...
Setting up libxau6:armhf (1:1.0.8-1) ...
Setting up libidn11:armhf (1.33-1) ...
Setting up libedit2:armhf (3.1-20160903-3) ...
Setting up libidn2-0:armhf (0.16-1+deb9u1) ...
Setting up libgcc-6-dev:armhf (6.3.0-18+deb9u1) ...
Setting up libio-pty-perl (1:1.08-1.1+b2) ...
Setting up liberror-perl (0.17024-1) ...
Setting up rename (0.20-4) ...
update-alternatives: using /usr/bin/file-rename to provide /usr/bin/rename (rename) in auto mode
update-alternatives: warning: skip creation of /usr/share/man/man1/rename.1.gz because associated file /usr/share/man/man1/file-rename.1p.gz (of link group rename) doesn't exist
Setting up libpsl5:armhf (0.17.0-3) ...
Setting up libkrb5support0:armhf (1.15-1+deb9u1) ...
Setting up libhogweed4:armhf (3.3-1+b2) ...
Setting up libisl15:armhf (0.18-1) ...
Setting up libipc-run-perl (0.94-1+deb9u1) ...
Setting up cpp-6 (6.3.0-18+deb9u1) ...
Setting up libxcb1:armhf (1.12-1) ...
Setting up cpp (4:6.3.0-4) ...
Setting up libk5crypto3:armhf (1.15-1+deb9u1) ...
Setting up libgnutls30:armhf (3.5.8-5+deb9u4) ...
Setting up libx11-6:armhf (2:1.6.4-3+deb9u1) ...
Setting up moreutils (0.60-1) ...
Setting up librtmp1:armhf (2.4+20151223.gitfa8646d.1-1+b1) ...
Setting up libxmuu1:armhf (2:1.1.2-2) ...
Setting up gcc-6 (6.3.0-18+deb9u1) ...
Setting up libldap-2.4-2:armhf (2.4.44+dfsg-5+deb9u2) ...
Setting up wget (1.18-5+deb9u2) ...
Setting up libkrb5-3:armhf (1.15-1+deb9u1) ...
Setting up libxext6:armhf (2:1.3.3-1+b2) ...
Setting up gcc (4:6.3.0-4) ...
Setting up libgssapi-krb5-2:armhf (1.15-1+deb9u1) ...
Setting up xauth (1:1.0.9-1+b2) ...
Setting up openssh-client (1:7.4p1-10+deb9u6) ...
Setting up libcurl3-gnutls:armhf (7.52.1-5+deb9u9) ...
Setting up git (1:2.11.0-3+deb9u4) ...
Processing triggers for libc-bin (2.24-11+deb9u4) ...
Removing intermediate container 1fb174ac669e
 ---> a51422239b47
Step 7/10 : RUN /home/mycodo/mycodo/scripts/upgrade_commands.sh update-pip
 ---> Running in c0f44274161a

#### Updating pip
Requirement already up-to-date: pip in /usr/local/lib/python3.6/site-packages (19.0.3)
Removing intermediate container c0f44274161a
 ---> bdbe21508eb5
Step 8/10 : RUN /home/mycodo/mycodo/scripts/upgrade_commands.sh update-pip-packages
 ---> Running in ed10f052da02

#### Installing pip requirements from requirements.txt
Requirement already up-to-date: pip in /usr/local/lib/python3.6/site-packages (19.0.3)
Requirement already up-to-date: setuptools in /usr/local/lib/python3.6/site-packages (40.8.0)
Collecting alembic==1.0.8 (from -r /home/mycodo/requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/d6/bb/ec1e21f2e303689ad2170eb47fc67df9ad4199ade6759a99474c4d3535c8/alembic-1.0.8.tar.gz (1.0MB)
Collecting argparse==1.4.0 (from -r /home/mycodo/requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/f2/94/3af39d34be01a24a6e65433d19e107099374224905f1e0cc6bbe1fd22a2f/argparse-1.4.0-py2.py3-none-any.whl
Collecting bcrypt==3.1.4 (from -r /home/mycodo/requirements.txt (line 3))
  Downloading https://files.pythonhosted.org/packages/f3/ec/bb6b384b5134fd881b91b6aa3a88ccddaad0103857760711a5ab8c799358/bcrypt-3.1.4.tar.gz (42kB)
Collecting Flask==1.0.2 (from -r /home/mycodo/requirements.txt (line 4))
  Downloading https://files.pythonhosted.org/packages/7f/e7/08578774ed4536d3242b14dacb4696386634607af824ea997202cd0edb4b/Flask-1.0.2-py2.py3-none-any.whl (91kB)
Collecting Flask_Babel==0.12.2 (from -r /home/mycodo/requirements.txt (line 5))
  Downloading https://files.pythonhosted.org/packages/82/b0/986b29938d4e8be7deb552ebfd1ef16c311276a59bcae10dec567a5b3d20/Flask-Babel-0.12.2.tar.gz (44kB)
Collecting Flask_Compress==1.4.0 (from -r /home/mycodo/requirements.txt (line 6))
  Downloading https://files.pythonhosted.org/packages/0e/2a/378bd072928f6d92fd8c417d66b00c757dc361c0405a46a0134de6fd323d/Flask-Compress-1.4.0.tar.gz
Collecting Flask_CSV==1.2.0 (from -r /home/mycodo/requirements.txt (line 7))
  Downloading https://files.pythonhosted.org/packages/27/c8/e822673a0e5add39315eba04a28c84301aa5dedd99e834c3319fe212c09c/Flask-CSV-1.2.0.tar.gz
Collecting Flask_InfluxDB==0.2 (from -r /home/mycodo/requirements.txt (line 8))
  Downloading https://files.pythonhosted.org/packages/fa/c9/bb1ce39ed08fb859dd880461429292783588353d92702d0bef7d179a1616/Flask_InfluxDB-0.2-py3-none-any.whl
Collecting Flask_Limiter==1.0.1 (from -r /home/mycodo/requirements.txt (line 9))
  Downloading https://files.pythonhosted.org/packages/56/22/70ff505dc4982ce23838da00c2ab580e95cfbe9814713fb0318898fd9191/Flask-Limiter-1.0.1.tar.gz (89kB)
Collecting Flask_Login==0.4.1 (from -r /home/mycodo/requirements.txt (line 10))
  Downloading https://files.pythonhosted.org/packages/c1/ff/bd9a4d2d81bf0c07d9e53e8cd3d675c56553719bbefd372df69bf1b3c1e4/Flask-Login-0.4.1.tar.gz
Collecting Flask_SQLAlchemy==2.3.2 (from -r /home/mycodo/requirements.txt (line 11))
  Downloading https://files.pythonhosted.org/packages/a1/44/294fb7f6bf49cc7224417cd0637018db9fee0729b4fe166e43e2bbb1f1c8/Flask_SQLAlchemy-2.3.2-py2.py3-none-any.whl
Collecting Flask_SSLify==0.1.5 (from -r /home/mycodo/requirements.txt (line 12))
  Downloading https://files.pythonhosted.org/packages/6e/98/54f2ffaf886d25eb1591cfb534c04cbf983236d657d58d180fd9ccbb5e7f/Flask-SSLify-0.1.5.tar.gz
Collecting Flask_WTF==0.14.2 (from -r /home/mycodo/requirements.txt (line 13))
  Downloading https://files.pythonhosted.org/packages/60/3a/58c629472d10539ae5167dc7c1fecfa95dd7d0b7864623931e3776438a24/Flask_WTF-0.14.2-py2.py3-none-any.whl
Collecting geocoder==1.38.1 (from -r /home/mycodo/requirements.txt (line 14))
  Downloading https://files.pythonhosted.org/packages/4f/6b/13166c909ad2f2d76b929a4227c952630ebaf0d729f6317eb09cbceccbab/geocoder-1.38.1-py2.py3-none-any.whl (98kB)
Collecting gunicorn==19.9.0 (from -r /home/mycodo/requirements.txt (line 15))
  Downloading https://files.pythonhosted.org/packages/8c/da/b8dd8deb741bff556db53902d4706774c8e1e67265f69528c14c003644e6/gunicorn-19.9.0-py2.py3-none-any.whl (112kB)
Collecting influxdb==5.0.0 (from -r /home/mycodo/requirements.txt (line 16))
  Downloading https://files.pythonhosted.org/packages/8d/79/7972c12e393080eda6920583c9c2ed2206771da7f6341c8971a2c02ff3d3/influxdb-5.0.0-py2.py3-none-any.whl (70kB)
Collecting locket==0.2.0 (from -r /home/mycodo/requirements.txt (line 17))
  Downloading https://files.pythonhosted.org/packages/d0/22/3c0f97614e0be8386542facb3a7dcfc2584f7b83608c02333bced641281c/locket-0.2.0.tar.gz
Collecting pylint (from -r /home/mycodo/requirements.txt (line 18))
  Downloading https://files.pythonhosted.org/packages/60/c2/b3f73f4ac008bef6e75bca4992f3963b3f85942e0277237721ef1c151f0d/pylint-2.3.1-py3-none-any.whl (765kB)
Collecting pyserial (from -r /home/mycodo/requirements.txt (line 19))
  Downloading https://files.pythonhosted.org/packages/0d/e4/2a744dd9e3be04a0c0907414e2a01a7c88bb3915cbe3c8cc06e209f59c30/pyserial-3.4-py2.py3-none-any.whl (193kB)
Collecting python-dateutil==2.8.0 (from -r /home/mycodo/requirements.txt (line 20))
  Downloading https://files.pythonhosted.org/packages/41/17/c62faccbfbd163c7f57f3844689e3a78bae1f403648a6afb1d0866d87fbb/python_dateutil-2.8.0-py2.py3-none-any.whl (226kB)
Collecting requests (from -r /home/mycodo/requirements.txt (line 21))
  Downloading https://files.pythonhosted.org/packages/7d/e3/20f3d364d6c8e5d2353c72a67778eb189176f08e873c9900e10c0287b84b/requests-2.21.0-py2.py3-none-any.whl (57kB)
Collecting rpyc==4.0.2 (from -r /home/mycodo/requirements.txt (line 22))
  Downloading https://files.pythonhosted.org/packages/ba/88/1cea477a4ad7c0f546a4c82aa367185be7b8fce512db8283e82de8454772/rpyc-4.0.2.tar.gz (53kB)
Collecting SQLAlchemy==1.3.1 (from -r /home/mycodo/requirements.txt (line 23))
  Downloading https://files.pythonhosted.org/packages/85/29/d7a5687d0d21ea8133f2d4ef02dfb4d191afe7ebc8bd9f962d99bdf595e1/SQLAlchemy-1.3.1.tar.gz (5.9MB)
Collecting WTForms==2.2.1 (from -r /home/mycodo/requirements.txt (line 24))
  Downloading https://files.pythonhosted.org/packages/9f/c8/dac5dce9908df1d9d48ec0e26e2a250839fa36ea2c602cc4f85ccfeb5c65/WTForms-2.2.1-py2.py3-none-any.whl (166kB)
Collecting Mako (from alembic==1.0.8->-r /home/mycodo/requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/eb/69/6137c60cae2ab8c911bff510bb6d1d23a0189f75d114bb277606c6486b5f/Mako-1.0.8.tar.gz (468kB)
Collecting python-editor>=0.3 (from alembic==1.0.8->-r /home/mycodo/requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/c6/d3/201fc3abe391bbae6606e6f1d598c15d367033332bd54352b12f35513717/python_editor-1.0.4-py3-none-any.whl
Collecting cffi>=1.1 (from bcrypt==3.1.4->-r /home/mycodo/requirements.txt (line 3))
  Downloading https://files.pythonhosted.org/packages/64/7c/27367b38e6cc3e1f49f193deb761fe75cda9f95da37b67b422e62281fcac/cffi-1.12.2.tar.gz (453kB)
Collecting six>=1.4.1 (from bcrypt==3.1.4->-r /home/mycodo/requirements.txt (line 3))
  Downloading https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Collecting click>=5.1 (from Flask==1.0.2->-r /home/mycodo/requirements.txt (line 4))
  Downloading https://files.pythonhosted.org/packages/fa/37/45185cb5abbc30d7257104c434fe0b07e5a195a6847506c074527aa599ec/Click-7.0-py2.py3-none-any.whl (81kB)
Collecting Werkzeug>=0.14 (from Flask==1.0.2->-r /home/mycodo/requirements.txt (line 4))
  Downloading https://files.pythonhosted.org/packages/29/5e/d54398f8ee78166d2cf07e46d19096e55aba506e44de998a1ad85b83ec8d/Werkzeug-0.15.0-py2.py3-none-any.whl (328kB)
Collecting itsdangerous>=0.24 (from Flask==1.0.2->-r /home/mycodo/requirements.txt (line 4))
  Downloading https://files.pythonhosted.org/packages/76/ae/44b03b253d6fade317f32c24d100b3b35c2239807046a4c953c7b89fa49e/itsdangerous-1.1.0-py2.py3-none-any.whl
Collecting Jinja2>=2.10 (from Flask==1.0.2->-r /home/mycodo/requirements.txt (line 4))
  Downloading https://files.pythonhosted.org/packages/7f/ff/ae64bacdfc95f27a016a7bed8e8686763ba4d277a78ca76f32659220a731/Jinja2-2.10-py2.py3-none-any.whl (126kB)
Collecting Babel>=2.3 (from Flask_Babel==0.12.2->-r /home/mycodo/requirements.txt (line 5))
  Downloading https://files.pythonhosted.org/packages/b8/ad/c6f60602d3ee3d92fbed87675b6fb6a6f9a38c223343ababdb44ba201f10/Babel-2.6.0-py2.py3-none-any.whl (8.1MB)
Collecting csvalidate (from Flask_CSV==1.2.0->-r /home/mycodo/requirements.txt (line 7))
  Downloading https://files.pythonhosted.org/packages/be/4e/039798c21e8297fd59629c96ba5ad62806245c6ea6d5a36647f71d0a6963/csvalidate-1.1.1.tar.gz
Collecting marshmallow (from Flask_CSV==1.2.0->-r /home/mycodo/requirements.txt (line 7))
  Downloading https://files.pythonhosted.org/packages/77/a3/4a9bf148dbe336ad068cc413f3683f9c275ea31f94ec05d19ea75f580b7b/marshmallow-2.19.1-py2.py3-none-any.whl (49kB)
Collecting limits (from Flask_Limiter==1.0.1->-r /home/mycodo/requirements.txt (line 9))
  Downloading https://files.pythonhosted.org/packages/62/97/27fbc02dcae873d2e12995d882a02ceab1cb8f7726f64e7f290351e1a13b/limits-1.3.tar.gz
Collecting ratelim (from geocoder==1.38.1->-r /home/mycodo/requirements.txt (line 14))
  Downloading https://files.pythonhosted.org/packages/f2/98/7e6d147fd16a10a5f821db6e25f192265d6ecca3d82957a4fdd592cad49c/ratelim-0.1.6-py2.py3-none-any.whl
Collecting future (from geocoder==1.38.1->-r /home/mycodo/requirements.txt (line 14))
  Downloading https://files.pythonhosted.org/packages/90/52/e20466b85000a181e1e144fd8305caf2cf475e2f9674e797b222f8105f5f/future-0.17.1.tar.gz (829kB)
Collecting pytz (from influxdb==5.0.0->-r /home/mycodo/requirements.txt (line 16))
  Downloading https://files.pythonhosted.org/packages/61/28/1d3920e4d1d50b19bc5d24398a7cd85cc7b9a75a490570d5a30c57622d34/pytz-2018.9-py2.py3-none-any.whl (510kB)
Collecting astroid<3,>=2.2.0 (from pylint->-r /home/mycodo/requirements.txt (line 18))
  Downloading https://files.pythonhosted.org/packages/d5/ad/7221a62a2dbce5c3b8c57fd18e1052c7331adc19b3f27f1561aa6e620db2/astroid-2.2.5-py3-none-any.whl (193kB)
Collecting mccabe<0.7,>=0.6 (from pylint->-r /home/mycodo/requirements.txt (line 18))
  Downloading https://files.pythonhosted.org/packages/87/89/479dc97e18549e21354893e4ee4ef36db1d237534982482c3681ee6e7b57/mccabe-0.6.1-py2.py3-none-any.whl
Collecting isort<5,>=4.2.5 (from pylint->-r /home/mycodo/requirements.txt (line 18))
  Downloading https://files.pythonhosted.org/packages/b6/89/3137d13dd30a0d063435661950f6dfd50957532989e49aef652f490ef616/isort-4.3.15-py2.py3-none-any.whl (42kB)
Collecting certifi>=2017.4.17 (from requests->-r /home/mycodo/requirements.txt (line 21))
  Downloading https://files.pythonhosted.org/packages/60/75/f692a584e85b7eaba0e03827b3d51f45f571c2e793dd731e598828d380aa/certifi-2019.3.9-py2.py3-none-any.whl (158kB)
Collecting urllib3<1.25,>=1.21.1 (from requests->-r /home/mycodo/requirements.txt (line 21))
  Downloading https://files.pythonhosted.org/packages/62/00/ee1d7de624db8ba7090d1226aebefab96a2c71cd5cfa7629d6ad3f61b79e/urllib3-1.24.1-py2.py3-none-any.whl (118kB)
Collecting idna<2.9,>=2.5 (from requests->-r /home/mycodo/requirements.txt (line 21))
  Downloading https://files.pythonhosted.org/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl (58kB)
Collecting chardet<3.1.0,>=3.0.2 (from requests->-r /home/mycodo/requirements.txt (line 21))
  Downloading https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl (133kB)
Collecting plumbum (from rpyc==4.0.2->-r /home/mycodo/requirements.txt (line 22))
  Downloading https://files.pythonhosted.org/packages/48/48/0c592a65c8ecc6a4c0da41d75097704a283595b6731be1531eee3f4f7778/plumbum-1.6.7-py2.py3-none-any.whl (110kB)
Collecting MarkupSafe>=0.9.2 (from Mako->alembic==1.0.8->-r /home/mycodo/requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/b9/2e/64db92e53b86efccfaea71321f597fa2e1b2bd3853d8ce658568f7a13094/MarkupSafe-1.1.1.tar.gz
Collecting pycparser (from cffi>=1.1->bcrypt==3.1.4->-r /home/mycodo/requirements.txt (line 3))
  Downloading https://files.pythonhosted.org/packages/68/9e/49196946aee219aead1290e00d1e7fdeab8567783e83e1b9ab5585e6206a/pycparser-2.19.tar.gz (158kB)
Collecting decorator (from ratelim->geocoder==1.38.1->-r /home/mycodo/requirements.txt (line 14))
  Downloading https://files.pythonhosted.org/packages/5f/88/0075e461560a1e750a0dcbf77f1d9de775028c37a19a346a6c565a257399/decorator-4.4.0-py2.py3-none-any.whl
Collecting lazy-object-proxy (from astroid<3,>=2.2.0->pylint->-r /home/mycodo/requirements.txt (line 18))
  Downloading https://files.pythonhosted.org/packages/55/08/23c0753599bdec1aec273e322f277c4e875150325f565017f6280549f554/lazy-object-proxy-1.3.1.tar.gz
Collecting typed-ast>=1.3.0; implementation_name == "cpython" (from astroid<3,>=2.2.0->pylint->-r /home/mycodo/requirements.txt (line 18))
  Downloading https://files.pythonhosted.org/packages/fc/c6/61d6410fc70fda073bd1810f9b7f7022f00146b108f278a0c00041bfe5b0/typed-ast-1.3.1.tar.gz (204kB)
Collecting wrapt (from astroid<3,>=2.2.0->pylint->-r /home/mycodo/requirements.txt (line 18))
  Downloading https://files.pythonhosted.org/packages/67/b2/0f71ca90b0ade7fad27e3d20327c996c6252a2ffe88f50a95bba7434eda9/wrapt-1.11.1.tar.gz
Installing collected packages: SQLAlchemy, MarkupSafe, Mako, python-editor, six, python-dateutil, alembic, argparse, pycparser, cffi, bcrypt, click, Werkzeug, itsdangerous, Jinja2, Flask, pytz, Babel, Flask-Babel, Flask-Compress, csvalidate, marshmallow, Flask-CSV, certifi, urllib3, idna, chardet, requests, influxdb, Flask-InfluxDB, limits, Flask-Limiter, Flask-Login, Flask-SQLAlchemy, Flask-SSLify, WTForms, Flask-WTF, decorator, ratelim, future, geocoder, gunicorn, locket, lazy-object-proxy, typed-ast, wrapt, astroid, mccabe, isort, pylint, pyserial, plumbum, rpyc
  Running setup.py install for SQLAlchemy: started
    Running setup.py install for SQLAlchemy: finished with status 'done'
  Running setup.py install for MarkupSafe: started
    Running setup.py install for MarkupSafe: finished with status 'done'
  Running setup.py install for Mako: started
    Running setup.py install for Mako: finished with status 'done'
  Running setup.py install for alembic: started
    Running setup.py install for alembic: finished with status 'done'
  Running setup.py install for pycparser: started
    Running setup.py install for pycparser: finished with status 'done'
  Running setup.py install for cffi: started
    Running setup.py install for cffi: finished with status 'done'
  Running setup.py install for bcrypt: started
    Running setup.py install for bcrypt: finished with status 'done'
  Running setup.py install for Flask-Babel: started
    Running setup.py install for Flask-Babel: finished with status 'done'
  Running setup.py install for Flask-Compress: started
    Running setup.py install for Flask-Compress: finished with status 'done'
  Running setup.py install for csvalidate: started
    Running setup.py install for csvalidate: finished with status 'done'
  Running setup.py install for Flask-CSV: started
    Running setup.py install for Flask-CSV: finished with status 'done'
  Running setup.py install for limits: started
    Running setup.py install for limits: finished with status 'done'
  Running setup.py install for Flask-Limiter: started
    Running setup.py install for Flask-Limiter: finished with status 'done'
  Running setup.py install for Flask-Login: started
    Running setup.py install for Flask-Login: finished with status 'done'
  Running setup.py install for Flask-SSLify: started
    Running setup.py install for Flask-SSLify: finished with status 'done'
  Running setup.py install for future: started
    Running setup.py install for future: finished with status 'done'
  Running setup.py install for locket: started
    Running setup.py install for locket: finished with status 'done'
  Running setup.py install for lazy-object-proxy: started
    Running setup.py install for lazy-object-proxy: finished with status 'done'
  Running setup.py install for typed-ast: started
    Running setup.py install for typed-ast: still running...
    Running setup.py install for typed-ast: finished with status 'done'
  Running setup.py install for wrapt: started
    Running setup.py install for wrapt: finished with status 'done'
  Running setup.py install for rpyc: started
    Running setup.py install for rpyc: finished with status 'done'
Successfully installed Babel-2.6.0 Flask-1.0.2 Flask-Babel-0.12.2 Flask-CSV-1.2.0 Flask-Compress-1.4.0 Flask-InfluxDB-0.2 Flask-Limiter-1.0.1 Flask-Login-0.4.1 Flask-SQLAlchemy-2.3.2 Flask-SSLify-0.1.5 Flask-WTF-0.14.2 Jinja2-2.10 Mako-1.0.8 MarkupSafe-1.1.1 SQLAlchemy-1.3.1 WTForms-2.2.1 Werkzeug-0.15.0 alembic-1.0.8 argparse-1.4.0 astroid-2.2.5 bcrypt-3.1.4 certifi-2019.3.9 cffi-1.12.2 chardet-3.0.4 click-7.0 csvalidate-1.1.1 decorator-4.4.0 future-0.17.1 geocoder-1.38.1 gunicorn-19.9.0 idna-2.8 influxdb-5.0.0 isort-4.3.15 itsdangerous-1.1.0 lazy-object-proxy-1.3.1 limits-1.3 locket-0.2.0 marshmallow-2.19.1 mccabe-0.6.1 plumbum-1.6.7 pycparser-2.19 pylint-2.3.1 pyserial-3.4 python-dateutil-2.8.0 python-editor-1.0.4 pytz-2018.9 ratelim-0.1.6 requests-2.21.0 rpyc-4.0.2 six-1.12.0 typed-ast-1.3.1 urllib3-1.24.1 wrapt-1.11.1
Removing intermediate container ed10f052da02
 ---> 797479dad6bc
Step 9/10 : RUN /home/mycodo/mycodo/scripts/upgrade_commands.sh ssl-certs-generate
 ---> Running in 3b5bbc350c1a

#### Checking for SSL certificates in /var/mycodo/ssl_certs/

#### Generating SSL certificates in /var/mycodo/ssl_certs/
Generating RSA private key, 4096 bit long modulus
....................................................................................................................................................................................................................................................++++
...........................++++
e is 65537 (0x010001)
writing RSA key
Signature ok
subject=O = mycodo, OU = mycodo, CN = mycodo
Getting Private key
Removing intermediate container 3b5bbc350c1a
 ---> 3feb734f50d0
Step 10/10 : RUN /home/mycodo/mycodo/scripts/upgrade_commands.sh compile-translations
 ---> Running in 56cb67a91acd

#### Compiling Translations
compiling catalog mycodo_flask/translations/es/LC_MESSAGES/messages.po to mycodo_flask/translations/es/LC_MESSAGES/messages.mo
compiling catalog mycodo_flask/translations/pt/LC_MESSAGES/messages.po to mycodo_flask/translations/pt/LC_MESSAGES/messages.mo
compiling catalog mycodo_flask/translations/it/LC_MESSAGES/messages.po to mycodo_flask/translations/it/LC_MESSAGES/messages.mo
compiling catalog mycodo_flask/translations/de/LC_MESSAGES/messages.po to mycodo_flask/translations/de/LC_MESSAGES/messages.mo
compiling catalog mycodo_flask/translations/nb/LC_MESSAGES/messages.po to mycodo_flask/translations/nb/LC_MESSAGES/messages.mo
compiling catalog mycodo_flask/translations/sv/LC_MESSAGES/messages.po to mycodo_flask/translations/sv/LC_MESSAGES/messages.mo
compiling catalog mycodo_flask/translations/nl/LC_MESSAGES/messages.po to mycodo_flask/translations/nl/LC_MESSAGES/messages.mo
compiling catalog mycodo_flask/translations/zh/LC_MESSAGES/messages.po to mycodo_flask/translations/zh/LC_MESSAGES/messages.mo
compiling catalog mycodo_flask/translations/fr/LC_MESSAGES/messages.po to mycodo_flask/translations/fr/LC_MESSAGES/messages.mo
compiling catalog mycodo_flask/translations/ru/LC_MESSAGES/messages.po to mycodo_flask/translations/ru/LC_MESSAGES/messages.mo
compiling catalog mycodo_flask/translations/sr/LC_MESSAGES/messages.po to mycodo_flask/translations/sr/LC_MESSAGES/messages.mo
Removing intermediate container 56cb67a91acd
 ---> fc98af08d7ac

Successfully built fc98af08d7ac
Successfully tagged app:latest
Building nginx
Step 1/7 : FROM nginx:1.15.9
1.15.9: Pulling from library/nginx
ecad9bd7ef0c: Already exists
f5cfe1bc5a80: Pull complete
b23447a4f47c: Pull complete
Digest: sha256:98efe605f61725fd817ea69521b0eeb32bef007af0e3d0aeb6258c6e6fe7fc1a
Status: Downloaded newer image for nginx:1.15.9
 ---> 9389658f86a0
Step 2/7 : RUN rm /etc/nginx/nginx.conf
 ---> Running in cce8a9a717f7
Removing intermediate container cce8a9a717f7
 ---> 9f7b3dec49cf
Step 3/7 : COPY nginx.conf /etc/nginx/
 ---> 9d9bd170a2e9
Step 4/7 : RUN rm /etc/nginx/conf.d/default.conf
 ---> Running in 832f6876e3e6
Removing intermediate container 832f6876e3e6
 ---> cee0013ca526
Step 5/7 : COPY project.conf /etc/nginx/conf.d/
 ---> b442270169e7
Step 6/7 : RUN mkdir -pv /var/mycodo
 ---> Running in 871a9c3f7753
mkdir: created directory '/var/mycodo'
Removing intermediate container 871a9c3f7753
 ---> 8bd0af5d1717
Step 7/7 : COPY 502.html /var/mycodo/
 ---> bbcfefa76198

Successfully built bbcfefa76198 Successfully tagged mycodo_nginx:latest Creating influxdb ... done Creating flask ... done Creating nginx ... done Creating daemon ... done pi@everlast:~/Mycodo $

And guess what I got. Magic.

Gonna go explore now, however I have a few comments just for fun

Collecting itsdangerous>=0.24 (from Flask==1.0.2->-r /home/mycodo/requirements.txt (line 4))

That guy stole my best bad idea for a library.

The only misadventure was not adding 'sudo' to the 'make build' instruction. I'm starting to make a habit of writing instructions to include the 'sudo' and I bold the rest of the command-line. This makes it easy to cut and paste for lazy, root-less folks such as myself. I don't wanna be root. Being root warps the perceptions of usage, usually in unfortunate ways.

I have a GUI. Nice work Kyle!

I logged in and looked around a little so far. Will try some of the basic stuff and see what works.

I have this big smile right now. That saying about how 'nothing good ever happens after midnight' came from someone who was doing it wrong. At least that is my perspective.

Theoi-Meteoroi commented 5 years ago

Well the first thing I tried was a USB connected sensor - the MH-z19. I cannot change the port from hardware serial due to some access issue:

Error: Modify Input: Invalid device or improper permissions to read device

I tried changing perms on the device, that isn't the issue. Its a container thing. And don't I like a challenge. Containers are attractive to me because as you become more ambitious with Mycodo, the platform becomes the limiting factor, even with four cores. For straight forward PID tasks with a few sensors, the Pi is more than cost effective. As the sensors become more sophisticated or you are simply ambitious ( voice control, integration with other code ) containers could allow the kind of isolation that prevents total system failure when a feature doesn't work as expected. Like the code I write.

I will have to come back to this later. So much to do. But it is a beginning and that is pretty exciting. The OS can take this to a number of higher performance platforms if ported with that in mind. There may be a way (I think there is) to push most of the work and storage to a cloud instance and have a lower end device like the Pi be the real-world proxy. Once you program a PID, the work is local and the rest can be more or less done elsewhere. This provides scale, if needed and still maintain a single pane of glass for complex configurations. Anything built in the cloud can also be done on a local server with virtualization, if you are allergic to clouds.

kizniche commented 5 years ago

Glad to see it's running! Here are a few notes before I begin my own investigation into getting external sensors working:

The only misadventure was not adding 'sudo' to the 'make build' instruction. I'm starting to make a habit of writing instructions to include the 'sudo' and I bold the rest of the command-line. This makes it easy to cut and paste for lazy, root-less folks such as myself. I don't wanna be root. Being root warps the perceptions of usage, usually in unfortunate ways.

After you issued the command sudo usermod -aG docker pi to add your user to the docker group, you must log out and back in for it to take effect. Then you can call docker without root privileges.

I have this big smile right now. That saying about how 'nothing good ever happens after midnight' came from someone who was doing it wrong. At least that is my perspective.

:smiley:

Well the first thing I tried was a USB connected sensor - the MH-z19. I cannot change the port from hardware serial due to some access issue: Error: Modify Input: Invalid device or improper permissions to read device

I haven't attempted to do this yet, so I'll see how I can fix this. I have privileged: true in the docker-compose.yml file, which should give access to the system devices, but I haven't done much more than this to get external sensors working on the Mycodo end.

In other news, today I'm implementing my recently-built outdoor LoRaWAN gateway (photo attached) on my university farm and sending sensor data from the surrounding greenhouses to The Things Network before being acquired by Mycodo (or multiple Mycodos). I got the BME280 working on my TTGO T-Beam dev. platform last night and just recently added support for downloading data from The Things Network into Mycodo via a TTN Input module. I'm going to be working on a way to make this Input module able to have a variable number if measurements selected (opposed to the current hard-coded ones for just the BME280), then each measurement can have its own unit/measurement configured, so there won't be any limitation to the number or type of measurements.

20190320_084245~01

kizniche commented 5 years ago

The gateway was successfully deployed on the farm and one node is currently measuring temperature, humidity, pressure, dew point, and vapor pressure deficit in one of the hydroponic greenhouses. Now to see if the system remains stable over a paltry cellular internet connection. I've already set up the Mycodo on the farm to download the data from TTN, just as I have at home, and it's working perfectly so far.

Regarding docker, I found the missing configuration settings I needed to detect devices after the container has started. I just pushed an update and successfully tested the MH-Z16/UART over USB, connected after the container started!

kizniche commented 5 years ago

I added Telegraf and Grafana to the docker build to experiment a bit with them. They were easily integrated, and add a new set of system monitoring and dashboard capability for Mycodo data. I'm not sure if they'll stay, but for the time being, they're included in the Docker build. I also fixed several issues with the dependency install script, moved everything to using Python 3, and successfully tested on a fresh install of Raspbian for everything to work.

kizniche commented 4 years ago

After much toiling, I have the latest version of Mycodo (8.1.1) running in Docker containers, without sacrificing its ability to be normally installed on a Raspberry Pi. I'll push my edits to master soon, after I tweak some of the volumes and directory structures. Here's it running on Ubuntu 18.04 (64-bit):

Screenshot_2019-11-30 c6b0d87e94bd - Dashboard - Mycodo 8 1 1

kizniche commented 4 years ago

The mycodo_docker branch is now defunct (and will be removed soon), as I've been successful at integrating the docker code to master without sacrificing any normal functionality. The Docker configuration/build files can be found under the docker folder, with docker/README.md containing all the current setup/build information.

There is a lot of functionality that doesn't work, but I'll be working on this gradually. This is a good step to bringing Mycodo available to other platforms.

Containers running on a full build

kiz@kimchi:~/PycharmProjects/Mycodo/docker$ docker container ls
CONTAINER ID        IMAGE                    COMMAND                  CREATED             STATUS              PORTS                                                                    NAMES
22ea6edd7511        app                      "bash -c 'PYTHONPATH…"   15 minutes ago      Up 15 minutes       0.0.0.0:9090->9090/tcp                                                   mycodo_daemon
baa0b92e76f8        docker_nginx             "nginx -g 'daemon of…"   15 minutes ago      Up 15 minutes       0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp                                 nginx
777b051a7079        grafana/grafana:latest   "/run.sh"                15 minutes ago      Up 15 minutes       0.0.0.0:3000->3000/tcp                                                   grafana
9a153480c81c        app                      "gunicorn --workers …"   15 minutes ago      Up 15 minutes                                                                                mycodo_flask
27bc125d1cf8        telegraf:latest          "/entrypoint.sh tele…"   15 minutes ago      Up 15 minutes       8092/udp, 8125/udp, 8094/tcp                                             telegraf
075d0552cc63        docker_influxdb          "/entrypoint.sh /bin…"   16 minutes ago      Up 15 minutes       0.0.0.0:8083->8083/tcp, 0.0.0.0:8086->8086/tcp, 0.0.0.0:8090->8090/tcp   influxdb

Grafana/Telegraf (only part of full stats available)

Screenshot_2019-11-30 Telegraf system overview - Grafana

Theoi-Meteoroi commented 4 years ago

Thanks Kyle! I'm going to spend some time looking at how this might work on a Mac with dockerdesktop. I'm just looking for serial port inputs right now and maybe a "sensor pod" on a FTDI-4232 with python code input to Mycodo. I can do the initial work on the standard release on a pi and then try it on a laptop with containers. USB-C changes what you can attach to a laptop (for instrumentation) and power has always been my biggest challenge. Hang enough sensors on a Pi and the power gets flaky with most wall-wart supplies. And some sensors I want to use ( AS7265x spectral sensor ) just crush the CPU on a pi with the matlab code to generate the spectral chart.
I think I whined earlier about Grafana - saying Mycodo saved me from having to do that. I'm using Grafana in my day job now for visualizing prometheus data. And so now, I'm doing that.

nargetdev commented 2 years ago

I'm just beginning my journey towards Dockerized mycodo. I'm very keen to port to balenaOS for my RPi's but I'm shooting towards docker-compose on my Ubuntu machine first.

I'm specifically having trouble building mycodo_flask. I think it's an environment thing, it seems to be that pip is missing from mycodo's version of python?

    "${MYCODO_PATH}"/env/bin/python -m pip install --upgrade pip
                                                                       ^
                                                                       |
                                                                  missing

Why does mycodo manage it's own binaries? Vs venv or the like?

Anyways I was able to get mycodo_flask to build by commenting some of the following, but then get runtime failure.

RUN /home/mycodo/mycodo/scripts/upgrade_commands.sh create-files-directories
RUN /home/mycodo/mycodo/scripts/upgrade_commands.sh update-apt
RUN /home/mycodo/mycodo/scripts/upgrade_commands.sh update-packages
RUN /home/mycodo/mycodo/scripts/upgrade_commands.sh install-docker-ce-cli
#RUN /home/mycodo/mycodo/scripts/upgrade_commands.sh docker-update-pip
#RUN /home/mycodo/mycodo/scripts/upgrade_commands.sh docker-update-pip-packages
RUN /home/mycodo/mycodo/scripts/upgrade_commands.sh ssl-certs-generate
#RUN /home/mycodo/mycodo/scripts/upgrade_commands.sh docker-compile-translations
RUN /home/mycodo/mycodo/scripts/upgrade_commands.sh compile-mycodo-wrapper
kizniche commented 2 years ago

@nargetdev You should use the code from the master branch, not the latest release. You're currently using old docker code. Try the master branch and it should work.

nargetdev commented 2 years ago

Ah.. forgot to git pull

kizniche commented 2 years ago

I made a bunch of docker changes since the last release: bd38694a56fc81dcda1bacbb74b2337942847440, 11e4114cd55e1ea7e20243aa7cdd6c15847f4f9b, and d2f9dbcb28de3d2cd42a5a50938153e59f5ebd04. So there should be significant improvements with building and more recent software versions.

nargetdev commented 2 years ago

Yes it worked this time. Nice work Kyle.

I'll stay posted regarding balena. Should be relatively straight forward. A few minor structural changes needed - docker-compose.yml needs to be in the root of the repo, and all bind mounts (ref to explicit host path) needs removed.

nargetdev commented 2 years ago

For what it's worth I managed to get the following fork to successfully upload the docker images to the RPi via balena push ... but there's a myriad of runtime issues that crop up, probably because I ripped out all the bind mounts from the docker-compose.yml

https://github.com/nargetdev/balena-mycodo

More to come as I dig in further..

jamie-mint commented 1 year ago

I'm getting errors with the host networking in the compose context. (because compose renames network hostnames)

the below example is illustrative:

[mycodo_telegraf] 2022-07-19T00:19:47Z E! [outputs.influxdb] When writing to [http://localhost:8086]: failed doing req: Post "http://localhost:8086/write?db=telegraf": dial tcp 127.0.0.1:8086: connect: connection refused

It should be found at: mycodo_influxdb:8086

I'm wondering as you'd said previously @kizniche you don't want to break compatibility with the "normal" build. Without making a ton of defines/exceptions for every single mention of localhost/127.0.0.1 towards microservices names in docker-compose context what do you think is the path of least resistance here?

kizniche commented 1 year ago

Fortunately just a few weeks ago I added the ability to configure influxdb settings in the Mycodo database. This includes the ability to set the hostname to connect to influxdb. I haven't tested it, but I suspect if you change it from "localhost" to "mycodo_influxdb", it should work. You'll need to install from the master branch, because this hasn't been released yet.

jamie-mint commented 1 year ago

Brilliant, yes I was just discovering this.

Another piece of the equation is that my embedded docker framework/platform (balenaOS) doesn't accept a parent dir context (i.e. context: ../). Just converted some paths hopefully no clobber. I'll report back when my build is running again.

P.S. Nice job moving on influxdb 2.x too.

nargetdev commented 1 year ago

No joy changing hostname to mycodo_influxdb

I think the problem might be more fundamental though..

'last_data' raised and error: 'Misc' object has no attribute 'measurement_db_name'
nargetdev commented 1 year ago

I can see this code is intertwined with the influxdb v1 and v2 logic switches. I think i'm going to take a step back and explore influxdb outside of the mycodo context (simple mock data) get my bearings and then come back in

kizniche commented 1 year ago

I just pushed a potential fix for the undeclared variable issue

jamie-mint commented 1 year ago

I'm able to docker-compose successfully on influx2 branch but I think there's a new issue on master, as mycodo_flask crashes now on initialization:

Traceback (most recent call last):
  File "/home/mycodo/env/lib/python3.9/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
    worker.init_process()
  File "/home/mycodo/env/lib/python3.9/site-packages/gunicorn/workers/base.py", line 134, in init_process
    self.load_wsgi()
  File "/home/mycodo/env/lib/python3.9/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/home/mycodo/env/lib/python3.9/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/home/mycodo/env/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
    return self.load_wsgiapp()
  File "/home/mycodo/env/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/home/mycodo/env/lib/python3.9/site-packages/gunicorn/util.py", line 359, in import_app
    mod = importlib.import_module(module)
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/home/mycodo/mycodo/start_flask_ui.py", line 13, in <module>
    app = create_app()  # required by the wsgi config and main()
  File "/home/mycodo/mycodo/mycodo_flask/app.py", line 61, in create_app
    register_extensions(app)
  File "/home/mycodo/mycodo/mycodo_flask/app.py", line 86, in register_extensions
    populate_db()
  File "/home/mycodo/mycodo/databases/models/__init__.py", line 147, in populate_db
    if not Misc.query.count():
  File "/home/mycodo/env/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 3163, in count
    return self._from_self(col).enable_eagerloads(False).scalar()
  File "/home/mycodo/env/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 2888, in scalar
    ret = self.one()
  File "/home/mycodo/env/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 2865, in one
    return self._iter().one()
  File "/home/mycodo/env/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 2903, in _iter
    result = self.session.execute(
  File "/home/mycodo/env/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 1692, in execute
    result = conn._execute_20(statement, params or {}, execution_options)
  File "/home/mycodo/env/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1631, in _execute_20
    return meth(self, args_10style, kwargs_10style, execution_options)
  File "/home/mycodo/env/lib/python3.9/site-packages/sqlalchemy/sql/elements.py", line 325, in _execute_on_connection
    return connection._execute_clauseelement(
  File "/home/mycodo/env/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1498, in _execute_clauseelement
    ret = self._execute_context(
  File "/home/mycodo/env/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1862, in _execute_context
    self._handle_dbapi_exception(
  File "/home/mycodo/env/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2043, in _handle_dbapi_exception
    util.raise_(
  File "/home/mycodo/env/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 207, in raise_
    raise exception
  File "/home/mycodo/env/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1819, in _execute_context
    self.dialect.do_execute(
  File "/home/mycodo/env/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 732, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such column: misc.measurement_db_name
[SQL: SELECT count(*) AS count_1
FROM (SELECT misc.id AS misc_id, misc.dismiss_notification AS misc_dismiss_notification, misc.force_https AS misc_force_https, misc.hide_alert_info AS misc_hide_alert_info, misc.hide_alert_success AS misc_hide_alert_success, misc.hide_alert_warning AS misc_hide_ale
rt_warning, misc.hide_tooltips AS misc_hide_tooltips, misc.grid_cell_height AS misc_grid_cell_height, misc.login_message AS misc_login_message, misc.max_amps AS misc_max_amps, misc.output_usage_cost AS misc_output_usage_cost, misc.output_usage_currency AS misc_outp
ut_usage_currency, misc.output_usage_dayofmonth AS misc_output_usage_dayofmonth, misc.output_usage_volts AS misc_output_usage_volts, misc.output_usage_report_gen AS misc_output_usage_report_gen, misc.output_usage_report_span AS misc_output_usage_report_span, misc.o
utput_usage_report_day AS misc_output_usage_report_day, misc.output_usage_report_hour AS misc_output_usage_report_hour, misc.sample_rate_controller_conditional AS misc_sample_rate_controller_conditional, misc.sample_rate_controller_function AS misc_sample_rate_cont
roller_function, misc.sample_rate_controller_input AS misc_sample_rate_controller_input, misc.sample_rate_controller_math AS misc_sample_rate_controller_math, misc.sample_rate_controller_output AS misc_sample_rate_controller_output, misc.sample_rate_controller_pid
AS misc_sample_rate_controller_pid, misc.sample_rate_controller_widget AS misc_sample_rate_controller_widget, misc.stats_opt_out AS misc_stats_opt_out, misc.enable_upgrade_check AS misc_enable_upgrade_check, misc.mycodo_upgrade_available AS misc_mycodo_upgrade_avai
lable, misc.rpyc_timeout AS misc_rpyc_timeout, misc.daemon_debug_mode AS misc_daemon_debug_mode, misc.net_test_ip AS misc_net_test_ip, misc.net_test_port AS misc_net_test_port, misc.net_test_timeout AS misc_net_test_timeout, misc.default_login_page AS misc_default_
login_page, misc.measurement_db_name AS misc_measurement_db_name, misc.measurement_db_version AS misc_measurement_db_version, misc.measurement_db_host AS misc_measurement_db_host, misc.measurement_db_port AS misc_measurement_db_port, misc.measurement_db_user AS mis
c_measurement_db_user, misc.measurement_db_password AS misc_measurement_db_password, misc.measurement_db_dbname AS misc_measurement_db_dbname
FROM misc) AS anon_1]
(Background on this error at: https://sqlalche.me/e/14/e3q8)
[2022-07-22 13:29:01 -0600] [7] [INFO] Worker exiting (pid: 7)
Error: Command 'influxd version' returned non-zero exit status 127.
[2022-07-22 13:29:01 -0600] [1] [INFO] Shutting down: Master
[2022-07-22 13:29:01 -0600] [1] [INFO] Reason: Worker failed to boot.
jamie-mint commented 1 year ago

I would imagine this is because your volume is already initialized with some data (i.e. not a cold start)?

Is there perhaps side-effects from running mycodo the normal way first? I.e. is the database that exists outside copied into the docker image

kizniche commented 1 year ago

I'm able to docker-compose successfully on influx2 branch

The influx2 branch is very old (currently 25 commits behind master, which includes several fixes for docker). The influx2 branch changes have also already been incorporated into the master branch and it needs to be deleted. So, all testing should be performed on the master branch.

kizniche commented 1 year ago

I think there's a new issue on master, as mycodo_flask crashes now on initialization

This error should not exist on master, as I fixed this undeclared variable with https://github.com/kizniche/Mycodo/commit/0fc6105b142b35e5b39759fbee067d252921f1cd

Is your repo clone up to date with this latest commit?

I'll see if I can find some time to spin up Mycodo in docker and see if I get any errors and see about fixing them.

jamie-mint commented 1 year ago

Yea these are from as sanitized an environment as I could conjur (at 0fc6105b142b35e5b39759fbee067d252921f1cd)

One of the things I saw in the logs from mycodo_flask /bin/sh: 1: influxd: not found

jamie-mint commented 1 year ago

I'm building on both Pop!_OS (basically ubuntu) and also raspbian.

uname -a # Pop!_OS Linux system76 5.15.8-76051508-generic #202112141040~1639505278~21.10~0ede46a SMP Tue Dec 14 22:38:29 U x86_64 x86_64 x86_64 GNU/Linux

uname -a # raspbian Linux planck64 5.10.92-v8+ #1514 SMP PREEMPT Mon Jan 17 17:39:38 GMT 2022 aarch64 GNU/Linux

I would like to get things running locally on my macbook as well.. but that's last in line.

kizniche commented 1 year ago

I think I fixed the issues. I now have docker building and running Mycodo without issue, on the master branch.

git clone https://github.com/kizniche/Mycodo
cd Mycodo/docker
sudo /bin/bash ./setup.sh dependencies
sudo make build
jamie-mint commented 1 year ago

No joy. Without copying the whole traceback I'm still in a similar spot on Pop!_OS and Debian (RPi)

Error: cannot import name 'Misc' from partially initialized module 'mycodo.databases.models' (most likely due to a circular import) (/home/mycodo/mycodo/databases/models/__init__.py)

Perhaps it's the leftover data in the volumes. Trying to delete the volumes now and see..

jamie-mint commented 1 year ago

Yes! It was the volumes..

WARNING - this next command can and will destroy data. Measure twice.. cut once.

docker volume rm $(docker volume ls -q)

From a clean state (no prior volumes), and after going Configure --> Time Series Database Options and set Hostname: mycodo_influxdb

We are correctly writing metrics to the database. I tested only my co2 sensor (FTDI) so far but it's working correctly.

Thankyou @kizniche

nargetdev commented 1 year ago

I managed to get i2c working. I created a pull request so you can check it out, not really to merge but i'm pretty stoked about one click deploy to any (or many) balenaOS devices simultaneously with single pane of glass management. @kizniche

I'll be surveying what all works and doesn't with our grow tents and mobile greenhouse. My primary incentive here is scalable management of many concurrent instances.

I was having some balena-specific permissions issue with the app mycodo_flask/mycodo_daemon container. It builds ok but then mycodo_daemon fails to pull it's own. Perhaps could just be built twice, but for now I just stored the container in my dockerhub registry (nargetdev/app)

nargetdev commented 1 year ago

That PR i mentioned requires the python virtual environment (not included) which I had setup on my other RPi. So that should be packaged in..

So far GPIO (normal read/write) works ok (using the /sys/class/gpio/<pin_num>/value)

PWM I was only able to get working through the RPi.GPIO python module

nargetdev commented 1 year ago

This is exciting though.. it's enough to switch over to docker based builds for production for me.

nargetdev commented 1 year ago

Is any initialization required for a new influxdb2.3 database?

i.e. can the influxdb Dockerfile simply be amended as:

FROM influxdb:2.3

[... rest of file ...]

nargetdev commented 1 year ago

I'm getting unauthorized access as follows and I'm wondering if it's because connections are not coming from localhost, but rather mycodo_daemon hostname

ts=2022-07-29T22:12:26.941630Z lvl=error msg="api error encountered" log_id=0bz~YeIW000 handler=session error="unauthorized access"

kizniche commented 1 year ago

The docker influxdb install script run.sh was only designed for influxdb 1.x, and since 1.x and 2.x have incompatible commands, the commands used to create the db/user/password likely don't work with 2.x.

kizniche commented 1 year ago

See here for the difference between the two:

https://github.com/kizniche/Mycodo/blob/eb1b7c6b405a80bd2bbca0ccbabb31f485264281/mycodo/scripts/upgrade_commands.sh#L428-L465

nargetdev commented 1 year ago

Yes I just found the install commands that are invoked on the upstream (non-docker) install/setup.sh script

if [[ ${INFLUX} == '1)' ]]; then
    ${INSTALL_CMD} update-influxdb-1 2>&1 | tee -a "${LOG_LOCATION}"
    ${INSTALL_CMD} update-influxdb-1-db-user 2>&1 | tee -a "${LOG_LOCATION}"
elif [[ ${INFLUX} == '2)' ]]; then
    ${INSTALL_CMD} update-influxdb-2 2>&1 | tee -a "${LOG_LOCATION}"
    ${INSTALL_CMD} update-influxdb-2-db-user 2>&1 | tee -a "${LOG_LOCATION}"

I tested this out (outside of docker), but i still somehow end up with an influxdb1.8 install

Anyways, no worries. In due time I may take a look at porting influxdb2.x to the docker side, but ver 1.x is fine for now.

-- UPDATE, dirty system.. clean install from master and I'm up and running on 2.2

.. for anyone onlooking if you need to get around the SSL issues before setting up certs you can do the following sudo ssh -L 8086:127.0.0.1:8086 -N -f username@mycodo_hostname.local in order to port forward the influxdb2.0 gui to your localhost 127.0.0.1:8086

kizniche commented 1 year ago

one click deploy to any (or many) balenaOS devices simultaneously with single pane of glass management.

I'm not familiar with this. Can you give give a breakdown of how this works or how to do it?

balenaOS doesn't accept a parent dir context (i.e. context: ../)

Why is this? Is the only solution to put the docker root directory (or just docker-compose.yaml) at the root of the Mycodo repository? I guess this wouldn't be too much of an issue if all the other directories were placed inside a docker/ directory. The directory structure of nargetdev/balena-mycodo currently has all these docker directories in the root of Mycodo. Could these be moved to docker/ and still work? If so, I'd be more open to merging the pull request since it keeps the docker and non-docker portions of Mycodo more segregated. Docker is still an experimental feature that needs some improvement, so is still a secondary feature at this point.

nargetdev commented 1 year ago

Hey there. So for the time being I've actually graduated to a lightweight Kubernetes (k3s) based deployment to manage my RPis and I'm finding it to be delicious, albeit with a learning curve (k8s manifests are much more verbose than docker-compose.yml)

k8s is not opinionated about a specific file structure in the way that BalenaOS mandates - so it's definitely possible now without mutilating the structure / mucking up bare metal compatibility.

My workflow for my own services has generally involved a build command like the following:

docker buildx build --push \
            --platform linux/arm64 \
            --tag nargetdev/cam-gbucket-dgraph:0.2.1   .

... in order to build cross platform image for RPi from my Macbook (very zippy build)

My motivation for switching to k3s from balena initially was their 10 device limit, but since then I've realized quite a few advantages that come packaged with k8s ecosystem in terms of observability, and extensive tooling of the mainstream de-facto standard for container management.

P.S. regarding BalenaOS / BalenaCloud - best way to grok I think is to just make an account at https://www.balena.io/ and flash some RPis with their OS and push some containers to the runtime (they have tons of tutorials). It's a very nice docker distro with bells and whistles (like a filesystem watcher that automatically rebuilds and pushes images to your devices as you edit source), but they do have a 10 device limit for their cloud PaaS - at which point you could just run your own open source instance, but I haven't tried, as I'm all in on k3s for now.

nargetdev commented 1 year ago

Ah.. one gotcha with k3s - you can choose to do this either the k3s way or the baremetal way at boot.

For k3s on the pi the cgroup_memory=1 cgroup_enable=memory must be set in /boot/cmdline.txt. This seems to muck up the nginx or flask or something when trying to run mycodo normally (really just the frontend - daemon still works fine). So normal Mycodo on the host or Mycodo via docker would have to be selected at boot.. but as long as one is aware that they are mutually exclusive at runtime I don't think it's a problem .. furthermore other k8s edge distros don't have this problem - for instance I was running KubeEdge services and bare metal (normal mycodo) concurrently.

nargetdev commented 1 year ago

@kizniche do you have a map for which volume mounts are populated on initial creation by the file system of the container? I didn't realize how Docker handles this until just now (I.e. initialized volume will clobber Docker file system, vs empty volume will assume Docker file system). I haven't looked at this closely yet, but I noticed it when containers were crashing because /home/mycodo/env/python was getting clobbered. The python executable for example should be in a RO location. What is needing to be persisted across containers and for what reasons? I'd like to limit or eliminate the possibility of clobber / runtime inconsistency due to initialized / uninitialized volumes.

Cheers. To containers.

kizniche commented 1 year ago

Are you referring to these?

https://github.com/kizniche/Mycodo/blob/9b42db8daeb7d035f6f1e06d2af4fc2a73dee10b/docker/docker-compose.yml#L38-L48

kizniche commented 1 year ago

@nargetdev could you please provide some more information about building/running on kubernetes? I'd like to explore this option more, but my experience is virtually all with Docker, so I could use some help getting this going and want to avoid fumbling around and hitting common issues that can be avoided with some guidance. Thanks.

jonny-sexton commented 1 year ago

Hi,

I am having a few issues running Mycodo on my Raspberry Pi Zero via docker. I have run the following commands successfully:

git clone https://github.com/kizniche/Mycodo
cd Mycodo/docker
sudo /bin/bash ./setup.sh dependencies

However, when I then ran sudo make build I got the following error:

The requested image's platform (linux/arm/v7) does not match the detected host platform (linux/arm/v6) and no specific platform was requested

Which I fixed by repacing FROM influxdb:1.8.10 with FROM mendhak/arm32v6-influxdb in /Mycodo/docker/influxdb/Dockerfile

I now have another error that I am not able to resolve:

ERROR: Service 'mycodo_flask' failed to build: The command '/bin/sh -c /home/mycodo/mycodo/scripts/upgrade_commands.sh install-docker-ce-cli' returned a non-zero code: 1

I checked and the file /home/mycodo/mycodo/scripts/upgrade_commands.sh does not exist. It appears that the line:

COPY ./mycodo/scripts/upgrade_commands.sh /home/mycodo/mycodo/scripts/upgrade_commands.sh

in Mycodo/docker/Dockerfile is not correct, as it should be:

COPY ../mycodo/scripts/upgrade_commands.sh /home/mycodo/mycodo/scripts/upgrade_commands.sh

instead. I have of coursed tried correcting this, running sudo make build -C docker from the parent directory instead, which should fix the relevant path issue. I also tried copying the files manually. However, I am still not able to correct this issue (I always end up having the same error message).

I will try the standard installation method instead now, which should be sufficient for my purposes. I just thought I would let you know in case I am doing anything wrong here.

Looking forward to working with Mycodo!

Cheers,

Jonny

kizniche commented 1 year ago

I've actually been working on Docker all day today. The branch I'm working on is https://github.com/kizniche/Mycodo/tree/docker-01 but I have several changes still uncommitted. I just got everything to build nicely on a Pi 4 and will be pushing changes soon, then merging into master shortly after. You may need to perform your change still for 32-bit ARM devices like your Pi, unless we can figure out a way to detect this automatically.