I have a deployed pod that has two containers (app and web). The web container has nginx and serves up most of the web site. The app container contains a specialized server the serves up the rest of the website via nginx. Everything works mostly great and I can connect with okteto to do testing. Everything is stored in one repo with a Dockerfile containing both the app and web targets.
But, there is one catch: okteto can sync the local repo folder with the ‘web’ container just fine. So I can change file in the repo and I can see the change in the nginx parts of the web site just fine. But if I change a file for the app side, it is not seen. I have to make changes locally then down/up the okteto so see the difference. This is a pain; and needing to modify both in coordination. A name-changed version of the okteto.yml file:
The question: is it possible to have okteto sync the filesystem with both containers?
Just in case it was relevant, I did try having two copies of the same repo so that okteto could use different local dirs for each container to sync against. But it didn’t seem to help.
Welcome to our community @JohnAD , thanks for posting!
The services key is meant to solve that issue. It seems like you are using it already, but it’s not working as expected.
Few questions to help troubleshoot this:
Can you check that /app is the right location where php expects the files to be at?
Is php-fpm configured to restart on changes?
If you exec into the PHP container, do you see any files on /app? And is the file updated?
If this doesn’t solve the issue, could you run okteto doctor while okteto up is active, so it generates a troubleshooting bundle, and share it with us? (if there’s private information, you can share it with me in a DM).
You are correct, @JohnAD. When using services, persistentVolume.enabled key needs to be set to true as stated in our documentation.
A possible work around could be having each container under a dev key. With that you could run okteto up for both containers separately, keeping the possibility to work with both simultaneously when you’d need to.
For example, you could run the web container with okteto up web and if you need both running in dev mode execute okteto up app separately.
Thanks for helping with this. Unfortunately, I can’t get both of them to run. Running okteto up app in one shell shuts down okteto up web in the other shell; and vice versa.
Unfortunately we don’t support running more than one okteto up for the same deployment.
Each one should be on a different deployment to enable running okteto up simultaneously. Sorry if that wasn’t clear from my previous message.