Skip to content

Commit 1b537b9

Browse files
author
Jovert Lota Palonpon
committed
Added micro-service for Database Administration, close #41
1 parent 25a62fa commit 1b537b9

File tree

6 files changed

+51
-2
lines changed

6 files changed

+51
-2
lines changed

.docker/php-fpm/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ RUN apt-get update && apt-get install -y \
2222

2323
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
2424

25-
RUN docker-php-ext-install bcmath exif mbstring pcnt pdo_mysqll zip && \
25+
RUN docker-php-ext-install bcmath exif mbstring pcntl pdo_mysql zip && \
2626
docker-php-ext-configure gd --with-gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include/ && \
2727
docker-php-ext-install gd
2828

.docker/webserver/nginx.conf.example

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,18 @@ server {
2121
try_files $uri $uri/ /index.php?$query_string;
2222
gzip_static on;
2323
}
24+
}
25+
26+
server {
27+
listen 80;
28+
listen [::]:80;
29+
server_name phpmyadmin.laravel-react-admin.test;
30+
location / {
31+
proxy_set_header Host $host;
32+
proxy_set_header X-Real-IP $remote_addr;
33+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
34+
proxy_set_header X-Forwarded-Proto $scheme;
35+
proxy_pass http://laravel-react-admin-db-admin/;
36+
proxy_read_timeout 90;
37+
}
2438
}

docker-compose.dev.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,10 @@ services:
3131
MYSQL_ROOT_PASSWORD: secret
3232
volumes:
3333
- ~/.laravel-react-admin-data:/var/lib/mysql
34+
35+
db-admin:
36+
volumes:
37+
- ~/.laravel-react-admin-db-admin/sessions:/sessions
38+
environment:
39+
PMA_HOST: laravel-react-admin-db
40+
PMA_PORT: 3306

docker-compose.prod.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,10 @@ services:
1717
MYSQL_ROOT_PASSWORD: secret
1818
volumes:
1919
- ~/.laravel-react-admin-data:/var/lib/mysql
20+
21+
db-admin:
22+
volumes:
23+
- ~/.laravel-react-admin-db-admin/sessions:/sessions
24+
environment:
25+
PMA_HOST: laravel-react-admin-db
26+
PMA_PORT: 3306

docker-compose.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,12 @@ services:
4545
restart: unless-stopped
4646
depends_on:
4747
- php-fpm
48+
49+
db-admin:
50+
image: phpmyadmin/phpmyadmin
51+
container_name: laravel-react-admin-db-admin
52+
restart: unless-stopped
53+
depends_on:
54+
- db
55+
links:
56+
- db

readme.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,22 @@ In development, do note that all files inside this app is _bind-mounted_ into th
7474

7575
You can run any artisan commands directly into the `laravel-react-admin-php-fpm` container. Here is an example of a migration command: `docker container exec -it laravel-react-admin-php-fpm php artisan migrate:fresh --seed`.
7676

77-
### What about webpack?
77+
### What about Browsersync?
7878

7979
As we are bundling frontend assets with [webpack](https://webpack.js.org/) under the hood, you must specify the custom host address where the application runs in docker so that webpack can proxy that to be able to develop using docker. You can pass a `--env.proxy` flag when running for example the `npm run watch` command: `npm run watch -- --env.proxy=http:your_custom_host_address`.
8080

81+
### Using PhpMyAdmin
82+
83+
You could use **PhpMyAdmin** to browse your MySql database as it is included in this **Docker** integration. Just add a _Virtual Host_ that points to `127.0.0.1` & the _Domain_ should be the same with your custom host address:
84+
85+
```
86+
// /etc/hosts
87+
88+
127.0.0.1 phpmyadmin.your_custom_host_address
89+
```
90+
91+
You could then visit **PhpMyAdmin** here: phpmyadmin.your_custom_host_address
92+
8193
---
8294

8395
## Credits

0 commit comments

Comments
 (0)