Giter Club home page Giter Club logo

im-web's Introduction

IM - Infrastructure Manager web GUI

Build Status Codacy Badge Codacy Badge License Docs

IM is a tool that ease the access and the usability of IaaS clouds by automating the VMI selection, deployment, configuration, software installation, monitoring and update of Virtual Appliances. It supports APIs from a large number of virtual platforms, making user applications cloud-agnostic. In addition it integrates a contextualization system to enable the installation and configuration of all the user required applications providing the user with a fully functional infrastructure.

1 DOCKER IMAGE

A Docker image named grycap/im-web has been created to make easier the deployment of an IM web GUI using the default configuration. Information about this image can be found here: https://registry.hub.docker.com/u/grycap/im-web/.

This container is prepaired to work linked with the IM service container grycap/im, in this way:

  • First launch the IM service specifying the name "im":
sudo docker run -d -p 8899:8899 --name im grycap/im 
  • Then launch the im-web container linking to the im:
sudo docker run -d -p 80:80 --name im-web --link im:im grycap/im-web 

It also supports environment variables to set the IM service location:

  • im_use_rest: Uses the REST API instead of the XML-RPC that is the default one. Default value "false".
  • im_use_ssl: Uses HTTPS to connect with the APIs. Default value "false".
  • im_host: Hostname of the IM service. Default value "im".
  • im_port: Port of the IM service. Default value "8899".
  • im_path: Path of the IM service. Default value "/".
  • im_db: Location of the D.B. file used in the web application to store data. Default value "/home/www-data/im.db". It can be also set a MySQL server URL, using this format: 'mysql://user:pass@mysqlserver/im_web_db'
  • openid_issuer: URL of the OpenID Issuer. Default value "".
  • openid_name: OpenID Issuer name. Default value "".
  • client_id: OpenID Client ID. Default value "client_id".
  • client_secret: OpenID Client Secret. Default value "client_secret".
  • redirect_uri: OpenID redirect URI . Default value "https://server.com/im-web/opend_auth.php".
docker run -p 80:80 -e "im_use_rest=true" -e "im_host=server.domain" -e "im_port=8800" -d grycap/im-web

There is also a version SSL enabled. In this case the docker image have a selfsigned certificate for testing purposes. Add your own in the docker command:

docker run -p 80:80 -p 443:443 -v server.crt:/etc/ssl/certs/server.crt -v server.key:/etc/ssl/certs/server.key -d grycap/im-web:1.5.5-ssl

Then you can access the IM Web portal in the following URL: http://localhost/im-web/

2 Kubernetes Helm Chart

The IM service and web interface can be installed on top of Kubernetes using Helm.

How to install the IM chart:

$ helm repo add grycap https://grycap.github.io/helm-charts/
$ helm install --namespace=im --name=im  grycap/IM

All the information about this chart is available at the IM chart README.

3 INSTALLATION

3.1 REQUISITES

IM web interface is based on PHP, so a web server with PHP support must be installed.

Also the mcrypt PHP modules must be installed and enabled.

It is also required to install the PHP module to access MySQL or SQLite databases.

In case of using the REST API it is also required to install the CURL PHP module.

3.2 INSTALLING

Select a proper path in the document root of the web server to install the IM web interface (i.e. /var/www/im).

tar xvzf IM-web-X.XX.tar.gz
mv IM-X.XX /var/www/im
chown -R www-data /var/www/im

3.3 CONFIGURATION

Adjust the configuration settings in the file config.php:

  • Flag to set the usage of the REST API instead of the XML-RPC one.
$im_use_rest=false;
  • Flag to set the usage of the APIs using HTTPS protocol instead of the standard HTTP.
$im_use_ssl=false;
  • Address of the IM host
$im_host="im-server.domain.com";
  • Port of the IM service
$im_port=8899;
  • Path of the IM service
$im_path='/';
  • Path of the IM web interface DB. The original path will be /var/www/im/im.db but is more secure to move it to a path not in the path of the web server. The file and the directory must have write permissions to the web server user. It can be also set a MySQL server URL, using this format: 'mysql://user:pass@mysqlserver/im_web_db'. Use MySQL in case of production instances.
