-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
1,648 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,6 @@ examples/blog/log | |
*.o | ||
*.beam | ||
*.plt | ||
.rebar | ||
.rebar | ||
log*/ | ||
erl_crash.dump |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
PROJECT = blog | ||
|
||
include erlang.mk | ||
|
||
SHELL_PATH = -pa ebin -pa deps/*/ebin ../../ebin ../../deps/*/ebin | ||
SHELL_OPTS = -s sync -s blog -s lager -config config/blog.config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# About | ||
This is an escript that uses sumo_db (and the code in ./src) to implement a blog. | ||
|
||
It uses different repositories (mysql, mongo) just as an example and | ||
to make a point about how easy it is to switch or mix different databases. | ||
|
||
# Tour | ||
* Start by taking a rough look at **./run**, and then **src/blog.erl**. | ||
* Note how: | ||
* The business logic is handled directly in the "entities" modules | ||
(blog\_post, blog\_author, etc). | ||
* The **blog** module is the main entry point to the CRUD routines. | ||
* Along the code, you only interact very briefly (and simply) with the | ||
**sumo** module. | ||
* The impedance between db and entity representations is greatly | ||
diminished by a clear abstraction level. | ||
|
||
# How to run | ||
./run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
[ | ||
{sasl, [ | ||
{sasl_error_logger, {file, "log/sasl-error.log"}}, | ||
{errlog_type, error}, | ||
{error_logger_mf_dir, "log/sasl"}, % Log directory | ||
{error_logger_mf_maxbytes, 10485760}, % 10 MB max file size | ||
{error_logger_mf_maxfiles, 5} % 5 files max | ||
]}, | ||
{sumo_db, | ||
[ | ||
{storage_backends, | ||
[ | ||
{elasticsearch_backend, sumo_backend_elasticsearch, | ||
[ | ||
{host, "127.0.0.1"}, | ||
{port, 9200}, | ||
{index, "blog"}, | ||
{poolsize, 10} | ||
]} | ||
]}, | ||
{repositories, | ||
[ | ||
{elasticsearch_repo, sumo_repo_elasticsearch, | ||
[ | ||
{storage_backend, elasticsearch_backend}, | ||
{workers, 10} | ||
]} | ||
]}, | ||
{docs, | ||
[ | ||
{blog_post, elasticsearch_repo}, | ||
{blog_author, elasticsearch_repo}, | ||
{blog_reader, elasticsearch_repo}, | ||
{blog_vote, elasticsearch_repo} | ||
]}, | ||
{events, []} | ||
]}, | ||
{lager, | ||
[ | ||
{colored, true}, | ||
{async_threshold, 200}, | ||
{async_threshold_window, 5}, | ||
{error_logger_hwm, 500}, | ||
{handlers, | ||
[ | ||
{lager_console_backend, debug}, | ||
{lager_file_backend, | ||
[ | ||
{"log/lager_error.log", debug, 10485760, "$D0", 5}, | ||
{"log/lager_console.log", debug, 10485760, "$D0", 5} | ||
]} | ||
]} | ||
]} | ||
]. |
Oops, something went wrong.