giocomai / omeka-s-docker

A docker image for Omeka S - does not include either modules or themes, just Omeka itself
https://hub.docker.com/r/giocomai/omeka-s-docker
GNU General Public License v3.0
12 stars 4 forks source link

An exception occurred in driver: SQLSTATE #3

Closed MaxiReglisse closed 1 year ago

MaxiReglisse commented 1 year ago

Hello, I have a problem after starting the docker composition when I connect to port 80 on the host machine.

Install Omeka S
Some installation requirements were not satisfied.
An exception occurred in driver: SQLSTATE[HY000] [2002] No such file or directory

The docker composition seems to have been launched correctly

image

Initially, I just wanted to check that it worked with the default settings, with a network local to the host VM, and a did not want fo fix any ip address.

Here is the docker-compose.yml used:

version: "3.3"

volumes:
  omeka_db:
  omekas:

networks:
  omekas-network:
    driver: bridge

services:

  omekas:
    depends_on:
      - omekas_db
    image:  docker.io/giocomai/omeka-s-docker:v4.0.1.production
    container_name: omekas
    ports:
      - "8000:80"
    restart: always
    volumes:
      - omekas:/var/www/html/volume:Z
    networks:
      - omekas-network

  omekas_db:
    image: docker.io/library/mysql:5.7
    container_name: omekas_db
    restart: always
    volumes:
      - omeka_db:/var/lib/mysql:Z
    environment:
      MYSQL_ROOT_PASSWORD: secretpassword #FIXME
      MYSQL_DATABASE: secretstring #FIXME
     MYSQL_USER: secretstring #FIXME
     MYSQL_PASSWORD: secretpassword #FIXME
    networks:
      - omekas-network

Can you help me solve this problem? thank you in advance.

Ernest.

giocomai commented 1 year ago

I haven't tried your docker-compose, but I suspect this may be related to the fact that you have not told omeka where to look for a database (I also realised I did not include this information in the readme).

In your omekas volume, you will have a config folder, and inside it a database.ini file.

Its contents should be something along the lines of:

user     = "secretstring"
password = "secretpassword"
dbname   = "secretstring"
host     = "omekas_db"

I'll add it to the readme.

If you use this in deployment, you'll probably add to fix a few things also in the local.config.php file.

MaxiReglisse commented 1 year ago

Thank you for your reply, you're right, the omekas container didn't have the database.ini file as I had modified it in my /home.

To solve this problem, I suggest sharing the database.ini file between the host and the container. The same goes for .htaccess and local.config.php.

Here's the new version of docker-compose.yml.

version: "3.3"

volumes:
  omeka_db:
  omekas:

networks:
  omekas-network:
    driver: bridge

services:

  omekas:
    depends_on:
      - omekas_db
    image: docker.io/giocomai/omeka-s-docker:v4.0.1.development
    container_name: omekas
    ports:
      - "8000:80"
    restart: always
    volumes:
      - omekas:/var/www/html/volume
      - ./.htaccess:/var/www/html/.htaccess
      - ./database.ini:/var/www/html/volume/config/database.ini
      - ./local.config.php:/var/www/html/volume/config/local.config.php
    networks:
      - omekas-network

  omekas_db:
    image: docker.io/library/mysql:5.7
    container_name: omekas_db
    restart: always
    volumes:
      - ./omekas_db:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: secretpassword
      MYSQL_DATABASE: secretstring
      MYSQL_USER: secretstring
      MYSQL_PASSWORD: secretpassword
    networks:
      - omekas-network