Open joker234 opened 6 years ago
Okay nevermind. I missread the Dockerfile.
Okay now I found out the main problem. Do you really want to execute these lines on each start of keks? https://github.com/kekshd/keks/blob/c7e1bb6b05b21426f3a410d56856ffb5374088b9/start.sh#L3-L6 On all other deployments we do the migration/precompile stuff. Like it is deployed now, on every restart the assets get precompiled again. Is this intentional?
To an extent.
The Dockerfile was designed to need minimal outside interference — mostly accounting for the fact that I have no control over the actual deployment.
Now, precompiling the assets is something that should actually be part of the build process and I'd love to simply put the corresponding line into the Dockerfile. But for reasons beyond me, the precompiling process needs a functioning DB connection — hence is something that has to be done after setting up the container. Now because I have no control over the actual deployment, the startup file seems to be the correct place to put the directive. In theory, it should only add a second or two to the startup process and cause no harm.
Aesthetically, I prefer minimal deployment voodoo and maximal encapsulation, which is how I tend to write my Dockerfiles. Orphan run files probably stem from unplanned shutdowns of Keks in conjunction with the old Rails version not implementing an annoying hack on its own.
Personally, I don't have a strong preference for the Keks startup process either way. Rearrange those commands as you please: Add a delete directive to the startup file, do more magic in the deployment script, whatever floats your boat.
Why do you start the rails app during the build. This breaks most deployment flows and needs ugly hacks like
docker exec rm /usr/src/app/tmp/pids/server.pid
. https://github.com/kekshd/keks/blob/c7e1bb6b05b21426f3a410d56856ffb5374088b9/Dockerfile#L7 https://github.com/kekshd/keks/blob/c7e1bb6b05b21426f3a410d56856ffb5374088b9/start.sh#L7If you have to start the app please stop it again or take care of the annoying pid file.