# What happens when I modify an application?

**URL:** <https://forums.balena.io/t/what-happens-when-i-modify-an-application/178487>\
**Category:** Product support\
**Created:** [August 27, 2020, 7:55pm UTC](https://forums.balena.io/t/what-happens-when-i-modify-an-application/178487 "2020-08-27T19:55:48Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![pitosalas](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/pitosalas/32/4181_2.png) [@pitosalas](https://forums.balena.io/u/pitosalas)\
**Post date:** [August 27, 2020, 7:55pm UTC](https://forums.balena.io/t/what-happens-when-i-modify-an-application/178487/1 "2020-08-27T19:55:49Z")

</div>

In Balena Cloud, I’ve created an application, created a device, done a `git push balena master`.

Then I test the application. and make a change to the overall repo - not just the Dockerfile but other files in the repo. In particular a subdirectory that the Dockerfile will copy to the container, with a

`COPY ./ros /ros`

Next I update the device with:

`git add --all; git commit -m "new version"; git push balena master`.

Will the previous state of the `/ros` in the container (i.e. on the device) affect what it looks like after the second push?

---

<div class="post-metadata">

**Author:** ![whm](https://avatars.discourse-cdn.com/v4/letter/w/ce7236/32.png) [@whm](https://forums.balena.io/u/whm)\
**Post date:** [August 27, 2020, 8:08pm UTC](https://forums.balena.io/t/what-happens-when-i-modify-an-application/178487/4 "2020-08-27T20:08:23Z")

</div>

No. You can create a persistent volume though. See this article for more information:

[https://www.balena.io/docs/learn/more/masterclasses/services-masterclass/#13-service-volumes](https://www.balena.io/docs/learn/more/masterclasses/services-masterclass/#13-service-volumes)

---

<div class="post-metadata">

**Author:** ![anujdeshpande](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/anujdeshpande/32/3155_2.png) [@anujdeshpande](https://forums.balena.io/u/anujdeshpande)\
**Post date:** [August 28, 2020, 7:31am UTC](https://forums.balena.io/t/what-happens-when-i-modify-an-application/178487/5 "2020-08-28T07:31:13Z")

</div>

Hi

- git push is supported but it’s a legacy way of doing things. We recommend you to move to `balena push` instead. Read more about it [here](https://www.balena.io/docs/learn/deploy/deployment/#git-push)
- If you want to have some data persistent on the device, as Caleb mentions, you should use persistent volumes.

---

<div class="post-metadata">

**Author:** ![pitosalas](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/pitosalas/32/4181_2.png) [@pitosalas](https://forums.balena.io/u/pitosalas)\
**Post date:** [August 28, 2020, 11:06am UTC](https://forums.balena.io/t/what-happens-when-i-modify-an-application/178487/7 "2020-08-28T11:06:39Z")

</div>

Will do. Is there any improvement using balena push or do you want to remove the implication that people can use you as their repo? However note that the product still recommends the old way:

 ![Screen Shot 2020-08-28 at 7.05.34 AM](https://global.discourse-cdn.com/balena/original/2X/c/c4ed26ef7e46e38e6cb2f3fc35222876deef4307.png)

---

<div class="post-metadata">

**Author:** ![jviotti](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/jviotti/32/220_2.png) [@jviotti](https://forums.balena.io/u/jviotti)\
**Post date:** [August 28, 2020, 11:11am UTC](https://forums.balena.io/t/what-happens-when-i-modify-an-application/178487/8 "2020-08-28T11:11:00Z")

</div>

Hey there! The idea is that `balena push` can break from the constraints imposed by `git push` and allow us to do various interesting things more easily, such as build-time secrets. We plan to keep augmenting the push functionality with more features that wouldn’t be very ergonomic when using plain `git`

---

<div class="post-metadata">

**Author:** ![pitosalas](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/pitosalas/32/4181_2.png) [@pitosalas](https://forums.balena.io/u/pitosalas)\
**Post date:** [August 28, 2020, 1:43pm UTC](https://forums.balena.io/t/what-happens-when-i-modify-an-application/178487/10 "2020-08-28T13:43:28Z")

</div>

Do balena push assume that I am in the git repo? Do I have to stage and commit before balena push or will it work on any directory tree? And I assume it starts at `pwd` and recurses down. I assume therefore it doesn’t try to handle things like gitignore and git submodules?

---

<div class="post-metadata">

**Author:** ![StefKors](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/stefkors/32/3900_2.png) [@StefKors](https://forums.balena.io/u/StefKors)\
**Post date:** [August 28, 2020, 2:18pm UTC](https://forums.balena.io/t/what-happens-when-i-modify-an-application/178487/11 "2020-08-28T14:18:32Z")

</div>

`balena push` doesn’t assume to be in a git repo actually. It’s not required tostage and commit before running balena push. For the best development flow you should read up on `local-mode`([https://www.balena.io/docs/learn/develop/local-mode/](https://www.balena.io/docs/learn/develop/local-mode/)) This uses balena push to sync changes to files on save.

If you finished development you can deploy your app, this will create a production build and deploy it to your device. The docs here: [https://www.balena.io/docs/learn/deploy/deployment/#overview](https://www.balena.io/docs/learn/deploy/deployment/#overview) Explain more on how this works, including information on the support for git-submodules are on that page.

---

<div class="post-metadata">

**Author:** ![pitosalas](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/pitosalas/32/4181_2.png) [@pitosalas](https://forums.balena.io/u/pitosalas)\
**Post date:** [August 28, 2020, 3:53pm UTC](https://forums.balena.io/t/what-happens-when-i-modify-an-application/178487/12 "2020-08-28T15:53:22Z")

</div>

One more thing. I used balena push and it hung. I don’t know if it completed successfully. It was sitting at [info] Uploading Images for an hour.

 ![Screen Shot 2020-08-28 at 11.52.14 AM](https://global.discourse-cdn.com/balena/original/2X/a/a3bd68d7b0ad6ca774ce12d2f2222e3202508f1b.png)

---

<div class="post-metadata">

**Author:** ![whm](https://avatars.discourse-cdn.com/v4/letter/w/ce7236/32.png) [@whm](https://forums.balena.io/u/whm)\
**Post date:** [August 28, 2020, 5:39pm UTC](https://forums.balena.io/t/what-happens-when-i-modify-an-application/178487/13 "2020-08-28T17:39:38Z")

</div>

I like using `balena push` over `git push` because that way I can push uncommitted changes to see if they will work. It can take dozens of tweaks to a Dockerfile before a build works correctly, with `balena push` I don’t have to have dozens of non-working commits before I get something that works.

---

<div class="post-metadata">

**Author:** ![dtischler](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/dtischler/32/2483_2.png) [@dtischler](https://forums.balena.io/u/dtischler)\
**Post date:** [August 28, 2020, 7:55pm UTC](https://forums.balena.io/t/what-happens-when-i-modify-an-application/178487/14 "2020-08-28T19:55:48Z")

</div>

Hi @pito, we did have a DNS issue this morning, so it might be worth trying your `balena push` again to see if it works now. With that said, Caleb is correct, `balena push` is definitely advantageous for rapid testing, especially when combined with local-mode and live pushes.

---

<div class="post-metadata">

**Author:** ![pitosalas](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/pitosalas/32/4181_2.png) [@pitosalas](https://forums.balena.io/u/pitosalas)\
**Post date:** [August 28, 2020, 9:35pm UTC](https://forums.balena.io/t/what-happens-when-i-modify-an-application/178487/16 "2020-08-28T21:35:12Z")

</div>

I’m now experimenting with local mode as requested. Notice the error I get on the second line of output after doing the balena push – “no docker-compose” …

 ![Screen Shot 2020-08-28 at 5.38.10 PM](https://global.discourse-cdn.com/balena/original/2X/4/4e52b29c3b9a9058ed163a072aa37188b36c8e68.png)

Livepush does not seem to detect a change. Maybe it’s not looking in the right place? Recall that my directory includes a big subdirectory called `ros` which is copied in one fell swoop in my Dockerfile.template with `COPY ./ros /ros`

If I change a file in that directory `ros/` it seems that it is not detected by live push, and doing another balena push also does not send it to the device.

Is that intended? How do I force it to still send it to the device?

---

<div class="post-metadata">

**Author:** ![dtischler](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/dtischler/32/2483_2.png) [@dtischler](https://forums.balena.io/u/dtischler)\
**Post date:** [August 28, 2020, 10:13pm UTC](https://forums.balena.io/t/what-happens-when-i-modify-an-application/178487/17 "2020-08-28T22:13:23Z")

</div>

The --nocache flag can be appended if your changes are not being detected, and will force it to be sent to the device:  
[https://www.balena.io/docs/reference/balena-cli/#-c---nocache](https://www.balena.io/docs/reference/balena-cli/#-c---nocache)

---

<div class="post-metadata">

**Author:** ![pitosalas](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/pitosalas/32/4181_2.png) [@pitosalas](https://forums.balena.io/u/pitosalas)\
**Post date:** [August 28, 2020, 11:56pm UTC](https://forums.balena.io/t/what-happens-when-i-modify-an-application/178487/19 "2020-08-28T23:56:29Z")

</div>

Thanks I will try that. But is that the expected behavior? In other words that files in such a file are not part of the livepush? Also I assume the “No Docker-Compose” is not a problem, right?

---

<div class="post-metadata">

**Author:** ![pitosalas](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/pitosalas/32/4181_2.png) [@pitosalas](https://forums.balena.io/u/pitosalas)\
**Post date:** [August 29, 2020, 10:10am UTC](https://forums.balena.io/t/what-happens-when-i-modify-an-application/178487/20 "2020-08-29T10:10:59Z")

</div>

Even with nocache it built the older version of the original files. In other words the problem seems to have been that the source files that it started with were an old version, not intermediate build results. When I switched local off it worked

---

<div class="post-metadata">

**Author:** ![majorz](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/majorz/32/639_2.png) [@majorz](https://forums.balena.io/u/majorz)\
**Post date:** [August 31, 2020, 1:38pm UTC](https://forums.balena.io/t/what-happens-when-i-modify-an-application/178487/23 "2020-08-31T13:38:14Z")

</div>

Hi @pitosalas,

I could not reproduce the behavior you described.

I created a new application and flashed a RPi device with it. I enabled local mode on the device.

The application is minimal:

```auto
FROM balenalib/%%BALENA_MACHINE_NAME%%-alpine

COPY ./files /files

CMD ["sleep", "infinity"]

```

The `files` folder contains some text files.

I pushed the application to the device in local mode. Then I checked the contents of the file I wanted to modify in `files`. After this I changed its content. The balena CLI detected the change and updated the container. Afterwards I rechecked the content of the same file on the device and it was updated. Here are the logs from my test:

```auto
$ balena push 92c8df3.local
[Info] Starting build on device 192.168.0.19
[Info] No "docker-compose.yml" file found at "."
[Info] Creating default composition with source: "."
[Build] [main] Step 1/5 : FROM balenalib/raspberrypi4-64-alpine
[Build] [main] ---> 0b9a47130779
[Build] [main] Step 2/5 : COPY ./files /files
[Build] [main] ---> 7f6dbf97a087
[Build] [main] Step 3/5 : CMD ["sleep", "infinity"]
[Build] [main] ---> Running in 589037e427ab
[Build] [main] Removing intermediate container 589037e427ab
[Build] [main] ---> 66cf9135cee0
[Build] [main] Step 4/5 : LABEL io.resin.local.image=1
[Build] [main] ---> Running in 5863cec48e98
[Build] [main] Removing intermediate container 5863cec48e98
[Build] [main] ---> 1dd0afc98bc5
[Build] [main] Step 5/5 : LABEL io.resin.local.service=main
[Build] [main] ---> Running in cfb5a8c74bfb
[Build] [main] Removing intermediate container cfb5a8c74bfb
[Build] [main] ---> abacaa6924b6
[Build] [main] Successfully built abacaa6924b6
[Build] [main] Successfully tagged local_image_main:latest

[Live] Waiting for device state to settle...
[Info] Streaming device logs...
[Live] Watching for file changes...
[Logs] [8/31/2020, 4:28:57 PM] Creating network 'default'
[Logs] [8/31/2020, 4:28:57 PM] Creating volume 'resin-data'
[Logs] [8/31/2020, 4:28:57 PM] Installing service 'main sha256:abacaa6924b6858d94bc2161bb0521530e80824cbce25f59239cd8ba862bd3bf'
[Logs] [8/31/2020, 4:29:01 PM] Installed service 'main sha256:abacaa6924b6858d94bc2161bb0521530e80824cbce25f59239cd8ba862bd3bf'
[Logs] [8/31/2020, 4:29:01 PM] Starting service 'main sha256:abacaa6924b6858d94bc2161bb0521530e80824cbce25f59239cd8ba862bd3bf'
[Logs] [8/31/2020, 4:29:03 PM] Started service 'main sha256:abacaa6924b6858d94bc2161bb0521530e80824cbce25f59239cd8ba862bd3bf'
[Live] Device state settled
[Live] Detected changes for container main, updating...
[Live] [main] Restarting service...
[Logs] [8/31/2020, 4:30:41 PM] Service exited 'main sha256:abacaa6924b6858d94bc2161bb0521530e80824cbce25f59239cd8ba862bd3bf'
[Logs] [8/31/2020, 4:30:44 PM] Restarting service 'main sha256:abacaa6924b6858d94bc2161bb0521530e80824cbce25f59239cd8ba862bd3bf'

```
