Skip to content

Commit

Permalink
Merge pull request #77 from kiloutyg/76-create-a-powerbi-dedicated-us…
Browse files Browse the repository at this point in the history
…er-with-only-read-privileges

76 create a powerbi dedicated user with only read privileges
  • Loading branch information
kiloutyg authored Mar 19, 2024
2 parents c854d95 + ed539a1 commit 95731cc
Show file tree
Hide file tree
Showing 6 changed files with 479 additions and 475 deletions.
27 changes: 14 additions & 13 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions create-power-bi-ronlyuser.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CREATE USER 'powerbi'@'%' IDENTIFIED BY 'powerbi';
GRANT SELECT ON efncdb.* TO 'powerbi'@'%';
FLUSH PRIVILEGES;
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ services:
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
volumes:
- ./database_data:/var/lib/mysql
- ./create-power-bi-ronlyuser.sql:/docker-entrypoint-initdb.d/create-readonly-user.sql
ports:
- "3307:3306"
networks:
Expand All @@ -20,6 +21,7 @@ services:
# - "traefik.http.routers.database-efnc.rule=PathPrefix(`/database-efnc`)"
# - "traefik.http.routers.database-efnc.entrypoints=mariadb"
# - "traefik.tcp.routers.tcp-database-efnc.entrypoints=mariadb"
command: ['--init-file', '/docker-entrypoint-initdb.d/create-readonly-user.sql']

phpmyadmin:
image: phpmyadmin/phpmyadmin
Expand Down
7 changes: 7 additions & 0 deletions env_create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ class Kernel extends BaseKernel
}
EOL

# Create the create-power-bi-ronlyuser.sql file
cat > create-power-bi-ronlyuser.sql <<EOL
CREATE USER 'powerbi'@'%' IDENTIFIED BY 'powerbi';
GRANT SELECT ON ${MYSQL_DATABASE}.* TO 'powerbi'@'%';
FLUSH PRIVILEGES;
EOL

# Create .env file
cat > .env <<EOL
MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
Expand Down
8 changes: 5 additions & 3 deletions env_update.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#!/bin/bash

cat > ~/.ssh/config <<EOL
Host github.com
StrictHostKeyChecking no
# Create the create-power-bi-ronlyuser.sql file
cat > create-power-bi-ronlyuser.sql <<EOL
CREATE USER 'powerbi'@'%' IDENTIFIED BY 'powerbi';
GRANT SELECT ON ${MYSQL_DATABASE}.* TO 'powerbi'@'%';
FLUSH PRIVILEGES;
EOL

read -p "What Timezone to use? (default Europe/Paris) " TIMEZONE
Expand Down
Loading

0 comments on commit 95731cc

Please sign in to comment.