The Pebble SDK has a pretty bad case of code rot nowadays. The world has moved on from reliance on Nodejs 10.x and Python2.7 but the pebble SDK has not. This is quickly becoming a blocker for would be app developers trying to install the SDK on their modern systems.
The pebble-wrapper side steps this issue by loosely wrapping pebble commands in a container runtime. A pre-made image that contains the SDK is spun up per project and commands are passed to the container runtime instead of being ran locally on the machine.
- Container runtime (docker/podman)
- jq (
sudo apt install jq)
sudo apt update
sudo apt install podman jqDownload the contents of tools/pebble-wrapper.sh from this repository:
curl -fsS https://raw.githubusercontent.com/kennedn/pebble-wrapper/master/tools/pebble-wrapper.sh > pebble-wrapper.shIf you are using docker, you will need to re-configure the CONTAINER_RUNTIME and EXTRA_RUN_ARGS variables in the script, change:
# Set up args for podman or docker depending on the container runtime installed
CONTAINER_RUNTIME="podman"
EXTRA_RUN_ARGS="--userns=keep-id"
#CONTAINER_RUNTIME="docker"
#EXTRA_RUN_ARGS=""to:
# Set up args for podman or docker depending on the container runtime installed
#CONTAINER_RUNTIME="podman"
#EXTRA_RUN_ARGS="--userns=keep-id"
CONTAINER_RUNTIME="docker"
EXTRA_RUN_ARGS=""Set execute permissions on the script:
chmod 755 pebble-wrapper.shConfigure the pebble alias for the script:
alias pebble="$(pwd)/pebble-wrapper.sh"cd to your project folder:
cd some-projectInvoke the script
pebble -hNOTE: The first run will take a while as it needs to download the container image
For each folder in which the pebble-wrapper script is invoked, a container will be spun up. Therefor, it is important to cd to the desired pebble project folder before invoking the script.
If a container is already running for the current folder, pebble commands will simply be passed to this container.
To clean-down pebble containers after you are finished developing:
pebble clean-containers
Besides this, with the alias set, the wrapper behaves exactly like the pebble tool. Please refer to the official pebble-tool documentation for usage outside of the wrapper functions.
pebble install does not work
To be able to return the prompt to the user, pebble install spins up a detached qemu-pebble process. This does not play nice with the docker exec command being run under the hood.
Invoke pebble install with the --logs command line argument to make it stick around after spinning up qemu-pebble