-
Notifications
You must be signed in to change notification settings - Fork 0
Hosting with LXD
abreitenfeld edited this page Mar 29, 2016
·
1 revision
General installation (as root recommend) procedure of LXD like described in https://linuxcontainers.org/lxd/getting-started-cli/#ubuntu-desktop-and-ubuntu-server.
add-apt-repository -y ppa:ubuntu-lxc/lxd-stable &&
apt-get update &&
apt-get dist-upgrade -y &&
apt-get install -y lxd &&
newgrp lxd &&
lxd init &&
systemctl stop lxc-net &&
systemctl start lxc-net &&
lxc remote add images images.linuxcontainers.org
Create a container using a remote image server.
lxc init images:ubuntu/trusty/i386 neonion &&
lxc config set neonion boot.autostart true &&
lxc config set neonion limits.memory 2GB &&
lxc start neonion
https://help.ubuntu.com/lts/serverguide/lxc.html#lxc-network
Install system requirements.
lxc exec neonion -- /bin/bash
apt-get update &&
apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev &&
apt-get install -y git node npm software-properties-common &&
apt-get install -y apache2 libapache2-mod-wsgi &&
apt-get install -y python2.7-dev python-pip &&
ln -sf /usr/bin/python2.7 /usr/local/bin/python &&
npm -g install yuglify
Setup Apache and install neonion.
groupadd www-neonion &&
adduser www-data www-neonion &&
mkdir /var/www/neonion &&
git clone https://github.molgen.mpg.de/GMPG/neonion.git &&
cd /var/www/neonion/neonion &&
pip install -r requirements.txt &&
python manage.py migrate &&
python manage.py loaddata fixtures/* &&
rm /etc/apache2/sites-enabled/000-default.conf &&
wget https://gist.githubusercontent.com/abreitenfeld/494b6be08698cc1d2f2a/raw/b12dc49f6b39263adc441a85aac303aac5d17c85/neonion.conf -P /etc/apache2/sites-available/ &&
ln -s /etc/apache2/sites-available/neonion.conf /etc/apache2/sites-enabled/ &&
chgrp -R www-neonion /var/www &&
chmod -R 770 /var/www &&
/etc/init.d/apache2 restart
Install Java 8 and ElasticSearch as service according to this guide.
add-apt-repository -y ppa:webupd8team/java &&
apt-get update &&
apt-get -y install oracle-java8-installer &&
wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - &&
echo "deb http://packages.elastic.co/elasticsearch/1.7/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-1.7.list &&
apt-get update &&
apt-get install -y elasticsearch &&
update-rc.d elasticsearch defaults 95 10 &&
service elasticsearch start
Install Annotator Store as services.
git clone https://github.com/openannotation/annotator-store.git /var/www/annotator-store &&
cd /var/www/annotator-store &&
pip install -e .[flask] &&
cp annotator.cfg.example annotator.cfg &&
wget https://gist.githubusercontent.com/abreitenfeld/db745fc2b9dbb2f3b753/raw/70604a1df560a07dff3efec9512e14fb97526a9d/annotator-store -P /etc/init.d/ &&
chmod 775 /etc/init.d/annotator-store &&
update-rc.d annotator-store defaults 98 &&
service annotator-store start
Source
Get the IP of the neonion container lxc info neonion
iptables -t nat -A PREROUTING -p tcp -i eth0 --dport 80 -j DNAT --to-destination 10.0.3.201:80
iptables -A FORWARD -p tcp -d 10.0.3.201 --dport 80 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -A OUTPUT -p tcp -o lo --dport 80 -j DNAT --to-destination 10.0.3.201:80