File storage. Store large files.
Instructions how to start via docker.
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
Build image for mongo database.
cd config/db
docker build --rm -t coffeine/mongo .
Run all containers.
docker-compose up
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" }
]
} )
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"
}
]
} )
LogIn into router via mongo client into admin database.
docker exec -it storage_mongodb_1 bash
mongo admin
Note: router servers,
db.createUser({
user: 'root',
pwd: 'toor',
roles: [
{
role: 'userAdminAnyDatabase',
db: 'admin'
},
{
role: "clusterAdmin",
db: "admin"
}
]
})
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'
}
]
})
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" );
sh.enableSharding( "storage" )
sh.shardCollection( "storage.fs.chunks", { files_id : 1, n : 1 } )
(Coming soon)
(Coming soon)
(Coming soon)
(Nothing yet)
Copyright (c) 2017 Vitaliy Tsutsman [email protected]
Licensed under the MIT license.