Skip to content

Instantly share code, notes, and snippets.

@masatomo
Last active February 28, 2018 08:49
Show Gist options
  • Star 17 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masatomo/983a84bad9671dc29213 to your computer and use it in GitHub Desktop.
Save masatomo/983a84bad9671dc29213 to your computer and use it in GitHub Desktop.
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
Copy link

thanks..

@nick13jaremek
Copy link

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

@dsernst
Copy link

dsernst commented Oct 6, 2015

👍

@orcaman
Copy link

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
Copy link

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
Copy link

dylanjha commented Dec 4, 2015

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

@jarthod
Copy link

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
Copy link

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