Comments (2)
The issue may not be directly related to the Bitnami container image/Helm chart, but rather to how the application is being utilized, configured in your specific environment, or tied to a specific scenario that is not easy to reproduce on our side.
If you think that's not the case and are interested in contributing a solution, we welcome you to create a pull request. The Bitnami team is excited to review your submission and offer feedback. You can find the contributing guidelines here.
Your contribution will greatly benefit the community. Feel free to reach out if you have any questions or need assistance.
Suppose you have any questions about the application, customizing its content, or technology and infrastructure usage. In that case, we highly recommend that you refer to the forums and user guides provided by the project responsible for the application or technology.
With that said, we'll keep this ticket open until the stale bot automatically closes it, in case someone from the community contributes valuable insights.
from charts.
I found a solution to my problem. Here are the details:
Environment variables in the .env file:
# MONGO
MONGO_HOST=127.0.0.1
MONGO_PORT=3001
MONGO_DB_NAME=MyApp
MONGO_USER=admin
MONGO_PASSWORD=password
MONGO_SECONDARY_KEY=X5ZxqCt4cQrQ3Zfr2zRBFk8R0eakYBaH
# MONGO EXPRESS
MONGO_EXPRESS_PORT=8080
MONGO_EXPRESS_AUTH_USERNAME=admin
MONGO_EXPRESS_AUTH_PASSWORD=password
Here's a sample of the Node.js connection code where I've added &directConnection=true
to the mongodb url that fix the problem.
import mongoose from "mongoose"
import dotenv from "dotenv"
dotenv.config()
export const db_connect = async () => {
console.log("Connecting to MongoDB...")
const db = await mongoose.connect(
`mongodb://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@${process.env.MONGO_HOST}:${process.env.MONGO_PORT}/${process.env.MONGO_DB_NAME}?authSource=admin&directConnection=true`
)
console.log("Connected to MongoDB")
}
db_connect()
Here's the complete Docker Compose file:
version: "3.9"
services:
mongodb:
image: bitnami/mongodb:latest
ports:
- "${MONGO_PORT}:${MONGO_PORT}"
environment:
MONGODB_ADVERTISED_HOSTNAME: ${MONGO_HOST}
MONGODB_ADVERTISED_PORT_NUMBER: ${MONGO_PORT}
MONGODB_PORT_NUMBER: ${MONGO_PORT}
MONGODB_ROOT_USER: ${MONGO_USER}
MONGODB_ROOT_PASSWORD: ${MONGO_PASSWORD}
MONGODB_REPLICA_SET_MODE: primary
MONGODB_REPLICA_SET_KEY: ${MONGO_SECONDARY_KEY}
volumes:
- ./database:/bitnami/mongodb
mongo-express:
image: mongo-express:latest
ports:
- "8081:8081"
environment:
ME_CONFIG_MONGODB_URL: mongodb://${MONGO_USER}:${MONGO_PASSWORD}@mongodb:${MONGO_PORT}
ME_CONFIG_BASICAUTH_USERNAME: ${MONGO_EXPRESS_AUTH_USERNAME}
ME_CONFIG_BASICAUTH_PASSWORD: ${MONGO_EXPRESS_AUTH_PASSWORD}
depends_on:
- mongodb
restart: unless-stopped
from charts.
Related Issues (20)
- [bitnami/mlflow] GCS storage for MLFow HOT 2
- [bitnami/postgresql-ha] Existing secret enforces key "postgres-password" even if user is postgres HOT 2
- [bitnami/redis] Can Redis provide a fixed external address for access
- [bitnami/redis] Can Redis provide a fixed external address for access HOT 2
- [bitnami/mongodb] Add client.pem in mongoDB chart with TLS enabled HOT 3
- tls.extraDnsNames is wrongly documented in values.yaml HOT 2
- [bitnami/common] Add a possibility to omit empty seLinuxOptions property from non-OpenShift environments HOT 1
- No documentation for upgrading to helm chart of version 22.x HOT 1
- [bitnami/mysql] Pod keeps being not ready and Mysqladmin tries to connect to `/tmp/mysql.sock` HOT 6
- [bitnami/postgresql] Helm pull failed but install works HOT 1
- Add extraHosts and hosts from extraRules to tls block of Ingress resource
- [bitnami/etcd] Etcd cronjob etcd-snapshotter is invalid HOT 1
- [bitnami/airflow] load dags initcontainer does not have resources section HOT 1
- [bitnami/redis-cluster] Allow to do Helm Upgrade without the `--set password=$REDIS_PASSWORD` HOT 2
- [bitnami/postgresql-ha] XX000: unable to get session context , Unable to create a database when connecting via Pgpool. HOT 2
- [bitnami/elasticsearch] ServiceAccount not getting added and creation of the wrong serviceaccount HOT 2
- [bitnami/keycloak] Keycloak Version 25.x.x and Metrics Exposure HOT 2
- [bitnami/mlflow] Allow setting resources for default init containers HOT 1
- [bitnami/zookeeper] Bitnami Support to onboard zookeeper into enterprise HOT 1
- UPGRADE FAILED: create: failed to create: Secret "sh.helm.release.v1.kube-prometheus.v3" is invalid: data: Too long: must have at most 1048576 bytes
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from charts.