DiouxX / docker-glpi

Project to deploy GLPI with docker
219 stars 185 forks source link

issue with time zone #72

Closed killmasta93 closed 1 year ago

killmasta93 commented 2 years ago

Hi i was wondering if someone else has had this issue, currently installing GLPI using docker compose but when i check on timezone it shows on the general settings

The use of the time zone has not been activated. Run the command "php bin/console glpi:database:enable_timezones" to activate it.

version: "3.2"

services:
#MariaDB Container
  mariadb:
    image: mariadb:10.7
    container_name: mariadb
    hostname: mariadb
    volumes:
      - /scsi2/glpi/db:/var/lib/mysql
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - /scsi2/glpi/mariadb.env
    restart: always

#GLPI Container
  glpi:
    image: diouxx/glpi
    container_name : glpi
    hostname: glpi
    ports:
      - "8096:80"
    volumes:
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
      - /scsi2/glpi/html:/var/www/html/glpi:rw
    environment:
      - TIMEZONE=America/Bogota
    restart: always
cat mariadb.env
MARIADB_ROOT_PASSWORD=mypass
MARIADB_DATABASE=glpidb
MARIADB_USER=glpi_user
MARIADB_PASSWORD=mypass
TZ=America/Bogota

Thank you

kevpwhite commented 1 year ago

Did you figure this out? I am having the same issue. Looking for guidance.

kevpwhite commented 1 year ago

I figured out my issue. Once I installed the docker image and ran install wizard. I did the following because I was getting the error under setup->general-> default values -> timezone -> error: timezone usage has not been activated. run the "php bin/console glpi:database:enable_timezones"

sudo docker exec -it mariadb sh 
su root 
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -p -u root mysql
mysql -u root -p
GRANT SELECT ON mysql.time_zone_name TO 'glpidatabseuser'@'%';
flush privileges;
#exit mariadb container

sudo docker-compose restart
sudo docker exec -it gpli sh
su root
##Note volume path is different here
php /var/www/html/glpi/bin/console glpi:database:enable_timezones
Output returned: Timezone usage has been enabled.

My docker-compose.yml

version: "3.2"

services:
#MariaDB Container
  mariadb:
    image: mariadb:10.7
    container_name: mariadb
    hostname: mariadb
    volumes:
      - /var/lib/mysql:/var/lib/mysql
    env_file:
      - .mariadb.env
    restart: always

#GLPI Container
  glpi:
    image: diouxx/glpi
    container_name : glpi
    hostname: glpi
    ports:
      - "3001:80"
    volumes:
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
      - /var/www/html/glpi/:/var/www/html/glpi
    environment:
      - TIMEZONE=America/Los_Angeles
    restart: always

.mariadb.env

MARIADB_ROOT_PASSWORD=YOURPASSWORDHERE
MARIADB_DATABASE=glpidb
MARIADB_USER=glpidatabseuser
MARIADB_PASSWORD=YOURPASSWORDHERE
killmasta93 commented 1 year ago

Thank you so much that did the trick, any ideas why this happens?