{"id":15341263,"url":"https://github.com/rohityadavcloud/monkeybox","last_synced_at":"2025-10-10T20:32:33.400Z","repository":{"id":143206505,"uuid":"114158549","full_name":"rohityadavcloud/monkeybox","owner":"rohityadavcloud","description":"Deprecated, see https://github.com/rhtyd/mbx","archived":true,"fork":false,"pushed_at":"2021-01-15T08:30:31.000Z","size":406,"stargazers_count":8,"open_issues_count":4,"forks_count":8,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-01-28T09:33:26.100Z","etag":null,"topics":["cloudstack","cloudstack-dev","kvm","packer"],"latest_commit_sha":null,"homepage":"http://rohityadav.cloud","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rohityadavcloud.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-12-13T19:05:50.000Z","updated_at":"2023-01-28T11:04:47.000Z","dependencies_parsed_at":"2023-05-18T17:00:47.241Z","dependency_job_id":null,"html_url":"https://github.com/rohityadavcloud/monkeybox","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rohityadavcloud/monkeybox","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohityadavcloud%2Fmonkeybox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohityadavcloud%2Fmonkeybox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohityadavcloud%2Fmonkeybox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohityadavcloud%2Fmonkeybox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rohityadavcloud","download_url":"https://codeload.github.com/rohityadavcloud/monkeybox/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohityadavcloud%2Fmonkeybox/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279005272,"owners_count":26083863,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloudstack","cloudstack-dev","kvm","packer"],"created_at":"2024-10-01T10:39:55.693Z","updated_at":"2025-10-10T20:32:33.394Z","avatar_url":"https://github.com/rohityadavcloud.png","language":"Shell","readme":"This is deprecated now, see https://github.com/rhtyd/mbx\n\n# MonkeyBox by @rhtyd\n\n\u003cimg src=\"https://raw.githubusercontent.com/rhtyd/monkeybox/master/doc/images/box-start.png\" style=\"width:400px;\"\u003e\n\nThe goal of this project is to help new CloudStack developers setup development\nenvironment based on ready to use VM boxes.\n\nNotes:\n- This guide assumes that you're running a latest debian-based GNU/Linux\n  distro such as Ubuntu. This guide was tested with `Ubuntu 17.10`.\n- Your laptop/platform has at least 16GB RAM and x86_64 Intel-VT or AMD-V\n  enabled CPU so you can run hardware-accelerated nested hypervisors.\n- If you've any other hypervisor such as VirtualBox or VMware workstations\n  please uninstall it before proceeding further.\n- Due to license issues, pre-built KVM-based monkeyboxes are only published.\n  Watch this space in sometimes, I may blog about how to DIY XenServer and\n  VMware/ESXi+vCenter monkeybox.\n\nPre-built :monkey:boxes can be [downloaded](http://dl.rohityadav.cloud/monkeyboxes/) from:\n\n    http://dl.rohityadav.cloud/monkeyboxes/\n\nClone the monkeybox repo using:\n\n    $ git clone https://github.com/rhtyd/monkeybox.git\n\nBuild an appliance using:\n\n    $ cd \u003cpath\u003e \u0026\u0026 packer build \u003cjson fil\u003e\n\nVagrant boxes are coming soon!\n\n# TODO\n\n- Ready to use KVM Boxes: Ubuntu\n- How to DIY XenServer and VMware monkeybox\n\n## Defaults\n\nDefault password for the `root` user is `password`.\n\nThese are the default static IPs of the MonkeyBox appliances:\n\n    KVM: 172.20.1.10\n    XenServer: 172.20.1.20\n    VMware: 172.20.1.30 (vCenter on 172.20.1.31, password: P@ssword123)\n\nIP range 172.20.1.50-254 is used by DHCP server for dynamic IP allocation.\n\n## Install KVM on your Laptop\n\nInstall KVM using following:\n\n    # apt-get install qemu-kvm libvirt-bin bridge-utils cpu-checker\n    # kvm-ok\n\nInstall `virt-manager`, the virtual machine manager graphical tool to manage VMs\non your machine:\n\n    # apt-get install virt-manager\n\n![VM Manager](doc/images/virt-manager.png)\n\nNote: you need to install/setup KVM only once.\n\n## MonkeyNet Virtual Networking\n\nFor our local dev-test environment, we'll create a 172.20.0.0/16 virtual network\nwith NAT so VMs on this network are only accessible from the host/laptop but\nnot by the outside network.\n\n    External Network\n      .                     +-----------------+\n      |              virbr1 | MonkeyBox VM1   |\n      |                  +--| IP: 172.20.1.10 |\n    +-----------------+  |  +-----------------+\n    | Host x.x.x.x    |--+\n    | IP: 172.20.0.1  |  |  +-----------------+\n    +-----------------+  +--| MonkeyBox VM2   |\n                            | IP: 172.20.x.y  |\n                            +-----------------+\n\nWe're choosing here 172.20.0.0/16 as the network range because as per RFC1918\nit is allowed to be used for private networks. The 192.168.x.x and 10.x.x.x\nmay be already used by VPN, lab resources and home networks which is why we\nneed to choose this range.\n\nTo keep the setup simple all MonkeyBox VMs have a single nic which can be\nused as a single physical network in CloudStack that has the public, private,\nmanagement/control and storage networks. A complex setup is possible by adding\nmultiple virtual networks and nics on them.\n\n### Setup MonkeyNet Virtual Network\n\nRun the following to setup `monkeynet` virtual network as described in above\nsection:\n\n    $ virsh net-define monkeynet.xml\n    $ virsh net-autostart monkeynet\n    $ virsh net-start monkeynet\n\nThe default network xml definition assumes `virbr1` is not already assigned, in\ncase you get an error change the bridge name to something other than `virbr1`.\n\nFinally confirm using:\n\n    $ virsh net-list\n    Name                 State      Autostart     Persistent\n    ----------------------------------------------------------\n    default              active     yes           yes\n    monkeynet            active     yes           yes\n\n    $ ifconfig virbr1\n    virbr1: flags=4099\u003cUP,BROADCAST,MULTICAST\u003e  mtu 1500\n        inet 172.20.0.1  netmask 255.255.0.0  broadcast 172.20.255.255\n        ether 52:54:00:c4:5b:40  txqueuelen 1000  (Ethernet)\n        RX packets 0  bytes 0 (0.0 B)\n        RX errors 0  dropped 0  overruns 0  frame 0\n        TX packets 0  bytes 0 (0.0 B)\n        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0\n\nAlternatively, you may open `virt-viewer` manager and click on:\n\n    Edit -\u003e Connection Details -\u003e Virtual Networks\n\nAdd a virtual network with NAT in 172.20.0.0/16 like below:\n\n![VM Manager Virt Network](doc/images/virt-net.png)\n\nThis will create a virtual network with NAT with the CIDR 172.20.0.0/16, your\ngateway will be `172.20.0.1` which is also your host's virtual bridge IP. The\nvirtual network's bridge name `virbrX`may be different and it does not matter as long\nas you've a NAT-enabled virtual network in 172.20.0.0/16.\n\nNote: you need to setup virtual networking only once.\n\n## Using MonkeyBox Appliance\n\nBuild or download [pre-built](http://dl.rohityadav.cloud/monkeyboxes/) monkey box appliance and import them as VMs using\nvirt-viewer by adding a new VM:\n\n![Import 1](doc/images/vm-import-0.png)\n\nNext, select the qcow2 disk image and configure the import for example 8GBs of\nRAM and 2 CPU cores, and make sure to select the private virtual network\ncreated before (`monkeynet`):\n\n![Import 2](doc/images/vm-import-1.png)\n\nBefore starting the imported appliance, select the option to copy host CPU\nconfiguration which will choose a CPU configuration similar to your host's CPU, i.e.\nwill allow nested hypervisors:\n\n![Import 3](doc/images/vm-import-2.png)\n\n### Networking and Dev/Test Setup\n\nYour base platform (laptop) will have the gateway IP `172.20.0.1`.\n\nIdeally, run your favourite IDE such as IntelliJ IDEA, text-editors, your\nmanagement server, MySQL server and NFS server (secondary and primary storages)\non your laptop (not in a VM) where these services can be accessible to VMs, KVM\nhosts etc. at your host IP `172.20.0.1`.\n\nOnce your VM has started, try remote login using: (root:password, replace IP\nwith the IP of your monkeybox host)\n\n    $ ssh root@172.20.1.10\n\nIf you need multiple hypervisor hosts, you can either clone an existing\nmonkeybox VM or re-import a new monkeybox template image (qcow2 etc). In such\ncases, do change the new VM's (bridge) IPs, rename their hostname and restart\nthem before you use them as additional hypervisor hosts.\n\n## CloudStack Development\n\n### Install Development Tools\n\nRun this:\n\n    $ sudo apt-get install openjdk-8-jdk maven python-mysql.connector libmysql-java mysql-server mysql-client bzip2 nfs-common uuid-runtime python-setuptools ipmitool genisoimage nfs-kernel-server quota\n\nSetup IntelliJ (recommended) or any IDE of your choice. Get IntelliJ IDEA\ncommunity edition from:\n\n    https://www.jetbrains.com/idea/download/#section=linux\n\nInstall pyenv, jenv as well.\n\nSetup `aliasrc` that defines some useful bash aliases, exports and utilities\nsuch as `agentscp`. Run the following while in the directory root:\n\n    $ echo \"source $PWD/aliasrc\" \u003e\u003e ~/.bashrc\n    $ echo \"source $PWD/aliasrc\" \u003e\u003e ~/.zshrc\n\nYou may need to `source` your shell's rc/profile or relaunch shell/terminal\nto use `agentscp`.\n\n### Setup MySQL Server\n\nAfter installing MySQL server, configure the following settings in its config\nfile such as at `/etc/mysql/mysql.conf.d/mysqld.cnf` and restart mysql-server:\n\n    [mysqld]\n\n    sql-mode=\"STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,ERROR_FOR_DIVISION_BY_ZERO,NO_ZERO_DATE,NO_ZERO_IN_DATE,NO_ENGINE_SUBSTITUTION\"\n    server_id = 1\n    innodb_rollback_on_timeout=1\n    innodb_lock_wait_timeout=600\n    max_connections=1000\n    log-bin=mysql-bin\n    binlog-format = 'ROW'\n\n### Setup NFS storage\n\nAfter installing nfs server, configure the exports:\n\n    echo \"/export  *(rw,async,no_root_squash,no_subtree_check)\" \u003e /etc/exports\n    mkdir -p /export/testing/primary /export/testing/secondary\n\nBeware: Before deploying a zone on your monkeybox environment, make sure to seed\nthe correct systemvmtemplate applicable for your branch. In your cloned\nCloudStack git repository you can use the `cloud-install-sys-tmplt` to seed\nthe systemvmtemplate.\n\nThe following is an example to setup `4.11.3` systemvmtemplate which you should\nrun after deploying CloudStack db: (please use CloudStack branch/version specific\nsystemvmtemplate)\n\n    cd /path/to/cloudstack/git/repo\n    wget http://packages.shapeblue.com/systemvmtemplate/4.11/systemvmtemplate-4.11.3-kvm.qcow2.bz2\n    ./scripts/storage/secondary/cloud-install-sys-tmplt \\\n          -m /export/testing/secondary -f systemvmtemplate-4.11.3-kvm.qcow2.bz2 \\\n          -h kvm -o localhost -r cloud -d cloud\n\n### Build and Test CloudStack\n\nIt's assumed that the directory structure is something like:\n\n        folder\n        ├── cloudstack\n        └── monkeybox\n\nFork the repository at: github.com/apache/cloudstack, or get the code:\n\n    $ git clone https://github.com/apache/cloudstack.git\n\nNoredist CloudStack builds requires additional jars that may be installed from:\n\n    https://github.com/rhtyd/cloudstack-nonoss\n\nClone the above repository and run the install.sh script, you'll need to do\nthis only once or whenver the noredist jar dependencies are updated in above\nrepository.\n\nBuild using:\n\n    $ mvn clean install -Dnoredist -P developer,systemvm\n\nDeploy database using:\n\n    $ mvn -q -Pdeveloper -pl developer -Ddeploydb\n\nRun management server using:\n\n    $ mvn -pl :cloud-client-ui jetty:run  -Dnoredist -Djava.net.preferIPv4Stack=true\n\nInstall marvin:\n\n    $ sudo pip install --upgrade tools/marvin/dist/Marvin*.tar.gz\n\nWhile in CloudStack's repo's root/top directory, run the folllowing to copy\nagent scripts, jars, configs to your KVM host:\n\n    $ cd /path/to/git-repo/root\n    $ agentscp 172.20.1.10  # Use the appropriate box IP\n\nDeploy datacenter using:\n\n    $ python tools/marvin/marvin/deployDataCenter.py -i ../monkeybox/adv-kvm.cfg\n\nExample, to run a marvin test:\n\n    $ nosetests --with-xunit --xunit-file=results.xml --with-marvin --marvin-config=../monkeybox/adv-kvm.cfg -s -a tags=advanced --zone=KVM-advzone1 --hypervisor=KVM test/integration/smoke/test_vm_life_cycle.py\n\nNote: Use nosetests-2.7 to run a smoketest, if you've nose installed for both Python2.7 and Python3.x in your environment.\n\nWhen you fix an issue, rebuild cloudstack and push new changes to your KVM host\nusing `agentscp` which will also restart the agent:\n\n    $ agentscp 172.20.1.10\n\nUsing IDEA IDE:\n- Import the `cloudstack` directory and select `Maven` as build system\n- Go through the defaults, in the profiles page at least select noredist, vmware\n  etc.\n- Once IDEA builds the codebase cache you're good to go!\n\n### Debugging CloudStack\n\nPrior to starting CloudStack management server using mvn (or otherwise), export\nthis on your shell:\n\n    export MAVEN_OPTS=\"$MAVEN_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n\"\n\nTo remote-debug the KVM agent, put the following in\n`/etc/default/cloudstack-agent` in your monkeybox and restart cloudstack-agent:\n\n    JAVA=/usr/bin/java -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n\n\nThe above will ensure that JVM with start with debugging enabled on port 8787.\nIn IntelliJ, or your IDE/editor you can attach a remote debugger to this\naddress:port and put breakpoints (and watches) as applicable.\n\n## Author\n\n[Rohit Yadav](http://rohityadav.cloud), rohit@yadav.cloud\n\n## Contributing\n\nSend a pull request on https://github.com/rhtyd/monkeybox\n\n## Troubleshooting\n\n### Iptables\n\nShould your datacenter deployment fail due to the KVM host unable to reach your management server, it might be due to iptable rules.\n\nIf you see this in your hosts agent.log:\n\n    java.net.NoRouteToHostException: No route to host\n            at sun.nio.ch.Net.connect0(Native Method)\n            at sun.nio.ch.Net.connect(Net.java:454)\n            at sun.nio.ch.Net.connect(Net.java:446)\n            at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:648)\n            at com.cloud.utils.nio.NioClient.init(NioClient.java:56)\n            at com.cloud.utils.nio.NioConnection.start(NioConnection.java:95)\n            at com.cloud.agent.Agent.start(Agent.java:263)\n            at com.cloud.agent.AgentShell.launchAgent(AgentShell.java:410)\n            at com.cloud.agent.AgentShell.launchAgentFromClassInfo(AgentShell.java:378)\n            at com.cloud.agent.AgentShell.launchAgent(AgentShell.java:362)\n            at com.cloud.agent.AgentShell.start(AgentShell.java:467)\n            at com.cloud.agent.AgentShell.main(AgentShell.java:502)\n\nAnd a telnet from host to management server on port gives this result:\n\n    $ telnet 172.20.0.1 8250\n    Trying 172.20.0.1...\n    telnet: connect to address 172.20.0.1: No route to host\n    \nClearing your iptables and setting new rules should take care of the issue. (Tested on Ubuntu 17.10)\n\nRun the following commands as su or with sudo powers.\n\nFirst, flush your rules and delete any user-defined chains:\n    \n    $ iptables -t nat -F \u0026\u0026 iptables -t nat -X\n    $ iptables -t filter -F \u0026\u0026 iptables -t filter -X\n    \nAdd new rules by running the two scripts located in docs/scripts to set up new nat and filter rules, \nensuring that the network name (virbr1) in filter.table matches your management server IP:\n\n    $ bash -x \u003cscript\u003e\n    \nAlternatively, add each rule separately.\n \nFinally, save your iptables.\n \nUbuntu:\n \n    iptables-save\n    \nand if using iptables-persistent:\n\n    service iptables-persistent save\n    \nCentOS 6 and older (CentOS 7 uses FirewallD by default):\n\n    service iptables save\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frohityadavcloud%2Fmonkeybox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frohityadavcloud%2Fmonkeybox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frohityadavcloud%2Fmonkeybox/lists"}