tobybatch / kimai2

Docker containers for the kimai2 web application including docker-compose and kubernetes/helm deployment.
MIT License
183 stars 97 forks source link

Difficiluty to setup prod with Mysql #88

Closed NeptisPID closed 4 years ago

NeptisPID commented 4 years ago

I am not sure if I should post this question here but anyway I try :)

I just want to use for testing the MySQL conf (and not sqlite version).

I have tried few things by modifying the DATABASE_URL added in kimai conf in the docker-compose.yml but I can't find a way to make it work properly.

I don't really know which IP I should use in the line : DATABASE_URL=mysql://kimaiuser:kimaipassword@?.?.?.?:3306/kimai (with the date from your example)

Could you help for it ? Sadly not an expert on database nor docker (working on it). Maybe it could be interesting to add an example of docker-compose.yml with the MySql instead of sqlite in the documentation ?

Thanks for your help.

tobybatch commented 4 years ago
version: '3'
services:

  mysql:
    image: mysql:5.7
    environment:
      - MYSQL_DATABASE=kimai
      - MYSQL_USER=kimai
      - MYSQL_PASSWORD=kimai
      - MYSQL_ROOT_PASSWORD=changeme
    volumes:
        - mysql:/var/lib/mysql
    command: --default-storage-engine innodb
    restart: always

  kimai:
    image: kimai/kimai2:apache-debian-1.7
    environment:
        APP_ENV: prod
        APP_SECRET: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
        DATABASE_URL: mysql://kimai:kimai@mysql/kimai
        MAILER_FROM: kimai@neontribe.co.uk
        MAILER_URL: "smtp://kimai:kimai@postfix:25/?timeout=60"
    depends_on:
        - mysql
    ports:
        - 9010:8001
    restart: always

volumes:
  mysql:
NeptisPID commented 4 years ago

Thanks @tobybatch. I found out why it was not working in my testing.

The mysql docker is call : sqldb and in all my testing I was using mysql...

Thank you again.