Skip to content

Commit eee4d4f

Browse files
authored
Merge pull request #15 from ModestCoders/one-volume-config
Change volumes configuration to use only one one volume for the whole…
2 parents 30c00a5 + 30a4ef2 commit eee4d4f

File tree

4 files changed

+60
-55
lines changed

4 files changed

+60
-55
lines changed

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,26 @@ and this project adheres to [Semantic Version](http://semver.org/spec/v2.0.0.htm
1111

1212
### Removed
1313

14+
## [next release 2.0.0] - 13-09-2018
15+
### Added
16+
17+
### Changed
18+
19+
* Set whole magento application in a named volume `magento` instead of using 6 volumes:
20+
21+
```
22+
app-vendor
23+
app-generated
24+
app-var
25+
pub-static
26+
pub-media
27+
integration-test-sandbox
28+
```
29+
30+
* Reason: Bug when having volumes inside a file bind mount: [#26157](https://github.com/moby/moby/issues/26157#issuecomment-419722589)
31+
32+
### Removed
33+
1434
## [1.3.0] - 05-09-2018
1535

1636
### Changed

README.md

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,19 @@ As a work-around for this behavior, you can put vendor or third-party library di
3939

4040
**Solution:**
4141

42-
* Use docker volumes for following directories:
42+
* Set full magento app inside a named volume `magento`
43+
* Synchronise only git repository files between host and container.
44+
* Everything else is not synchronised, so performance is same as in local setups.
4345

44-
* vendor
45-
* generated
46-
* var
47-
* pub/static
48-
* pub/media
46+
**How do you get the code that is not synchronised in your host?**
4947

50-
* Custom synchronisation of `vendor` and `generated`:
51-
* These volumes are synchronised seamless thanks to [magento2-dockergento-console](https://github.com/ModestCoders/magento2-dockergento-console)
52-
* See [dockergento workflow](#workflow) for a better understanding about whole development process with dockergento.
48+
Even if not synchronised, it is needed to have magento and vendor code in your host. Not only for developing but also for xdebug.
49+
50+
To sync that code seamlessly, [magento2-dockergento-console](https://github.com/ModestCoders/magento2-dockergento-console) uses `docker cp` automatically when you execute relevant commands like `dockergento composer` or `dockergento start`, so you do not need to care about that.
51+
52+
On the other hand, for those that implement modules inside vendor, we also provide a `unison` container that watches and syncs changes in background when you develop inside vendor.
53+
54+
See [dockergento workflow](#workflow) for a better understanding about whole development process with dockergento.
5355

5456
## Preconditions
5557

@@ -87,37 +89,31 @@ As a work-around for this behavior, you can put vendor or third-party library di
8789
app-volumes:
8890
build: ./config/docker/image/app-volumes
8991
volumes: &appvolumes
90-
- .:/var/www/html:delegated
91-
- ~/.composer:/var/www/.composer:delegated
92-
- sockdata:/sock
93-
- app-vendor:/var/www/html/<magento_dir>/vendor
94-
- app-generated:/var/www/html/<magento_dir>/generated
95-
- app-var:/var/www/html/<magento_dir>/var
96-
- pub-static:/var/www/html/<magento_dir>/pub/static
97-
- pub-media:/var/www/html/<magento_dir>/pub/media
98-
- integration-test-sandbox:/var/www/html/<magento_dir>/dev/tests/integration/tmp
92+
- ~/.composer:/var/www/.composer:delegated
93+
- sockdata:/sock
94+
- magento:/var/www/html/<magento_dir>
95+
- ./app:/var/www/html/<magento_dir>/app:delegated
96+
- ./.git:/var/www/html/.git:delegated
97+
- ./config:/var/www/html/config:delegated
98+
- ./composer.json:/var/www/html/composer.json:delegated
99+
- ./composer.lock:/var/www/html/composer.lock:delegated
100+
# Add here the rest of files and folders in your git repository that you want to bind between host and container
99101

100102
unison:
101103
image: modestcoders/unison:2.51.2
102104
volumes:
103-
- app-vendor:/var/www/html/<magento_dir>/vendor
104-
- ./vendor:/sync/vendor
105+
- magento:/var/www/html/<magento_dir>
106+
- ./<magento_dir>/vendor:/sync/<magento_dir>/vendor
105107
environment:
106-
- SYNC_SOURCE_BASE_PATH=/sync
108+
- SYNC_SOURCE_BASE_PATH=/sync/<magento_dir>
107109
- SYNC_DESTINATION_BASE_PATH=/var/www/html/<magento_dir>
108110
- SYNC_MAX_INOTIFY_WATCHES=60000
109111
```
110112

111113
* `config/docker/image/app-volumes/Dockerfile`
112114

113115
```
114-
RUN mkdir -p /var/www/html/<magento_dir>/vendor \
115-
/var/www/html/<magento_dir>/generated \
116-
/var/www/html/<magento_dir>/var \
117-
/var/www/html/<magento_dir>/pub/static \
118-
/var/www/html/<magento_dir>/pub/media \
119-
/var/www/html/<magento_dir>/dev/tests/integration/tmp \
120-
&& chown -R 1000:1000 /var/www/html/<magento_dir>
116+
RUN mkdir -p /var/www/html/<magento_dir> && chown -R 1000:1000 /var/www/html
121117
```
122118

123119
* `config/docker/image/nginx/conf/default.conf`

config/docker/image/app-volumes/Dockerfile

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
FROM alpine:latest
22

3-
RUN mkdir -p /var/www/html/vendor \
4-
/var/www/html/generated \
5-
/var/www/html/var \
6-
/var/www/html/pub/static \
7-
/var/www/html/pub/media \
8-
/var/www/html/dev/tests/integration/tmp \
9-
&& chown -R 1000:1000 /var/www/html
3+
RUN mkdir -p /var/www/html && chown -R 1000:1000 /var/www/html
104

115
# Keep container running until all other containers are created.
126
# This avoid issues when this container is started multiple times.

docker-compose.yml

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ services:
44
app-volumes:
55
build: ./config/docker/image/app-volumes
66
volumes: &appvolumes
7-
- .:/var/www/html:delegated
87
- ~/.composer:/var/www/.composer:delegated
98
- sockdata:/sock
10-
- app-vendor:/var/www/html/vendor
11-
- app-generated:/var/www/html/generated
12-
- app-var:/var/www/html/var
13-
- pub-static:/var/www/html/pub/static
14-
- pub-media:/var/www/html/pub/media
15-
- integration-test-sandbox:/var/www/html/dev/tests/integration/tmp
9+
- magento:/var/www/html
10+
- ./app:/var/www/html/app:delegated
11+
- ./.git:/var/www/html/.git:delegated
12+
- ./config:/var/www/html/config:delegated
13+
- ./composer.json:/var/www/html/composer.json:delegated
14+
- ./composer.lock:/var/www/html/composer.lock:delegated
15+
# Add here the rest of files and folders in your git repository that you want to bind between host and container
1616

1717
app:
1818
build: ./config/docker/image/nginx
@@ -43,10 +43,16 @@ services:
4343
volumes:
4444
- dbdata:/var/lib/mysql
4545

46+
node:
47+
image: modestcoders/node-php:node8-php7.1
48+
volumes: *appvolumes
49+
depends_on:
50+
- app-volumes
51+
4652
unison:
4753
image: modestcoders/unison:2.51.2
4854
volumes:
49-
- app-vendor:/var/www/html/vendor
55+
- magento:/var/www/html
5056
- ./vendor:/sync/vendor
5157
environment:
5258
- SYNC_SOURCE_BASE_PATH=/sync
@@ -56,18 +62,7 @@ services:
5662
- app-volumes
5763
privileged: true
5864

59-
node:
60-
image: modestcoders/node-php:node8-php7.1
61-
volumes: *appvolumes
62-
depends_on:
63-
- app-volumes
64-
6565
volumes:
6666
dbdata:
6767
sockdata:
68-
app-vendor:
69-
app-generated:
70-
app-var:
71-
pub-static:
72-
pub-media:
73-
integration-test-sandbox:
68+
magento:

0 commit comments

Comments
 (0)