Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

building docker crashes my raspberry pi #124

Open
AnduriI opened this issue Oct 20, 2018 · 9 comments
Open

building docker crashes my raspberry pi #124

AnduriI opened this issue Oct 20, 2018 · 9 comments

Comments

@AnduriI
Copy link

AnduriI commented Oct 20, 2018

Hey there,

I tried to setup my own find3 server. As I'm not a linux professional I tried to go the easy way of using docker. I did follow these steps: https://www.internalpositioning.com/doc/server_setup.md
But when trying to build the docker image my rpi reboots and I don't know what is happening...

pi@Kueche:~ $ docker build -t schollz/find3 .
Sending build context to Docker daemon  1.074GB
Step 1/8 : FROM ubuntu:18.04
18.04: Pulling from library/ubuntu
23025a23403a: Pulling fs layer
99727326c2f3: Pulling fs layer
241db6d0729b: Pulling fs layer
54bb1a4b4b1e: Waiting
[rebooting here]
pi@Kueche:~ $ free -h
             total       used       free     shared    buffers     cached
Mem:          923M       216M       706M       6,2M        12M       119M
-/+ buffers/cache:        84M       838M
Swap:         2,0G         0B       2,0G

I hope someone can help.

Regards,
Anduril

@schollz
Copy link
Owner

schollz commented Oct 20, 2018

I don't think you have enough memory to build

@AnduriI
Copy link
Author

AnduriI commented Oct 20, 2018

you mean using a bigger sd-card?

@schollz
Copy link
Owner

schollz commented Oct 21, 2018

@AnduriI I mean RAM...I'm pretty sure 1GB+2G swap is not enough memory

@AnduriI
Copy link
Author

AnduriI commented Oct 21, 2018

well I think I misunderstood your guide a little bit...
"However, if you are using a Raspberry Pi, you’ll need to build the armf version yourself." --> I thought I have to build the docker image on my raspberry, but there is no raspberry with more than 1GB RAM. Do I have to further increase the swap or is there any other way to build it? I don't have another linux on hand, but maybe I could use a virtual box or live-linux...

@suiluj
Copy link

suiluj commented Oct 30, 2018

Hello i got a build error on the new RaspberryPi 3 Model B+ (But it is not crashing)

I installed docker via:

curl -sSL https://get.docker.com | sh

And when building the armf version via:

wget https://raw.githubusercontent.com/schollz/find3/master/Dockerfile
docker build -t schollz/find3 .

