lxc_manager_node
This has been tested on clean install of ubuntu 14.04 64bit.
install
Update you system to the newest packages and reboot. You may need to do this several times:
sudo apt-get update && sudo apt-get upgrade -y && sudo reboot
Once there are no more updates, add the virt
user:
sudo adduser virt
Make the password something strong, and remember it.
Now you can install the packages we need:
sudo add-apt-repository ppa:ubuntu-lxc/stable
sudo add-apt-repository ppa:ubuntu-lxc/cgmanager-stable
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install git nodejs npm lxc redis-server btrfs-tools
remap nodejs
to node
:
sudo ln -s /usr/bin/nodejs /usr/bin/node
And install the node packages:
sudo npm install -g forever
give the virt
user network access:
echo "virt veth lxcbr0 1024" | sudo tee -a /etc/lxc/lxc-usernet
lets set up the config file for the virt
user, first switch users:
su virt
The lines below will add the proper config file:
mkdir -p ~/.config/lxc
echo "lxc.id_map = u 0 `grep -oP "^$USER:\K\d+" /etc/subuid` `grep -oP "^$USER:\d+:\K\d+" /etc/subuid`" > ~/.config/lxc/default.conf
echo "lxc.id_map = g 0 `grep -oP "^$USER:\K\d+" /etc/subgid` `grep -oP "^$USER:\d+:\K\d+" /etc/subgid`" >> ~/.config/lxc/default.conf
echo "lxc.network.type = veth" >> ~/.config/lxc/default.conf
echo "lxc.network.link = lxcbr0" >> ~/.config/lxc/default.conf
Clone the repo and set it up:
git clone https://github.com/wmantly/lxc_manager_node.git
cd lxc_manager_node
npm install
Its safer at this point to reboot the system, `exit` back to the privlaged user and `reboot`
**SSH or log dercily into the `virt` user!!!** this will not if you use su!
Now you can can create a test container:
```bash
lxc-create -t download -n test-ubuntu -- -d ubuntu -r trusty -a amd64
start and attach the container to make sure everthing is ok:
lxc-start -n test-ubuntu -d
lxc-attach -n test-ubuntu
If everything worked you can stop and delete the container
lxc-stop -n test-ubuntu
lxc-destroy -n test-ubuntu
auto start
crontab
@reboot /usr/local/bin/forever start -a -o /home/virt/lxc_manager_node/server.out.log -e /home/virt/lxc_manager_node/server.err.log /home/virt/lxc_manager_node/bin/www
##rc.local
sudo cgm create all virt
sudo cgm chown all virt $(id -u virt) $(id -g virt)
Description
Languages
JavaScript
77.6%
HTML
17.9%
Shell
4.2%
CSS
0.3%