First, add the server as remote branch.
git remote add deploy [email protected]:/var/app/commonbike
Now choose: where do you want to deploy?
-
To the test environment, test.common.bike?
git push deploy branch-you-want-to-deploy:develop
-
To production, common.bike?
git push deploy branch-you-want-to-deploy:master
Wait a few minutes before the branch is fully deployed. Result: a new deployment!
There are two ways.
You can create a backup of a MongoDB deployment by making a copy of MongoDB’s underlying data files (docs).
So, to backup the mongo db:
rsync -avz [email protected]:/usr/share/commonbike_mdb ~/backup-mongodb
So, to restore the mongo db:
rsync -avz ~/backup-mongodb/commonbike_mdb/* [email protected]:~/backup-mongodb
NOTE: Since copying multiple files is not an atomic operation, you must stop all writes to the mongod before copying the files.
An easy way to do mongodb backups on the server is using [mongodump](https://docs.mongodb.com/manual/reference/program/mongodump/#bin.mongodump)
and [mongorestore](https://docs.mongodb.com/manual/reference/program/mongorestore/#bin.mongorestore)
.
First log in to the server:
ssh [email protected] -C
Log in into the Docker container used for mongo:
docker exec -it deploy_db_1 bash
Backup the database:
mongodump -h 127.0.0.1 --port 27017 --out /data/backup/20180101 -d commonbike
If you want to restore the database in a later stage:
mongorestore -h 127.0.0.1 --port 27017 /data/backup/20180101 -d commonbike