Commit 47a1f83a authored by Evan W. Patton's avatar Evan W. Patton Committed by Jeffrey Schiller

Add Vagrantfile for development environment bootstrapping (#1540)

* Add Vagrantfile for development environment bootstrapping

Change-Id: I2fb08206d96f2ff0da73954f820134b7a0684aef
parent 17ce0528
...@@ -23,7 +23,38 @@ If you have skipped this step and have gone ahead and made your changes already, ...@@ -23,7 +23,38 @@ If you have skipped this step and have gone ahead and made your changes already,
Check out our open source [site](http://appinventor.mit.edu/appinventor-sources/) to find a lot more information about the project and how to contribute to it. Check out our open source [site](http://appinventor.mit.edu/appinventor-sources/) to find a lot more information about the project and how to contribute to it.
## Setup instructions ## Setup instructions (Vagrant)
The easiest way to get a development environment up and running is to use the provided Vagrantfile. Install [Vagrant](https://vagrantup.com) and open a terminal in the root directory of this repository. Run the following commands
```bash
vagrant plugin install vagrant-vbguest # optionally for virtualbox users, and only once
vagrant up # initializes the VM
```
It may take a few minutes for Vagrant to initialize as it will pull down a virtual machine image from the Internet and configure it with all of the App Inventor dependencies. Subsequent start-ups will be faster. Next, enter the virtual machine by running:
```bash
vagrant ssh
```
This should open up a terminal within the virtual machine in the directory `/vagrant/appinventor`. This directory is the same as the `appinventor` directory in this repository, shared between your host machine and the virtual machine. Any changes made on one side will be visible in the other. This allows you to edit files on your host machine with your preferred editor, while keeping the build environment relegated to the virtual machine. To build App Inventor, you may now run:
```bash
ant
```
and to run App Inventor:
```bash
start_appinventor
```
Press Ctrl+C to quit the server. Enter exit at the prompt to leave the virtual machine. To reclaim resources when you are not actively developing, you can run `vagrant halt` to stop the virtual machine. To completely remove the virtual machine, run `vagrant destroy`. If you destroy the VM, you will need to start these instructions from the top.
For better performance, consider using the manual instructions.
## Setup instructions (manual)
This is a quick guide to get started with the sources. More detailed instructions can be found [here](https://docs.google.com/document/pub?id=1Xc9yt02x3BRoq5m1PJHBr81OOv69rEBy8LVG_84j9jc), a slide show can be seen [here](http://josmas.github.io/contributingToAppInventor2/#/), and all the [documentation](http://appinventor.mit.edu/appinventor-sources/#documentation) for the project is available in our [site](http://appinventor.mit.edu/appinventor-sources/). This is a quick guide to get started with the sources. More detailed instructions can be found [here](https://docs.google.com/document/pub?id=1Xc9yt02x3BRoq5m1PJHBr81OOv69rEBy8LVG_84j9jc), a slide show can be seen [here](http://josmas.github.io/contributingToAppInventor2/#/), and all the [documentation](http://appinventor.mit.edu/appinventor-sources/#documentation) for the project is available in our [site](http://appinventor.mit.edu/appinventor-sources/).
......
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/bionic64"
config.vm.boot_timeout = 400
config.vm.provider "virtualbox" do |v|
v.name = "ForAppinventor2-bionic64"
v.memory = "4096"
v.customize ["modifyvm", :id, "--usb", "on"]
# fix for slow network
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
v.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
v.customize ["modifyvm", :id, "--nictype1", "virtio"]
end
config.vm.provision :shell, path: "bootstrap.sh"
config.vm.network :forwarded_port, guest: 8888, host: 8888
config.vm.network :forwarded_port, guest: 9990, host: 9990
end
#!/usr/bin/env bash
dpkg --add-architecture i386
# Install dependencies
apt-get update
apt-get upgrade -y
apt-get install -y libc6:i386 libstdc++6:i386 glibc-doc:i386 gcc-5-base:i386 gcc-6-base:i386 libgcc1:i386 \
openjdk-8-jdk zip unzip ant lib32z1 adb phantomjs
# Install App Engine
mkdir -p /opt/appengine
cd /opt/appengine
wget --no-verbose -O /tmp/appengine.zip https://storage.googleapis.com/appengine-sdks/featured/appengine-java-sdk-1.9.68.zip
unzip -o /tmp/appengine.zip
# Configure shell
echo "export PATH=$PATH:/opt/appengine/appengine-java-sdk-1.9.68/bin" >> /home/vagrant/.bashrc
echo "cd /vagrant/appinventor" >> /home/vagrant/.bashrc
# Configure java
update-java-alternatives -s java-1.8.0-openjdk-amd64
# Make the auth key in advance
cd /vagrant/appinventor
sudo -u vagrant ant MakeAuthKey
# Helper script for starting App Inventor dev server
cat <<EOF > /usr/local/bin/start_appinventor
ant RunLocalBuildServer &> buildserver.log &
BUILDSERVER=$!
dev_appserver.sh -p 8888 -a 0.0.0.0 appengine/build/war
kill -9 -- -$BUILDSERVER
EOF
chmod +x /usr/local/bin/start_appinventor
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment