# Getting Syncthing to work with both containers

**URL:** <https://community.okteto.com/t/getting-syncthing-to-work-with-both-containers/677>\
**Category:** How Do I?\
**Created:** [March 1, 2023, 11:31pm UTC](https://community.okteto.com/t/getting-syncthing-to-work-with-both-containers/677 "2023-03-01T23:31:13Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![JohnAD](https://avatars.discourse-cdn.com/v4/letter/j/eb8c5e/32.png) [@JohnAD](https://community.okteto.com/u/JohnAD)\
**Post date:** [March 1, 2023, 11:31pm UTC](https://community.okteto.com/t/getting-syncthing-to-work-with-both-containers/677/1 "2023-03-01T23:31:13Z")

</div>

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:

```yaml
name: abcd
namespace: bling
dev:
  abcd:
    container: web
    command: nginx-entrypoint
    sync:
      - .:/app
    persistentVolume:
      enabled: false
    forward:
      - 8080:8080
    services:
      - name: abcd
        container: app
        command: entrypoint-prod php-fpm
        sync:
          - .:/app

```

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.

---

<div class="post-metadata">

**Author:** ![ramiro](https://sea1.discourse-cdn.com/flex019/user_avatar/community.okteto.com/ramiro/32/6_2.png) [@ramiro](https://community.okteto.com/u/ramiro)\
**Post date:** [March 1, 2023, 11:41pm UTC](https://community.okteto.com/t/getting-syncthing-to-work-with-both-containers/677/3 "2023-03-01T23:41:58Z")

</div>

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:

1. Can you check that `/app` is the right location where `php` expects the files to be at?
2. Is `php-fpm` configured to restart on changes?
3. 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).

---

<div class="post-metadata">

**Author:** ![JohnAD](https://avatars.discourse-cdn.com/v4/letter/j/eb8c5e/32.png) [@JohnAD](https://community.okteto.com/u/JohnAD)\
**Post date:** [March 2, 2023, 2:38pm UTC](https://community.okteto.com/t/getting-syncthing-to-work-with-both-containers/677/4 "2023-03-02T14:38:16Z")

</div>

I’m suspecting the problem is related to:

```yaml
    persistentVolume:
      enabled: false

```

The target cluster does not support persistent volumes. And adding those same lines to the service is not permitted by the okteto tool.

---

<div class="post-metadata">

**Author:** ![tavferreira](https://sea1.discourse-cdn.com/flex019/user_avatar/community.okteto.com/tavferreira/32/318_2.png) [@tavferreira](https://community.okteto.com/u/tavferreira)\
**Post date:** [March 3, 2023, 3:10pm UTC](https://community.okteto.com/t/getting-syncthing-to-work-with-both-containers/677/5 "2023-03-03T15:10:51Z")

</div>

You are correct, @JohnAD. When using `services`, `persistentVolume.enabled` key needs to be set to `true` as stated in our [documentation](https://www.okteto.com/docs/reference/manifest/#persistentvolume-object-optional).

A possible work around could be having each container under a [dev key](https://www.okteto.com/docs/reference/manifest/#dev-object-optional). 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.

Hope this helps. Let us know otherwise.

---

<div class="post-metadata">

**Author:** ![JohnAD](https://avatars.discourse-cdn.com/v4/letter/j/eb8c5e/32.png) [@JohnAD](https://community.okteto.com/u/JohnAD)\
**Post date:** [March 6, 2023, 4:08pm UTC](https://community.okteto.com/t/getting-syncthing-to-work-with-both-containers/677/6 "2023-03-06T16:08:40Z")

</div>

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.

yaml so far:

```yaml
name: abcd
namespace: bling
dev:
  web:
    name: abcd
    container: web
    command: nginx-entrypoint
    sync:
      - .:/app
    persistentVolume:
      enabled: false
    forward:
      - 8080:8080
  app:
    name: abcd
    container: app
    command: entrypoint-prod php-fpm
    sync:
      - .:/app
    persistentVolume:
      enabled: false

```

If there a different format needed to get both containers up in the same pod?

---

<div class="post-metadata">

**Author:** ![tavferreira](https://sea1.discourse-cdn.com/flex019/user_avatar/community.okteto.com/tavferreira/32/318_2.png) [@tavferreira](https://community.okteto.com/u/tavferreira)\
**Post date:** [March 7, 2023, 9:10am UTC](https://community.okteto.com/t/getting-syncthing-to-work-with-both-containers/677/7 "2023-03-07T09:10:24Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![JohnAD](https://avatars.discourse-cdn.com/v4/letter/j/eb8c5e/32.png) [@JohnAD](https://community.okteto.com/u/JohnAD)\
**Post date:** [March 7, 2023, 3:24pm UTC](https://community.okteto.com/t/getting-syncthing-to-work-with-both-containers/677/8 "2023-03-07T15:24:58Z")

</div>

Thanks for helping work this out. While “no” is never an ideal answer for what I want; at least it provides closure 😄

John
