Skip to content

Instantly share code, notes, and snippets.

@Adyg
Last active August 29, 2015 14:02
Show Gist options
  • Save Adyg/5d9f9956dffebdb80c87 to your computer and use it in GitHub Desktop.
Save Adyg/5d9f9956dffebdb80c87 to your computer and use it in GitHub Desktop.
Ohmage server
apt-get update
GIT
apt-get install git
JAVA
apt-get install software-properties-common python-software-properties
add-apt-repository ppa:webupd8team/java
apt-get update
apt-get install oracle-java7-set-default
TOMCAT
apt-get install tomcat7
nano /etc/default/tomcat7
Uncomment JAVA_HOME and set it to '/usr/lib/jvm/java-7-oracle'
nano /etc/tomcat7/server.xml
Uncomment "<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />"
sudo service tomcat7 restart
APACHE
apt-get install apache2
sudo a2enmod proxy proxy_ajp
sudo service apache2 restart
cd /etc/apache2/sites-available
create a "ohmage" vhost file with:
--------------------------------
Redirect 302 /index.html /ohmage
<IfModule mod_proxy_ajp.c>
ProxyPass /app ajp://127.0.0.1:8009/app
ProxyPass /ohmage ajp://127.0.0.1:8009/ohmage
</IfModule>
------------------------------------
sudo a2ensite ohmage
service apache2 reload
MYSQL
apt-get install mysql-server
cd /vagrant/codebase/db/sql/base
mysql -u root -p < ohmage-ddl.sql
cd /vagrant/codebase/db/sql/settings
cat *.sql | mysql -u root -p ohmage
cd /vagrant/codebase/db/sql/preferences
mysql -u root -p ohmage < default_preferences.sql
GRANT ALL PRIVILEGES ON ohmage.* To 'ohmage'@'localhost' IDENTIFIED BY '&!sickly';
ANT
sudo apt-get install ant
JUNIT
apt-get install junit
FILES
Create: /opt/ohmage/userdata/images, /opt/ohmage/userdata/video, /opt/ohmage/userdata/audio
Getting it to run:
in /vagrant/codebase run: ant dist-no_ssl
copy /vagrant/codebase/dist/webapp-ohmage-2.16-no_ssl.war to /var/lib/tomcat7/webapps/ohmage.war
service tomcat7 restart
in the host, http://localhost:9302/ohmage/EasyPost.html will be available
Requirements
------------
- vagrant
- Virtualbox
Directory structure
--------------------
ohmage
ohmage/codebase
ohmage/codebase/app
ohmage/codebase/web
ohmage/codebase/trialist
ohmage/vagrant
Getting the code
----------------
1. cd ohmage/codebase
2. git clone [email protected]:ohmage/server.git app
3. git clone [email protected]:ohmage/gwt-front-end.git web
4. git clone [email protected]:ohmage/trialist-front-end.git trialist
5. cd web && git checkout 756ccc6b4ec0e2dfdeee4e4dfbbfc4e436390cc1 (this is the sha of the commit before stuff started breaking, as far as I can tell)
Getting the vagrant box running
-------------------------------
1. cd ohmage/vagrant && vagrant init
2. Download the box from http://ovh.to/pvFqzad and save it to ohmage/vagrant directory
3. vagrant box add [downloaded box filename] --name ohmagevm --force
Set the content of ohmage/vagrant/Vagrantfile to:
Vagrant.configure("2") do |config|
config.ssh.forward_agent = true
config.vm.define :djangovm do |django_config|
# Every Vagrant virtual environment requires a box to build off of.
django_config.vm.box = "ohmagevm"
# Forward a port from the guest to the host, which allows for outside
# computers to access the VM, whereas host only networking does not.
django_config.vm.network :forwarded_port, host: 9302, guest: 80
django_config.vm.network :forwarded_port, host: 9303, guest: 9303
django_config.vm.synced_folder "../", "/vagrant", id: "1",
mount_options: ["dmode=775", "fmode=764"]
end
end
Use "vagrant up" to start the VM and "vagrant ssh" to access it.
Compiling & Running the applications
------------------------------------
sudo rm /var/lib/tomcat7/webapps/ohmage.war
sudo rm -R /var/lib/tomcat7/webapps/ohmage
sudo rm /var/lib/tomcat7/webapps/app.war
sudo rm -R /var/lib/tomcat7/webapps/app
sudo rm /var/lib/tomcat7/webapps/web.war
sudo rm -R /var/lib/tomcat7/webapps/web
cd /vagrant/codebase/app
ant dist-no_ssl
sudo cp /vagrant/codebase/app/dist/webapp-ohmage-2.16-no_ssl.war /var/lib/tomcat7/webapps/app.war
cd /vagrant/codebase/web
ant clean
ant buildwar-nossl
ant
sudo cp /vagrant/codebase/web/MobilizeWeb-nossl.war /var/lib/tomcat7/webapps/web.war
service tomcat7 restart
sudo cp -R /vagrant/codebase/web/war/mobilizeweb /var/lib/tomcat7/webapps/web
Using the apps
--------------
- http://localhost:9302/app/EasyPost.html (server)
- http://localhost:9302/web (client)
- http://localhost:9303 (trialist)
The client login by default is ohmage.admin/ohmage.passwd.
This has to be repeated after each set of changes to the code.
Swapping the VM
---------------
cd ohmage/vagrant
vagrant destroy
wget http://templates.adriang.eu/package_5June14.box
vagrant box add package_5June14.box --name ohmagevm --force
vagrant up
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment