Need help with docker compose #580
Replies: 2 comments
|
note: ive tried the 'mongo-mount' thing but i dont know why when Restheart starts in docker it just ignores it from the yml file |
|
The default configuration only mounts a "restheart" database on root. That is a security decision to avoid people unintentionally exposing all databases to the external world using the default credentials (that are very weak). You mention you tried to edit the mongo-mounts, the right thing to do that in docker-compose.yml is to add it to the RHO environment variable: RHO: >
/mclient/connection-string->"mongodb://mongodb";
/http-listener/host->"0.0.0.0";
/mongo/mongo-mounts[1]->{"what":"*","where":"/"};See: https://restheart.org/docs/configuration As mentioned in this page: YOU MUST UPDATE THE DEFAULT PASSWORD before exposing RESTHeart to the Internet! The admin role can execute any request because it’s configured as the root role in mongoAclAuthorizer. curl -i -u admin:secret -X PATCH localhost:8080/users/admin \
-H "Content-Type: application/json" -d '{ "password": "my-strong-password" }'we have just pushed an updated and more complete version of docker-compose.yml. That is it, with the necessary mongo-mounts to mount all databases to the root API "/" # RESTHeart Docker Compose Configuration
# Runs RESTHeart with MongoDB in replica set mode
name: restheart
services:
# RESTHeart API server
restheart:
image: softinstigate/restheart:latest
environment:
# RHO (RESTHeart Overrides) - Override default configuration
# Uses semicolon-separated XPath expressions to modify config
# Note: Arrays use XPath 1.0 indexing (1-based, not 0-based)
# Uncomment the commented line below to override the default mount and expose all databases at root
RHO: >
/mclient/connection-string->"mongodb://mongodb";
/http-listener/host->"0.0.0.0";
/mongo/mongo-mounts[1]->{"what":"*","where":"/"};
# Wait for MongoDB to be healthy before starting
depends_on:
mongodb:
condition: service_healthy
ports:
- "8080:8080" # Expose RESTHeart API on http://localhost:8080
# MongoDB database server
mongodb:
image: mongo:8.0
# Run as replica set (required for change streams and transactions)
command: ["--bind_ip_all", "--replSet", "rs0"]
# Health check to initialize replica set
healthcheck:
test:
[
"CMD",
"mongosh",
"--quiet",
"--eval",
"'if (!rs.isMaster().ismaster) { rs.initiate(); }'",
]
interval: 5s # Check every 5 seconds
timeout: 10s # Wait up to 10 seconds for response
retries: 5 # Retry 5 times before marking unhealthy
start_period: 5s # Grace period before health checks start |
Uh oh!
There was an error while loading. Please reload this page.
right now i'm using the docker-compose available on the repo, here's the file
docker-compose.yml
can anyone tell me if this configuration is right? and also, when i try to GET,POST,DELETE or PUT, it just throws "404 collection now found" even if i have that db and collection in db, also ive noticed that by default RestHeart will use a db which is created when restheart is connected to mongodb called as "restheart", inside this db, i can do CRUD, but it does now use any other db
can anyone please help me, also im a beginner or fresher you can say
Thanks!
All reactions