Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docs #32

Merged
merged 18 commits into from
Feb 15, 2016
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 74 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Monkeying around with virtual machines and pxe configs.
- [HTTP PXE](#http-pxe)
- [HTTP VM](#http-vm)
- [HTTP installimage](#http-installimage)
- [HTTP DHCP](#http-dhcp)
+ [Issues](#issues)
+ [Copyright](#copyright)
+ [Name origin](#name-origin)
Expand All @@ -24,10 +25,26 @@ Monkeying around with virtual machines and pxe configs.

## Setup

Create `marmoset.conf` before using marmoset! See `Configuration` for details.
Clone the repo, for example into /opt. Than copy the service file into the systemd directory and reload systemd to recognize the file:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Clone the repository into a directory of your choice, /opt for example" , "then"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

```bash
cd /opt
git clone https://github.com/virtapi/marmoset.git
cd marmoset
cp ext/marmoset.service /etc/systemd/system/
systemctl daemon-reload
```
Copy the `marmoset.conf.example` to `marmoset.conf` and adjust the settings to your needs.
Checkout the Comments in the file our our [Configuration](#configuration) section.

Now we need to setup a virtualenv and install the requirement python packages (remove libvirt from the requirements.txt and `pkg-config libvirt gcc` from the list of packages to install if you don't want to manage VMs with marmoset):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"and install the required python packages"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

```bash
pacman -Syu python-virtualenv pkg-config libvirt gcc
virtualenv prod
source prod/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
```

---

## Requirements
Expand Down Expand Up @@ -128,9 +145,11 @@ Start it like this:

$ ./marmoset.py server

Or with gunicorn:
Or use our systemd service:

$ systemctl start marmoset

$ gunicorn marmoset.app:app
A third solution is to use nginx + uwsgi to power the app. This is the recommended way if you expect a high amount of requests.

### HTTP PXE

Expand Down Expand Up @@ -479,6 +498,58 @@ Errormessage if you want to delete or list a nonexistent entry:
}
```

### HTTP DHCP
This endpoint allows us the throw static IP/MAC combinations into an openldap database. This database is connected to an isc-dhcpd. We can identify an object by its IP or MAC address.

#### List Entries
curl -u admin:secret http://localhost:5000/v1/dhcp
```json
[
{
"additional_statements": {},
"dhcp_hostname": "odin.fritz.box",
"gateway": "option routers 192.168.10.1",
"ip_address": "192.168.10.5",
"mac": "00:00:00:00:00:00",
"networkmask": "option subnet-mask 255.255.255.0"
},
{
"additional_statements": {},
"dhcp_hostname": "odin.fritz.box",
"gateway": "option routers 10.3.7.1",
"ip_address": "10.3.7.41",
"mac": "00:00:00:00:00:00",
"networkmask": "option subnet-mask 255.255.255.0"
}
]
```

#### List One Entry based on MAC
curl -u admin:secret http://localhost:5000/v1/dhcp/mac/00:00:00:00:00:00
```json
{
"additional_statements": {},
"dhcp_hostname": "odin.fritz.box",
"gateway": "option routers 10.3.7.1",
"ip_address": "10.3.7.41",
"mac": "00:00:00:00:00:00",
"networkmask": "option subnet-mask 255.255.255.0"
}
```

#### List one Entry based on IP
curl -u admin:secret http://localhost:5000/v1/dhcp/ipv4/10.3.7.41
```json
{
"additional_statements": {},
"dhcp_hostname": "odin.fritz.box",
"gateway": "option routers 10.3.7.1",
"ip_address": "10.3.7.41",
"mac": "00:00:00:00:00:00",
"networkmask": "option subnet-mask 255.255.255.0"
}
```

---

## Issues
Expand Down
17 changes: 16 additions & 1 deletion marmoset.conf.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
[Modules]
PXE: True
VM: True
INSTALLIMAGE: True
Installimage: True
DHCP: True

[Webserver]
# Settings for HTTP Basic Auth
Expand Down Expand Up @@ -34,9 +35,13 @@ Network:
# storage name is given.
Storage:

# this gets used for storing PXE options
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"this will be used for"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

[PXEConfig]
ConfigDirectory: /srv/tftp/pxelinux.cfg/

# this gets used for storing installimage options
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"this will be used for"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

[Config]
ConfigDirectory: /srv/tftp/config/
# The PXELabel section has no defaults, as its entries depend on
# the PXE configuration. The syntax is `label: callbackmethod`.
# If the entry doesn't need any callback, just let callbackmethod
Expand All @@ -47,3 +52,13 @@ ConfigDirectory: /srv/tftp/pxelinux.cfg/
#freebsd: createpwhashfile
#openbsd:

[DHCPConfig]
# list of all statements that we allow
# see https://github.com/virtapi/marmoset/issues/7#issuecomment-175262281
# and see https://github.com/virtapi/marmoset/issues/7#issuecomment-175275522
additional_statements = option domain-name-servers,option domain-name,max-lease-time,default-lease-time,option ntp-servers
ldap_server = localhost
ldap_port = 389
ldap_bind_dn = cn=root,dc=example,dc=com
ldap_passwort = secret
ldap_client_base_dn = dc=example,dc=com
2 changes: 1 addition & 1 deletion marmoset.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3

import marmoset

Expand Down