I cant push my project to the Balena repository

After testing and tuning my project into balena I organized a repository in bitbucket where I plan to keep and maintain the sources for the final version of my Balena based device. Now I’m trying to pull this repository to a new balena application in BalenaCloud.

I added the balena endpoint to my git repository via “git remote add balena myuser@git.balena-cloud.com:myuser/balenaApp.git” then I push code with “git push balena master”. However I still getting the following error:

[Info] Starting build for 3dcamintegration, user andres
[Info] Dashboard link: balena dashboard
[Error] Could not detect project type: Service main: Could not find a Dockerfile for this service
[Error] Not deploying release.

remote: error: hook declined to update refs/heads/master
To andres@git.balena-cloud.com:andres/3dcamintegration.git
! [remote rejected] master → master (hook declined)
error: failed to push some refs to

I have the same code working in another balena app and there is the docker-compose.yml, so I dont know why it is falling, have you experience this before?

Hi there, as the error says, it seems a Dockerfile is missing for the main service. Can you post your docker-compose here? I suspect you might have a build field for the main service, but the main service doesn’t have a Dockerfile.

version: ‘2’
volumes:
cam-config-data: {}
services:
vpa:
restart: always
build: ./vpa
privileged: true
web:
restart: always
build: ./webservice
network_mode: host
ports:
- “80:80”
- “443:443”
services:
restart: always
build : ./services
network_mode: host
volumes:
- ‘cam-config-data:/data’
depends_on:
- web
labels:
io.balena.features.balena-api: ‘1’
io.balena.features.dbus: ‘1’
finder:
restart: always
build : ./finder
network_mode: host

Dear @sradevski, I already check that ever container has the Dockerfile.templete, I also leave the application with only 1 container, but still the same error while pushing.

I don’t see anything wrong with the docker-compose, so that one should work. Can you try pushing the project to your app using the balena CLI? Also, was there anything else pushed to that app before that differs from what you are pushing now? If that’s the case, you will need to force push with git to overwrite the previous content. Try both of those first, and we can take it from there.

I didnt push anything before, and I’m trying balena push , let you know about the results.

It worked using “balena push app”, but I dont know why it takes several minutes, like 30 mins before it start really uploading the source files.
Also after doing the first push with Balena, I tried with git, but still having the same problem. So why exactly is not the same using balena or git push? There is a way to solve it? I prefer to use git push because is way faster.

As it was very slow, I tried using Cli to push directly to the device in order to avoid to pass through BalenaCloud, but every time I tried the connection was broken. Any clues to improve my workflow?

Reasons why git push may not work when balena push does work:

  • You may not have not committed some files, like docker-compose.yml or Dockerfile or a subfolder for a service. Running git status might show something “untracked”.
  • Your .gitignore file (in the root folder or in subfolders) may be ignoring some files – which then would not show as “untracked”, but would not be committed.

Reason why “balena push” may be much slower than “git push”, it may be because it is uploading a lot of files. “git push” only transfers a git diff of the contents, whereas “balena push” transfers everything every time. If there are files that are not strictly needed in the build and final image, you could perhaps list those files in a .dockerignore file.

I don’t think is neither of these 2 reasons.

$ git status
On branch balenaintegration
Your branch is up-to-date with ‘origin/balenaintegration’.
nothing to commit, working directory clean
and :
$ cat .gitignore
*.pyc

The whole folder, including .git files and all in all, is only 6.2M
Maybe the problem is at the security level?
As I mentioned before, this is an original repository in bitbucket where several people are working in and are the sum of several testing other apps in Balena that are working, I’m just uploading this to my new app.

Hi there,

It does not sound like a security issue, as if your key was not valid it would not have sent anything to the builder, but as mentioned earlier missing files that aren’t being pushed. By the sounds of a 30 minute balena push that implies there is a lot of data being packaged up and sent to the builders. In the root of your project, where you’re either git pushing or balena pushing, could you please run du -hc and give us the results?

Can you just clarify that the contents of .gitignore is just *.pyc please, as this looks like the response you sent us is slightly garbled?

Thanks and best regards,

Heds

Hi,

Just one more thought, the original git push issue looks like it isn’t picking the fact up that the docker-compose.yml file exists. Can you ensure that it is actually called that, and is in the root of the repository?

Thanks and best regards,

Heds

Hi again,

Thanks, so there’s a couple of things to note here. The first is that there’s no docker-compose.yml in the root of your repository, so when you run git push, the builder can’t find it and it assumes it’s looking for a Dockerfile[.template] instead, which of course also doesn’t exist. You pasted the contents of a docker-compose.yml file earlier, where does this actually reside?

I’m also unsure how balena push is working if git push is not, given there’s no docker-compose.yml file. Were you balena pushing from the same directory?

Best regards,

Heds

The content of the file .gitignore is only *.pyc. Is just to show that im not ignoring the balena files.

The docker-compose.yml exist, I think you can access to Applications>appexample.
I dont thins is about structure of the project and Docker files, because it is working with balena push.

Other thing, is very fast at the moment it starts the uploand but while is showing " Uploading source package to balena cloud" this is what takes time.

Hi,

Yes, so it sounds like balena push is trying to package up everything possibly including the .git directory, perhaps, but this should be ignored by default. Is the repository you’re trying to push public or private? If public, I could try and replicate this here if you give me a link to the project.

Whilst you say the docker-compose.yml exists, it does not appear to be in the output you pasted in the response above, which was the whole of the project to push?

Best regards,

Heds

It exists, I run ls in the same directory where I run du -hc

$ ls
docker-compose.yml finder services vpa webservice

Apologies, yes, I’d forgotten it won’t have listed the actual files.

I think I’ve just noticed something else, however, which is that when pushing you’re using a branch, not the master. Try this instead:

git push balena balenaintegration:master

As mentioned here if you’re not working from the master branch, you need to tell git which branch to push to the balena remote.

Please let me know if that works.

Best regards,

Heds

1 Like

Ok I’m testing, I hope the balena app repository is not going to get damage or something like that, Ill tell you as soon as the upload is finished.

What you’re doing here is explicitly telling git to use the balenaintegration branch as master for the balena remote. If you don’t do this, it will use the master branch of your repository, which I suspect does not contain the docker-compose.yml file. Is this a correct assumption?

Best regards,

Heds

yep, that’s it! I took a long time the first, but then just uploading the changes is way faster! Thanks a lot!

I have another different question that is about containers’ communication, but as you are a little bit familiar with my project, maybe you know the answer. If it is better to open another Issue, let me know:

so I have 3 container web, services, VPA and Finder, I provide images from VPA, but I didn’t add the network_mode: host because in my understanding it was only when you need to communicate from the exterior to your container. However, web and services had the network_mode: host attribute, but they were no able to communicate with VPA. I added and now they are communicating fine, I just want to understand what I got wrong, or maybe it is a different attribute that I have to add. I don’t need VPA exposing their ports.