diff --git a/.gitignore b/.gitignore index 453680b..693c025 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,4 @@ npm-debug.log tmp package-lock.json dump.rdb -/mysql \ No newline at end of file +/docker/mysql/volume \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 13acc56..beb5e35 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -25,7 +25,13 @@ services: - NODE_ENV=production working_dir: /app privileged: true - command: node dispatch.js + ###### 'sleep 30 && node scripts/init' will drop the tables + ###### RUN ONLY ONCE THEN REMOVE 'sleep 30 && node scripts/init' + command: /bin/sh -c 'sleep 30; node scripts/init; node dispatch.js' + # init the databases +# command: sleep 30 && node scripts/init && node dispatch.js + # without init +# command: node dispatch.js links: - redis - mysql @@ -47,9 +53,10 @@ services: #ports: # - 33306:3306 volumes: - # change it to your own path + # change './docker/mysql/volume' to your own path # WARNING: without this line, your data will be lost. - - "./mysql:/var/lib/mysql" + - "./docker/mysql/volume:/var/lib/mysql" + command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --init-connect='SET NAMES utf8mb4;' --innodb-flush-log-at-trx-commit=0 environment: MYSQL_ALLOW_EMPTY_PASSWORD: "true" MYSQL_DATABASE: "rap2"