docker-joomla icon indicating copy to clipboard operation
docker-joomla copied to clipboard

Postgresql support?

Open davidworkman9 opened this issue 7 years ago • 7 comments

Is there any support for postgres?

davidworkman9 avatar Jan 11 '18 18:01 davidworkman9

At the moment no but I'd take a pull request adding build variants with PostgreSQL support.

mbabker avatar Jan 11 '18 18:01 mbabker

@mbabker this has been fixed in #48.

J0WI avatar Feb 14 '18 01:02 J0WI

Well, yes and no. We need to make sure our entrypoint script doesn't cause issues if you try to boot connected to a PostgreSQL container as that file does a lot of validations for MySQL stuff (the PHP dependencies are loaded now, but the runtime steps need checking).

mbabker avatar Feb 14 '18 01:02 mbabker

Hey everyone! I've created gist with Docker Compose + Joomla + PostgreSQL + Nginx setup.

https://gist.github.com/stepankuzmin/6b7d206f921221f74086c162f9b6ac24

stepankuzmin avatar Apr 29 '19 12:04 stepankuzmin

So, no plans to support PostgreSQL anytime soon?

AtjonTV avatar Oct 08 '22 06:10 AtjonTV

We are looking at this, we could add the code from @stepankuzmin to the core, I have not had time to look at it yet.

Llewellynvdm avatar Oct 10 '22 16:10 Llewellynvdm

So first of all thank you @stepankuzmin you configurations does indeed work, even with the latest images, and even with traefik

Here is the details I used to test this:

version: '3.7'

services:
  postgress_nginx:
    image: nginx:alpine
    container_name: postgress_nginx
    restart: unless-stopped
    ports:
      - 8080:80
    volumes:
      - "${PROJECT_PATH}/postgress/joomla:/var/www/html"
      - "${PROJECT_PATH}/postgress/nginx.conf:/etc/nginx/nginx.conf"
    depends_on:
      - postgress_joomla
    networks:
      - traefik
    labels:
      # joomla
      - "traefik.enable=true"
      - "traefik.http.routers.postgress_nginx.rule=Host(`postgress.builder.vdm`)"
      - "traefik.http.services.postgress_nginx.loadbalancer.server.port=80"

  postgress_joomla:
    image: joomla:3.10.11-php7.4-fpm-alpine
    container_name: postgress_joomla
    restart: unless-stopped
    environment:
      - JOOMLA_DB_HOST=postgress_db:5432
      - JOOMLA_DB_USER=postgres
      - JOOMLA_DB_PASSWORD=mysecretpassword
      - JOOMLA_DB_NAME=db
    volumes:
      - "${PROJECT_PATH}/postgress/joomla:/var/www/html"
      - "${PROJECT_PATH}/postgress/makedb.php:/makedb.php"
    depends_on:
      - postgress_db
    networks:
      - traefik

  postgress_db:
    image: postgres:latest
    container_name: postgress_db
    restart: unless-stopped
    environment:
      - POSTGRES_DB=db
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=mysecretpassword
    volumes:
      - "${PROJECT_PATH}/postgress/db:/var/lib/postgresql/data"
    networks:
      - traefik

networks:
  traefik:
    external:
      name: traefik_webgateway

So we can make some changes to accommodate the postgress implementation.

Llewellynvdm avatar Oct 10 '22 21:10 Llewellynvdm

Hey guys!

Any plans when the official container will support PostgreSQL out of the box?

AtjonTV avatar Feb 06 '23 15:02 AtjonTV

I did not get around to working on this last year. Except for the official release stuff I have taken a few weeks "break" from all community support. I will make this a high priority soon as I am back, which will be beginning March the soonest.

Llewellynvdm avatar Feb 06 '23 15:02 Llewellynvdm

Okay seems like I have a workable solution here, can anyone test this please? We want to achieve to objectives here, one the mysql should still work as before without any change needed. Then of course the PostgreSQL should also now work with an extra tag JOOMLA_DB_TYPE=pgsql

Checkout the pgsql branch and let me know if there is any issues.

Once I have confirmation of stability we can proceed to merge. @HLeithner can you also give this a look.

Llewellynvdm avatar Mar 31 '23 13:03 Llewellynvdm

Please give your testing feedback to this PR.

Llewellynvdm avatar Mar 31 '23 13:03 Llewellynvdm

Changes has been merged and will become available when we release Joomla 4.3.1

Llewellynvdm avatar Apr 19 '23 20:04 Llewellynvdm

Thank you very much for adding official PostgreSQL support to Joomla Docker images.

I had a problem connecting to my external PostgreSQL database and had to fix makedb.php to add " dbname={$db}" to the connection string :

elseif ($dbType === 'pgsql')
{
	$port = $port ? (int)$port : 5432;
	$maxTries = 10;

	do {
		$connection = "host={$host} port={$port} dbname={$db} user={$user} password={$password}";
		$dbconn = @pg_connect($connection);

Am I the only one to have had this problem because without the fix, I would get "PostgreSQL Connection Error" ?

raegedoc avatar Dec 21 '23 04:12 raegedoc