-
Notifications
You must be signed in to change notification settings - Fork 21
1 Install, Configure and Run AWE
The recommended installation method for AWE is with Docker (Section 1), but you can also run AWE without Docker (Section 0).
sudo apt-get -y install mongodb-server bzr make gcc mercurial git
Note that mongodb-server is only needed for the AWE server.
apt-get install golang
or
cd ~
mkdir -p ~/gopath
hg clone -u release https://code.google.com/p/go
cd ~/go/src ./all.bash
export GOPATH=/home/<user>/gopath
export PATH=$PATH:/home/<user>/go/bin:/home/<user>/gopath/bin
export PATH=$PATH:${GOPATH}/src/github.com/MG-RAST/AWE/utils
go get github.com/MG-RAST/AWE/...
or, if you want to include the git commit number in the binary
export GITHASH=$(git -C ${GOPATH}/src/github.com/MG-RAST/AWE rev-parse HEAD)
echo ${GITHASH}
go get -ldflags "-X github.com/MG-RAST/AWE/lib/conf.GIT_COMMIT_HASH ${GITHASH}" github.com/MG-RAST/AWE/...
Both awe-server and awe-client binaries are compiled at this point. Test with:
${GOPATH}/bin/awe-client --help
${GOPATH}/bin/awe-client --show_git_commit_hash
Continue with Section 3.
If you prefer a manual installation please use our Dockerfiles for instructions. Note that these Dockerfiles create statically compiled binaries that you can easily extract. (Also note that the AWE worker binary is named awe-client.)
To install Docker, e.g. using ubuntu:
sudo apt-get update && sudo apt-get -y install docker.io
Optional:
Docker requires quite some disk space, you can set these environment variables to tell docker to use ephemeral disk space in the docker config file:
# /etc/default/docker.io
export TMPDIR=/media/ephemeral/tmp/
export DOCKER_OPTS="-g=/media/ephemeral/docker"
Create tmp dir:
mkdir /media/ephemeral/tmp/
And restart docker:
sudo service docker.io restart
Download AWE image from DockerHub:
sudo docker pull mgrast/awe
sudo docker pull mgrast/mongodb # only needed for AWE server
You can also build the image on you own from Dockerfiles. The Dockerfiles for AWE worker and AWE server can be found here:
AWE worker and AWE server: https://github.com/MG-RAST/AWE/tree/master/dockerfiles/awe
MongoDB: https://github.com/MG-RAST/AWE/tree/master/dockerfiles/mongodb
Example to build image:
docker build -t mgrast/awe:latest https://raw.githubusercontent.com/MG-RAST/AWE/master/dockerfiles/awe/Dockerfile
If you need binaries, either download binaries for the latest tagged version from github https://github.com/MG-RAST/AWE/releases/latest), or extract the very latest version from the Dockerimage:
docker create --name awe mgrast/awe
docker cp awe:/gopath/bin/awe-server .
docker cp awe:/gopath/bin/awe-client .
This example assumes you run the AWE worker in a container. If you do not use Docker, ignore the line that starts with "docker run". The AWE worker will store files on the host in the DATADIR directory. Do not forget to specifiy the AWE server url. Here the AWE worker is completely configured by command line parameters and does not need a configuration file. This command will run AWE worker as a demonized container:
export DATADIR=/media/ephemeral/awe-client/
mkdir -p ${DATADIR}
/usr/bin/docker run -d --name awe-client -v /var/run/docker.sock:/var/run/docker.sock -v ${DATADIR}:${DATADIR} mgrast/awe \
/gopath/bin/awe-client --data=${DATADIR}/data --logs=${DATADIR}/logs --workpath=${DATADIR}/work --serverurl=<awe_server> --group=docker --supported_apps=*
To run in foreground replace "-d" with "-t -i --rm"
/usr/bin/docker run -t -i --rm --name ...
Verify the container is running:
sudo docker ps
The AWE server requires a Mongodb instance. On ubuntu the mongo server should already be running once installed. With Docker you can start an instance like this:
export DATADIR="/media/ephemeral/awe-server/"
/usr/bin/docker run --rm --name awe-server-mongodb -v ${DATADIR}mongodb/:/data/db --expose=27017 mgrast/mongodb /usr/bin/mongod
You can configure the AWE server with a configuration file and via command line options. You can start with out template config file for the AWE server and then make changes:
/usr/bin/curl -o ${DATADIR}awe-server.cfg https://raw.githubusercontent.com/MG-RAST/AWE/master/templates/awes.cfg.template
This is the command to start the AWE server. If you do not use Docker, ignore the line that starts with "docker run":
export TITLE="my server"
export PUBLIC_IPV4=<PUBLIC IP>
docker run --rm --name awe-server -p 80:80 -p 8001:8001 -v ${DATADIR}awe-server.cfg:/awe-config/awe-server.cfg -v ${DATADIR}data/:/mnt/data/awe/ --link=awe-server-mongodb:mongodb mgrast/awe \
/gopath/bin/awe-server --hosts=mongodb --debuglevel=1 --conf=/awe-config/awe-server.cfg --use_app_defs=yes --site-port=80 --api-port=8001 --api-url=http://${PUBLIC_IPV4}:8001 --site-url=http://${PUBLIC_IPV4}:80 --title=${TITLE}
Comments:
port 80: AWE server monitor
port 8001: AWE server API
"-v" mounts host to container directories
"--link" connects AWE server and mongodb
If you run awe server binary directly, note that you will need the "site" sub-directory in the AWE git repository (https://github.com/MG-RAST/AWE/tree/master/site) to use the AWE monitor.
https://raw.githubusercontent.com/MG-RAST/AWE/master/templates/awes.cfg.template
Config file specification is available at, or use "awe-server --help"
https://github.com/MG-RAST/AWE/wiki/AWE-config-file-manual
AWE options: --recover: if this flag is set, awe-server will automatically recover the queue before last time it was shut down. --debug: set the debug log level from 0 to 3, by default debug log is not printed --dev: print simple queue statistics to stdout every 10 seconds
Check logs:
- Log location: <path/to/awe/logs> configured in config file.
- Log types: access.log, error.log, debug.log, event.log, perf.log
TODO: this requires update, this is partly automatic now.
WARNING: Soon deprecated. The default configuration will be automatically set up and does only require the port to be defined on which the AWE Monitor listens.
- Configure the web site path in awe.cfg for awe-server
e.g.
[Directories]
Site=/Users/wtang/gopath/src/github.com/MG-RAST/AWE/site #where the js are
[Ports]
site-port=8080 #what port you want to use as the web interface
- Create a config file (config.js) under server machine $GOPATH/src/MG-RAST/AWE/site/js
you can rename config.js.tt to config.js, and edit the content of config.js:
e.g.
var RetinaConfig = {
"awe_ip": "http://140.221.84.148:8000",
"workflow_ip": "http://140.221.84.148:8000/awf"
}
- 140.221.84.148:8000 is the external server API URL.
- After above configuration, your web interface can be accessed by: http://140.221.84.148:8080/
- You can use localhost as the ip address, but then you can only access the web interface from the local machine by http://localhost:8080
For installation and configuration of Shock, please refer to https://github.com/MG-RAST/Shock
To update vendorized code in AWE
cd AWE
go get -v github.com/mjibson/party
party -d vendor -c -u
Can be used to conveniently start multiple AWE worker instance in the cloud. Requires recent Ubuntu image.
#!/bin/bash
set -e
set -x
# configuration
export AWE_SERVER="<server-address:port>"
export GROUP="docker"
export EPHEMERAL="/mnt"
# or export EPHERMERAL="/media/ephemeral/"
export DATADIR=${EPHEMERAL}/awe-client/
export WORKERNAME=""
# Detect IP and set worker name
# export WORKERNAME=`ifconfig eth0 | grep 'inet addr' | cut -d ":" -f 2 |cut -d " " -f1`
# install docker
apt-get update && sudo apt-get -y install docker.io
sleep 2
# move docker location to EPHEMERAL
# the default location for Docker to store images may not have enough space:
mkdir -p ${EPHEMERAL}/tmp/
echo 'export TMPDIR='${EPHEMERAL}'/tmp/' >> /etc/default/docker.io
echo 'export DOCKER_OPTS="-g='${EPHEMERAL}'/docker"' >> /etc/default/docker.io
/usr/sbin/service docker.io restart
sleep 4
# Create directory for awe-worker data:
mkdir -p ${DATADIR}
# Run awe-worker:
/usr/bin/docker run -d --name awe-client -v /var/run/docker.sock:/var/run/docker.sock -v ${DATADIR}:${DATADIR} mgrast/awe /gopath/bin/awe-client --data=${DATADIR}/data --logs=${DATADIR}/logs --workpath=${DATADIR}/work --serverurl=${AWE_SERVER} --group=${GROUP} --debug_level=1 --auto_clean_dir=false --supported_apps=*
#Start awe-worker on reboots. This step is optional (better would be upstart or systemd unit), thus it is commented:
#echo "/usr/bin/docker run -d --name awe-client -v /var/run/docker.sock:/var/run/docker.sock -v ${DATADIR}:${DATADIR} mgrast/awe /gopath/bin/awe-client --data=${DATADIR}/data --logs=${DATADIR}/logs --workpath=${DATADIR}/work --serverurl=${AWE_SERVER} --name=${WORKERNAME}--group=${GROUP} --debug_level=1 --auto_clean_dir=false --supported_apps=*" >> /etc/rc.local