Skip to content

Conversation

@wearepariah
Copy link

@wearepariah wearepariah commented Dec 11, 2025

Changed environment variable name from OC_CONFIG_DIR to OC_CONF_DIR due to dual use of the same variable name causing issues in edge cases (per #1279 @ opencloud-eu/opencloud#1279)
PR to docs as well @ opencloud-eu/docs#547

Changed environment variable name from OC_CONFIG_DIR to OC_CONF_DIR due to dual use of the same variable name causing issues in edge cases (per #1279 @ opencloud-eu/opencloud#1279)
@streaminganger
Copy link
Contributor

your issue can be controlled without making this breaking change. you shouldn't be passing OC_CONFIG_DIR to the container so that the default path is used.

https://github.com/opencloud-eu/opencloud/blob/4c5d5fb218de4e8c09544900b9000213c51e23f8/pkg/config/defaults/paths.go#L46

@wearepariah
Copy link
Author

sorry, I think you are misunderstanding here - the docs state to use a variable named OC_CONFIG_DIR inside the Docker compose file.
This creates an issue whereby, regardless of whether the host directory in that variable is accessible on the host, if the host path just so happens to be in a location that needs root privileges inside the container - Opencloud tries to create that directory inside the container and failes (as it does not have root).
https://github.com/opencloud-eu/opencloud/blob/2670f24605dd0f97b89329f5a2f2f99d5107bc68/pkg/config/defaults/paths.go#L54 here is where it is used to define a path inside the container (completely separate to the compose file context)

very happy for this to be solved another way, but the simplest seems to be 'name the variable something else in the Docker Compose file examples and docs'

@streaminganger
Copy link
Contributor

streaminganger commented Dec 11, 2025

hm, i don't think i misunderstood. OC_CONFIG_DIR is only used for substitution in compose. you're facing issues because you are passing the env into the container and that messes with the oc runtime.

in your compose file, you did this

    env_file:
      - opencloud.env

you should look at specifying the required envs explicitly instead of sending the whole env in. this compose repo does just that and that's why it doesn't have any issues

@wearepariah
Copy link
Author

wearepariah commented Dec 11, 2025

then i suggest you read this, the docs I am referring to:
https://docs.opencloud.eu/docs/admin/getting-started/container/docker-compose/docker-compose-base
which state, explicitly to:
set an OC_CONFIG_DIR variable for defining a host-side directory for config to be stored in.
and
use an .env file to store this and other variables in one place
Setting the variable name within the Docker Compose file has exactly the same impact, and can only be gotten around by using a different variable name, or setting the volume path directly (without a variable)
to no longer use of the same variable name, both in the Docker-Compose file, and inside of Opencloud, for adjacent, but separate, purposes is the point of this PR.
I would be curious to understand how changing the name of a Docker Compose Variable is a 'breaking change' as you describe.
EDIT: Note that this PR is to the example Docker Compose files, and the docs - nothing truly 'functional'

@streaminganger
Copy link
Contributor

you answered it yourself here ;D not sure what more needs to be said.

set an OC_CONFIG_DIR variable for defining a host-side directory for config to be stored in.

the env var works in this repo and nothing needs to be fixed. you are on your own if you choose to write your own compose file as you have shown to have done here, changing the variable name (when nothing is broken btw) will most definitely affect everyone who has set it to point to a custom directory. there is nothing to fix in this repo, everything is working if you follow the instructions from the readme carefully.

@JappeHallunken
Copy link

Yea, there is even an example, where it makes clear it's on the host

OC_CONFIG_DIR=/your/local/path/opencloud/config

The only mistake is here, where it is called OC_CONFIG_PATH, but I already made an PR

@micbar
Copy link
Contributor

micbar commented Dec 11, 2025

Yea, there is even an example, where it makes clear it's on the host

OC_CONFIG_DIR=/your/local/path/opencloud/config

The only mistake is here, where it is called OC_CONFIG_PATH, but I already made an PR

Please do not mix docker compose and product env vars. The dev docs are correct. They are referring to the path variable inside the container.

@wearepariah
Copy link
Author

Yea, there is even an example, where it makes clear it's on the host

OC_CONFIG_DIR=/your/local/path/opencloud/config

The only mistake is here, where it is called OC_CONFIG_PATH, but I already made an PR

Please do not mix docker compose and product env vars. The dev docs are correct. They are referring to the path variable inside the container.

which is the point I am trying to make - the same variable name is used in the example docker compose file and inside of the container, for different purposes. The overlap of variable names causes issues - intent of PR is to have one variable name (OC_CONF_DIR) for the Docker Compose file, and another (OC_CONFIG_DIR, left as is) for the product inside the container

@JappeHallunken
Copy link

Ok I get it, but maybe OC_HOST_CONFIG_DIR would be even better then?
But it's still a breaking change...

@wearepariah
Copy link
Author

Ok I get it, but maybe OC_HOST_CONFIG_DIR would be even better then? But it's still a breaking change...

Sure, if that's simpler/makes more sense? Very open to edits/changes/alternate/better solutions. OC_CONF_DIR was used to mirror the format of the other variable used in the Docker Compose context OC_DATA_DIR - can change that one to OC_HOST_DATA_DIR as well for 'ultimate clarity'?

Don't know that it's a breaking change though? I would guess that anyone already deployed will have had to use a workaround/customise the compose/variables to get it working in the current form, with the internal/external variables having the same name, ends up functioning like this:

      - ${OC_CONFIG_DIR:-opencloud-config}:${OC_CONFIG_DIR:-/etc/opencloud}

without it actually being present in the Docker compose file (meaning bind mounts likely wouldn't work as expected?).

To trace my thinking on that, here it takes that variable (if present) and uses it instead of /etc/opencloud as the config directory inside the container, and here it tries create a directory at that path inside the container filesystem (which is what surfaced the issue for me).

@wearepariah
Copy link
Author

wearepariah commented Dec 12, 2025

Ok I get it, but maybe OC_HOST_CONFIG_DIR would be even better then? But it's still a breaking change...

Having another look at your PR, we have the same 'issue' but looking from different angles - perhaps a another/better(?) target for this fix would be all references to OC_CONFIG_DIR in https://github.com/opencloud-eu/opencloud to be changed to OC_CONFIG_PATH to align with the docs?
The variable name would no longer overlap with what's in the Docker Compose file (fixing my issue) and the docs would align to what's in the code (fixing yours)?
EDIT: this would almost certainly be a breaking change for existing deployments though

@streaminganger
Copy link
Contributor

streaminganger commented Dec 12, 2025

Yea, there is even an example, where it makes clear it's on the host

OC_CONFIG_DIR=/your/local/path/opencloud/config

The only mistake is here, where it is called OC_CONFIG_PATH, but I already made an PR

Please do not mix docker compose and product env vars. The dev docs are correct. They are referring to the path variable inside the container.

this. period. not sure why the author is so dead insistent that it's a docs issue and not his own. I even gave him a fix and he refuses to take it.

@wearepariah
Copy link
Author

wearepariah commented Dec 12, 2025

Yea, there is even an example, where it makes clear it's on the host

OC_CONFIG_DIR=/your/local/path/opencloud/config

The only mistake is here, where it is called OC_CONFIG_PATH, but I already made an PR

Please do not mix docker compose and product env vars. The dev docs are correct. They are referring to the path variable inside the container.

this. period. not sure why the author is so dead insistent that it's a docs issue and not his own. I even gave him a fix and he refuses to take it.

the docs i linked you say:

Update your .env file with custom paths:

OC_CONFIG_DIR=/your/local/path/opencloud/config
OC_DATA_DIR=/your/local/path/opencloud/data

the example of my 'custom file' (cloned and unchanged from this repo at the time that issue was raised in July) you linked is doing exactly that.
I give up, many happy returns.

@wearepariah wearepariah deleted the patch-1 branch December 12, 2025 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants