container: pre-built Vagrant box and docker container

Change-Id: Id49a6426f52fd3e22a94fee4607b7e2a6d0a7454
This commit is contained in:
dulalsaurab
2021-05-21 20:37:03 +00:00
parent 48ada89a8a
commit 8c8e633d26
6 changed files with 146 additions and 28 deletions
Vendored
-28
View File
@@ -1,28 +0,0 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
$script = <<SCRIPT
ln -s /vagrant /home/vagrant/mini-ndn
# Check if install.sh is present or someone just copied the Vagrantfile directly
if [[ -f /home/vagrant/mini-ndn/install.sh ]]; then
pushd /home/vagrant/mini-ndn
else
# Remove the symlink
rm /home/vagrant/mini-ndn
git clone --depth 1 https://github.com/named-data/mini-ndn.git
pushd mini-ndn
fi
./install.sh -qa
SCRIPT
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/bionic64"
config.vm.provision "shell", privileged: false, inline: $script
config.vm.provider "virtualbox" do |vb|
vb.name = "mini-ndn_box"
vb.memory = 4096
vb.cpus = 4
end
end
+47
View File
@@ -0,0 +1,47 @@
[comments]: The original author of Mini-NDN docker is Md Ashiqur Rahman (marahman@email.arizona.edu)
| :exclamation: Mini-NDN docker is in experimental phase, it uses older version of Mini-NDN and is incompatible with the current version |
|-----------------------------------------------------------------------------------------------------------------------------------------|
### `docker build` or `docker pull`
The [Dockerfile](https://github.com/ashiqopu/docker-minindn/blob/master/Dockerfile) can be used directly to `build` an image from scratch.
* Build with `Dockerfile`:
* Open terminal and use the following command:
```bash
git clone https://github.com/ashiqopu/docker-minindn
cd docker-minindn
```
* Type and enter.
```bash
docker build -t minindn .
```
* You can then access the container through shell with,
```bash
docker run -m 4g --cpus=4 -it --rm --privileged \
-v /lib/modules:/lib/modules \
minindn bin/bash
```
* Pull from hub:
* Open a terminal and type:
```bash
docker pull marahman/minindn:v0.2
```
* You can then access the container through shell with,
```bash
docker run -m 4g --cpus=4 -it --rm --privileged -e DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v /lib/modules:/lib/modules \
marahman/minindn:v0.2 bin/bash
```
### Notes:
* Memory (-m), CPU (--cpus) are recommended by Mini-NDN.
* `--privileged` is mandatory for underlying [Mininet](http://mininet.org/) to utilize virtual switch
* Root directory on `run` is `/mini-ndn` containing the installation and examples.
* GUI may not work for now due to docker and xterm setup issues and is independent from Mini-NDN.
+2
View File
@@ -6,4 +6,6 @@ Past NDN Hackathon projects
- 3rd NDN Hackathon: `Mini-NDN cluster <https://github.com/3rd-ndn-hackathon/mini-NDN-cluster>`_. - 3rd NDN Hackathon: `Mini-NDN cluster <https://github.com/3rd-ndn-hackathon/mini-NDN-cluster>`_.
- 4th NDN Hackathon: `Mini-NDN wifi <https://github.com/4th-ndn-hackathon/Mini-NDN-Wi-Fi>`_. - 4th NDN Hackathon: `Mini-NDN wifi <https://github.com/4th-ndn-hackathon/Mini-NDN-Wi-Fi>`_.
- 7th NDN Hackathon: `Mini-NDN documentation <https://github.com/7th-ndn-hackathon/mini-ndn-documentation>`_. - 7th NDN Hackathon: `Mini-NDN documentation <https://github.com/7th-ndn-hackathon/mini-ndn-documentation>`_.
- 11th NDN Hackathon: `Mini-NDN improvements <https://11th-ndn-hackathon.named-data.net/hacks.html#8-mini-ndn-improvements>`_.
- 12th NDN Hackathon: `Mini-NDN improvements and Refactoring <https://12th-ndn-hackathon.named-data.net/hacks.html#7-mini-ndn-improvements>`_.
+8
View File
@@ -46,6 +46,13 @@ Some notable flags are:
- ``--ppa`` prefers installing NDN software from `named-data PPA <https://launchpad.net/~named-data/+archive/ubuntu/ppa>`_. - ``--ppa`` prefers installing NDN software from `named-data PPA <https://launchpad.net/~named-data/+archive/ubuntu/ppa>`_.
This shortens installation time by downloading binary packages, but is only available on Ubuntu. This shortens installation time by downloading binary packages, but is only available on Ubuntu.
- ``--source`` prefers installing NDN software from source code. - ``--source`` prefers installing NDN software from source code.
IMPORTANT: For now, Mininet-WiFi only works with ``--source`` installation because the current NFD release (0.7.1) doesn't
incorporate `issue 5155 <https://redmine.named-data.net/issues/5155>`, a required patch for WiFi module to work properly.
With the next NFD release, Mininet-WiFi will work with both ``source`` and ``ppa``. Alternatively, you can
checkout (at your own risk) a third-party source "`Use NFD nightly with Mini-NDN <https://yoursunny.com/t/2021/NFD-nightly-minindn/>`", which provides
NFD-nightly version and contains all the necessary patches.
- ``--dummy-keychain`` patches ndn-cxx to use an in-memory dummy KeyChain, which reduces CPU overhead - ``--dummy-keychain`` patches ndn-cxx to use an in-memory dummy KeyChain, which reduces CPU overhead
and allows you to scale up Mini-NDN experiments. Large Mini-NDN experiments would run significantly and allows you to scale up Mini-NDN experiments. Large Mini-NDN experiments would run significantly
faster after applying this patch. However, your experiments cannot use any NDN security related faster after applying this patch. However, your experiments cannot use any NDN security related
@@ -67,6 +74,7 @@ If NDN software is installed from source code (not PPA), the code is downloaded
under your ``mini-ndn`` clone. If you modify the source code, you need to manually recompile and under your ``mini-ndn`` clone. If you modify the source code, you need to manually recompile and
reinstall the software (``./waf && sudo ./waf install``). reinstall the software (``./waf && sudo ./waf install``).
Installing Dependencies Installing Dependencies
----------------------- -----------------------
+73
View File
@@ -0,0 +1,73 @@
# Mini-NDN in [VirtualBox](https://www.virtualbox.org/) using [vagrant](https://www.vagrantup.com/).
### [RECOMMENDED] Mini-NDN Vagrant Box
We have a Mini-NDN pre-installed in a vagrant box. The box can be found [here](https://app.vagrantup.com/sdulal/boxes/mini-ndn). For suggested Mini-NDN resource allocation,
Here's an example [`Vagrantfile`](https://gerrit.named-data.net/c/mini-ndn/+/6426/18/vagrant/Vagrantfile):
```ruby
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "sdulal/mini-ndn"
config.vm.provider "virtualbox" do |vb|
vb.memory = "4096"
vb.cpus = "4"
vb.name = "mini-ndn-box"
end
end
```
----
### [NOT RECOMMENDED] Building from scratch with `vagrant` and VirtualBox containing Mini-NDN
* Download and install VirtualBox and Vagrant
* https://www.vagrantup.com/downloads
* https://www.virtualbox.org/wiki/Downloads
* To create and start fresh virtual machine:
* Create a file called "Vagrantfile" with this basic setup:
```ruby
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "bento/ubuntu-20.04"
config.disksize.size = '40GB'
config.vm.provider "virtualbox" do |vb|
vb.memory = 4096
vb.cpus = 4
vb.name = "mini-ndn-box"
end
end
```
* Open your terminal or command line in the directory that has Vagrantfile
* Start the virtual machine with,
`$ vagrant up`
* (If required) The username/password for the vm are both `vagrant`.
* To install Mini-NDN, use the following commands:
```bash
git clone https://github.com/named-data/mini-ndn.git
cd mini-ndn
./install.sh --source
```
* To test mini-ndn:
* while still in the `mini-ndn` directory, enter
```bash
sudo python examples/mnndn.py
```
* If it worked, You will see the Mini-NDN CLI. Enter `exit` to close the CLI.
(Additional optional "not really needed" steps)
* To clean and export vm as Vagrant Box:
* while in vm, enter these to clean:
```bash
cd
sudo apt-get clean
sudo dd if=/dev/zero of=/EMPTY bs=1M
sudo rm -f /EMPTY
cat /dev/null > ~/.bash_history && history -c && exit
```
* Close the vm window and open a terminal in the same directory as the `Vagrantfile`.
* In the terminal, type this command where `vb_name` is the name of the vm defined in `Vagrantfile`, and `box_name` any name for the output `.box` file
```bash
vagrant package --base vb_name --output box_name.box
```
+16
View File
@@ -0,0 +1,16 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# This vagrant box is built with Ubuntu 20.04 basebox from bento. Mini-NDN is
# pre-installed in this box. Recommended resource allocation for mini NDN:
# memory = "4096" cpus = "4". However, modifiy the memory, cups and other
# configuration as per your need.
Vagrant.configure("2") do |config|
config.vm.box = "sdulal/mini-ndn"
config.vm.provider "virtualbox" do |vb|
vb.memory = "4096"
vb.cpus = "4"
vb.name = "mini-ndn-box"
end
end