Hello everyone, I am getting error in self hosting...
# ask-questions
j
Hello everyone, I am getting error in self hosting part when I am sending config.yml file for mysql connection. 2024-02-14 165142 growthbook-1 | {"level":50,"time":1707909702995,"pid":58,"hostname":"c8e52db7dc35","err":{"type":"MongooseServerSelectionError","message":"connect ECONNREFUSED 127.0.0.1:27017","stack":"MongooseServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017\n at Connection.openUri (/usr/local/src/app/node_modules/mongoose/lib/connection.js82532)\n at /usr/local/src/app/node_modules/mongoose/lib/index.js41410\n at /usr/local/src/app/node_modules/mongoose/lib/helpers/promiseOrCallback.js415\n at Promise._execute (/usr/local/src/app/node_modules/bluebird/js/release/debuggability.js3849)\n at Promise._resolveFromExecutor (/usr/local/src/app/node_modules/bluebird/js/release/promise.js51818)\n at new Promise (/usr/local/src/app/node_modules/bluebird/js/release/promise.js10310)\n at promiseOrCallback (/usr/local/src/app/node_modules/mongoose/lib/helpers/promiseOrCallback.js4010)\n at Mongoose._promiseOrCallback (/usr/local/src/app/node_modules/mongoose/lib/index.js128810)\n at Mongoose.connect (/usr/local/src/app/node_modules/mongoose/lib/index.js41320)\n at /usr/local/src/app/packages/back-end/dist/init/mongo.js5038\n at Generator.throw (<anonymous>)\n at rejected (/usr/local/src/app/packages/back-end/dist/init/mongo.js665)","reason":{"type":"Unknown","servers":{},"stale":false,"compatible":true,"heartbeatFrequencyMS":10000,"localThresholdMS":15,"setName":null,"maxElectionId":null,"maxSetVersion":null,"commonWireVersion":0,"logicalSessionTimeoutMinutes":null}},"msg":"Failed to connect to MongoDB after retrying"} 2024-02-14 165142 growthbook-1 | {"level":50,"time":1707909702996,"pid":58,"hostname":"c8e52db7dc35","err":{"type":"Error","message":"MongoDB connection error.","stack":"Error: MongoDB connection error.\n at /usr/local/src/app/packages/back-end/dist/init/mongo.js5419\n at Generator.throw (<anonymous>)\n at rejected (/usr/local/src/app/packages/back-end/dist/init/mongo.js665)"},"msg":"Failed to initialize application"}
f
"MongoDB connection error"
can you check that you have Mongo or a DocumentDB running?
and then check the connection string
you can verify it works with Mongo Compass if you like
j
version: "3" services: mysql: image: mysql:latest environment: - MYSQL_ROOT_PASSWORD=password volumes: - mysqldata:/var/lib/mysql growthbook: build: context: . dockerfile: Dockerfile ports: - "4000:3000" - "4100:3100" depends_on: - mysql environment: - MYSQL_HOST=mysql - MYSQL_PORT=3306 - MYSQL_DATABASE=growthbook - MYSQL_USER=root - MYSQL_PASSWORD=password - APP_ORIGIN=http://localhost:4000 - API_HOST=http://localhost:4100 - CACHE_ENGINE=redis - CACHE_CONNECTION_URL=redis://localhost:6379 - CACHE_STALE_TTL=5 - CACHE_EXPIRES_TTL=5 volumes: - uploads:/usr/local/src/app/packages/back-end/uploads volumes: uploads: mysqldata: but I am using mysql, why its trying to connect with mongo?
f
GrowthBook requires a nosql db to work for its own internal db
j
mysql db is also running.
f
where you store your data is separate
looks like mongo is running- but sounds like you have to set the connection string
correctly
j
# docker-compose.yml version: "3" services: mongo: image: "mongo:latest" environment: - MONGO_INITDB_ROOT_USERNAME=root - MONGO_INITDB_ROOT_PASSWORD=password volumes: - mongodata:/data/db growthbook: # image: "growthbook/growthbook:latest" build: context: . dockerfile: Dockerfile ports: - "4000:3000" - "4100:3100" depends_on: - mongo environment: - MONGODB_URI=mongodb://root:password@mongo:27017/growthbook?authSource=admin - APP_ORIGIN=http://localhost:4000 - API_HOST=http://localhost:4100 - CACHE_ENGINE:"redis" - CACHE_CONNECTION_URL:"redis://localhost:6379" - CACHE_STALE_TTL:5 - CACHE_EXPIRES_TTL:5 volumes: - uploads:/usr/local/src/app/packages/back-end/uploads volumes: uploads: mongodata: like this?
f
I think so
you can also double check that connection info for Mongo from CLI or Compass
j
It works fine if i send like above, but when I try sending the config.yml file it breaks. trying to follow this approach for MySQL connection. https://docs.growthbook.io/self-host/config#redshift-clickhouse-postgres-and-mysql-or-mariadb config.yml datasources: warehouse: type: mysql name: Main Warehouse # Connection params (different for each type of data source) params: host: localhost port: 3306 user: root password: password # use env for secrets database: growthbook # How to query the data (same for all SQL sources) settings: userIdTypes: - userIdType: user_id description: Logged-in user id - userIdType: anonymous_id description: Anonymous visitor id queries: exposure: - id: user_id name: Logged-in user experiments userIdType: user_id query: > SELECT user_id, received_at as timestamp, experiment_id, variation_id, context_location_country as country FROM experiment_viewed dimensions: - country identityJoins: - ids: ["user_id", "anonymous_id"] query: SELECT user_id, anonymous_id FROM identifies metrics: signups: type: binomial name: Sign Ups userIdType: user_id datasource: warehouse sql: SELECT user_id, anonymous_id, received_at as timestamp FROM signups dimensions: country: name: Country userIdType: user_id datasource: warehouse sql: SELECT user_id, country as value from users segments: visitors: name: Visitors in the US datasource: warehouse sql: |- SELECT userid as user_id, timestamp as date FROM users WHERE country='US' userIdType: user_id
q
Is there a way we can disable register option and have that open only for invites ?
f
Hi
do you mean for account registration?
within GrowthBook? you can disable automatic joining - and have it let you manually approve/reject users
q
Are you referring to open source version ?
f
You tell me- I was trying to guess more details about your request
q
I am referring to open source version
We would not like to have registration by default rather only on invite
f
Do you use SSO?
q
Do we have sso for open source version ?
f
It’s available as a paid feature. It seems we don’t have that option on the open source version- but it wouldn’t be hard to add- can you open a GitHub issue for this?
👍 1
q
You mean SSO or the other ask ?
f
Disabling registration
👍 1
It would be a quick project
q
Sure thanks