Super-Visions / docker-itop

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

Unable to run initial setup on iTop 3.0.0 #4

Closed ClepToManix closed 2 years ago

ClepToManix commented 2 years ago

Hey,

thanks for contributing the lastest iTop for Docker! I tried to install this in my environment with latest docker-compose and traefik (webproxy)

I created a docker-compose file to get it running inside docker-compose. My config is like this:

version: "3.9"
services:
  db:
    image: mariadb:latest
    restart: unless-stopped 
    networks:
      - default
    environment:
      - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
      - MYSQL_DATABASE=${ITOP_DB_NAME}
      - MYSQL_USER=${ITOP_DB_USER}
      - MYSQL_PASSWORD=${ITOP_DB_PASS}
    volumes:
      - ./database:/var/lib/mysql
      - /etc/localtime:/etc/localtime:ro
      - /etc/timezone:/etc/timezone:ro

  itop:
    image: supervisions/itop:latest
    restart: unless-stopped
    networks:
     - default
     - proxy
    links:
      - db
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.its-itop.entrypoints=http"
      - "traefik.http.routers.its-itop.rule=Host(`${DOMAIN}`)"
      - "traefik.http.middlewares.its-itop-https-redirect.redirectscheme.scheme=https"
      - "traefik.http.routers.its-itop.middlewares=its-itop-https-redirect"
      - "traefik.http.routers.its-itop-secure.entrypoints=https"
      - "traefik.http.routers.its-itop-secure.rule=Host(`${DOMAIN}`)"
      - "traefik.http.routers.its-itop-secure.tls=true"
      - "traefik.http.routers.its-itop-secure.tls.certresolver=http"
      - "traefik.http.routers.its-itop-secure.service=its-itop"
      - "traefik.http.services.its-itop.loadbalancer.server.port=80"
      - "traefik.docker.network=proxy"
      - "traefik.http.routers.its-itop-secure.middlewares=secHeaders@file"
    volumes:
      - ./data:/var/www/html
      - /etc/localtime:/etc/localtime:ro
      - /etc/timezone:/etc/timezone:ro
networks:
  proxy:
   external: true

After trying to reach the domain with domain.tld/setup i get an 404 error from apache. So i think, the proxy (traefik) works correctly and redirect me to an apache server. Maybe i have to add an environment variable to the iTop-Image to tell the apache, hes not only reachable via localhost. But maybe im totally wrong. If i try only domain.tld im getting 403 forbidden error.

I know you cant support other projects like traefik, but maybe you can help me. If you need further information, just ask me

ClepToManix commented 2 years ago

Found my Issue: I had to create the volume a little bit different:

      - itop-data:/var/www/html

With this i am able to access /setup. But after clicking on continue, i get the following error message:

Warning: require_once(/var/www/html/env-production/dictionaries/en-us.dict.php): failed to open stream: No such file or directory in /var/www/html/core/dict.class.inc.php on line 261

Fatal error: require_once(): Failed opening required '/var/www/html/env-production/dictionaries/en-us.dict.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/dict.class.inc.php on line 261
Hipska commented 2 years ago

Hi, yes as stated on the readme you need to select “install a new iTop” on the second page of the setup.

Also see the dockerfile on which volumes can be used. The way you made the volume will make it very hard to update your iTop to a new version.

ClepToManix commented 2 years ago

Hi, yes as stated on the readme you need to select “install a new iTop” on the second page of the setup.

Also see the dockerfile on which volumes can be used. The way you made the volume will make it very hard to update your iTop to a new version.

Hey, thanks for ur fast reply. I’m getting this error while attempting the second page. I’m not able to choose install a new version.

Thanks for the hint^^ I will try to modify my volumes.

Edit: Modified the volumes:

volumes:
      - itop-conf:/var/www/html/conf
      - itop-data:/var/www/html/data
      - itop-env:/var/www/html/env-production
      - itop-log:/var/www/html/log
      - /etc/localtime:/etc/localtime:ro
      - /etc/timezone:/etc/timezone:ro

Also getting a new error since i have change the volumes.

Security Warning: the configuration file 'conf/production/config-itop.php' should be read-only.
Please modify the access rights to this file.

If i click on the skip button, i get similar error:

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

Maybe the failure occure because the docker log show, that the php version of the image is greater than iTop expecting.

itop_1  | 2022-02-04 20:42:44 | Ok      |       | The current PHP Version (7.4.27) is greater than the minimum version required to run iTop, which is (7.1.3)
Hipska commented 2 years ago

Hmm, I will give it a try on Monday as well…

ClepToManix commented 2 years ago

Hmm, I will give it a try on Monday as well…

Thank you very much

finaldzn commented 2 years ago

Hello, im trying to reinstall my itop installation on kubernetes using helm chart. I added my config-itop.php file to a volume and i try to restore the itop but im running into the same error.

finaldzn commented 2 years ago

I think the problem comes from the fact that the volume is owned by the user root while the website is using the user www-data, and be cause it doesnt own the file it fails at startup and cannot read the file, i think a solution would be to build your own docker image with your own config-itop.php so its owned by the process.

Hipska commented 2 years ago

I confirm I'm having the same issue. It has been a long time I started a new iTop setup from scratch 😉 It is not a permissions issue, but it seems like the setup wants to load some compiled dictionaries for some reason. Still figuring out..

Hipska commented 2 years ago

I'm in contact with the developers, for now I would suggest this workaround:

  1. Use image supervisions/itop:2.7
  2. Run the initial setup
  3. Set image to supervisions/itop:3.0
  4. Run docker-compose up
  5. Run docker-compose exec itop chmod u+w conf/production/config-itop.php
  6. Run the setup again to upgrade

This workaround works if there is a volume for conf and env-production.

Sorry for the inconvenience.

finaldzn commented 2 years ago

Deleting config-itop.php also works for a clean install of verison 3.0

Hipska commented 2 years ago

Indeed, that file is there only to be able to prefill DB configuration settings based on environment variables. So that's also a valid workaround..

ClepToManix commented 2 years ago

Hey,

thanks for posting your workarrounds. In my case i had to do a mix of both of your suggestions. On itop 2.7 im getting an security warning and after this an php failure. To deal with this i stop the containers docker-compose down, remove the config-itop.php inside the volume path and start the container again with docker-compose up.

After finishing the wizard, i switched the image version to supervisions/itop:latest. The only problem i have is, that the models dont seem to be loaded correctly (helpdesk, change-management, problem, etc.). But i think the reason of this is, that the base of the image uses the version 3.0 from 17 Nov 2021. The stable version was released in january. So i think this is not an bug. I'm only on the beta, am I?

I want to configure my instance in the 2.7 version. If there is a new release of the image, i can upgrade to 3.x.

Maybe you want to share the docker-compose configuration with the rest of the world (without the specific traefik stuff). If that should be the case, you are welcome to just take over the stuff

Thank you :)

Hipska commented 2 years ago

If you are using supervisions/itop:latest and are not on the 3.0 release, you should do a docker pull to be on the actual latest.

See also tags to verify the checksums.

Hipska commented 2 years ago

Good news, this will be fixed with iTop 3.0.1!

a1ad commented 2 years ago

5. docker-compose exec itop chmod u+w conf/production/config-itop.php

Its not working here: I cant complete the setup on 2.7: image

My compose:

version: "3.9"
networks:
  PROXY-LAN:
    external: true
    name: int-proxy-lan

services:
  db:
    container_name: iTop-DB
    image: mariadb:latest
    restart: unless-stopped 
    networks:
      - default
    environment:
      - MYSQL_ROOT_PASSWORD=itop-root
      - MYSQL_DATABASE=itop
      - MYSQL_USER=itop
      - MYSQL_PASSWORD=it0p
    volumes:
      - ./database:/var/lib/mysql
      - /etc/localtime:/etc/localtime:ro
      - /etc/timezone:/etc/timezone:ro

  itop:
    container_name: iTop
    image: supervisions/itop:2.7
    restart: unless-stopped
    networks:
     - default
     - PROXY-LAN
    links:
      - db
    environment:
      - DB_ENV_MYSQL_DATABASE=itop
      - DB_ENV_MYSQL_USER=itop
      - DB_ENV_MYSQL_PASSWORD=it0p
    volumes:
      - itop-conf:/var/www/html/conf
      - itop-data:/var/www/html/data
      - itop-env:/var/www/html/env-production
      - itop-log:/var/www/html/log
      - /etc/localtime:/etc/localtime:ro
      - /etc/timezone:/etc/timezone:ro

volumes:
  itop-conf:
  itop-data:
  itop-env:
  itop-log:
Hipska commented 2 years ago

If you want to run on 2.7 you need to change the image to: image: supervisions/itop:2.7

a1ad commented 2 years ago

If you want to run on 2.7 you need to change the image to: image: supervisions/itop:2.7

Oh yeah, i did. Sorry wrong copy past.

a1ad commented 2 years ago

Tried it again, just to be sure.

Removed the volumes:

root@lintoolsrv01:~/docker/iTop# docker volume ls
DRIVER    VOLUME NAME
local     03c48ae177f83196e0cfd6d5f2ab507fe39001b893297c22bc8f95a94a6b7894
local     phpipam_phpipam-logo
local     portainer_agent_data
local     portainer_data
local     zabbix-docker_snmptraps

Compose file:

version: "3.9"
networks:
  PROXY-LAN:
    external: true
    name: int-proxy-lan

services:
  db:
    container_name: iTop-DB
    image: mariadb:latest
    restart: unless-stopped 
    networks:
      - default
    environment:
      - MYSQL_ROOT_PASSWORD=root
      - MYSQL_DATABASE=itop
      - MYSQL_USER=itop
      - MYSQL_PASSWORD=it0p
    volumes:
      - ./database:/var/lib/mysql
      - /etc/localtime:/etc/localtime:ro
      - /etc/timezone:/etc/timezone:ro

  itop:
    container_name: iTop
    image: supervisions/itop:2.7
    restart: unless-stopped
    networks:
     - default
     - PROXY-LAN
    links:
      - db
    environment:
      - DB_ENV_MYSQL_DATABASE=itop
      - DB_ENV_MYSQL_USER=itop
      - DB_ENV_MYSQL_PASSWORD=it0p
    volumes:
      - itop-conf:/var/www/html/conf
      - itop-data:/var/www/html/data
      - itop-env:/var/www/html/env-production
      - itop-log:/var/www/html/log
      - /etc/localtime:/etc/localtime:ro
      - /etc/timezone:/etc/timezone:ro

volumes:
  itop-conf:
  itop-data:
  itop-env:
  itop-log:

Removed database mount:

root@lintoolsrv01:~/docker/iTop# ls
docker-compose.yml
root@lintoolsrv01:~/docker/iTop# 

itop setup > install new > accept license > DB:

image

Admin account:

image

Misc:

image

Next, next, ... until ready to install:

image

Click install and:

image
Hipska commented 2 years ago

I think there is something wrong with your docker installation, I just tested and all works great here. I see also the CSS and images aren't loading well in your setup pages, so I would look into fixing that. There doesn't seem to be an issue with our iTop images..

a1ad commented 2 years ago

@Hipska indeed, it is something with my reverse proxy.