Skip to content

Commit

Permalink
Merge pull request jwasham#8 from tinpee/master
Browse files Browse the repository at this point in the history
Add empty db folder, fix readme
  • Loading branch information
jwasham authored Oct 20, 2016
2 parents 89b56b4 + ed2d5dc commit 83335f9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,21 @@ __Make sure you already installed [docker](https://www.docker.com)__
__If you already had a backup file `cards.db`. Run following command:__
*Note: We don't need to rebuild image, just delete old container if you already built.*
`docker run -d -p 8000:8000 --name cs-flash-cards -v :<path_to_folder_contains_cards_db>:/src/db cs-flash-cards`
`<path_to_folder_contains_cards_db>`: is the full path contains `cards.db`
`docker run -d -p 8000:8000 --name cs-flash-cards -v :<path_to_folder_contains_cards_db>:/src/db cs-flash-cards`.
`<path_to_folder_contains_cards_db>`: is the full path contains `cards.db`.
Example: `/home/tinpee/cs-flash-cards/db`, and `cards.db` is inside this folder.
For convenient, if you don't have `cards.db`, this container will auto copy a new one from `cards-jwasham.db`. So you don't need to `initdb`
For convenient, if you don't have `cards.db`, this container will auto copy a new one from `cards-jwasham.db`. So you don't need to `initdb`.
__How to backup data ?__
### How to backup data ?
We just need store `cards.db` file, and don't need any sql command.
- If you run container with `-v <folder_db>:/src/db` just go to `folder_db` and store `cards.db` anywhere you want.
- Without `-v flag`. Type: `docker cp <name_of_container>:/src/db/cards.db /path/to/save`
__How to restore data ?__
### How to restore data ?
- Delete old container (not image): `docker rm cs-flash-cards`
- Build a new one with `-v flag`:
`docker run -d -p 8000:8000 --name cs-flash-cards -v :<path_to_folder_contains_cards_db>:/src/db cs-flash-cards`
`docker run -d -p 8000:8000 --name cs-flash-cards -v <path_to_folder_contains_cards_db>:/src/db cs-flash-cards`
- Voila :)
*Happy learning!*
Empty file added db/.gitkeep
Empty file.
1 change: 0 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash

if [ ! -f /src/db/cards.db ]; then
mkdir -p /src/db
cp cards-jwasham.db /src/db/cards.db
fi

Expand Down

0 comments on commit 83335f9

Please sign in to comment.