• Stars
    star
    322
  • Rank 130,376 (Top 3 %)
  • Language
    Shell
  • Created over 9 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Sync Remote and Local MongoDB Databases 🔥

mongo-sync

Sync Remote and Local MongoDB Databases in Bash. Works with Heroku too!

For all the Rubyists out there, I've converted this in to a Ruby Gem as well.

mongo-sync demo gif

Usage

  • Download / Clone the script

    git clone https://github.com/sheharyarn/mongo-sync.git
    cd mongo-sync
  • Edit config.yml and insert your configuration details

  • Use the script like this:

     ./mongo-sync push [options]		# Push DB to Remote
     ./mongo-sync pull [options]		# Pull DB to Local
  • Options

     -y  # Skip confirmation
     --config alternate-config-file.yml
    

Notes

  • mongo-sync requires mongodump and mongorestore binaries to be installed in your system. If you have mongodb installed, then you probably already have them
  • Pushing/Pulling overwrites the Target DB
  • It's a good idea to keep your config.yml in .gitignore if you're using it inside some other project

TODO

  • Add a --no-overwrite flag+feature that doesn't drop the target db before restoring it, and actually tries to sync it
  • Add a backup command and an --auto-backup feature
  • Add more options for Local DB in config.yml

Contributing

  1. Fork it
  2. Create your feature/fix branch (git checkout -b feature/my-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin feature/my-feature)
  5. Create a new Pull Request

License

Copyright (c) 2015 Sheharyar Naseer

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

memento

Simple + Powerful interface to the Mnesia Distributed Database 💾
Elixir
737
star
2

que

Simple Job Processing in Elixir with Mnesia ⚡
Elixir
668
star
3

dotfiles

📦 My Configs and Dotfiles
Shell
121
star
4

ecto_rut

Ecto Model shortcuts to make your life easier! 🎉
Elixir
112
star
5

cloudup.dev

Tools to jump-start development on the Cloud ☁️
JavaScript
106
star
6

better_params

Cleaner request parameters in Elixir web applications 🙌
Elixir
97
star
7

dbfs

Distributed Blockchain-based File Storage 📡
Elixir
63
star
8

capistrano-rake

Execute rake tasks on remote servers (Only Capistrano 3+)
Ruby
41
star
9

github-trending

A gem that fetches trending github repos
Ruby
40
star
10

ztd

Distributed real-time Todo App over RabbitMQ in Elixir 🐰⚡️🌐💧💻
Elixir
24
star
11

mongo-sync-ruby

A Ruby Gem for syncing local and remote Mongo Databases
Ruby
16
star
12

explay

Google Play API in Elixir 💻
Protocol Buffer
16
star
13

cipherjs

Javascript Implementation of simple Ciphers
JavaScript
12
star
14

collab

Details and ElixirConf talk: https://shyr.io/t/real-time-collab
Elixir
12
star
15

sheharyarn.github.io

My Blog
HTML
11
star
16

simple-phoenix-chat

Super simple implementation of Real-time chat in Elixir & Phoenix using WebSockets / Channels
Elixir
11
star
17

freelancer-leaderboard

Displays Freelancer Scavenger 2014 Leaderboard
Ruby
10
star
18

vncviewer

Simple utility to invoke VNC from shell in OSX
Shell
6
star
19

ex_utils

⚡ Collection of Awesome Elixir shortcuts and utilities ⚡
Elixir
6
star
20

werewolf.nvim

🔆🌑 Apply custom Neovim configs based on system theme
Lua
6
star
21

httpbin-node

Node.js implementation of httpbin
JavaScript
5
star
22

httpcodes.co

Quick Informational pages on HTTP Status Codes and HTTP Verbs
HTML
4
star
23

s3_direct_upload_example

Example RoR Application on using the s3_direct_upload gem
Ruby
4
star
24

etv

Ethereum Transaction Verifier
Elixir
2
star
25

dbfs-web

DBFS Web Client
JavaScript
2
star
26

geo-bounds

Axis-aligned geospatial bounded-boxes in Elixir
Elixir
2
star
27

zippy

DEPRECATED! - Zippy is a Ruby Program that downloads files from Zippyshare in your Terminal
Ruby
2
star
28

vertex

2
star
29

cm-test-solution

CareMerge Test Solution
JavaScript
1
star
30

daniyal.me

HTML
1
star
31

nustalumni-android

Android app for the NUST Alumni Association
Java
1
star
32

syklean-html

HTML Layout for the Syklean Octopress Theme
JavaScript
1
star
33

sparkrelay-android

Java
1
star
34

harisandhafsa

HTML
1
star
35

rmd-template

Rails 4 + Mongoid 4 + Devise Template
Ruby
1
star
36

ecto_atomized_map

Use Atom keys for Ecto Schema Maps ⚛️
Elixir
1
star
37

elixir-yaml

YAML Parser and Encoder for Elixir – WIP!
Elixir
1
star
38

ex_gun

Mailgun Integration in Elixir
Elixir
1
star