rocket-sled
v1.0.3
Published
Test-bed for local Node modules in mobile and IoT environments.
Downloads
5
Readme
RocketSled
RocketSled is a testbed for common and popular Node modules, compatible in Android mobile, IoT and MacOS environments.
Use git clone https://github.com/LeydenWireless/rocket-sled.git
to copy the app config and file structure to a sites
or other subdirectory, preferably a subdirectory from your OS's user home. The importance of this, and the obvious absence of an NPM project will be clarified in the following narrative.
Precursor
The intent of this project is to use orphaned (no Verizon or ATT, etc...) Android phones in wireless challenged areas, to host Node.js app servers and non-standard microservices. With a Chrome client on top of this, these devices can help first-responders collect remote environmental data in coastal areas, and relay the data to the cloud once wireless connectivity has been re-established. Of course this mobile app server would also be beneficial in a meshed agricultural network, or assist health care workers serving populations in remote locations.
Dev Environment
This mobile dev framework has been deployed and tested on MacOS, Android Linux for mobile (3.10.84 aarch64 and 4.4.13 armv81), with minor modifications to the runtime scripts to resolve compatibility issues.
The preferred terminal emulator for Android phones is Termux, installed from the Google Play app store. Once installed, make sure you give the app full access to memory, including SD card if the permissions for this are separate in your settings. Run the following commands in the Termux terminal emulator to install and upgrade packages on your mobile device:
pkg upgrade
pkg install git
pkg install nano
pkg install perl
pkg install mariadb
pkg install nodejs-lts
Some mobile phones support the latest version of Node, but may experience issues with some less popular modules. To use the latest version of Node instead of Node LTS, change the last line to:
pkg install node
Then clone the project, if you haven't done so already, and install with NPM. For Android mobile installs, use the production flag:
git clone https://github.com/LeydenWireless/rocket-sled
cd rocket-sled
npm install --production
For MacOS installs, use a plain vanilla install without flags:
git clone https://github.com/LeydenWireless/rocket-sled
cd rocket-sled
npm install
Most mobile Android Linux distributions can work with your phone's SD card for this installation, but for better compatibility you should install RocketSled in a subdirectory of Termux home, such as a sites/
subdirectory.
Ignition
To start the app, make sure you run the start script from the rocket-sled/
directory: npm start &
Some debugging messages will display, along with the ip address and port that the server is listening to. If the server can't determine the ip address, it will display as localhost:80 or localhost:8080, depending on what other ports are already in use. Open a new tab in your browser and point it to that.
localhost/form is a test page to upload files. localhost/upload is the success page. You can list the uploaded files in the rocket-sled/uploads
directory. If you are running the app on a mobile phone, your camera is an upload source choice, making this an ideal framework for a selfie app.
To stop the app, type: npm stop
App Scripts
The three NPM scripts the app uses are start
, stop
and preinstall
. These scripts modify the search path to find and use global modules, and should only be executed in the scope they were intended for. They are documented in the package.json file, but also here for quick reference:
start:
export NODE_PATH=$(npm root --quiet):$(npm root --quiet -g) && node metaphor.js
stop:
export NODE_PATH=$(npm root --quiet):$(npm root --quiet -g) && node grimm_reaper.js
postinstall (used by npm install):
export NODE_PATH=$(npm root --quiet):$(npm root --quiet -g) && node polymer.js
Utilities
Several utilities are included in package.json; they are:
Bootstrap
blubird
dotenv
Express
node-wifi
Underscore
Static Modules
The dotenv Node module is installed as a static module. That is, the required module files are part of this GitHub project, installed via git clone and not npm install. This of course is not standard practice, but rather an experiment to see what's possile in a mobile Node deployment.
Comments are always welcome. Ping me, Paul Zabin, on LinkedIn.