Giter VIP home page Giter VIP logo

storage's Introduction

Storage

Build Status Codacy Badge codecov

File storage. Store large files.

Getting Started

On the server

Docker

Instructions how to start via docker.

Server

Build image, run container in background and connect to container.

docker build --rm -t coffeine/storage .
docker run -p 8080:8080 -d coffeine/storage
docker exec -it coffeine/virtuoso-api bash
Mongodb

Build image for mongo database.

cd config/db
docker build --rm -t coffeine/mongo .

Docker compose

Run all containers.

docker-compose up

Sharding

Config servers replica

Connect to [primary] container.

docker exec -it storage_mongodb_config_0_1 bash

Create replica set of config servers.

rs.initiate( {
   _id: "configSet",
   configsvr: true,
   members: [
      { _id: 0, host: "mongodb_config_0:27019" },
      { _id: 1, host: "mongodb_config_1:27019" },
      { _id: 2, host: "mongodb_config_2:27019" }
   ]
} )
Configure replication for each cluster

Connect to [primary] container.

docker exec -it storage_mongodb_0_0_1 bash

Configure replica set.

rs.initiate( {
    "_id" : "music-notes",
    "members" : [
        {
            "_id" : 0,
            "host" : "mongodb_0_0:27018"
        },
        {
            "_id" : 1,
            "host" : "mongodb_0_1:27018"
        },
        {
            "_id" : 2,
            "host" : "mongodb_0_2:27018"
        }
    ]
} )
Enable security

LogIn into router via mongo client into admin database.

docker exec -it storage_mongodb_1 bash
mongo admin
Create admin user.

Note: router servers,

db.createUser({
    user: 'root',
    pwd: 'toor',
    roles: [
        {
            role: 'userAdminAnyDatabase',
            db: 'admin'
        },
        {
            role: "clusterAdmin",
            db: "admin"
        }
    ]
})
Create user for app

Connect as admin.

mongo -u "root" -p "toor" --authenticationDatabase "admin" storage

Create user for app.

db.createUser({
    user: 'storage',
    pwd: 'storage',
    roles: [
        {
            role: 'readWrite',
            db: 'storage'
        }
    ]
})
Add shards.
sh.addShard( "music-notes/mongodb_0_0:27018,mongodb_0_1:27018,mongodb_0_2:27018" );
sh.addShard( "music-files/mongodb_1_0:27018,mongodb_1_1:27018,mongodb_1_2:27018" );
Enable database sharding
sh.enableSharding( "storage" )
sh.shardCollection( "storage.fs.chunks", { files_id : 1, n : 1 } )

Documentation

(Coming soon)

Examples

(Coming soon)

Contributing

(Coming soon)

Release History

(Nothing yet)

License

Copyright (c) 2017 Vitaliy Tsutsman [email protected]
Licensed under the MIT license.

storage's People

Contributors

coffeine-009 avatar ci-thecoffeine avatar

Watchers

James Cloos avatar  avatar Vitaliy Tsutsman avatar

storage's Issues

Cluster.

Investigate and implement mongodb cluster.

Replica

Investigate and implement mongodb replication.

Add tests.

Write tests for controller, service, validation.

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.