There is no instruction in the manual how to start PIO Remote inside docker, it is not trivial… Now platformio-core crashes, see below.
Configs
Ok, I’ll create on RPi a new folder /addon/hello_world
and three files inside:
- config.json
- Dockerfile
- run.sh
config.json
{
"name": "Hello world",
"version": "0.1",
"slug": "hello_world",
"description": "My first real add-on!",
"startup": "before",
"boot": "auto",
"options": {},
"schema": {},
"ports": {}
}
Dockerfile
{
ARG BUILD_FROM
FROM $BUILD_FROM
ENV LANG C.UTF-8
# Install requirements for add-on. Platformio needs 2.7
RUN apk add --no-cache python
# Example from https://github.com/gliderlabs/docker-alpine/blob/master/docs/usage.md
RUN apk add --update \
python \
python-dev \
py-pip \
build-base \
&& pip install virtualenv \
&& rm -rf /var/cache/apk/*
WORKDIR /data
COPY . /data
RUN virtualenv -p python2 /data/.platformio/penv \
&& chmod +x /data/.platformio/penv/bin/activate \
&& /data/.platformio/penv/bin/activate \
&& pip install -U platformio
# Copy data for add-on
COPY run.sh /
RUN chmod a+x /run.sh
CMD [ "/run.sh" ]
}
run.sh
echo Hello world started!
python --version
echo ">pio remote --help"
pio remote --help
echo ">platformio remote agent start"
platformio remote agent start
echo Hello world finished!
}
Results
From the documentation Remote Development — PlatformIO latest documentation it is not clear how I should authorize RPi, but in reality it does not matter now. Both commands, platformio remote agent start
and pio account login
give the same error.
Result of run.sh
Hello world started!
Python 2.7.15
>pio remote --help
********************************************************************************
If you like PlatformIO, please:
- follow us on Twitter to stay up-to-date on the latest project news > https://twitter.com/PlatformIO_Org
- star it on GitHub > https://github.com/platformio/platformio
- try PlatformIO IDE for IoT development > https://platformio.org/platformio-ide
- support us with PlatformIO Plus > https://pioplus.com
********************************************************************************
Usage: pio remote [OPTIONS] COMMAND [ARGS]...
Options:
-a, --agent TEXT
-h, --help Show this message and exit.
Commands:
agent Start new agent or list active
device Monitor remote device or list existing
run Process project environments remotely
test Remote Unit Testing
update Update installed Platforms, Packages and Libraries
>platformio remote agent start
CorePackageManager: Installing tool-pioplus @ >=1.3.1,<2
Downloading
Downloading
Unpacking
Unpacking
tool-pioplus @ 1.4.2 has been successfully installed!
CorePackageManager: Installing contrib-pysite @ >=0.2.0,<2
Downloading
Downloading
Unpacking
Unpacking
contrib-pysite @ 0.3.2 has been successfully installed!
Error: Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/platformio/__main__.py", line 120, in main
cli(None, None, None)
File "/usr/lib/python2.7/site-packages/click/core.py", line 700, in __call__
return self.main(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/click/core.py", line 680, in main
rv = self.invoke(ctx)
File "/usr/lib/python2.7/site-packages/click/core.py", line 1027, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/lib/python2.7/site-packages/click/core.py", line 1027, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/lib/python2.7/site-packages/click/core.py", line 1027, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/lib/python2.7/site-packages/click/core.py", line 873, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/lib/python2.7/site-packages/click/core.py", line 508, in invoke
return callback(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/platformio/commands/remote.py", line 52, in remote_agent_start
pioplus_call(sys.argv[1:])
File "/usr/lib/python2.7/site-packages/platformio/managers/core.py", line 114, in pioplus_call
code = subprocess.call([pioplus_path] + args, **kwargs)
File "/usr/lib/python2.7/subprocess.py", line 172, in call
return Popen(*popenargs, **kwargs).wait()
File "/usr/lib/python2.7/subprocess.py", line 394, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1047, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
============================================================
An unexpected error occurred. Further steps:
* Verify that you have the latest version of PlatformIO using
`pip install -U platformio` command
* Try to find answer in FAQ Troubleshooting section
http://docs.platformio.org/page/faq.html
* Report this problem to the developers
https://github.com/platformio/platformio-core/issues
============================================================
Hello world finished!