Giter Club home page Giter Club logo

im-web's Issues

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

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.

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.

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 

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

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.