Development Environment Ideas

Dear community,

coming from a software development background, I decided to set up a proper CI/CD (continous integration / continous delivery) pipeline based on two environments: one docker based HA installation for development/testing and one for production (running on a different machine).

Getting a pipeline set up should not be an issue and I found several topics in this forum to get me started. What I am missing however is the concept of having two separate environments: yes, I can set up a development environment where I can test out changes to configuration.yaml and yaml based lovelace dashboards. These changes I can commit and using my pipeline, get them checked and deployed into my production environments.

The main challenge for me is changes to my production environment through configuration in the web UI. Since there do not end up in my yaml, my develoment environment does not reflect my real configuration. What approach are you using? Some kind of back-up / restore mechanism to first pull in the current changes from production into development? Or could I solve it through git by tracking addional files? Ideally in this case I would never make changes to production directly but work in development and then push those changes to production.

What works best for you? Is having a development environment a practical approach in the first place?

Alternatively, I am thinking of using only one environment tracked by git so that I could at least do some config validation through my pipeline and get versioning in case something went wrong.

Curious to learn about what’s working for you :slight_smile:

The config for stuff configured in the UI is stored in the hidden directory .storage in json format. But it also contains api tokens, password and other sensitive information, so pushing it to a public git repo is not the best idea :slight_smile:

I’m not a dev, so no CI/CD here.
I have two VMs for Home Assistant one for production and one for “development”, which is actually just a copy of prod and used to test new things or updates and not actually developing something for HA. Once I’m happy with the tests I push the changes to prod through git, for stuff configured through the UI I just do it manually again on prod.

Thanks @Burningstone for sharing your setup. I am using a private git repo, but it still would not be a great idea to push it into the cloud.

I am thinking however, if one-way syncing .storage from prod to dev could work (e.g. using Syncthing). If the directory only changes if I am actively modifying things, then I have it under control.

That being said, I am not sure whether I am gaining much this way. Ideally, all changes happen in the Dev environment and then allow me to safely transfer them into the prod system.

Are you by any chance from Switzerland (just a wild guess from your name xD)?

That’s the problem, .storagealso stores some information like rhe state of some entities to restore them after a restarts, it’s a bit of a mess in the sense that it stores config data and other data.

You guessed right :wink:

That’s the problem, .storage also stores some information like rhe state of some entities to restore them after a restarts, it’s a bit of a mess in the sense that it stores config data and other data.

So I better look for an alternative…