Skip to content

Commit 2e7ab32

Browse files
cwbitcwbit
cwbit
authored and
cwbit
committed
(feat) added support for mysql overrides
you can now edit `mysql/my.cnf` to override or change mysql settings on `mysqld` startup
1 parent 540f299 commit 2e7ab32

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

README.md

+29-2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,23 @@ For those looking to get started in `60 sec` using just the defaults (which are
3232
cakephp
3333
.. put your cake app in here ..
3434
```
35+
36+
If you want to do that all from commandline...
37+
38+
```bash
39+
cd ~/your/local/DEV/folder
40+
mkdir myapp
41+
cd myapp
42+
mkdir cakephp
43+
```
44+
45+
And then to simultaneously download the latest master file, unpack it, and stuff it into a docker folder, run this...
46+
47+
```bash
48+
curl -Lo cakephp-docker.zip https://github.com/cwbit/cakephp-docker/archive/master.zip && \
49+
unzip cakephp-docker.zip && \
50+
mv cakephp-docker-master docker
51+
```
3552
3. From commandline, `cd` into the `docker` directory and run `docker-compose up`
3653

3754
```bash
@@ -74,6 +91,8 @@ Here is an example of what my typical setup looks like
7491
..
7592
docker
7693
docker-compose.yml
94+
mysql
95+
my.cnf
7796
nginx
7897
nginx.conf
7998
php-fpm
@@ -109,6 +128,7 @@ username : myapp
109128
password : myapp
110129
database : myapp
111130
```
131+
112132
You can access your MySQL database (with your favorite GUI app) on
113133
114134
`localhost:8106`
@@ -157,6 +177,7 @@ There are 4 containers that I use all the time that will be spooled up automatic
157177

158178
First we're creating an nginx server. The configuration is set based on the CakePHP suggestions for nginx and `myapp-nginx` will handle all the incoming requests from the client and forward them to the `myapp-php-fpm` server which is what actually runs your PHP code.
159179

180+
You can configure the **nginx server** by editing the `/nginx/nginx.conf` file
160181

161182
### `myapp-php-fpm` - the PHP processor
162183

@@ -173,11 +194,17 @@ It also includes some php ini overrides (see `php-fpm\php-ini-overrides.ini`)
173194

174195
This container will (by default) look for your web app code in `../cakephp/` (relative to the `docker-compose` file).
175196

197+
You can configure what **PHP extensions** are loaded by editing `/php-fpm/Dockerfile`
198+
199+
You can configure **PHP overrides** by editing `/php-fpm/php-ini-overrides.ini`
200+
176201
### `myapp-mysql` - the database server
177202

178-
The first time you run the docker containers it will create a folder in your root structure called `mysql` and this is where it will store all your database data.
203+
The first time you run the docker containers it will create a folder in your root structure called `mysql` (at the same level as your `docker` folder) and this is where it will store all your database data.
204+
205+
Since the data is stored on your host device you can bring the mysql container up and down or completely destroy and rebuild it without ever actually touching your data - it is "safely" stored on the host.
179206

180-
Since the data is stored on your host device you can bring the mysql container up and down or completely destroy and rebuild it without ever actually touching your data - it is "safely" stored on the host
207+
You can configure **MySQL overrides** by editing `/mysql/my.cnf`
181208

182209
### `myapp-mailhog` - the smtp server
183210

docker-compose.yml

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ myapp-mysql:
1313
container_name: myapp-mysql
1414
volumes:
1515
- ../mysql:/var/lib/mysql
16+
- ./mysql/my.cnf:/etc/mysql/my.cnf
1617
ports:
1718
- "8106:3306"
1819
environment:

mysql/my.cnf

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[mysqld]
2+
# find default by doing `select @@sql_mode;`
3+
# sql_mode = "STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

0 commit comments

Comments
 (0)