From 4db3dd1a3558c6288c046b4e77003d85dcd1be93 Mon Sep 17 00:00:00 2001 From: vincentastolfi Date: Tue, 6 Aug 2024 20:31:40 +0200 Subject: [PATCH] :green_heart: last fix for deployment --- db/init.sql | 11 +++++++++++ docker-compose.yml | 7 +++---- package.json | 2 +- 3 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 db/init.sql 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",