Feature No Code Attached Yet Documentation Required
avatar nickyeoman
nickyeoman
20 May 2023

Steps to reproduce the issue

  1. Create a Joomla container in Docker using the image joomla:4.3.1 from Docker Hub.
  2. Try to run the command php cli/joomla.php core:install inside the container, following the instructions outlined in the Joomla CLI Update documentation.

Expected result

The Joomla installer should run successfully.

Actual result

The output displays: Install Joomla to run cli commands. This behavior is expected according to the code found in cli/joomla.php on line 46:

// Check if installed
if (
    !file_exists(JPATH_CONFIGURATION . '/configuration.php')
    || (filesize(JPATH_CONFIGURATION . '/configuration.php') < 10)
) {
    echo 'Install Joomla to run cli commands' . PHP_EOL;
    exit;
}

System information

Additional comments

According to the Installing Joomla via the CLI documentation, it should be possible to install Joomla using Joomla cli. However, this is currently not working because the cli/joomla.php file checks for the existence of configuration.php before attempting the installation. This check prevents the installation process when trying to create the configuration.php file in the first place.

avatar nickyeoman nickyeoman - open - 20 May 2023
avatar joomla-cms-bot joomla-cms-bot - change - 20 May 2023
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 20 May 2023
avatar alikon
alikon - comment - 21 May 2023
avatar Fedik
Fedik - comment - 21 May 2023

Hi,

According to the Installing Joomla via the CLI documentation

Because you use Docker image please follow the information from the image description. https://hub.docker.com/_/joomla
If I right understood it will "pre install" joomla for you.

For bugs in the image please reaport https://github.com/joomla-docker/docker-joomla/

avatar Fedik Fedik - change - 21 May 2023
Title
Joomla 4 cli core:install doesn't work
Joomla 4 cli core:install doesn't work in Docker
avatar Fedik Fedik - edited - 21 May 2023
avatar Fedik Fedik - change - 21 May 2023
Labels Added: bug
avatar Fedik Fedik - labeled - 21 May 2023
avatar alikon
alikon - comment - 21 May 2023

@Fedik php cli/joomla.php core:install has never been landed in core, that doc page must be amended
starting for 4.3 you can install from cli with php installation/joomla.php install

so imho it's not a bug more a doc issue

avatar Fedik Fedik - change - 21 May 2023
Labels Removed: bug
avatar Fedik Fedik - unlabeled - 21 May 2023
avatar Fedik
Fedik - comment - 21 May 2023

Okay :)

avatar nickyeoman
nickyeoman - comment - 22 May 2023

Yes, I think this is a documentation issue. The page provided by @alikon J4.xJoomla CLI Installation is what I was trying to do.

Tested the above documentation page with dockerhub image joomla:4.3.1 and the following bash script, works perfect.

#!/bin/bash
# Load .env
set -o allexport
source .env
set +o allexport

DB_PREFIX=$(LC_CTYPE=C tr -dc '[:alpha:]' < /dev/urandom | head -c 3)_

docker-compose exec -u www-data joomla php installation/joomla.php install \
  --site-name=$PROJECTNAME \
  --admin-email=$EMAIL \
  --admin-user=$JOOMLA_USER \
  --admin-username=$JOOMLA_USER \
  --admin-password=$JOOMLA_PASSWORD \
  --db-type=mysqli \
  --db-host=mariadb \
  --db-user=$MYSQL_USER \
  --db-pass=$MYSQL_PASSWORD \
  --db-name=$MYSQL_DATABASE \
  --db-prefix=$DB_PREFIX \
  --db-encryption=0

Docker note

Just to clarify If I right understood it will "pre install" joomla for you. -@Fedik

That statement is not correct, the DockerFile only extracts the zip file and gives you a ready installation (unless the volume is already full then it skips installation).

RUN set -ex; \
	curl -o joomla.tar.bz2 -SL {{ env.joomlaPackage }}; \
	echo "$JOOMLA_SHA512 *joomla.tar.bz2" | sha512sum -c -; \
	mkdir /usr/src/joomla; \
	tar -xf joomla.tar.bz2 -C /usr/src/joomla; \
	rm joomla.tar.bz2; \
	chown -R www-data:www-data /usr/src/joomla

I'm not even sure if it does anything with the ENV it asks for on the dockerhub page. But as you say that's an issue for: https://github.com/joomla-docker/docker-joomla/

My above code could be run from a custom dockerfile instead of docker-compose

Conclusion

Yes, this is a documentation issue with the page: https://docs.joomla.org/J4.x:CLI_Update#Installing_Joomla.21_via_the_CLI

As for a solution, I'm not sure if it should be removed, as I like the idea of a json file.

avatar alikon alikon - change - 22 May 2023
Labels Added: Documentation Required
avatar alikon alikon - labeled - 22 May 2023
avatar alikon alikon - change - 22 May 2023
Labels Added: Feature
avatar alikon alikon - labeled - 22 May 2023
avatar rdeutz
rdeutz - comment - 6 May 2024

not an core issue

avatar rdeutz rdeutz - change - 6 May 2024
Status New Closed
Closed_Date 0000-00-00 00:00:00 2024-05-06 20:56:30
Closed_By rdeutz
avatar rdeutz rdeutz - close - 6 May 2024

Add a Comment

Login with GitHub to post a comment