Coder Social home page Coder Social logo

codevachon / dokku-mongodb-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jeffutter/dokku-mongodb-plugin

0.0 2.0 0.0 159 KB

Plugin to setup Mongodb accounts for containers deployed to Dokku

License: GNU General Public License v2.0

Ruby 23.82% Shell 76.18%

dokku-mongodb-plugin's Introduction

![Gitter](https://badges.gitter.im/Join Chat.svg)

MongoDB plugin for Dokku

Plugin to setup Mongodb accounts for containers deployed to Dokku

Installation

git clone https://github.com/jeffutter/dokku-mongodb-plugin.git /var/lib/dokku/plugins/mongodb
dokku plugins-install

Commands

$ dokku help
    mongodb:console                 		        Launch an admin mongodb console
    mongodb:create <app> <database> 		        Create a Mongo database and optional params for app
    mongodb:delete <app> <database> 		        Delete specified Mongo database
    mongodb:dump <database> [-tar]                  Creates a binary export of the contents of database (-tar tarball dump)
    mongodb:link <app> <database>	       	        Set ENV variables for app if database exists
    mongodb:list                    		        List all databases
    mongodb:logs                    		        Show logs from MongoDB program
    mongodb:restore <database> <file-or dirname>    Restores the state of a database of a database exported with mongodb:dump
    mongodb:start                   		        Start the MongoDB docker container if it isn't running
    mongodb:status                  		        Shows status of MongoDB
    mongodb:stop                    		        Stop the MongoDB docker container

Simple usage

You need to have app running with the same name!

Create a new DB:

$ dokku mongodb:create foo            # Server side
$ ssh dokku@server mongodb:create foo # Client side

    {
        "_id" : ObjectId("524c90dc45addf0edad783a2"),
        "user" : "foo",
        "readOnly" : false,
        "pwd" : "825ec0deacccb3c6bb621d84153e5877"
    }

Now if you push your app again, you will have the following ENV variables:

MONGODB_DATABASE
MONGODB_HOST
MONGODB_PORT
MONGODB_USERNAME
MONGODB_PASSWORD
MONGO_URL
MONGO_URI

These can be found using:

dokku config appname

Persistence

The Mongo DB data is stored outside the container on the host at $DOKKU_ROOT/.mongodb/data. Inside the container, this location is bound to /tmp/mongo and will be there. Since the data is stored outside the container, it will persistent through container restarts, and also be available to future revisions of your container.

Backing up a database

mongodb:dump creates a backup of a whole database. The result can be optionally compressed in a gzipped tarball (tar.gz) by adding the -tar parameter after the database name. The dump is placed in the current directory and named <databasename>-<date and time>.
Example: dokku mongodb:dump api-production -tar

Restoring a database

mongodb:restore can be used to restore dump created with mongodb:dump (or mongodump which it uses internally). It can be used with a gzipped dump.
Example: dokku mongodb:restore api-production /path/to/dump/api-production-2015-03-09-16h54-43s.tar.gz

It can also be used with a database dumped to a folder (mongodb:dump without the -tarargument)
Example: dokku mongodb:restore api-production /path/to/dump/api-production-2015-03-09-16h54-43s/api-production/

This will drop the database and re-create it completely from the dump.

dokku-mongodb-plugin's People

Contributors

codevachon avatar crunchtime-ali avatar dommmel avatar dunckr avatar egdelwonk avatar ericrwolfe avatar erikthorselius avatar farmetha avatar florianheinemann avatar gitter-badger avatar igamid avatar jazzzz avatar jbking avatar jeffutter avatar markstos avatar metasansana avatar mxck avatar osiloke avatar steffenmllr avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.