Giter Site home page Giter Site logo

apk-factory-service's Introduction

APK Factory Service

Web service which takes Open Web App manifests and produces Synthetic APKs.

This service depends on APK Factory Library.

Build Status

Dependencies

  • GraphicsMagick
  • MySQL
  • Java 7
  • Ant (from the Android SDK)
  • unzip (UnZip, by Info-ZIP will work)

APT-based Linux:

sudo apt-get install graphicsmagick  mysql-server
# Android SDK also requires:
sudo apt-get install openjdk-7-jdk ant ia32-libs unzip

Mac OS X with brew:

brew install libtiff graphicsmagick mariadb

Installation

# Clone apk-factory-library
cd lib/ext && git clone https://github.com/mozilla/apk-factory-library.git
cd ../..
npm rebuild

# Create the database and an *apk* user with privileges on it.
mysql.server start
mysql -u root < docs/db/schema_up_000.sql
mysql -u root < docs/db/schema_up_001.sql
mysql -u root < docs/db/schema_up_002.sql
mysql -u root -e "CREATE USER 'apk'@'localhost' IDENTIFIED BY 'password';"
mysql -u root -e "GRANT ALL PRIVILEGES ON apk_factory.* TO 'apk'@'localhost';"

Install the Android SDK. See Notes on Android SDK for common setup instructions. You'll need to expose the SDK path with something like this:

export ANDROID_HOME=~/Downloads/adt-bundle-mac/sdk/

You need to have API 19 (or maybe higher?). Check for adt-bundle-mac/sdk/platforms/android-19/.

Please read config/default.js which documents the various configuration paramters and allowable values.

Local development

One time install of development only modules

npm install node-inspector tape

You'll probably want to point your local generator to a local APK Signer. See config/default.js for where to set its URL.

After setting ANDROID_HOME, fire up your local controller and generator servers like:

npm start

If everything is configured you should be able to post a manifest to your controller and get a binary APK response. Try this:

curl -v 'http://127.0.0.1:8080/application.apk?manifestUrl=http://deltron3030.testmanifest.com/manifest.webapp'

curl -v -H "Content-Type: application/json" -X POST -d '{ "installed":{"http://deltron3030.testmanifest.com/manifest.webapp":1394909578}}' https://localhost:8080/app_updates

You can generate manifests at testmanifest.com.

You can attach a debugger via two tabs in Chrome, if you do this instead of npm start

node scripts/development-server.js debug

And then load in Chrome:

CLI

There is a command line interface to create APKs locally.

node  --endpoint=http://localhost:8080 bin/cli.js http://people.mozilla.org/~fdesre/openwebapps/package.manifest application.apk

Testing

Unit tests

$ npm test

Integration tests

 $ INT_TESTING=true npm start
 $ ./node_modules/.bin/tap --timeout=999999 int-test/integration-test.js

or to target a different environment

 $ APK_ENDPOINT='http://dapk.net' tap int-test/integration-test.js

Deployment

Production

Stage

Dev

Dev server is automatically deployed from master after a commit

https://apk-controller.dev.mozaws.net

OLD Dev Server

A former development server is available at http://dapk.net.

Some notes on how its process is started up:

ANDROID_HOME=/data/android-sdk-linux \
CONFIG_FILES='/home/ubuntu/apk-factory-service/config/default.js,/home/ubuntu/apk-factory-service/config/aws.js' \
forever start bin/controller

Command Line Interface

node bin/cli.js

apk-factory-service's People

Watchers

 avatar  avatar

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.