$im_db="/home/www-data/im.db";
  • In case that the IM service and web interface are in the same host, the Recipes feature can be activated. Specify the path of the recipes_ansible.db file of the IM and take care that the file and the directory must have write permissions to the web server user. In other case set "".
$recipes_db="/usr/local/im/contextualization/recipes_ansible.db";
  • OpenID Issuer supported use "" to disable OpenID support.
$openid_issuer="https://iam-test.indigo-datacloud.eu/";
  • OpenID Issuer name.
$openid_name="INDIGO IAM";
  • OpenID Client data.
$CLIENT_ID = 'client_id';
$CLIENT_SECRET = 'client_secret';
$REDIRECT_URI = 'https://server.com/im-web/openid_auth.php';
  • Key to crypt the credentials data it must be 32 chars.
$cred_crypt_key = "n04ykjinrswda5sdfnb5680yu21+qgh3";
  • Start substring (for internal use).
$cred_cryp_start = "#Crypt@d";

3.4 DEFAULT USER

The default administrator user is admin with password admin.

im-web's People

Contributors

borjaest avatar micafer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

borjaest

im-web's Issues

Cannot delete infrastructure: 'Unsupported Auth Version requested

Current behaviour

The im-web allows the creation of infrastructures with unsuported Auth Version but does not allow to destroy them.

Using the following template simple-node (with line 81 uncommented) .

Output:

aefd1abc-74b7-11ea-8dbb-0242ac110002 | 0 | Show | Show | failed | N/A |   |  
-- | -- | -- | -- | -- | -- | -- | --

If I press delete:

Error: Error: Code: 400. Error Destroying Inf: Error destroying the infrastructure:

<LibcloudError in None 'Unsupported Auth Version requested'>

Desired behaviour

Not sure if it is an issue on the destroying process, but I should be able to delete any infrastructure in my "Infrastructure" menu.

Error registering a new user

Warning: Undefined array key "rand" in /var/www/html/im-web/userinfo.php on line 38

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/im-web/userinfo.php:38) in /var/www/html/im-web/userinfo.php on line 107

Doc first example returns 403 Forbiden

Hi,

I am just following the examples at the documentation main page:
https://imdocs.readthedocs.io/en/latest/gstarted.html

Using the im in docker with im-web. But I cannot access to the dashboard. Always I try to get to http://localhost the access is denied:

403: Forbidden
You don't have permission to access / on this server.
Apache/2.4.25 (Debian) Server at localhost Port 80

Log:
im-web_1 | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.22.0.2. Set the 'ServerName' directive globally to suppress this message
im-web_1 | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.22.0.2. Set the 'ServerName' directive globally to suppress this message
im-web_1 | [Thu Mar 12 14:14:38.921800 2020] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.25 (Debian) PHP/7.3.0 configured -- resuming normal operations
im-web_1 | [Thu Mar 12 14:14:38.921907 2020] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
im-web_1 | [Thu Mar 12 14:15:19.545952 2020] [autoindex:error] [pid 16] [client 172.22.0.1:54894] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.php,index.html) found, and server-generated directory index forbidden by Options directive
im-web_1 | 172.22.0.1 - - [12/Mar/2020:14:15:19 +0000] "GET / HTTP/1.1" 403 501 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36"

Here is a docker-compose.yml file implemented to deployn the application fast:

version: '3'

services:
im:
image: grycap/im
container_name: im
volumes:
- ~/Documents/im:/etc/im
ports:
- "8899:8899"
- "8800:8800"
im-web:
image: grycap/im-web
container_name: im-web
ports:
- "80:80"

BR, Borja

Error connecting to URL: http://localhost:8800/infrastructures

Hi,

I am using the im to deploy an infrastructure but it looks neither the im-web nor the im_client.py can retreive the infrastructure information:

im configuration (docker-compose):

  im:
    image: grycap/im:1.9.1  # <-- This is the im container version
    container_name: im
    volumes:
      - ~/Documents/im:/etc/im
    ports:
      - "8899:8899"  
      - "8800:8800"   # <-- API port is map to 8800

im-web configuration:

im_use_rest=true
im_use_ssl=false
im_host=localhost
im_port=8800

When using the im-web I get on the infrastructure page:
Error: Code: 0. Error connecting to URL: http://localhost:8800/infrastructures

im_client.py configuration:

