Commit a04cd591 authored by Ioannis Tsafaras's avatar Ioannis Tsafaras
Browse files

Merge pull request #265 from pkoro/doc_additions

Added information on how to generate service and lambda instance images
parents 300b1dd5 5e513366
# Lambda Instance images creation
## Description
This guide describes how to generate and publish Lambda master and slaves images on the ~okeanos public cloud.
In the steps that follow we will use the `snf-image-creator` tool to create and publish the images.
## Steps
1. Install the Fokia library. To install Fokia and its dependencies, consult the [installation guide](../fokia/usage.md).
2. Navigate to the fokia library folder: `cd <project_directory>/core/fokia`.
3. In order to bootstrap a minimal Lambda Instance (1 master and 1 slave node), which we will use for the image creation, execute the following command:
```python lambda_instance_manager.py --image-creation --project-name <~okeanos project name> --auth-token <~okeanos auth token>```
(Note that no services will be started on these two hosts as we are using the --image-creation flag.)
4. After `lambda_instance_manager.py` finishes a Lambda master and slave nodes will be available on your cyclades account. You will be able to login using ssh from the system, where you run the `lambda_instance_manager.py` command.
5. To be able to upload the Lambda slave image to the ~okeanos cloud, you must assign a public IP to the slave node<sup>[1](#footnote1)</sup> (the master node already has a public IP by default).
6. Login (using ssh) onto the Lambda master and slave nodes respectively. On each host, execute:
```rm -f /root/* && snf-image-creator /```
7. `snf-image-creator` will run and bundle the host. Insert the required image properties, and ~okeanos credentials, to register your new image on the ~okeanos cloud. The recommended Lambda master image name to use is: `Lambda master YYYYMMDD` (e.g. `Lambda master 20151219`). The recommended Lambda slave image name to use is: `Lambda slave YYYYMMDD` (e.g. `Lambda slave 20151219`). For more information about using snf-image-creator, consult the [relevant documentation](https://www.synnefo.org/docs/snf-image-creator/latest/usage.html#dialog-based-version).
8. On the source code repository edit the `webapp/ansible/roles/service-vm/templates/settings.py.j2` file, changing the `MASTER_IMAGE_ID` and `SLAVE_IMAGE_ID` variables to the new image ids<sup>[2](#footnote2)</sup> for your changes to take effect.
<a name="footnote1"><sup>1</sup></a> There is a bug that causes a public IP not to attach correctly, if the node has previously been attached to a private network. In that case, de-attach the Lambda slave node from the lambda-vpn, attach the public IP, then re-attach it to the lambda-vpn.
<a name="footnote2"><sup>2</sup></a> To get the ~okeanos image ids, one can issue `kamaki image list`.
# Messages on the central service
## Description
This guide describes how to publish a message on the [Central service](https://lambda.grnet.gr) of the service. This guide is intended to be used only by the administrators of the central service VM.
The administrator of the central service must first login the machine using ssh and become the `root` user. From the command line provide the following command
```sh
$ cd /var/www/okeanos-LoD/central_service/app/frontend
```
to navigate to the appropriate folder. In order to publish (or remove) a message from the central service web interface the python script `admin-message.py` (located in the aforementioned folder) may be used.
The following command prints out the help message related to this script:
```sh
$ python admin-message.py --help
usage: admin-message.py [-h] [--action {set,remove}] [--title TITLE]
[--message MESSAGE]
[--type {danger,warning,info,success}]
Admin Message
optional arguments:
-h, --help show this help message and exit
--action {set,remove}
set or remove an admin message (default: set)
--title TITLE title of the admin message (used only with set action,
default:"Title")
--message MESSAGE admin message (used only with set action,
default="Message")
--type {danger,warning,info,success}
the type of the message (used only with set action,
default="info")
```
In order to add a new message to the central web interface the `set` action should be used. The `--title` and `--message` arguments accept text as their arguments. Based on the the message itself (its contents) an appropriate `--type` should be used alongside (`info` for blue background, `success` for green, `warning` for orange and `danger` for red).
The following command will generate a "Lorem Ipsum" message on the central web interface
as it is shown also on the screenshot picture below.
```sh
$ python admin-message.py --action set \
--title "Lorem Ipsum" \
--message "Lorem Ipsum is ..." \
--type danger
```
Result:
![Screenshot](../images/lorem_ipsum.png)
To remove the message the `remove` action should be used (without any further arguments), like so:
```sh
$ python admin-message.py --action remove
```
\ No newline at end of file
# Service VM image creation
## Description
This guide describes how to generate and publish a Lambda service VM images on the ~okeanos public cloud. In order to create the image file a custom script that uses `snf-image-creator` in the backend has been developed.
### The create_image.sh shell script
The script responsible for creating a Service VM image. It must be run on a service VM. It sets up the default site, enables the ansible-vm-init init script, then runs snf-image-creator, to bundle the host. We will use this script in Step 6 below.
## Steps
1. Install the Fokia library. To install Fokia and its dependencies, consult the [installation guide](../fokia/usage.md).
2. Navigate to the Service VM manager folder: `cd <project_directory>/webapp/manager`.
3. Create a new Service VM, by issuing the following command:
```python service_vm_manager.py --action image_creation --project-name <~okeanos project name> --auth-token <~okeanos auth token>```
4. After the service_vm_manager finishes successfully, login to the created VM using ssh.
5. Navigate to the following folder on the Service VM:
```cd /var/www/okeanos-LoD/webapp/image```
6. Execute `./create_image.sh`.
7. snf-image-creator will run behind the scenes to bundle the host. Insert the required image properties, and
~okeanos credentials, to register your new image on the ~okeanos cloud.
The recommended image name to use is `Lambda Service VM YYYYMMDD` (e.g. `Lambda Service VM 20151219`).
For more information about using snf-image-creator, consult the [relevant documentation](https://www.synnefo.org/docs/snf-image-creator/latest/usage.html#dialog-based-version).
# Lambda Instance images creation
## Description
Using the fokia library, an administrator is able to create new Lambda Instance Master and Slave nodes on the ~okeanos infrastructure, that will have all services installed, but not configured or started. Then, he can use the snf-image-creator tool to create updated images to be published.
## Usage
1. To create the Lambda Master and Slave nodes suitable for Lambda Instance images creation, one must use the fokia library. This can be done either on your own computer, after installing the required dependencies, or using an up-to-date Lambda Service VM. To install fokia and its dependencies on your own computer, consult [\<project_directory\>/core/README.md] (https://github.com/grnet/okeanos-LoD/blob/master/core/README.md).
2. Navigate to the fokia library folder: `cd <project_directory>/core/fokia`.
3. Run `python lambda_instance_manager.py --image-creation --project-name <~okeanos project name> --auth-token <~okeanos auth token>`, to create a minimal Lambda Instance (1 Master and 1 Slave node) suitable for image creation (services are not configured or started, when using the --image-creation flag).
4. After lambda_instance_manager finishes the Lambda Instance creation successfully, a Lambda Master and a Lambda Slave VM will be available on your cyclades account. You will be able to ssh into their root user, from the system, where you run the lambda_instance_manager.
5. To be able to upload the Lambda Slave image to the ~okeanos cloud, you must assign a public IP to the Slave node<sup>[1](#footnote1)</sup> (the Master node already has a public IP by default).
6. ssh into the Master and Slave nodes. On each host, run:
1. `rm /root/*` (Optional step, to remove downloaded packages and minimize image size)
2. `snf-image-creator /`
7. snf-image-creator will run, to bundle the host. Insert the required image properties, and ~okeanos credentials, to register your new image on the ~okeanos cloud. Recommended Lambda Master image name/description: Lambda Master YYYYMMDD (e.g. Lambda Master 20151219). Recommended Lambda Slave image name/description: Lambda Slave YYYYMMDD (e.g. Lambda Slave 20151219). For more information about using snf-image-creator, consult its [documentation] (https://www.synnefo.org/docs/snf-image-creator/latest/usage.html#dialog-based-version).
8. Edit the `webapp/ansible/roles/service-vm/templates/settings.py.j2` file, changing the MASTER_IMAGE_ID and SLAVE_IMAGE_ID variables to the new image ids<sup>[2](#footnote2)</sup>.
<a name="footnote1"><sup>1</sup></a> There is a bug that causes a public IP not to attach correctly, if the node has previously been attached to a private network. In that case, de-attach the Lambda Slave node from the lambda-vpn, attach the public IP, then re-attach it to the lambda-vpn.
<a name="footnote2"><sup>2</sup></a> To get the ~okeanos image ids, one can issue `kamaki image list`.
......@@ -39,6 +39,11 @@ pages:
- 'Lamdba Instances API calls': 'central-api/API_lambda_instances.md'
- 'Lamdba Applications API calls': 'central-api/API_lambda_applications.md'
- Administration:
- Service VM image: 'admin/service.md'
- Lambda nodes images: 'admin/lambda.md'
- Service Messages: 'admin/messages.md'
- 'License': 'about/license.md'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment