Closed anc-tvr closed 1 month ago
I completely understand, but these files are always different for everyone's preference and use case, so I didn't want to add such opinionated file in the repo. However, I'm open to contributions of you or anybody else has a very good example.
Find below an example I use for developing datamodels for a customer, running iTop in production would look different, so be aware to use this example with caution.
services:
itop:
image: supervisions/itop:3.2.0
volumes:
- ./iTop-datamodel:/var/www/html/extensions/my_project-datamodel:rw
- ./env-production:/var/www/html/env-production
- conf:/var/www/html/conf
- data:/var/www/html/data
- ~/vagrant/itop/extensions/sv-geolocation:/var/www/html/extensions/sv-geolocation:rw
- ~/vagrant/itop/extensions/sv-display-mgmt:/var/www/html/extensions/sv-display-mgmt:rw
- ~/vagrant/itop/extensions/sv-room-mgmt:/var/www/html/extensions/sv-room-mgmt:rw
- ~/vagrant/itop/extensions/sv-auto-dispatch:/var/www/html/extensions/sv-auto-dispatch:rw
- ~/vagrant/itop/toolkit:/var/www/html/toolkit:ro
- ~/vagrant/itop/tools:/var/www/html/tools:ro
environment:
VIRTUAL_HOST: my_project.docker.super-visions.com
# DB_ENV_MYSQL_DATABASE: itop
# DB_ENV_MYSQL_USER: itop
# DB_ENV_MYSQL_PASSWORD: itop
links:
- db
network_mode: bridge
db:
image: mariadb
command: --max_allowed_packet=33554432
volumes:
- ./itop-dump.sql.gz:/docker-entrypoint-initdb.d/01-itop-dump.sql.gz
environment:
MYSQL_DATABASE: itop
MYSQL_USER: itop
MYSQL_PASSWORD: itop
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
network_mode: bridge
volumes:
conf:
data:
PS: If you search on "compose", you will also find a lot of examples: https://github.com/Super-Visions/docker-itop/issues?q=is%3Aissue+compose
I tried with local and also with global volemes paths, nothing changes, necessary directories and files are not created neither in the user's working directory, nor in /var/www/html. I tried to give sudo chown www-data: -R ~/iTop/www/ and the same to /var/www/html/, tried to recursively give rights to directories: 664, 755, 777 but I have the same result - Warning: mkdir(): Permission denied in /var/www/html/setup/...
User's dir path volume:
- ./www/conf:/var/www/html/conf
- ./www/data:/var/www/html/data
- ./www/iTop-datamodel:/var/www/html/extensions/my_project-datamodel:rw
- ./www/env-production:/var/www/html/env-production
- ./www/extensions/sv-geolocation:/var/www/html/extensions/sv-geolocation:rw
- ./www/extensions/sv-display-mgmt:/var/www/html/extensions/sv-display-mgmt:rw
- ./www/extensions/sv-room-mgmt:/var/www/html/extensions/sv-room-mgmt:rw
- ./www/extensions/sv-auto-dispatch:/var/www/html/extensions/sv-auto-dispatch:rw
- ./www/toolkit:/var/www/html/toolkit:ro
- ./www/tools:/var/www/html/tools:ro
and tried in system dir:
- /var/www/html/conf:/var/www/html/conf
- /var/www/html/data:/var/www/html/data
- /var/www/html/iTop-datamodel:/var/www/html/extensions/my_project-datamodel:rw
- /var/www/html/env-production:/var/www/html/env-production
- /var/www/html/extensions/sv-geolocation:/var/www/html/extensions/sv-geolocation:rw
- /var/www/html/extensions/sv-display-mgmt:/var/www/html/extensions/sv-display-mgmt:rw
- /var/www/html/extensions/sv-room-mgmt:/var/www/html/extensions/sv-room-mgmt:rw
- /var/www/html/extensions/sv-auto-dispatch:/var/www/html/extensions/sv-auto-dispatch:rw
- /var/www/html/toolkit:/var/www/html/toolkit:ro
- /var/www/html/tools:/var/www/html/tools:ro
The same result:
Warning: mkdir(): Permission denied in /var/www/html/setup/setuputils.class.inc.php on line 782
Fatal error: Uncaught RuntimeException: Directory "/var/www/html/data/cache-production" was not created in /var/www/html/setup/setuputils.class.inc.php:783 Stack trace: #0 /var/www/html/setup/setuputils.class.inc.php(781): SetupUtils::builddir() #1 /var/www/html/sources/Service/Cache/DataModelDependantCache.php(54): SetupUtils::builddir() #2 /var/www/html/sources/Service/InterfaceDiscovery/InterfaceDiscovery.php(86): Combodo\iTop\Service\Cache\DataModelDependantCache->Store() #3 /var/www/html/sources/Service/InterfaceDiscovery/InterfaceDiscovery.php(115): Combodo\iTop\Service\InterfaceDiscovery\InterfaceDiscovery->GetAutoloadClassMaps() #4 /var/www/html/sources/Service/InterfaceDiscovery/InterfaceDiscovery.php(59): Combodo\iTop\Service\InterfaceDiscovery\InterfaceDiscovery->GetCandidateClasses() #5 /var/www/html/sources/Service/InterfaceDiscovery/InterfaceDiscovery.php(43): Combodo\iTop\Service\InterfaceDiscovery\InterfaceDiscovery->FindClasses() #6 /var/www/html/sources/Application/TwigBase/UI/UIBlockExtension.php(31): Combodo\iTop\Service\InterfaceDiscovery\InterfaceDiscovery->FindItopClasses() #7 /var/www/html/lib/twig/twig/src/ExtensionSet.php(453): Combodo\iTop\Application\TwigBase\UI\UIBlockExtension->getTokenParsers() #8 /var/www/html/lib/twig/twig/src/ExtensionSet.php(428): Twig\ExtensionSet->initExtension() #9 /var/www/html/lib/twig/twig/src/ExtensionSet.php(399): Twig\ExtensionSet->initExtensions() #10 /var/www/html/lib/twig/twig/src/Environment.php(816): Twig\ExtensionSet->getUnaryOperators() #11 /var/www/html/lib/twig/twig/src/Lexer.php(475): Twig\Environment->getUnaryOperators() #12 /var/www/html/lib/twig/twig/src/Lexer.php(119): Twig\Lexer->getOperatorRegex() #13 /var/www/html/lib/twig/twig/src/Lexer.php(167): Twig\Lexer->initialize() #14 /var/www/html/lib/twig/twig/src/Environment.php(471): Twig\Lexer->tokenize() #15 /var/www/html/lib/twig/twig/src/Environment.php(518): Twig\Environment->tokenize() #16 /var/www/html/lib/twig/twig/src/Environment.php(350): Twig\Environment->compileSource() #17 /var/www/html/lib/twig/twig/src/Environment.php(312): Twig\Environment->loadTemplate() #18 /var/www/html/lib/twig/twig/src/Environment.php(280): Twig\Environment->load() #19 /var/www/html/sources/Application/TwigBase/Twig/TwigHelper.php(160): Twig\Environment->render() #20 /var/www/html/sources/Application/WebPage/WebPage.php(1756): Combodo\iTop\Application\TwigBase\Twig\TwigHelper::RenderTemplate() #21 /var/www/html/sources/Application/WebPage/WebPage.php(1651): Combodo\iTop\Application\WebPage\WebPage->RenderContent() #22 /var/www/html/setup/setuppage.class.inc.php(174): Combodo\iTop\Application\WebPage\WebPage->output() #23 /var/www/html/setup/wizardcontroller.class.inc.php(280): SetupPage->output() #24 /var/www/html/setup/wizardcontroller.class.inc.php(137): WizardController->DisplayStep() #25 /var/www/html/setup/wizard.php(73): WizardController->Start() #26 {main} Next Twig\Error\SyntaxError: An exception has been thrown during the compilation of a template ("Directory "/var/www/html/data/cache-production" was not created") in "pages/backoffice/setuppage/layout.html.twig". in /var/www/html/lib/twig/twig/src/Environment.php:523 Stack trace: #0 /var/www/html/lib/twig/twig/src/Environment.php(350): Twig\Environment->compileSource() #1 /var/www/html/lib/twig/twig/src/Environment.php(312): Twig\Environment->loadTemplate() #2 /var/www/html/lib/twig/twig/src/Environment.php(280): Twig\Environment->load() #3 /var/www/html/sources/Application/TwigBase/Twig/TwigHelper.php(160): Twig\Environment->render() #4 /var/www/html/sources/Application/WebPage/WebPage.php(1756): Combodo\iTop\Application\TwigBase\Twig\TwigHelper::RenderTemplate() #5 /var/www/html/sources/Application/WebPage/WebPage.php(1651): Combodo\iTop\Application\WebPage\WebPage->RenderContent() #6 /var/www/html/setup/setuppage.class.inc.php(174): Combodo\iTop\Application\WebPage\WebPage->output() #7 /var/www/html/setup/wizardcontroller.class.inc.php(280): SetupPage->output() #8 /var/www/html/setup/wizardcontroller.class.inc.php(137): WizardController->DisplayStep() #9 /var/www/html/setup/wizard.php(73): WizardController->Start() #10 {main} Next CoreTemplateException: Twig Exception when rendering 'templates/pages/backoffice/setuppage/layout.html.twig (523) - ' : An exception has been thrown during the compilation of a template ("Directory "/var/www/html/data/cache-production" was not created") in "pages/backoffice/setuppage/layout.html.twig". in /var/www/html/sources/Application/TwigBase/Twig/TwigHelper.php:192 Stack trace: #0 /var/www/html/sources/Application/WebPage/WebPage.php(1756): Combodo\iTop\Application\TwigBase\Twig\TwigHelper::RenderTemplate() #1 /var/www/html/sources/Application/WebPage/WebPage.php(1651): Combodo\iTop\Application\WebPage\WebPage->RenderContent() #2 /var/www/html/setup/setuppage.class.inc.php(174): Combodo\iTop\Application\WebPage\WebPage->output() #3 /var/www/html/setup/wizardcontroller.class.inc.php(280): SetupPage->output() #4 /var/www/html/setup/wizardcontroller.class.inc.php(137): WizardController->DisplayStep() #5 /var/www/html/setup/wizard.php(73): WizardController->Start() #6 {main} thrown in /var/www/html/sources/Application/TwigBase/Twig/TwigHelper.php on line 192
As said before, it was just an example and everyone's environment is different. So you need to adjust to which directories you actually have and want to mount in the container.
Sorry, but if you look closely, I've already done it. All paths is a real and existent.
Warning: mkdir(): Permission denied in /var/www/html/setup/setuputils.class.inc.php on line 782
combined with
Directory "/var/www/html/data/cache-production" was not created in /var/www/html/setup/setuputils.class.inc.php:783
Implies there is a problem with your mount of /var/www/html/data directory or its permissions..
This is not a problem of iTop or the docker image, but rather common docker usage problem, so I closed this issue. You can ask for help on this general topic on one of the Official Docker communities or iTop Community Slack if really wanted, however not very relevant in this case.
Hello! I'm very interested in running iTop via docker-compose, but I unfortunately don't know the exact variables and relations. Do you have any examples to start container via docker-compose? I'd be very grateful if you'd help me with this and I suppose other people who are interested in this project would be grateful too. And in general, it would be great if such a file existed in your repo.