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
@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