Giter Site home page Giter Site logo

roaar's Introduction

RoaaR - Rust on an ARMv7 ResinOS Device

This project allows you to develop minimal rust based containers, which don't require that you push a 900MB+ image to the device with all the toolchain included

Installation:

This project depends on rdt - resin device toolbox and docker so make sure you have both of these installed on your machine. I have also only tested this on Ubuntu 16.10, but I think it should work on OSX as well.

Once you have your

Usage:

Build

The build.sh script allows you to build your rust source code for an armv7 target, it does this by building it all in a docker container on your laptop. It then spits out a bundled up binary into /release which you can deploy to a local resinOS device with rdt or push to resin.io with git.

The build currently defaults to using rustup and a specified armv7 target to crosscompile (see Dockerfile.build). However, there is an option called --unsafe which will then build your code in an armv7 emulated container, this allows you to compile and link against C libraries that rust binds to using ffi

Deploy

The deploy.sh script allows you to push your runtime container (see Dockerfile) over to a local resinOS device. You will first have to follow the resinOS getting started guide to get a device up and running on your local network.

Release on resin.io

To push this code to your fleet of resin.io device, you will first need to run build.sh to create the binary in /release. Now you need to commit the binary to the repo with git add . && git commit -m "release to fleet". You then need to add your resin.io Application git remote to this repo and then do git push resin master. Note: this will build the Dockerfile and not the Dockerfile.build.

Injecting Env vars into the ResinOS deployed container

If you want to add some ENV vars to the runtime container the you can specify these in the environment [] section of the .resin-sync.yml file.

Notes:

Alpine base image for smaller containers:

Note that if you are using only native rust (i.e. not using --unsafe) and not linking to any C libraries using FFI, then you can most likely switch your the base image in the Dockerfile to FROM ctarwater/armhf-alpine-rpi-glibc:latest which will result in a container with on disk size of about 21MB, which is pretty awesome.

Looking in the build container:

docker run -it --rm --entrypoint=/usr/bin/qemu-arm-static arm7_rust_builder /bin/bash

TODO:

  • Allow the build script to build a library and its example to deploy.
  • Allow deploy.sh to accept an IP address or <hostname>.local argument, so we can push to different devices.
  • Clean up and trim down the Dockerfile.build_unsafe
  • create release.sh which will push the project to a resin.io fleet of devices.
  • Allow the build.sh to accept the --release argument so we can make smaller binaries when we wanna ship.

roaar's People

Stargazers

Momo Bel avatar Geoffrey Thomas avatar  avatar Nawfel avatar Yann Simon avatar Peter Rudenko avatar Doug Tangren avatar Raphael Randschau avatar Kostas Lekkas avatar

Watchers

James Cloos avatar

roaar's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.