https://github.com/launchscout/elixir-microservices-demo
https://github.com/launchscout/elixir-microservices-demo
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/launchscout/elixir-microservices-demo
- Owner: launchscout
- Created: 2020-06-16T13:36:18.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T09:04:20.000Z (over 3 years ago)
- Last Synced: 2024-04-13T07:10:37.169Z (over 2 years ago)
- Language: Elixir
- Homepage:
- Size: 1.7 MB
- Stars: 1
- Watchers: 24
- Forks: 1
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ELixir Microservices Demo
This repo consists of three Elixir apps that implement a simple inventory
application using the microservices architecture. One server manages
authentication, another the products and the last the User Interface.
## Setup
In each of the subdirectories of this repo, run the following:
```sh
asdf install
mix deps.get
mix ecto.setup
```
In the web_server directory only:
```sh
cd assets && npm install
```
Finally, create this file `web_server/config/dev.secret.exs` with this content:
```elixir
use Mix.Config
config :web_server, WebServerWeb.Authentication,
issuer: "web_server",
secret_key: "replace-me-with-a-random-string"
config :web_server, WebServerWeb.Endpoint, server: true
```
And create this file `web_server/config/prod.secret.exs` with this content:
```elixir
use Mix.Config
config :web_server, WebServerWeb.Authentication,
issuer: "web_server",
secret_key: "replace-me-with-a-random-string"
config :web_server, WebServerWeb.Endpoint,
http: [
port: String.to_integer(System.get_env("PORT") || "4000"),
transport_options: [socket_opts: [:inet6]]
],
secret_key_base: "replace-me-with-a-random-string"
config :web_server, WebServerWeb.Endpoint, server: true
```
## Demo
To run the demo, run the following in separate terminals:
```sh
cd auth_server
iex --name auth_server@127.0.0.1 -S mix
```
```sh
cd product_server
iex --name product_server@127.0.0.1 -S mix
```
```sh
cd web_server
iex --name web_server@127.0.0.1 -S mix phx.server
```
Once all apps are started: `open http://localhost:4000`