aquariumbio / aquarium-local

Docker configuration for running Aquarium with a local (non-deployment) configuration
http://aquariumbio.github.io/aquarium-local
MIT License
2 stars 2 forks source link

Windows (Ubuntu on WSL2) initialization of db fails for aquarium-local #1

Closed jdbishop closed 3 years ago

jdbishop commented 3 years ago

Aquarium failed to initialize on Windows 10 (Ubuntu on WSL2 within Windows Terminal after installing Docker Desktop, WSL2, Ubuntu from Microsoft Store) with the following error:

db_1            | 2021-01-20T19:57:21.267561Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
db_1            | 2021-01-20T19:57:21.270228Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
db_1            | 2021-01-20T19:57:21.270295Z 0 [ERROR] Aborting
db_1            |

I was able to get aquarium-local to initialize and run on my Windows 10 machine by making three changes (one specified and two unspecified in the docs) to the docker-compose.yml configuration file included in the distro (see my updated "db" section from the docker-compose.yml file). Maybe update the docker-compose.yml file?

  db:
    # --changed from 5.7 to 5.7.16 --
    image: mysql:5.7.16
    #-----------------------------------
    # -- added as suggested by docs ----------------------------------------------------------------------------
    command: --innodb-flush-method=O_DSYNC --innodb-use-native-aio=0 --log_bin=ON --server-id=1
    # --------------------------------------------------------------------------------------------------------------- 
    restart: always
    environment:
      MYSQL_DATABASE: ${DB_NAME}
      MYSQL_USER: ${DB_USER}
      MYSQL_PASSWORD: ${DB_PASSWORD}
      MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}
      TZ: ${TIMEZONE}
    volumes:
      # -- removed --------------
      #- ./data/db:/var/lib/mysql
      #----------------------------
      # -- added ---
      - .:/application
      #---------------
      - ./data/mysql_init/dump.sql:/docker-entrypoint-initdb.d/dump.sql
    networks:
      - aquarium_net
bjkeller commented 3 years ago

I changed aquarium.sh to check for running in WSL so that it runs docker-compose with the docker-compose.windows.yml file. This corresponds to the second change. You will have to pull the repo to get the changed script.

I don't think the other changes are necessary. I suspect you may have had a database initialization failure that left garbage in the database directory. In this case, you have to remove the contents of data/db with rm -rf data/db/*

bjkeller commented 3 years ago

Closing this. The WSL check is added in https://github.com/aquariumbio/aquarium-local/commit/ba92c166481e314b32c9f7e02269255c5a8dfef6 If you still have problems, let us know.