Web service which converts Open Web Apps into native Android apps
Перейти к файлу
mykmelez-mozilla-owner 6af36ce79c
note that project is archived
2019-06-20 11:17:06 -07:00
bin Decrement build for uncaught exceptions. Fixes Issue#74 2014-07-29 09:24:58 -07:00
config Controller/Generator should return 503 based on config.maximumNumberOfConcurrentBuilds. Fixes bug#1031027 2014-07-14 15:02:03 -07:00
docs Merge pull request #79 from pdehaan/patch-1 2014-10-14 15:40:07 -07:00
int-test Rework review and release modes. Use ant debug. Fixes Bug#988644 2014-04-01 19:12:53 -07:00
lib FileLoader.copy should use a buffer instead of string. fixes #84 2015-01-07 14:11:37 -08:00
node_modules Enhance monolith logging for app updates 2014-04-14 09:04:52 -07:00
scripts Rework review and release modes. Use ant debug. Fixes Bug#988644 2014-04-01 19:12:53 -07:00
test Controller/Generator should return 503 based on config.maximumNumberOfConcurrentBuilds. Fixes bug#1031027 2014-07-14 15:02:03 -07:00
test-manifests Started reorganizing builder into apk-factory-service 2013-11-20 10:04:57 -08:00
util-templates Started reorganizing builder into apk-factory-service 2013-11-20 10:04:57 -08:00
.gitignore Moving apk-factory-library install path out of node_modules. Fixes Bug#967849 2014-02-04 15:06:44 -08:00
.jshintrc Adding .jshintrc 2014-01-27 16:23:02 -08:00
.travis.yml We're too noisy for #mobile 2014-02-12 14:05:10 -08:00
CODE_OF_CONDUCT.md Add Mozilla Code of Conduct file 2019-03-27 21:21:33 -07:00
Gruntfile.js Started reorganizing builder into apk-factory-service 2013-11-20 10:04:57 -08:00
README.md note that project is archived 2019-06-20 11:17:06 -07:00
RELEASE_NOTES.md Create release-2014-04-02-01 release 2014-04-02 15:01:21 -07:00
build Bug 979759: run npm rebuild during build process. 2014-03-06 11:44:33 -05:00
install-tools.sh Started reorganizing builder into apk-factory-service 2013-11-20 10:04:57 -08:00
package.json Made CLI build packaged apps. Fixes Bug#962879 2014-04-25 08:43:26 -07:00

README.md

Note: this project has been archived, as development has stalled, and it isn't being actively maintained, nor used.

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 g++
# 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 JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
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.

Use config/developer.js to override any settings.

cp config/developer.js-dist config/developer.js

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:

Logs will appear in var/log

Logs will appear in var/log/apk-generator.log and var/log/apk-controller.log

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

To check if things are working, you can request an APK build from your local server like this:

curl -v -o application.apk 'http://localhost:8080/application.apk?manifestUrl=https://yacht.paas.allizom.org/yacht/manifest.webapp'

Where the manifestUrl is a valid link to an open web app manifest.

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

Monitoring

Check out the monitoring documentation.