updated mongo express
This commit is contained in:
parent
d1234e37ac
commit
2fe676da63
4
.env
4
.env
|
|
@ -1,7 +1,7 @@
|
||||||
# MongoDB credentials
|
# MongoDB credentials
|
||||||
MONGO_ROOT_USERNAME=admin
|
MONGO_ROOT_USERNAME=admin
|
||||||
MONGO_ROOT_PASSWORD=change_this_password
|
MONGO_ROOT_PASSWORD=password
|
||||||
|
|
||||||
# Mongo Express credentials
|
# Mongo Express credentials
|
||||||
MONGOEXPRESS_USERNAME=mexpress
|
MONGOEXPRESS_USERNAME=mexpress
|
||||||
MONGOEXPRESS_PASSWORD=change_this_password_too
|
MONGOEXPRESS_PASSWORD=password
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
// Custom Mongo Express configuration
|
||||||
|
// This file MUST be mounted at /node_modules/mongo-express/config.js
|
||||||
|
module.exports = {
|
||||||
|
mongodb: {
|
||||||
|
// Connection string for MongoDB
|
||||||
|
connectionString: process.env.ME_CONFIG_MONGODB_URL || 'mongodb://admin:password@mongodb:27017/admin',
|
||||||
|
|
||||||
|
// MongoDB server options
|
||||||
|
admin: true,
|
||||||
|
|
||||||
|
// MongoDB authentication options
|
||||||
|
adminUsername: process.env.ME_CONFIG_MONGODB_ADMINUSERNAME || 'admin',
|
||||||
|
adminPassword: process.env.ME_CONFIG_MONGODB_ADMINPASSWORD || 'password',
|
||||||
|
|
||||||
|
// Auth database name
|
||||||
|
auth: [
|
||||||
|
{
|
||||||
|
database: process.env.ME_CONFIG_MONGODB_AUTH_DATABASE || 'admin',
|
||||||
|
username: process.env.ME_CONFIG_MONGODB_ADMINUSERNAME || 'admin',
|
||||||
|
password: process.env.ME_CONFIG_MONGODB_ADMINPASSWORD || 'password',
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
// Web server options
|
||||||
|
site: {
|
||||||
|
// Base URL path
|
||||||
|
baseUrl: '/',
|
||||||
|
|
||||||
|
// Web server port
|
||||||
|
port: process.env.ME_CONFIG_SITE_PORT || 8081,
|
||||||
|
|
||||||
|
// Web server host
|
||||||
|
host: '0.0.0.0'
|
||||||
|
},
|
||||||
|
|
||||||
|
// Options for basic authentication
|
||||||
|
basicAuth: {
|
||||||
|
// Use environment variables for basic authentication
|
||||||
|
username: process.env.ME_CONFIG_BASICAUTH_USERNAME || 'mexpress',
|
||||||
|
password: process.env.ME_CONFIG_BASICAUTH_PASSWORD || 'password'
|
||||||
|
},
|
||||||
|
|
||||||
|
// Other options
|
||||||
|
options: {
|
||||||
|
// Enable editing
|
||||||
|
editMode: true,
|
||||||
|
|
||||||
|
// Enable admin mode
|
||||||
|
adminMode: true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -15,7 +15,8 @@ services:
|
||||||
ports:
|
ports:
|
||||||
- "27017:27017" # Expose MongoDB port to external machines
|
- "27017:27017" # Expose MongoDB port to external machines
|
||||||
# Use a simpler configuration without replica set for now
|
# Use a simpler configuration without replica set for now
|
||||||
command: ["--auth", "--bind_ip_all"]
|
command:
|
||||||
|
["--auth", "--bind_ip_all", "--logpath", "/proc/1/fd/1", "--logappend"]
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/admin -u ${MONGO_ROOT_USERNAME:-admin} -p ${MONGO_ROOT_PASSWORD:-password} --quiet
|
test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/admin -u ${MONGO_ROOT_USERNAME:-admin} -p ${MONGO_ROOT_PASSWORD:-password} --quiet
|
||||||
interval: 10s
|
interval: 10s
|
||||||
|
|
@ -40,21 +41,23 @@ services:
|
||||||
hostname: mongo-express
|
hostname: mongo-express
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- ./mongo-express-config.js:/node_modules/mongo-express/config.js:ro
|
- ./config.js:/node_modules/mongo-express/config.js:ro
|
||||||
environment:
|
environment:
|
||||||
- ME_CONFIG_MONGODB_ADMINUSERNAME=${MONGO_ROOT_USERNAME:-admin}
|
- ME_CONFIG_MONGODB_ADMINUSERNAME=${MONGO_ROOT_USERNAME:-admin}
|
||||||
- ME_CONFIG_MONGODB_ADMINPASSWORD=${MONGO_ROOT_PASSWORD:-password}
|
- ME_CONFIG_MONGODB_ADMINPASSWORD=${MONGO_ROOT_PASSWORD:-password}
|
||||||
- ME_CONFIG_MONGODB_SERVER=mongodb # This should match container_name of MongoDB
|
- ME_CONFIG_MONGODB_SERVER=mongodb # This should match container_name of MongoDB
|
||||||
- ME_CONFIG_MONGODB_AUTH_DATABASE=admin
|
- ME_CONFIG_MONGODB_AUTH_DATABASE=admin
|
||||||
# Fix connection string format
|
# Fix connection string format
|
||||||
- ME_CONFIG_MONGODB_URL=mongodb://${MONGO_ROOT_USERNAME:-admin}:${MONGO_ROOT_PASSWORD:-password}@mongodb:27017/?authSource=admin
|
- ME_CONFIG_MONGODB_URL=mongodb://${MONGO_ROOT_USERNAME:-admin}:${MONGO_ROOT_PASSWORD:-password}@mongodb:27017/?authSource=admin
|
||||||
# Explicitly disable basic auth
|
# Explicitly disable basic auth
|
||||||
- ME_CONFIG_BASICAUTH_USERNAME=
|
- ME_CONFIG_BASICAUTH_USERNAME=${MONGOEXPRESS_USERNAME:-mexpress}
|
||||||
- ME_CONFIG_BASICAUTH_PASSWORD=
|
- ME_CONFIG_BASICAUTH_PASSWORD=${MONGOEXPRESS_PASSWORD:-password}
|
||||||
ports:
|
ports:
|
||||||
- "8081:8081" # Expose Mongo Express web interface to external machines
|
- "8001:8081" # Expose Mongo Express web interface to external machines
|
||||||
depends_on:
|
depends_on:
|
||||||
- mongodb
|
mongodb:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
- mongo_network
|
- mongo_network
|
||||||
logging:
|
logging:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue