Super-Visions / docker-itop

https://hub.docker.com/r/supervisions/itop/
21 stars 19 forks source link

2.7/3.0 images broken/missconfigured? #8

Closed lazyest closed 1 year ago

lazyest commented 1 year ago

Just started to use itop with your docker images. Few days I've spent on figuring out and now I see 2.7 and 3.0 images are not working as default. From my point thsts something wring with database connection, because on manual installation it shows empty page after wizard steps done and I have in logs

mariadb | 2023-04-03 12:59:20 34 [Warning] Access denied for user ''@'172.22.0.5' (using password: NO) mariadb | 2023-04-03 12:59:24 35 [Warning] Access denied for user 'itop'@'172.22.0.5' (using password: NO) mariadb | 2023-04-03 12:59:25 36 [Warning] Access denied for user 'itop'@'172.22.0.5' (using password: NO) mariadb | 2023-04-03 12:59:54 43 [Warning] Access denied for user ''@'172.22.0.5' (using password: NO) mariadb | 2023-04-03 12:59:56 46 [Warning] Access denied for user ''@'172.22.0.5' (using password: NO)

User/pass is working and same docker-compose configuration for 2.6 image is working fine

Also I've tried unattended installation with wiki-provided sampled xml response file, same thing. Maybe I'm wrong but just now I have no another explanation

docker-compose part:

  db:
    image: mariadb
    container_name: mariadb
    restart: always
    environment:
      - MYSQL_DATABASE=itop
      - MYSQL_USER=itop
      - MYSQL_PASSWORD=itop
      - MYSQL_RANDOM_ROOT_PASSWORD=yes
    volumes:
      - ./mariadb:/var/lib/mysql
  itop:
    image: supervisions/itop
    container_name: itop
    restart: always
    depends_on:
      - db

Unattented mode seems to be non-compatible with 3.x in general docker-compose exec -T -u www-data itop bash -c "cd setup; php install.php --response_file=install.xml --clean=1"

Installation mode detected. Cleanup mode detected. Trying to delete the configuration file: '/var/www/html/conf/production/config-itop.php'. Emptying the cache directory '/var/www/html/data/cache-production'. Emptying the target directory '/var/www/html/env-production'. Deleting database 'itop' Trace: Info - CheckBackupPrerequisites Trace: Info - PHP functions disabled: Info: mysqldump is present: Ok. Trace: Info - mysqldump -V said: mysqldump Ver 10.19 Distrib 10.5.18-MariaDB, for debian-linux-gnu (x86_64) Error: The following modules have unmet dependencies: Configuration Management (CMDB) (id: itop-config-mgmt/3.0.2) depends on itop-structure/2.7.1, Service Management (id: itop-service-mgmt/3.0.2) depends on itop-tickets/2.0.0, Tickets Management (id: itop-tickets/3.0.2) depends on itop-structure/2.7.1 Encountered stopper issues. Aborting...

but with 2.7 its running but after we have

Fatal error: Uncaught Error: Class 'SetupUtils' not found in /var/www/html/application/forms.class.inc.php:1492
Stack trace:
  #0 /var/www/html/application/forms.class.inc.php(1456): RunTimeIconSelectionField::FindIconsOnDisk('/var/www/html/e...')
  #1 /var/www/html/core/modelreflection.class.inc.php(264): RunTimeIconSelectionField->__construct('icon', '', '') 
  #2 /var/www/html/application/dashlet.class.inc.php(1914): ModelReflectionRuntime->GetIconSelectionField('icon')
  #3 /var/www/html/application/dashboard.class.inc.php(185): DashletHeaderStatic->__construct(Object(ModelReflectionRuntime), '1')
  #4 /var/www/html/application/dashboard.class.inc.php(147): Dashboard->InitDashletFromDOMNode(Object(DOMElement))
  #5 /var/www/html/application/dashboard.class.inc.php(78): Dashboard->FromDOMDocument(Object(DOMDocument))
  #6 /var/www/html/application/dashboard.class.inc.php(883): Dashboard->FromXml('<?xml version="...')
  #7 /var/www/html/application/menunode.class.inc.php(1180): RuntimeDashboard::GetDashboard('/var/www/html/e...', 'Welco in /var/www/html/application/forms.class.inc.php on line 1492

iTop: An error occurred, check server error log for more information.

Once again, :2.6 image is fine

Hipska commented 1 year ago

Can you try to see the setup wizard works fine. Remember to select new installation instead of upgrade.

We cannot support unattended install as that is code delivered by Combodo, so issues regarding to that should be directed to their support portals.

lazyest commented 1 year ago

yeah, sure I've tried everything and I'll definitely not publish a post without this ;) yes, I've tried new installation on both 2.7 and 3 images. Same docker-compose, 2.6 is OK, 2.7/3.0 failed

Hipska commented 1 year ago

I just ran the setup wizard with the following compose file and it all worked fine:

