Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to use MongoDB 2.6.x on CircleCI (circle.yml)
dependencies:
cache_directories:
- mongodb-linux-x86_64-2.6.4
pre:
- if [[ ! -d mongodb-linux-x86_64-2.6.4 ]]; then wget http://downloads.mongodb.org/linux/mongodb-linux-x86_64-2.6.4.tgz && tar xvzf mongodb-linux-x86_64-2.6.4.tgz; fi
- sudo /etc/init.d/mongodb stop
- sudo cp mongodb-linux-x86_64-2.6.4/bin/* /usr/bin
- sudo /etc/init.d/mongodb start
@donnykurnia

This comment has been minimized.

Copy link

@donnykurnia donnykurnia commented Jul 5, 2015

thanks..

@nick13jaremek

This comment has been minimized.

Copy link

@nick13jaremek nick13jaremek commented Jul 31, 2015

Thank you very much for this! Really helpful :_)

@dsernst

This comment has been minimized.

Copy link

@dsernst dsernst commented Oct 6, 2015

👍

@orcaman

This comment has been minimized.

Copy link

@orcaman orcaman commented Nov 27, 2015

I think they also have mongodb included, so you don't have to actually download and install it yourself Simply set this in your circle.yml file:

machine:
  services:
    - mongodb
@evuez

This comment has been minimized.

Copy link

@evuez evuez commented Dec 1, 2015

@orcaman It is indeed included but it's an older version, so you don't have stuff like text search.

@dylanjha

This comment has been minimized.

Copy link

@dylanjha dylanjha commented Dec 4, 2015

how can mongo 3.0.x be run on Circle ci?

@jarthod

This comment has been minimized.

Copy link

@jarthod jarthod commented Dec 19, 2015

Here is a mongodb 3.2 version:

  cache_directories:
    - mongodb-linux-x86_64-ubuntu1204-3.2.0
  pre:
    - if [[ ! -d mongodb-linux-x86_64-ubuntu1204-3.2.0 ]]; then wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1204-3.2.0.tgz && tar xvzf mongodb-linux-x86_64-ubuntu1204-3.2.0.tgz; fi
    - sudo stop mongodb
    - sudo cp mongodb-linux-x86_64-ubuntu1204-3.2.0/bin/* /usr/bin
    - sudo start mongodb
@Aeron

This comment has been minimized.

Copy link

@Aeron Aeron commented Mar 4, 2016

It may be a bit tricky when you’re deploying via AWS CodeDeploy, because everything that will be put in current directory and declared as cache will also be included/bundled in ZIP archive that will be placed on S3 for further deploy. So you easily will get extra 200 MB in size.

To avoid such issues, it is better to download, unarchive and cache everything on one level higher, in /home/ubuntu directory. Just use simple ../directory with proper command arguments:

dependencies:
  cache_directories:
    - ../mongodb-linux-x86_64-ubuntu1204-3.2.3
  pre:
    - if [[ ! -d ../mongodb-linux-x86_64-ubuntu1204-3.2.3 ]]; then wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1204-3.2.3.tgz -P ../ && tar xvzf ../mongodb-linux-x86_64-ubuntu1204-3.2.3.tgz -C ../; fi
    - sudo stop mongodb
    - sudo cp ../mongodb-linux-x86_64-ubuntu1204-3.2.3/bin/* /usr/bin
    - sudo start mongodb
    - pip install asynctest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment