Fig and Rails Env Is Too Heavy, I Found workaround(Mac OSX)
(PS)
I quit use fig so I decieded to develop localhost. because I have no time to construct devenv.
Firstly, this blog was quite good and effective for me.
Sync is working fine, but suddonly, rsync was getting weird.
Additionally, these rsync strategy is faster than sync folder,
but it is definetly slow than localhost.
Localhost is super fast.
And I faced problems as follows.
- rails console history or mysql history is gone away when fig restart.
- rails console mysql connection has gone away because of restarting db.
For now, I think fig(docker compose) is not good as development environment.
If you have identical dev env, please message to me.
TL;DR
- virtual box disk io is not good because of file sync. so turn off.
– - use NFS, for sync your directories.
Environment
- fig 1.0.0
- boot2docker v1.3.1
- docker container(rails)
- docker container(mysql)
Background & Problem
Recently, it is very easy to create development env because fig and docker.
But I was starting development, I noticed it is verrrry slow… It’s so annoying.
Workaround
Turn off /Users directory sync
By default, /Users directory is synced with boot2docker.
This sync is very slow so I turned it off, response speed is up.
Use NFS
I turn off sync, so I have to another method to sync my host’s source code.
I googled, and found this thread .
This thread is quite good for me.
I used this solution because I wanna use fig.
sync.sh
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
|
This script is almost good, but in my case, the last command fswatch is don’t affect.
so I used simple command watch -n 2 sh sync.sh
. it works for me.
I wrote .rsyncignore something like below.
.rsyncignore
1 2 |
|
Dockerfile
gem is installed global.
1 2 3 4 5 6 7 |
|
fig.yml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
|
In db section, volumes isn’t need.
In web section, volumes is attached from boot2docker to web container.
That’s it.