version: '3'
services:
  itop:
    image: supervisions/itop:3.0
    environment:
      VIRTUAL_HOST: itop-test.docker.super-visions.com
      DB_ENV_MYSQL_DATABASE: itop
      DB_ENV_MYSQL_USER: itop
      DB_ENV_MYSQL_PASSWORD: itop
    links:
      - "db:db"
    network_mode: bridge
  db:
    image: mariadb
    environment:
      MYSQL_DATABASE: itop
      MYSQL_USER: itop
      MYSQL_PASSWORD: itop
      MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
    network_mode: bridge

It also looks like your itop-config.php is not having a password anymore?

lazyest commented 1 year ago

hm, you right, in this way its working nice. I didn't find available environment variables for image, maybe this is doing the trick internally? Anyhow thanks, seems like problem was solved for now

lazyest commented 1 year ago

after successful installation I have

Warning: require_once(/var/www/html/env-production/dictionaries/languages.php): failed to open stream: No such file or directory in /var/www/html/core/metamodel.class.php on line 6613

Fatal error: require_once(): Failed opening required '/var/www/html/env-production/dictionaries/languages.php' (include_path='/var/www/html/lib/pear/archive_tar:/var/www/html/lib/pear/console_getopt:/var/www/html/lib/pear/pear-core-minimal/src:/var/www/html/lib/pear/pear_exception:.:/usr/local/lib/php') in /var/www/html/core/metamodel.class.php on line 6613

lazyest commented 1 year ago

seems like if I'm not installing sample data it returns me this kind of result. Will investigate it more but I feel something wrong here

lazyest commented 1 year ago

hm in my understanding its seems to conflict with basic http auth of reverse proxy upd: nope

Fatal error: Uncaught CoreException: Include: wrong file name in configuration file: config file = /var/www/html/conf/production/config-itop.php, section = addons, filename = /addons/userrights/userrightsnull.class.inc.php in /var/www/html/core/metamodel.class.php:6814
Stack trace: 
  #0 /var/www/html/core/metamodel.class.php(6632): MetaModel::IncludeModule('/addons/userrig...', 'addons') 
  #1 /var/www/html/core/metamodel.class.php(6525): MetaModel::LoadConfig(Object(Config), false) 
  #2 /var/www/html/setup/runtimeenv.class.inc.php(131): MetaModel::Startup(Object(Config), true, false, false, 'production')
  #3 /var/www/html/setup/wizardsteps.class.inc.php(2617): RunTimeEnvironment->InitDataModel(Object(Config), true) 
  #4 /var/www/html/setup/wizardcontroller.class.inc.php(197): WizStepDone->Display(Object(SetupPage)) 
  #5 /var/www/html/setup/wizardcontroller.class.inc.php(134): WizardController->DisplayStep(Object(WizStepDone)) 
  #6 /var/www/html/setup/wizardcontroller.class.inc.php(270): WizardController->Next() 
  #7 /var/www/html/setup/ in /var/www/html/core/metamodel.class.php on line 6814

just clicking default installation of production

Hipska commented 1 year ago

I’ll try again without env variables and let you know.

The language and other iTop errors don’t seem to be related to the Docker image, so they should be reported with Combodo.

lazyest commented 1 year ago

Maybe you can just provide as much info about available variables? ;) I'll play with them

lazyest commented 1 year ago

still something unclear with packaging as far as I can see

after finished installation I have

Warning: require_once(/var/www/html/env-production/dictionaries/languages.php): failed to open stream: No such file or directory in /var/www/html/core/metamodel.class.php on line 6613

Fatal error: require_once(): Failed opening required '/var/www/html/env-production/dictionaries/languages.php' (include_path='/var/www/html/lib/pear/archive_tar:/var/www/html/lib/pear/console_getopt:/var/www/html/lib/pear/pear-core-minimal/src:/var/www/html/lib/pear/pear_exception:.:/usr/local/lib/php') in /var/www/html/core/metamodel.class.php on line 6613

Hipska commented 1 year ago

All worked fine also without the specific ENV vars and choose the production option instead of the demo sample data, You can see here which env variables are being used.

Do you select any specific language that is causing issues maybe? Do you also have the same problem when installing iTop plain, so without using Docker?

lazyest commented 1 year ago

Well

Seems like I've found the explanation

I'm using reverse proxy, traefik Also, there was basic http auth on top of it. This seems to be interfering with itop internals somehow. For now its not very important how, I've switched off auth forwarding in traefik and it seems to resolve issue at least with 3.x branch. So sorry for disturbing but now it can be somehow described for future ;)

Hipska commented 1 year ago

Thanks to come back on this. Feel free to share a good working Traefik config!

FYI, I'm using jwilder/nginx-proxy in my dev setup.

lazyest commented 1 year ago

sorry but just now I'm a bit confused Image is running, itop is fine. I'm restarting traefik removing basic http auth and have

Warning: require_once(/var/www/html/env-production/dictionaries/languages.php): failed to open stream: No such file or directory in /var/www/html/core/metamodel.class.php on line 6613

Fatal error: require_once(): Failed opening required '/var/www/html/env-production/dictionaries/languages.php' (include_path='/var/www/html/lib/pear/archive_tar:/var/www/html/lib/pear/console_getopt:/var/www/html/lib/pear/pear-core-minimal/src:/var/www/html/lib/pear/pear_exception:.:/usr/local/lib/php') in /var/www/html/core/metamodel.class.php on line 6613