I get the following error at the end:

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-0y72uat4/matplotlib/
The command '/bin/sh -c apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y wget git libc6-dev make pkg-config g++ gcc mosquitto-clients mosquitto python3 python3-dev python3-pip python3-setuptools python3-wheel supervisor && 	mkdir /usr/local/work && 	rm -rf /var/lib/apt/lists/* && 	set -eux; 		dpkgArch="$(dpkg --print-architecture)"; 	case "${dpkgArch##*-}" in 		amd64) goRelArch='linux-amd64'; goRelSha256='b3fcf280ff86558e0559e185b601c9eade0fd24c900b4c63cd14d1d38613e499' ;; 		armhf) goRelArch='linux-armv6l'; goRelSha256='8ffeb3577d8ca5477064f1cb8739835973c866487f2bf81df1227eaa96826acd' ;; 		arm64) goRelArch='linux-arm64'; goRelSha256='e4853168f41d0bea65e4d38f992a2d44b58552605f623640c5ead89d515c56c9' ;; 		i386) goRelArch='linux-386'; goRelSha256='1a91932b65b4af2f84ef2dce10d790e6a0d3d22c9ea1bdf3d8c4d9279dfa680e' ;; 		ppc64el) goRelArch='linux-ppc64le'; goRelSha256='e874d617f0e322f8c2dda8c23ea3a2ea21d5dfe7177abb1f8b6a0ac7cd653272' ;; 		s390x) goRelArch='linux-s390x'; goRelSha256='c113495fbb175d6beb1b881750de1dd034c7ae8657c30b3de8808032c9af0a15' ;; 	*) goRelArch='src'; goRelSha256='afc1e12f5fe49a471e3aae7d906c73e9d5b1fdd36d52d72652dde8f6250152fb'; 			echo >&2; echo >&2 "warning: current architecture ($dpkgArch) does not have a corresponding Go binary release; will be building from source"; echo >&2 ;; 	esac; 		url="https://golang.org/dl/go${GOLANG_VERSION}.${goRelArch}.tar.gz"; 	wget -O go.tgz "$url"; 	echo "${goRelSha256} *go.tgz" | sha256sum -c -; 	tar -C /usr/local -xzf go.tgz; rm go.tgz; 		if [ "$goRelArch" = 'src' ]; then 		echo >&2; 		echo >&2 'error: UNIMPLEMENTED'; 		echo >&2 'TODO install golang-any from jessie-backports for GOROOT_BOOTSTRAP (and uninstall after build)'; 		echo >&2; 		exit 1; 	fi; 		export PATH="/usr/local/go/bin:$PATH"; 	go version && 	mkdir /build && cd /build && 	git clone https://github.com/schollz/find3 && 	mkdir /data && 	mkdir /app && 	echo '#!/bin/bash\npkill -9 mosquitto\ncp -R -u -p /app/mosquitto_config /data\nmosquitto -d -c /data/mosquitto_config/mosquitto.conf\nmkdir -p /data/logs\n/usr/bin/supervisord\n'> /app/startup.sh && 	chmod +x /app/startup.sh && echo '[supervisord]\nnodaemon=true\n[program:main]\ndirectory=/app/main\ncommand=/app/main/main -debug -data /data/data -mqtt-dir /data/mosquitto_config\npriority=1\nstdout_logfile=/data/logs/main.stdout\nstdout_logfile_maxbytes=0\nstderr_logfile=/data/logs/main.stderr\nstderr_logfile_maxbytes=0\n[program:ai]\ndirectory=/app/ai\ncommand=make production\npriority=2\nstdout_logfile=/data/logs/ai.stdout\nstdout_logfile_maxbytes=0\nstderr_logfile=/data/logs/ai.stderr\nstderr_logfile_maxbytes=0\n'> /etc/supervisor/conf.d/supervisord.conf && 	mkdir /app/mosquitto_config && 	touch /app/mosquitto_config/acl  && 	touch /app/mosquitto_config/passwd  && echo 'allow_anonymous false\nacl_file /data/mosquitto_config/acl\npassword_file /data/mosquitto_config/passwd\npid_file /data/mosquitto_config/pid\n'> /app/mosquitto_config/mosquitto.conf && 	echo "moving to find3" && cd /build/find3/server/main  && go build -v && 	echo "moving main" && mv /build/find3/server/main /app/main && 	echo "moving to ai" && cd /build/find3/server/ai  && python3 -m pip install -r requirements.txt && 	echo "moving ai" && mv /build/find3/server/ai /app/ai && 	echo "removing go srces" && rm -rf /usr/local/work/src && 	echo "purging packages" && apt-get remove -y --auto-remove git libc6-dev pkg-config g++ gcc && 	echo "autoclean" && apt-get autoclean && 	echo "clean" && apt-get clean && 	echo "autoremove" && apt-get autoremove && 	echo "rm trash" && rm -rf ~/.local/share/Trash/* && 	echo "rm go" && rm -rf /usr/local/go* && 	echo "rm perl" && rm -rf /usr/share/perl* && 	echo "rm build" && rm -rf /build* && 	echo "rm doc" && rm -rf /usr/share/doc*' returned a non-zero code: 1

Perhaps we should include this command somewhere in the Dockerfile? (i am not a docker expert):

pip install --upgrade setuptools

mentioned here

Update:
Now i just use the "hard" way because it is easier without docker at the moment ;)

@AnduriI
Copy link
Author

AnduriI commented Nov 6, 2018

