Skip to content
Snippets Groups Projects
Commit 1e6b3b2c authored by Florent Gluck's avatar Florent Gluck
Browse files

Updated README.md to add how to create an initial template and also how to...

Updated README.md to add how to create an initial template and also how to create the initial user hashed password
parent 22ee27ad
Branches
No related tags found
No related merge requests found
......@@ -389,6 +389,8 @@ go build
## Server installation
### Setting up environment variables
In order to run properly, **nexus-server** requires a special file hierarchy and environment variables.
First, create directories for config, data and logs:
......@@ -405,11 +407,13 @@ export NEXUS_LOG_PATH=~/nexus-server/log
Note that `NEXUS_LOG_PATH` is not required and if it doesn't exist, log file will be created in the current directory.
### Setting up an initial user
Create an initial users file in `$NEXUS_CONFIG_PATH/users.json` with the content below. This sample defines the Jane Doe user with the following specifications:
- email: `janedoe@nexus.org`
- password: `12345678`
- capabilities: enough to create/update/list users and create VMs
- capabilities: all of them
```{.shell}
[
......@@ -419,20 +423,97 @@ Create an initial users file in `$NEXUS_CONFIG_PATH/users.json` with the content
"lastname": "Doe",
"pwd": "$2a$10$YJFT8V8YRCw9naiJTcMdZOwdCwqmzFiVL9DUswzJhW19RSCezuZ5i",
"caps": {
"USER_LIST":1,
"USER_CREATE":1,
"USER_DESTROY":1,
"USER_SET_CAPS":1,
"USER_LIST":1,
"VM_CREATE":1,
"VM_SET_ACCESS":1
"VM_DESTROY_ANY":1,
"VM_START_ANY":1,
"VM_STOP_ANY":1,
"VM_LIST_ANY":1,
"VM_SET_ACCESS":1,
"TPL_CREATE":1,
"TPL_DESTROY":1,
"TPL_DESTROY_ANY":1,
"TPL_LIST":1,
"TPL_LIST_ANY":1
}
}
]
```
Note that the tool `genpwd` can be used to obtain a hashed password from a password entered on the keyboard. Here is how to run `genpwd`:
1. Go into `genpwd` source directory:
```
cd tools/genpwd/src
```
1. Compile `genpwd`:
```
go build .
```
1. Run `genpwd`:
```
./genpwd
```
### Creating a first VM template
To create a VM, an initial template is needed. The script `template_creator` located in `tools/template_creator` can be used to create an initial template file, which is nothing else than a regular `qcow2` image file.
The script requires an ISO image which will be the operating system installed in the template.
For instance, you can download the Xubuntu 22.04 ISO image from [http://ftp.free.fr/mirrors/ftp.xubuntu.com/releases/22.04/release/xubuntu-22.04-desktop-amd64.iso](http://ftp.free.fr/mirrors/ftp.xubuntu.com/releases/22.04/release/xubuntu-22.04-desktop-amd64.iso):
```
wget http://ftp.free.fr/mirrors/ftp.xubuntu.com/releases/22.04/release/xubuntu-22.04-desktop-amd64.iso
```
Then, simply run the `template_creator` script and specify the ISO image in argument:
```
./template_creator xubuntu-22.04-desktop-amd64.iso
```
The script will create a 200GB disk (`disk.qcow`) and start a VM with the ISO above. You will then be able to go through the steps to install the operating system on the disk created previously.
Note that you can easily modify the `template_creator` script to modify:
- The size of the disk (variable `DISK_SIZE`)
- The number of CPUs (variable `CPU`)
- The amount of RAM (variable `RAM`)
Once the installation is completed, create the first template, by following these steps:
- Create a directory for the template (the directory name is the template's UUID):
```
mkdir $NEXUS_DATA_PATH/templates/791fc6f9-5222-4cfa-9323-f74de5e10b2b
```
The site [https://www.uuidgenerator.net/](https://www.uuidgenerator.net/) can be used to randomly generate UUIDs
- Move the `disk.qcow` file you created above into the template directory:
```
mv tools/template_creator/disk.qcow $NEXUS_DATA_PATH/templates/791fc6f9-5222-4cfa-9323-f74de5e10b2b
```
- Inside the template directory, create the template config file `template.json` with the following content:
```
{
"id": "791fc6f9-5222-4cfa-9323-f74de5e10b2b",
"name": "Xubuntu 22.04",
"owner": "janedoe@nexus.org",
"access": "public"
}
```
### Starting the service
Now you should be ready to run the server with `go run .` or `./nexus-server`
By default the service runs on port 8000, but it can be changed with the `-p` option. For instance to start the service on port 32768:
```
./nexus-server -p 32768
```
<!--
### HOWTO: Exporting a VM disk image
Given each VM's disk is an overlay baked by a template's disk image, exporting a VM's disk image into a dedicated and independant file is slightly tricky. Below are the steps to do so.
......@@ -466,3 +547,4 @@ Steps:
After completion of these 3 steps, `new_overlay.qcow` is equivalent to `base.qcow` + `overlay.qcow`.
Note that step 2) is very slow and can take several minutes given the template file can be very large (> 10GB).
-->
\ No newline at end of file
File moved
module genpwd/main
module genpwd
go 1.18
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment