You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2020/06/28 17:26:31 UTC
[GitHub] [couchdb-docker] guest20 opened a new issue #183: touching docker.ini on startup does not respond well to a readonly filesystem
guest20 opened a new issue #183:
URL: https://github.com/apache/couchdb-docker/issues/183
Overwriting `local.d/docker.ini` from `k8s` causes the couch container to go into `CrashLoopBackOff` because `touch: cannot touch '/opt/couchdb/etc/local.d/docker.ini': Read-only file system`
## Expected Behavior
I'd expect to just be able to mount my own `docker.ini` over the top of the one in the container so I can skip the setup wizard (in my case I only `n=1`)
## Current Behavior
`CrashLoopBackOff` because couchdb crashes when it attempts to touch `docker.ini`
## Steps to Reproduce (for bugs)
The `single-node.ini` seen here came from clicking "single node cluster" in the ui, and then grabbing the config from the running contgainer.
```
apiVersion: v1
kind: ConfigMap
metadata:
name: couchdb-ini
data:
single-node.ini: |
[admins]
admin = -pbkdf2-████████████████████████
[couchdb]
uuid = ████████████████████████████████
[couch_httpd_auth]
secret = ████████████████████████████████
[chttpd]
bind_address = 0.0.0.0
port = 5984
[log]
level = debug
writer = stderr
[cluster]
n = 1
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: couchdb
spec:
selector:
matchLabels:
app: couchdb
replicas: 1
template:
metadata:
labels:
app: couchdb
spec:
containers:
- name: couchdb
image: couchdb:3.0.1
ports:
- containerPort: 5984
envFrom:
- configMapRef:
name: couchdb-config
volumeMounts:
- name: config-volume
mountPath: /opt/couchdb/etc/local.d/docker.ini
subPath: single-node.ini
volumes:
- name: config-volume
configMap:
name: couchdb-ini
items:
- key: single-node.ini
path: single-node.ini
```
1. `kubectl apply -f ...`
1, `kubectl get pods `
## Context
my cluster was built via `k3s`, and runs `fluxcd` to apply changes to my manifests - I think i've managed to pare it down.
## Your Environment
* Version used: 3.0.1, from dockerhub
* Operating System and version (desktop or mobile): `Linux dave 4.19.0-8-amd64 #1 SMP Debian 4.19.98-1+deb10u1 (2020-04-27) x86_64 GNU/Linux `
*
```
kubectl version
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.3+k3s1", GitCommit:"96653e8d86b74a1f73eadf09d4edc44778c2f8dd", GitTreeState:"clean", BuildDate:"2020-06-01T16:47:11Z", GoVersion:"go1.13.11", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.3+k3s1", GitCommit:"96653e8d86b74a1f73eadf09d4edc44778c2f8dd", GitTreeState:"clean", BuildDate:"2020-06-01T16:47:11Z", GoVersion:"go1.13.11", Compiler:"gc", Platform:"linux/amd64"}
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb-docker] wohali commented on issue #183: touching docker.ini on startup does not respond well to a readonly filesystem
Posted by GitBox <gi...@apache.org>.
wohali commented on issue #183:
URL: https://github.com/apache/couchdb-docker/issues/183#issuecomment-650813543
Strictly speaking this isn't a Docker issue, it's a CouchDB topic, but I'll answer it here.
CouchDB mandates having write access to the last file in the config chain for any updates it wants to make itself. There's no way currently to avoid this behaviour.
Are you willing to mount a read-write file ascibetically _after_ your `single-node.ini` one, so CouchDB can meet its needs?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb-docker] guest20 edited a comment on issue #183: touching docker.ini on startup does not respond well to a readonly filesystem
Posted by GitBox <gi...@apache.org>.
guest20 edited a comment on issue #183:
URL: https://github.com/apache/couchdb-docker/issues/183#issuecomment-650813346
I did try calling it `single-node.ini`, which is ascibetically later than `docker.ini`. In that case couchdb just refused to start, and fell into `CrashLoopBackOff` without any message at all (so I gave up and created a ticket)
**Edit**: And that's where the `[log]` section in the config came from
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb-docker] willholley commented on issue #183: touching docker.ini on startup does not respond well to a readonly filesystem
Posted by GitBox <gi...@apache.org>.
willholley commented on issue #183:
URL: https://github.com/apache/couchdb-docker/issues/183#issuecomment-650811190
Can you just change the mountpath to e.g. `/opt/couchdb/etc/local.d/zz-single-node.ini`? As described in the [docs](https://docs.couchdb.org/en/stable/config/intro.html#configuration-files), settings in successive config files override the settings in earlier entries so you just need to put your overrides into a file that sorts later than `docker.ini` within `local.d`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb-docker] wohali removed a comment on issue #183: touching docker.ini on startup does not respond well to a readonly filesystem
Posted by GitBox <gi...@apache.org>.
wohali removed a comment on issue #183:
URL: https://github.com/apache/couchdb-docker/issues/183#issuecomment-650813543
Strictly speaking this isn't a Docker issue, it's a CouchDB topic, but I'll answer it here.
CouchDB mandates having write access to the last file in the config chain for any updates it wants to make itself. There's no way currently to avoid this behaviour.
Are you willing to mount a read-write file ascibetically _after_ your `single-node.ini` one, so CouchDB can meet its needs?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb-docker] guest20 commented on issue #183: touching docker.ini on startup does not respond well to a readonly filesystem
Posted by GitBox <gi...@apache.org>.
guest20 commented on issue #183:
URL: https://github.com/apache/couchdb-docker/issues/183#issuecomment-650813346
I did try calling it `single-node.ini`, which is ascibetically later than `docker.ini`. In that case couchdb just refused to start, and fell into `CrashLoopBackOff` without any message at all (so I gave up and created a ticket)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb-docker] wohali commented on issue #183: touching docker.ini on startup does not respond well to a readonly filesystem
Posted by GitBox <gi...@apache.org>.
wohali commented on issue #183:
URL: https://github.com/apache/couchdb-docker/issues/183#issuecomment-650813901
We can file a PR to only touch the file if it does not exist, but then wouldn't you get stuck here?
https://github.com/apache/couchdb-docker/blob/master/3.1.0/docker-entrypoint.sh#L59
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb-docker] wohali commented on issue #183: touching docker.ini on startup does not respond well to a readonly filesystem
Posted by GitBox <gi...@apache.org>.
wohali commented on issue #183:
URL: https://github.com/apache/couchdb-docker/issues/183#issuecomment-650816563
> > If you place it prior to docker.ini then any changes it writes will go inside the container and be lost.
>
> This sounds like exactly the what I'm looking for.
Great! That's the recommended approach, then. 😉
> Is there also a magical file I can poke to solve the "you need to create _global_changes, _replicator and _users manually" thing?
Try adding the following to your ini file:
```
[couchdb]
single_node=true
```
Assuming, of course, you're deploying this as a single node and not a cluster.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb-docker] wohali commented on issue #183: touching docker.ini on startup does not respond well to a readonly filesystem
Posted by GitBox <gi...@apache.org>.
wohali commented on issue #183:
URL: https://github.com/apache/couchdb-docker/issues/183#issuecomment-650814185
The issue Will is bringing up is that CouchDB requires write access to the last file in the config chain. If you make your file last ascibetically, you'll break CouchDB. If you place it prior to `docker.ini` then any changes it writes will go inside the container and be lost.
If you're OK with this, then that's the best workaround, and we'll document it.
We'd recommend having a writeable config file placed in permanent storage outside of the system, but I wouldn't know exactly how to do that in your `k3s` setup.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb-docker] guest20 commented on issue #183: touching docker.ini on startup does not respond well to a readonly filesystem
Posted by GitBox <gi...@apache.org>.
guest20 commented on issue #183:
URL: https://github.com/apache/couchdb-docker/issues/183#issuecomment-650816301
Thanks for mulling this over with me!
> mount a read-write file ascibetically _after_ ...
The files i'm mounting come from a `ConfigMap`, I'm not sure if I can make them `rw`.
> If you make your file last ascibetically, you'll break CouchDB.
Yep, that's definitely what's happening here.
> If you place it prior to `docker.ini` then any changes it writes will go inside the container and be lost.
This sounds like exactly the what I'm looking for.
Is there also a magical file I can poke to solve the "you need to create `_global_changes`, `_replicator` and `_users` manually" thing?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org