The configuration on the im_client.cfg

[im_client]
restapi_url=http://172.17.0.1:8800  # <-- inside docker, so this addr is localhost
auth_file=auth.dat
verify-ssl=false
#xmlrpc_ssl_ca_certs=/tmp/pki/ca-chain.pem

When using the im_client.py I get:

root@509881c7fbd6:/home# im_client.py create tosca-templates/simple-node.yml 
Connected with: http://172.17.0.1:8800
('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

Notes with telnet:

(base) borja@eoan-dev:~$ telnet localhost 8800
Trying 127.0.0.1...
Connected to localhost.
Connection closed by foreign host.

(base) borja@eoan-dev:~$ telnet localhost 8899
Trying 127.0.0.1...
Connected to localhost.
telnet> close
Connection closed.

(base) borja@eoan-dev:~$ telnet localhost 8805 # <-- sample not opened
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused

BR Borja

Error registering a user

Fatal error: Uncaught ArgumentCountError: Too few arguments to function insert_credential(), 13 passed in /var/www/html/im-web/userinfo.php on line 85 and exactly 14 expected in /var/www/html/im-web/cred.php:41 Stack trace: #0 /var/www/html/im-web/userinfo.php(85): insert_credential('mark12345', '', 'InfrastructureM...', '', 'mark12345', 'test12345', '', '', '', '', '', '', '') #1 {main} thrown in /var/www/html/im-web/cred.php on line 41 

Errors when configuring a persisten db

Purpose

I would like to make my session data persistent (to save my templates, etc.). Therefore I need to have the database on the host. Following the documentation there is a parameter which indicates the location to place the .db:
im-web>configuration>im_db

Issues

Unable to open database file in /var/www/html/im-web/db_sqlite.php

runnning the following command:

docker run -p 80:80 -e "im_db=/home/www-data/im.db" -d --name im-web grycap/im-web

When I access the im-web url '' I get the following error after log-in:

Fatal error: Uncaught Exception: Unable to open database: unable to open database file in /var/www/html/im-web/db_sqlite.php:26 Stack trace: #0 /var/www/html/im-web/db_sqlite.php(26): SQLite3->open('/home/www-data/...') #1 /var/www/html/im-web/user.php(65): IMDBSQLite3->__construct() #2 /var/www/html/im-web/list.php(32): check_session_user() #3 {main} thrown in /var/www/html/im-web/db_sqlite.php on line 26

If I do an export docker export im-web > web.tar I can see there is no such /home/www-data/im.db, therefore the system complains is not able to open it.

Attempt to write a readonly database in /var/www/html/im-web/db_sqlite.php

So let's add the database file: I extract the im.db from the web.tar created with export from /var/www/www-data/ and place it in a ./im-web/db folder with the following docker-compose.yml:

  im-web:
    image: grycap/im-web
    container_name: im-web
    environment:
      - im_db=/home/www-data/im.db
    volumes:
      - ./im-web/db:/home/www-data
    ports: 
      - "80:80"

Then it is possible to log-in, however, if you try to save a topology using Topologies > Add+ write something (and a name) and then Save, you will get the following error:

Warning: SQLite3::exec(): attempt to write a readonly database in /var/www/html/im-web/db_sqlite.php on line 82

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/im-web/db_sqlite.php:82) in /var/www/html/im-web/user.php on line 26

It looks the im-web cannot wrtie into the database.

The work-arround

It seems you have to give write permissions for everyone (group is not sufficient) to the database file AND the folder which contains the data. So you can run:

chmod -R a+w im-web/db

You do not need to restart the im-web container, you can see directly it is possible to save your templates.

The change request

I could be possible to explain this procedure in the documentation (or kind of) but I think it would be easier for the users to:

  1. If the environment im_db is defined, to create automatically the im.db in that location.
  2. It is confusing the name im.db, it made me think it is a file generated by by the im. So at the beginning I tried to link the file generated by "IM_DATA_DB" from the im to the "im_db" from the im-web. I would propose to change "im_db" and "im.db" to "imweb_db" and "im-web.db" by default.
  3. Not sure how to solve the issue with the permissions but I am not feeling safe granting writting access to all my users in my computer. Anyone could auto generate his access as admin to the infrastructure web manager.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.