chore: grant privileges dev db

This commit is contained in:
Sonny
2023-05-29 19:48:57 +02:00
parent 3a6f8a8cd6
commit 7c4999830f
4 changed files with 22 additions and 6 deletions

View File

@@ -1,7 +1,7 @@
version: "3.8"
services:
my-links-db:
my-links-dev-db:
image: mysql:latest
restart: always
env_file:

View File

@@ -1,8 +1,21 @@
CONTAINER_NAME = "docker-my-links-dev-db-1"
ROOT_PASSWORD = "root_passwd"
USER_NAME = "my-user"
start-dev:
@echo 'Starting DB container'
docker compose --env-file ../.env -f ./dev.docker-compose.yml up -d
@echo 'Waiting for a minute (need to set $(USER_NAME) privileges)'
@sleep 1m
@echo 'Grant privileges for $(USER_NAME)'
docker exec -it $(CONTAINER_NAME) mysql -u root -p$(ROOT_PASSWORD) -e "grant ALL PRIVILEGES ON *.* TO '$(USER_NAME)';flush privileges;"
@echo 'Dont forget to do migrations before run dev'
start-prod:
docker-compose --env-file ../.env -f ./docker-compose.yml up -d
build:
docker build -f ./Dockerfile -t sonny/my-links ../
docker build -f ./Dockerfile -t sonny/my-links ../

View File

@@ -1,7 +1,7 @@
MYSQL_USER="my_user"
MYSQL_PASSWORD="root"
MYSQL_DATABASE="my-links"
MYSQL_ROOT_PASSWORD="root"
MYSQL_USER="my-user"
MYSQL_PASSWORD="my-user_passwd"
MYSQL_ROOT_PASSWORD="root_passwd"
MYSQL_DATABASE="MyLinks"
# Or if you need external Database
# DATABASE_IP="localhost"

View File

@@ -0,0 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (i.e. Git)
provider = "mysql"