Skip to content

Commit afd0cde

Browse files
authored
Merge pull request #51 from connorabbas/develop
docker, database updates
2 parents 8ac57c5 + 4608163 commit afd0cde

File tree

5 files changed

+28
-17
lines changed

5 files changed

+28
-17
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"customizations": {
1313
"vscode": {
1414
"extensions": [
15+
"ms-azuretools.vscode-docker",
1516
"absszero.vscode-laravel-goto",
1617
"codingyu.laravel-goto-view",
1718
"onecentlin.laravel-blade",

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ A basic starter kit using [Laravel](https://laravel.com/docs/master), [Intertia.
44
Need an admin panel? [There's a branch for that.](https://github.com/connorabbas/laravel-inertia-primevue/tree/feature/admin-panel)
55

66
## Usage with Docker
7-
This starter kit is configured to use Docker Compose for local development with a few extra configuration steps. With this setup, you do not need PHP, Composer, MySQL/MariaDB, or Node.js installed on your machine to get up and running with this project.
7+
This starter kit is configured to use Docker Compose for local development with a few extra configuration steps. With this setup, you do not need PHP, Composer, MySQL or Node.js installed on your machine to get up and running with this project.
88

99
### Setup
1010
1. In a new directory (outside of your Laravel project) create a `docker-compose.yml` file to create a reverse proxy container using [Traefik](https://doc.traefik.io/traefik/getting-started/quick-start/). You can reference this [example implementation](https://github.com/connorabbas/traefik-docker-compose/blob/master/docker-compose.yml).
@@ -19,11 +19,11 @@ This starter kit is configured to use Docker Compose for local development with
1919
# Match with value used in docker-compose.local.yml
2020
APP_URL=http://primevue-inertia.localhost
2121
22-
DB_CONNECTION=mariadb
23-
DB_HOST=mariadb # service name from container
22+
DB_CONNECTION=mysql
23+
DB_HOST=mysql
2424
DB_PORT=3306
2525
DB_DATABASE=laravel
26-
DB_USERNAME=docker_mariadb
26+
DB_USERNAME=sail
2727
DB_PASSWORD=password
2828
2929
# Update as needed for running multiple projects

docker-compose.local.yml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
services:
22
laravel:
3-
container_name: primevue_inertia_laravel
43
build:
54
context: ./docker/local/php/8.3
65
dockerfile: Dockerfile
@@ -28,28 +27,35 @@ services:
2827
- sail
2928
- proxy
3029
depends_on:
31-
- mariadb
30+
- mysql
3231

33-
mariadb:
34-
container_name: primevue_inertia_mariadb
35-
image: mariadb:11
32+
mysql:
33+
image: 'mysql/mysql-server:8.0'
3634
ports:
37-
- "${FORWARD_DB_PORT:-3306}:3306"
35+
- '${FORWARD_DB_PORT:-3306}:3306'
3836
environment:
3937
MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
40-
MYSQL_ROOT_HOST: "%"
38+
MYSQL_ROOT_HOST: '%'
4139
MYSQL_DATABASE: '${DB_DATABASE}'
4240
MYSQL_USER: '${DB_USERNAME}'
4341
MYSQL_PASSWORD: '${DB_PASSWORD}'
44-
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
42+
MYSQL_ALLOW_EMPTY_PASSWORD: 1
4543
volumes:
46-
- primevue_inertia_mariadb_data:/var/lib/mysql
47-
- ./docker/local/database/init.sql:/docker-entrypoint-initdb.d/init.sql
44+
- 'primevue-inertia-mysql:/var/lib/mysql'
45+
- './docker/local/database/mysql/create-testing-database.sh:/docker-entrypoint-initdb.d/10-create-testing-database.sh'
4846
networks:
4947
- sail
48+
healthcheck:
49+
test:
50+
- CMD
51+
- mysqladmin
52+
- ping
53+
- '-p${DB_PASSWORD}'
54+
retries: 3
55+
timeout: 5s
5056

5157
volumes:
52-
primevue_inertia_mariadb_data:
58+
primevue-inertia-mysql:
5359
driver: local
5460

5561
networks:

docker/local/database/init.sql

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
3+
mysql --user=root --password="$MYSQL_ROOT_PASSWORD" <<-EOSQL
4+
CREATE DATABASE IF NOT EXISTS testing;
5+
GRANT ALL PRIVILEGES ON \`testing%\`.* TO '$MYSQL_USER'@'%';
6+
EOSQL

0 commit comments

Comments
 (0)