Docker is becoming the mainstream backend development environment [^ 1]. I like to install and use PHP directly on my local PC, but there are many cases where this is not the case. The BEAR.Sunday application has a lot of I/O for auto-generated files, so performance is an issue in the Mac Docker environment. As an example of the solution, gamu1012 posted an article last year Use docker \ -sync when developing with Docker \ + BEAR \ .Sunday. Also, in another article, I learned that the file synchronization that docker-sync does can also be achieved with Mutagen. [^ 2] In this article, I will write about building the BEAR development environment using docker-sync and Mutagen, respectively, both having the same performance and speed, and the usability.
--macOS Catalina Processor 1.4GHz Memory 16 GB
docker-compose.mutagen.yml
version: '3'
services:
app:
build:
context: .
dockerfile: docker/php/Dockerfile
expose:
- '9000'
volumes:
- source-con-sun:/var/www/html/
web:
build: docker/nginx/
ports:
- '1758:80'
volumes:
- source-con-sun:/var/www/html/
links:
- app
depends_on:
- app
volumes:
source-con-sun:
x-mutagen:
sync:
defaults:
ignore:
vcs: true
source-con-sun:
alpha: "."
beta: "volume://source-con-sun"
mode: "two-way-resolved"
ignore:
paths:
- var/log/hal-app/last.logref.log
configurationBeta:
permissions:
defaultFileMode: 0666
defaultDirectoryMode: 0777
--Volume mount settings --Added x-mutagen field
BEAR installation default index.php response time:
Environment | Time |
---|---|
Default Docker | 1.10 sec |
Docker + docker-sync | 117 ms |
Docker + Mutagen | 162 ms |
--Specified context: hal-app
--Refer to the above repository for details on measurement procedures, etc.
As you can see, docker-sync and Mutagen are about the same and faster.
――I was stressed that Mutagen had to wait for about 1 minute at startup. It may be possible to improve by the setting method, but it has not been investigated. Also, since a synchronization error will occur with a symbolic link that includes an absolute path, it was necessary to set exclusions. [^ 3]
From the above issues, I wondered if docker-sync would still be good for Mac Docker at this time. This is the article of BEAR \ .Sunday Advent Calendar 2020 12/22. Wish you a good year! : dolphin:
-Use Mutagen to speed up Docker, which is a heavy development environment, by 3 times \ | GRIPHONE ENGINEER'S BLOG -Recently \ (2020/08 ) Docker for Mac file access slow problem memo -Qiita
Although it is irrelevant to the main subject, it took a lot of time to install docker-sync in my environment, so I will describe the solution.
brew install eugenmayer/dockersync/unox
Occasionally the following error occurred (Python 3.8 environment).
The version of Python to use with the virtualenv in the `eugenmayer/dockersync/unox` formula\ncannot be guessed automatically because a recognised Python dependency could not be found.
If you are using a non-standard Python depedency, please add
`:using => \"[email protected]\"` to\n`virtualenv_install_with_resources` to resolve the issue manually.
brew edit unox
As
After rewriting depends_on "python @ 3" to depends_on "python @ 3.8
", the installation was completed. [^ 4]
[^ 1]: What is Docker? -EY \ -Office
Recommended Posts