Skip to content

Commit

Permalink
Added micro-service for Database Administration, close #41
Browse files Browse the repository at this point in the history
  • Loading branch information
Jovert Lota Palonpon committed Apr 10, 2019
1 parent 25a62fa commit 1b537b9
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .docker/php-fpm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ RUN apt-get update && apt-get install -y \

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

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

Expand Down
14 changes: 14 additions & 0 deletions .docker/webserver/nginx.conf.example
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,18 @@ server {
try_files $uri $uri/ /index.php?$query_string;
gzip_static on;
}
}

server {
listen 80;
listen [::]:80;
server_name phpmyadmin.laravel-react-admin.test;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://laravel-react-admin-db-admin/;
proxy_read_timeout 90;
}
}
7 changes: 7 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,10 @@ services:
MYSQL_ROOT_PASSWORD: secret
volumes:
- ~/.laravel-react-admin-data:/var/lib/mysql

db-admin:
volumes:
- ~/.laravel-react-admin-db-admin/sessions:/sessions
environment:
PMA_HOST: laravel-react-admin-db
PMA_PORT: 3306
7 changes: 7 additions & 0 deletions docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,10 @@ services:
MYSQL_ROOT_PASSWORD: secret
volumes:
- ~/.laravel-react-admin-data:/var/lib/mysql

db-admin:
volumes:
- ~/.laravel-react-admin-db-admin/sessions:/sessions
environment:
PMA_HOST: laravel-react-admin-db
PMA_PORT: 3306
9 changes: 9 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,12 @@ services:
restart: unless-stopped
depends_on:
- php-fpm

db-admin:
image: phpmyadmin/phpmyadmin
container_name: laravel-react-admin-db-admin
restart: unless-stopped
depends_on:
- db
links:
- db
14 changes: 13 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,22 @@ In development, do note that all files inside this app is _bind-mounted_ into th

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`.

### What about webpack?
### What about Browsersync?

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`.

### Using PhpMyAdmin

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:

```
// /etc/hosts
127.0.0.1 phpmyadmin.your_custom_host_address
```

You could then visit **PhpMyAdmin** here: phpmyadmin.your_custom_host_address

---

## Credits
Expand Down

0 comments on commit 1b537b9

Please sign in to comment.