well I tried also the 'hard' way and my raspberry crashed during the go get. What is the 'official'/'suggested'/... way of getting a find server running on a raspberry pi 3?

@suiluj
Copy link

suiluj commented Nov 7, 2018

@AnduriI you have to install golang at first:

sudo apt-get update
sudo apt-get install golang

Then you have to export the GOPATH in your .bashrc file (in the /home/pi folder). Add the following at the end of the file:
nano ~/.bashrc

export GOPATH=$HOME/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin

Important: You have to exit the ssh session and relogin after adding the enviroment variables!

Now you should be able to follow the "hard" way.
Does it work now?

@AnduriI
Copy link
Author

AnduriI commented Nov 8, 2018

@suiluj I did correctly installed golang. I didn't know golang is on apt-get repo, so I installed from source. Now I changed to the version from the repo.
I see a problem as this states go version to be 1.3.3 in conflict with the guide saying go1.6+ is needed.
But still, I don't think my problem is about go versions. My raspberry starts downloading the packages before it suddently falls silent:

github.com/schollz/find3 (download)
github.com/NYTimes/gziphandler (download)
github.com/russross/blackfriday (download)
github.com/cihub/seelog (download)
github.com/eclipse/paho.mqtt.golang (download)
Fetching https://golang.org/x/net/proxy?go-get=1
Parsing meta tags from https://golang.org/x/net/proxy?go-get=1 (status code 200)
get "golang.org/x/net/proxy": found meta tag main.metaImport{Prefix:"golang.org/                                                                                                           x/net", VCS:"git", RepoRoot:"https://go.googlesource.com/net"} at https://golang                                                                                                           .org/x/net/proxy?go-get=1
get "golang.org/x/net/proxy": verifying non-authoritative meta tag
Fetching https://golang.org/x/net?go-get=1
Parsing meta tags from https://golang.org/x/net?go-get=1 (status code 200)
golang.org/x/net (download)
import "context": import path doesn't contain a slash
package github.com/schollz/find3/...
        imports github.com/schollz/find3
        imports github.com/NYTimes/gziphandler
        imports github.com/russross/blackfriday
        imports github.com/schollz/find3/server/main
        imports github.com/cihub/seelog
        imports github.com/cihub/seelog/archive
        imports github.com/cihub/seelog/archive/gzip
        imports github.com/cihub/seelog/archive/tar
        imports github.com/cihub/seelog/archive/zip
        imports github.com/eclipse/paho.mqtt.golang
        imports github.com/eclipse/paho.mqtt.golang/packets
        imports golang.org/x/net/proxy
        imports context: unrecognized import path "context"
Fetching https://golang.org/x/net/websocket?go-get=1
Parsing meta tags from https://golang.org/x/net/websocket?go-get=1 (status code 200)
get "golang.org/x/net/websocket": found meta tag main.metaImport{Prefix:"golang.org/x/net", VCS:"git", RepoRoot:"https://go.googlesource.com/net"} at https://golang.org/x/net/websocket?go-get=1
get "golang.org/x/net/websocket": verifying non-authoritative meta tag
Fetching https://golang.org/x/net?go-get=1
Parsing meta tags from https://golang.org/x/net?go-get=1 (status code 200)
github.com/gin-contrib/gzip (download)
github.com/gin-gonic/gin (download)
github.com/gin-contrib/sse (download)
github.com/golang/protobuf (download)

After pressing any key it says (inactive)... don't know why

addition:
After a few tries it downloaded all the files. Now I have a similar problem when installing the requirements.txt. I changed to install them one by one manually and it worked for all excep 5. The missing libs are matplotlib, numpy, scikit-learn, scipy and sklearn. Again they start to install with downloading and suddenly go silent. I have to reconnect my putty to regain controll (but raspberry seems to still run, pinging it still succeeds).

@Mazotis
Copy link
Contributor

Mazotis commented Feb 27, 2019

pull #140 also fixes this issue, when compiling using docker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants