Merging several balena-cloud projects

Hi,

I am beginning to play around with balenaCloud and I successfully deployed the balenaDash project on my Raspberry Pi 3. I also was able to run, some month ago, the balena-rpi-python-picamera project. And today I want work with balena-rpi-gpio, but along side balenaDash.
So my question is : How do you merge two projects?
I would have guessed that I could simply add the folder in my project and adapt the docker-compose.yml file accordingly. But I am facing issues when I “git push balena master” my code.
[Info] Uploading images
[Success] Successfully uploaded images
[Error] Some services failed to build:
[Error] Service: rpi-gpio
[Error] Error: The command ‘/bin/sh -c pip install -r /usr/src/requirements.txt’ returned a non-zero code: 1
[Info] Built on arm03
[Error] Not deploying release.

remote: error: hook declined to update refs/heads/master
To git.balena-cloud.com:gh_raztou3d/rezasn-monitoring.git
 ! [remote rejected] master -> master (hook declined)
error: failed to push some refs to 'gh_raztou3d@git.balena-cloud.com:gh_raztou3d/rezasn-monitoring.git'

Please find here my code : https://github.com/Raztou3D/monitoring
Please find here attached the complete log. balena-logs.log (25.2 KB)

Please consider that I am a beginner :slight_smile:

Thanks in advance !

Reza

Hi @raztou3d,

Having a quick look through the build logs, it looks like it can’t use gcc (which is the GNU C Compiler):

[rpi-gpio]        Downloading https://files.pythonhosted.org/packages/cb/88/d3817eb11fc77a8d9a63abeab8fe303266b1e3b85e2952238f0da43fed4e/RPi.GPIO-0.7.0.tar.gz
[rpi-gpio]      Building wheels for collected packages: RPi.Gpio
[rpi-gpio]        Building wheel for RPi.Gpio (setup.py): started
[rpi-gpio]        Building wheel for RPi.Gpio (setup.py): finished with status 'error'
[rpi-gpio]        ERROR: Command errored out with exit status 1:
[rpi-gpio]         command: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-n1Nwyu/RPi.Gpio/setup.py'"'"'; __file__='"'"'/tmp/pip-install-n1Nwyu/RPi.Gpio/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-qlDfBL --python-tag cp27
[rpi-gpio]             cwd: /tmp/pip-install-n1Nwyu/RPi.Gpio/
[rpi-gpio]        Complete output (16 lines):
[rpi-gpio]        running bdist_wheel
[rpi-gpio]        running build
[rpi-gpio]        running build_py
[rpi-gpio]        creating build
[rpi-gpio]        creating build/lib.linux-armv7l-2.7
[rpi-gpio]        creating build/lib.linux-armv7l-2.7/RPi
[rpi-gpio]        copying RPi/__init__.py -> build/lib.linux-armv7l-2.7/RPi
[rpi-gpio]        creating build/lib.linux-armv7l-2.7/RPi/GPIO
[rpi-gpio]        copying RPi/GPIO/__init__.py -> build/lib.linux-armv7l-2.7/RPi/GPIO
[rpi-gpio]        running build_ext
[rpi-gpio]        building 'RPi._GPIO' extension
[rpi-gpio]        creating build/temp.linux-armv7l-2.7
[rpi-gpio]        creating build/temp.linux-armv7l-2.7/source
[rpi-gpio]        gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include/python2.7 -c source/py_gpio.c -o build/temp.linux-armv7l-2.7/source/py_gpio.o
[rpi-gpio]        unable to execute 'gcc': No such file or directory
[rpi-gpio]        error: command 'gcc' failed with exit status 1

This is probably because the base image doesn’t include it. Looking at it closely, although you use a -build (see here) base image variant for the photos service, the place this is failing is building the rpi-gpio service, whose base image is balenalib/raspberrypi3-python. If you change this to balenalib/raspberrypi3-python:build, this will use the -build variant which includes build tools such as gcc and will compile.

It’s well worth reading the Dockerfile reference guide to understand how to use this effectively, as well as the docker-compose reference guide.

Hope this helps!

Best regards,

Heds

1 Like

Hi Heds,

Thanks for your amazingly quick answer. It is highly appreciated!

You were right, it did the trick! Thank you.

Also, with this I have the answer to my other question. I guess you can really just merge two project by creating a folder and working on the docker files.

Thanks again !

Best regards,

Reza