Skip to content

Commit ddb9c5f

Browse files
committed
Add known issue for setting up the database
1 parent 05912a9 commit ddb9c5f

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

_posts/2024-07-11-Known-Issues.md

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,44 @@ After setting the memory limit, restart the worker container to apply the change
2323
you might need to adjust the memory limit of the docker daemon as well.
2424

2525
- **Workaround**: If increasing the memory limit does not solve the issue, you can try to reduce the number of workers
26-
or the number of elements in the queue to process.
26+
or the number of elements in the queue to process.
27+
28+
29+
30+
### Initial setup of the database fails
31+
Sometimes when you try to deploy a new instance of FMD, the initialisation of the database fails with the following error message:
32+
```
33+
....
34+
mongo-db-1 | {"t":{"$date":"2024-10-29T09:32:29.237+00:00"},"s":"E", "c":"CONTROL", "id":20557, "ctx":"initandlisten","msg":"DBException in initAndListen, terminating","attr":{"error":"IllegalOperation: Attempted to create a lock file on a read-only directory: /data/db"}}
35+
...
36+
```
37+
This can happen if the `mongo-db-1` container is not able to write to the `/data/db` directory within the container.
38+
Usually that means that there was a problem creating the directory for the database due to permissions on the host system.
39+
If that is the case, subsequent attempts to start the container will fail because the directory already exists but is not writable and
40+
the container will not be able to connect to the database. The following error message will be shown in the logs:
41+
```
42+
backend-worker | pymongo.errors.ServerSelectionTimeoutError: mongo-db-1:27017: [Errno -2] Name or service not known (configured timeouts: socketTimeoutMS: 20000.0ms, connectTimeoutMS: 20000.0ms), Timeout: 30s, Topology Description: <TopologyDescription id: 6720aba298caf29a9cb0f029, topology_type: Unknown, servers: [<ServerDescription ('mongo-db-1', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('mongo-db-1:27017: [Errno -2] Name or service not known (configured timeouts: socketTimeoutMS: 20000.0ms, connectTimeoutMS: 20000.0ms)')>]>
43+
backend-worker exited with code 0
44+
```
45+
To overcome this issue you can remove the directories (`mongo_database` and `django_database`) and manually
46+
create them with the correct permissions. The environment variables `LOCAL_MONGO_DB_PATH_NODE1` and `DJANGO_SQLITE_DATABASE_MOUNT_PATH`
47+
should be set to the correct paths where the directories should be created on the host.
48+
```
49+
# Check if the environment variables are set correctly in the .env file:
50+
cat .env
51+
52+
# Delete the mongo_database and django_database directories -> Replace <YOUR_PATH> with the correct path:
53+
rm -R <YOUR_PATH>/mongo_database
54+
rm -R <YOUR_PATH>/django_database
55+
56+
# Creates the mongo_database directory -> Replace <LOCAL_MONGO_DB_PATH_NODE1> with the correct path:
57+
mkdir -p <LOCAL_MONGO_DB_PATH_NODE1>
58+
59+
# Create the django_database directory -> Replace <DJANGO_SQLITE_DATABASE_MOUNT_PATH> with the correct path:
60+
mkdir -p <DJANGO_SQLITE_DATABASE_MOUNT_PATH>
61+
```
62+
After creating the directories you can restart the deployment and the containers should start successfully.
63+
```
64+
docker compose up
65+
```
66+

0 commit comments

Comments
 (0)