Skip to content

Latest commit

 

History

History
67 lines (55 loc) · 5.93 KB

INSTALLATION_DIGITALOCEAN.md

File metadata and controls

67 lines (55 loc) · 5.93 KB

How to install the Open Event Android App Generator on DigitalOcean.com

As sample set up is installed here

Build Server Requirements

Required Components

  • index.html A html file which can server as the landing page for your server.
  • runPy.php A php script that will launch python script by taking input from index.html.
  • appgenserver.py A python script containg commands to compile and generate the app
  • clone.sh A bash script used for cloning the source code for android app onto the server.
  • buildApk.sh A bash script used for initiating the app's build and signing it once the app has been generated.
  • email.php A php script used to send the email containing the generated app as an attachment.
  • upload.php A php script that will upload the json zip that is chosen by the user into a unique folder based on his timestamp.
    api.php A php script that serves as an API and handles incoming requests to the server.
  • copyapk.sh A bash script that will copy the generated and signed apk to the release folder in public-html of the server.

Server Setup

  1. Navigate to server's /var/www/ and install the Android SDK here.
  2. You can do that by following this thread on stackoverflow.
  3. Edit the .bashrc file located in /root to reference to the SDK you have just installed

To do this, type in nano /root/.bashrc and press enter.
Navigae to the bottom of the file that opens and add following code there
export ANDROID_HOME=/var/www/android-sdk-linux
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

  1. Download the template app icon that is to be used during compilation if user hasn't provided us with any logo.
    sudo apt-get install wget
    wget image_link_here

  2. Move all the files mentioned in the scripts folder (Except runPy.php, upload.php and index.html) into /root/scripts.

  3. Move runPy.php, upload.php, and index.html to /var/www/html

  4. Install and setup JAVA on your machine.

  5. Next, install PHP.This can be done by simply writing sudo apt-get install php in your terminal.
    Now modify the maximum upload limit of php to atleast 500MB. (Default is 2MB)

  6. Mdify your sudoers list to allow www-data to run the runPy.php script as root You can do this by typing the following command sudo visudo and hitting enter
    Next scroll to the bottom of the file and add www-data ALL = NOPASSWD: /var/www/html/runPy.php

  7. Create a firebase account and add your API key to index.html
    Navigate to your Account and then create a new project (Name it whatever you want)
    Open this newly created project and click the Pink colored button saying "Add Firebase to your web app"
    Copy the code listed there and paste it to index.html Also add your server's IP address to trusted sources in the Firebase console by clicking on Add Domain

  8. Create another folder in your public-html named api and move contents of the folder api here.

  9. The sender's address, message title and the body of email is defined in conig.json inside apk-generator/scripts. Changing this will affect the email that is sent.

Glosarry

Term Meaning
Build Server Backend which generates the app when your details are submitted on the app-generator website
Script Executable files containing code which help in compiling the app
Root User User who is currently accessing the build server directly
www-data Public user who accesses the server via the webpage
Terminal Tool for accessing the computer remotely
Sendgrid Tool used for sending the email from terminal to the user
var/www Your server's public directory (Anyone can read the stuff placed here)
Firebase An online data storage service used for storing the data input by the user and later retrieving it at the server