How can it be possible and what kind of magic is happening here? Maybe I should clean something inside for some reason? This is first error I've got but later another one started to appear

lazyest commented 1 year ago

I see dictionaries in html dir but not in env-production.

Hipska commented 1 year ago

Yeah please clean all volumes and containers and start over completely. Also test with iTop running outside a container or without Traefik. Please also mention which language you select for administrator user.

lazyest commented 1 year ago

Language is always EN for now I've recreated whole VM several times so its constant behavior Running without traefik won't require restarting traefik ;)

seems like content of env-production dissapearing after container restart

Hipska commented 1 year ago

Wait, what do you mean with "restart"? What exact commands do you use?

If you want to persist volumes during recreation of containers, you need to instruct docker-compose to do that.

lazyest commented 1 year ago

ok here we go different ls outputs are from different stages, after docker-compose up, after filling wizard etc

root@itop:/opt/itop# docker-compose exec itop ls env-production
root@itop:/opt/itop# docker-compose exec itop ls env-production
authent-cas   combodo-backoffice-darkmoon-theme  itop-backup             itop-core-update    itop-portal           itop-storage-mgmt     web.config
authent-external  combodo-db-tools           itop-bridge-cmdb-ticket         itop-datacenter-mgmt    itop-portal-base      itop-structure
authent-ldap      combodo-webhook-integration        itop-bridge-virtualization-storage  itop-endusers-devices   itop-profiles-itil    itop-themes-compat
authent-local     core                   itop-change-mgmt            itop-files-information  itop-request-mgmt     itop-tickets
autoload.php      dictionaries               itop-config             itop-hub-connector  itop-service-mgmt     itop-virtualization-mgmt
branding      itop-attachments           itop-config-mgmt            itop-oauth-client   itop-sla-computation  itop-welcome-itil
root@itop:/opt/itop# docker-compose stop traefik
Stopping itop_traefik_1 ... done
root@itop:/opt/itop# docker-compose exec itop ls env-production
authent-cas   combodo-backoffice-darkmoon-theme  itop-backup             itop-core-update    itop-portal           itop-storage-mgmt     web.config
authent-external  combodo-db-tools           itop-bridge-cmdb-ticket         itop-datacenter-mgmt    itop-portal-base      itop-structure
authent-ldap      combodo-webhook-integration        itop-bridge-virtualization-storage  itop-endusers-devices   itop-profiles-itil    itop-themes-compat
authent-local     core                   itop-change-mgmt            itop-files-information  itop-request-mgmt     itop-tickets
autoload.php      dictionaries               itop-config             itop-hub-connector  itop-service-mgmt     itop-virtualization-mgmt
branding      itop-attachments           itop-config-mgmt            itop-oauth-client   itop-sla-computation  itop-welcome-itil
root@itop:/opt/itop# nano docker-compose.yml 
root@itop:/opt/itop# docker-compose up -d
Starting itop_traefik_1 ... 
mariadb is up-to-date
Starting itop_traefik_1 ... done
Recreating itop_itop_1  ... done
root@itop:/opt/itop# docker-compose exec itop ls env-production

I can imagine I need to store something but without description we're discussing it here :) need more docs, you see? :) In fact, I need to mount /var/www/html/env-production as volume, right? Thats the only tricky path to store or we have more to find out later?

definitely not all. I've stored env-production and got

Fatal error: Uncaught CoreException: Include: wrong file name in configuration file: config file = /var/www/html/conf/production/config-itop.php, section = addons, filename = /addons/userrights/userrightsnull.class.inc.php in /var/www/html/core/metamodel.class.php:6814 Stack trace: #0 /var/www/html/core/metamodel.class.php(6632): MetaModel::IncludeModule('/addons/userrig...', 'addons') #1 /var/www/html/core/metamodel.class.php(6529): MetaModel::LoadConfig(Object(Config), true) #2 /var/www/html/application/startup.inc.php(101): MetaModel::Startup('/var/www/html/c...', false, true, false, 'production') #3 /var/www/html/pages/UI.php(299): require_once('/var/www/html/a...') #4 {main} thrown in /var/www/html/core/metamodel.class.php on line 6814

Seems like need also addons dir, right?

Hipska commented 1 year ago

What did you modify in docker-compose.yml causing to the itop container to be recreated?

Recreating containers will always result in losing data, unless the volumes are persisted. That is not something specific to iTop. To see current volumes defined in iTop container: https://github.com/Super-Visions/docker-itop/blob/bdb7a5134b458215a36a7faf346ed93443c243be/3.0/Dockerfile#L45

See docker compose docs on how to configure volumes.

Note that you might also want to persist the database data..

lazyest commented 1 year ago

oh, cool. This seems to be proper answer. If you don't mind, plz update the doc for docker image with that 4 path to store somewhere persistently

PS: Of course I'm storing DB, as you've already mentioned, its not specific to iTop :)

Thank you very much, its always good to have so responsive person.