How to add mongodb in nanobox boxfile.yml

56 Views Asked by At

I tried to config nanobox and aws. Follow https://guides.nanobox.io/ruby/rails/add-a-database/

but no document about: How to connect with mongodb in boxfile.yml

My App run in Rails 5, ruby 2.5 with Mongodb and try to use nanobox with aws.

Here what I have in boxfile.yml

run.config:
  engine: ruby

  extra_packages:
    - nodejs
    - pkgconf
    - libxml2
    - libxslt
1

There are 1 best solutions below

0
On

you simply add a mongodb component to your box file in this way:

run.config:
  engine: ruby

  extra_packages:
    - nodejs
    - pkgconf
    - libxml2
    - libxslt


data.mongodb:
  image: nanobox/mongodb:3.0

  # optional add some configs here
  config:
    objcheck: true
    log_verbosity: 'v'

you can use your components by using the DATA_DB_HOST, DATA_DB_USER and DATA_DB_PASS variables that nanobox generate for you. Usually, the database name is gonano.