{"id":16738433,"url":"https://github.com/mrifat/d_boutique","last_synced_at":"2025-06-17T22:38:49.933Z","repository":{"id":48290459,"uuid":"229499117","full_name":"mrifat/d_boutique","owner":"mrifat","description":"A distributed in memory data store","archived":false,"fork":false,"pushed_at":"2021-08-03T04:36:04.000Z","size":34,"stargazers_count":1,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-05T06:27:21.618Z","etag":null,"topics":["distributed-storage","educational-project","elixir"],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrifat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-12-22T00:19:25.000Z","updated_at":"2022-03-03T18:36:50.000Z","dependencies_parsed_at":"2022-09-15T09:43:34.778Z","dependency_job_id":null,"html_url":"https://github.com/mrifat/d_boutique","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mrifat/d_boutique","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrifat%2Fd_boutique","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrifat%2Fd_boutique/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrifat%2Fd_boutique/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrifat%2Fd_boutique/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrifat","download_url":"https://codeload.github.com/mrifat/d_boutique/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrifat%2Fd_boutique/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260452763,"owners_count":23011542,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["distributed-storage","educational-project","elixir"],"created_at":"2024-10-13T00:30:44.700Z","updated_at":"2025-06-17T22:38:44.919Z","avatar_url":"https://github.com/mrifat.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# D-Boutique\nD-Boutique is a distributed key value store built in Elixir, it uses Erlang's [built-in term storage](https://erlang.org/doc/man/ets.html).\n\nD-Boutique was built as an attempt to understand how distributed systems works and to learn more about Elixir and Erlang ecosystem.\n\nD-Boutique is an umbrella project consisting of two supervised applications.\n\n## Getting Started\nSetup your machine with Erlang \u003csub\u003e\u003csup\u003e22.2\u003c/sup\u003e\u003c/sub\u003e and Elixir \u003csub\u003e\u003csup\u003e1.9.4\u003c/sup\u003e\u003c/sub\u003e.\n\nThe easiest way to do that is to use a universal language version manager, i.e: [asdf](https://github.com/asdf-vm/asdf).\n\n**OSX**\n```shell\n$\u003e brew install asdf\n\n$\u003e echo -e \"\\n. $(brew --prefix asdf)/asdf.sh\" \u003e\u003e ~/.bash_profile\n$\u003e echo -e \"\\n. $(brew --prefix asdf)/etc/bash_completion.d/asdf.bash\" \u003e\u003e ~/.bash_profile\n```\n\nErlang\n\n\u003csub\u003e\u003csup\u003e_You may encounter an SSL error, in that case please refer to [asdf-erlang](https://github.com/asdf-vm/asdf-erlang) for possible solution._\u003c/sup\u003e\u003c/sub\u003e\n```shell\n$\u003e asdf plugin-add erlang https://github.com/asdf-vm/asdf-erlang.git\n\n$\u003e brew install autoconf\n$\u003e asdf install erlang 22.2\n```\n\nElixir\n```shell\n$\u003e asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git\n$\u003e asdf install elixir 1.9.4\n```\n\n**Linux**\n\n```shell\n$\u003e git clone https://github.com/asdf-vm/asdf.git ~/.asdf\n\n$\u003e cd ~/.asdf\n$\u003e git checkout \"$(git describe --abbrev=0 --tags)\"\n\n$\u003e echo -e '\\n. $HOME/.asdf/asdf.sh' \u003e\u003e ~/.bashrc\n$\u003e echo -e '\\n. $HOME/.asdf/completions/asdf.bash' \u003e\u003e ~/.bashrc\n```\n\nErlang\n\n\u003csub\u003e\u003csup\u003e_Assumes you want a full installation of support packages, please refer to [asdf-erlang](https://github.com/asdf-vm/asdf-erlang) for more details._\u003c/sup\u003e\u003c/sub\u003e\n```shell\n$\u003e apt-get -y install build-essential autoconf m4 libncurses5-dev libwxgtk3.0-dev libgl1-mesa-dev libglu1-mesa-dev libpng-dev libssh-dev unixodbc-dev xsltproc fop\n$\u003e asdf install erlang 22.2\n```\n\nElixir\n```shell\n$\u003e apt-get -y install unzip\n$\u003e asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git\n$\u003e asdf install elixir 1.9.4\n    ```\n\n## Development Configuration\nAt its current state D-Boutique identifies the cluster by the computer name so you will want to change the `cluster_id` in `config/config.exs` to match your computer name.\n\n```shell\nconfig :boutique,\n  cluster_id: \"YOUR_COMPUTER_NAME\",\n  port: \"THE_PORT_NUMBER_YOU_WANT_TO_USE\"\n```\n\n## Running the Project\nGetting the dependencies and running the tests.\n```shell\n# Get the dependencies.\n$\u003e mix deps.get\n\n# Run tests\n$\u003e mix test\n```\n\nTo run the distributed tests you need to make sure that you have separate nodes started, each node is responsible for a range of data stores based on their\nbucket names, in the test environment the nodes are divided as:\n\u003e a..g node\n\u003e\n\u003e h..n node\n\u003e\n\u003e o..u node\n\u003e\n\u003e v..z node\n\n```shell\n# cd into boutique app\n$\u003e cd apps/boutique\n\n# start the first node\n$\u003e iex --sname a-g -S mix\n\n# start the second node\n$\u003e iex --sname h-n -S mix\n\n# start the third node\n$\u003e iex --sname o-u -S mix\n\n# start the fourth node from the umbrella root to start the TCP server\n$\u003e cd ../../\n$\u003e iex --sname v-z -S mix test --only distributed\n```\nIf you want to run the project on different computers,\nmake sure the computers are on the same network and have the same `~/.erlang.cookie` value.\n\nCheck Erlang's [epmd](http://erlang.org/doc/man/epmd.html) for more information.\n\nRunning the project in a  cluster:\n```shell\n# cd into boutique app\n$\u003e cd apps/boutique\n\n# start the first node\n$\u003e iex --sname a-g -S mix\n\n# start the second node\n$\u003e iex --sname h-n -S mix\n\n# start the third node\n$\u003e iex --sname o-u -S mix\n\n# start the fourth node from the umbrella root to start the TCP server\n$\u003e cd ../../\n$\u003e iex --sname v-z -S mix\n14:27:57.773 [info]  Accepting connections on port 4040\n```\n\nRunning the project in a single node, from the umbrella root, run:\n```shell\n$\u003e iex -S mix\n14:27:57.773 [info]  Accepting connections on port 4040\n```\n\nMaking requests\n```shell\n# Use telent or any similar application protocol to connect over the TCP server\n# feel free to have multiple telnet sessions to play around with.\n$\u003e telnet 127.0.0.1 4040 # or the port you have in your config.\n$\u003e CREATE shopping\nOK\n\n$\u003e PUT shopping milk 3\nOK\n\n$\u003e GET shopping milk\n3\nOK\n\n$\u003e DELETE shopping milk\nOK\n\n$\u003e ^]\ntelnet\u003e quit\nConnection closed.\n```\n\n## Documentation\nTo generate the documentation for the projects run:\n```shell\n$\u003e mix docs\n```\nDocumentation files are generated in `docs/`, open `docs/index.html` to read the API reference, or any module of interest.\n\n## Projects\n### Boutique\nThis project starts a supervision tree that handles creating and updating the state of data stores using Elixir [Agents](https://hexdocs.pm/elixir/Agent.html) and [GenServers](https://hexdocs.pm/elixir/GenServer.html).\n\n### Boutique Server\nA TCP Server, listens to a port until the port is available and get hold of the socket.\nOnce a client connection is established on the port it accepts it and proceeds to read the client requests and writes responses back.\n\n## Notes\nThis project was created for educational purposes only, I created it to learn more about distributed systems, the Elixir process life cycle, concurrency, and state mutation.\n\nCheck out Elixir's [Introduction to Mix](https://elixir-lang.org/getting-started/mix-otp/introduction-to-mix.html) for more information.\n\nDue the beam VM and OTP implementation, all nodes on the network can access any process in any other node on the cluster by default which is a security concern,\nin general communication between nodes should happen using SSL or any kind of encrypted messaging you'd like to use.\nErlang provides a powerful `:rpc` module that can be used for secure communication between nodes of a cluster. Currently this project does not use the `:rpc` module.\n\n## Useful Resources:\n- Learn You Some Erlang: Distribution chapter: [Distribunomicon](https://learnyousomeerlang.com/distribunomicon)\n- CAP Theorem: [Brewer's CAP Theorem](http://www.julianbrowne.com/article/brewers-cap-theorem)\n- You Can't Sacrifice [Partition Tolerance](https://codahale.com/you-cant-sacrifice-partition-tolerance/)\n- Processes in Elixir: [Process](https://hexdocs.pm/elixir/Process.html)\n- GenServers: [GenServer](https://hexdocs.pm/elixir/GenServer.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrifat%2Fd_boutique","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrifat%2Fd_boutique","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrifat%2Fd_boutique/lists"}