diff --git a/db/init.sql b/db/init.sql new file mode 100644 index 0000000..5239fe3 --- /dev/null +++ b/db/init.sql @@ -0,0 +1,11 @@ +CREATE DATABASE IF NOT EXISTS battleship; + +USE battleship; +CREATE TABLE IF NOT EXISTS users ( + pseudo VARCHAR(256), + password VARCHAR(256) +); + +CREATE USER 'root' IDENTIFIED WITH mysql_native_password BY 'rootpassword'; +GRANT ALL PRIVILEGES ON battleship.* TO 'root'; +FLUSH PRIVILEGES; \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 4ad28c0..cc0ae0c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,6 +13,7 @@ services: - DB_USER=root - DB_PASSWORD=password - DB_NAME=battleship + - COOKIE_SECRET_KEY=dhdgdnjejf depends_on: - db @@ -21,10 +22,8 @@ services: restart: always environment: MYSQL_ROOT_PASSWORD: password + MYSQL_DATABASE: battleship ports: - "3306:3306" volumes: - - db_data:/var/lib/mysql - -volumes: - db_data: + - ./db:/docker-entrypoint-initdb.d \ No newline at end of file diff --git a/package.json b/package.json index ce65962..d04ceea 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "scripts": { "prod": "node index.js", "dev": "nodemon --env-file=.env index.js", - "start": "node --env-file=.env index.js" + "start": "node index.js" }, "author": "Vincent Astolfi", "license": "ISC",