Deploy on Balena button from sub directory

Hi,

I’m trying to work out what arguments I need to add to the URL for the “Deploy on Balena” button in the README.md for my project.

I would like to host all the balena specific files in a sub directory of the project, e.g. balena

So I have the docker-compose.yml, balena.yml and Dockerfile-template in this balena directory along with a specific README.md.

In the README.md I have

[![balena deploy button](https://www.balena.io/deploy.svg)](https://dashboard.balena-cloud.com/deploy?repoUrl=https://github.com/hardillb/device-agent&configUrl=https://raw.githubusercontent.com/hardillb/device-agent/master/balena/balena.yml)

The repoUrl points to the root of the git repo and the configUrl points to the exact location of the balena.yml file.

Will this be enough for the build engine to find the files as they are not in the root of the repository?

I’m specifically trying not to need a git repository just for the Balena integration if possible.

Thanks,

Ben

Hey Ben, welcome to the forums!

Unfortunately on first glance the deploy button will not work with your compose file in a subdirectory, as the project will be cloned and the deploy command run from the root.

May I ask why the balena files cannot live in the project root? Do the balena compose and dockerfiles not have dependencies on components in the project root in some way? I would love to understand more about your use case. While I totally understand not wanting to create another repo, I’ve never personally had issues adding the required balena files to the root of my projects.

Cheers,
Kyle

Hi Kyle,

No, there are no direct dependencies on things in the root of the project.

The Dockerfile installs a public npm an packages (that are build from the root project). We have other integrations that live in the project (in their own sub directories) and I’m trying to keep the root clean and all the different integrations in their own subdir.

As a workaround I have added a standalone repo, but this adds management and audit overhead that I’d like to reduce.

Hey Ben, I think the main issue here is the deploy button needs to clone the sources in order to generate a release. So in that sense it needs to use the root of the repo.

What is lacking is a way to specify a different compose sub-directory for the building of the release.

A compromise might be to put the compose file in the root of the project, and keep the balena.yml and the Dockerfile.template in a subdirectory. The compose file could then reference the build context path and where to find the build files.

At least that way the only “balena” file in your project root is a docker-compose.yml.

Beyond that I suggest you add this feature request to the balena public roadmap to see if it gains any community traction. As it would have to be a new property of the URL to specify a subdirectory for the balena project root.