Skip to content

Commit 691c984

Browse files
Update docu (#1147)
* Update documentation * test * improve activate disabled characters docu * Requested changes * requested changes 2 --------- Co-authored-by: Nicolás Sanchez <[email protected]>
1 parent c9b2d40 commit 691c984

File tree

1 file changed

+67
-26
lines changed

1 file changed

+67
-26
lines changed

README.md

Lines changed: 67 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,90 +3,131 @@ Mirra Backend is an umbrella project that contains several apps within it.
33

44
The objective is to split the project into multiple applications (modules) based on their responsibilities. This will allow us to add decoupled modules that can be used together without having a dependency between them.
55

6-
## Requirements
6+
## Setup Guide
7+
8+
This guide will help you install the necessary tools and run the backend services for the Mirra project.
9+
10+
## 1. Install Nix
11+
12+
Run the following command in the terminal:
713

8-
- **Nix:**
9-
You can install the Nix package manager by running the following command in your terminal:
1014
```bash
1115
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
1216
```
1317

14-
The installer will ask you for the sudo password, and then print the details about what steps it will perform to install Nix. You have to accept this to proceed with the installation.
18+
The installer will ask you for the sudo password, and then print the details about what steps it will perform to install Nix. You have to accept this to proceed with the installation
1519

1620
Make sure there weren't any errors during the installation and, if there are none, close the shell and start a new one.
1721

1822
To test if Nix generally works, just run GNU hello or any other package:
23+
1924
```bash
2025
nix run nixpkgs#hello
26+
```
27+
28+
If you see:
29+
30+
```bash
2131
> Hello, world!
2232
```
2333

24-
For a more detailed explanation, visit the [Nixcademy installation guide](https://nixcademy.com/2024/01/15/nix-on-macos/).
34+
Then Nix has been installed correctly. For more details, check the [Nixcademy installation guide](https://nixcademy.com).
35+
36+
## 2. Install Devenv
2537

26-
- **Devenv:**
38+
Nix MUST be installed before devenv (devenv depends on nix).
39+
The following command installs devenv:
2740

28-
After installing Nix, run the following command to install devenv:
2941
```bash
3042
nix-env -if https://install.devenv.sh/latest
3143
```
3244

3345
For devenv to manage caches for you, add yourself to trusted-users in nix conf:
46+
3447
```bash
35-
# Log in as super user first
3648
sudo su -
37-
# Open config file using Vim
3849
vim /etc/nix/nix.custom.conf
39-
# Add the users you want to use nix store to nix.custom.conf file
40-
# Press 'i' to write stuff in file using vim (insert mode).
41-
# Press 'esc' (exit insert mode) then type ':wq' to save changes.
50+
```
51+
52+
Inside Vim, press `i` to edit and add the following line, replacing `your-user` with your actual username:
53+
54+
```bash
4255
trusted-users = root your-user
43-
# If you don't know your user, you can type the following in a terminal:
56+
```
57+
58+
59+
Save and exit Vim (`Esc`, then `:wq` and Enter).
60+
61+
- If you don't know your user, you can type the following in a terminal:
62+
63+
```bash
4464
whoami
45-
# Restart nix-daemon
65+
```
66+
67+
Then after you're done with Vim, You have to restart the nix-daemon
68+
69+
```bash
4670
sudo launchctl kickstart -k system/systems.determinate.nix-daemon
4771
```
4872

49-
Clone the repo:
73+
## 3. Clone the repository
74+
5075
```bash
5176
git clone https://github.com/lambdaclass/mirra_backend.git
5277
```
5378

54-
Install the last elixir package manager inside the repo folder and devenv shell:
79+
## 4. Install the Elixir package manager
80+
5581
```bash
5682
cd mirra_backend
5783
devenv shell
5884
mix archive.install github hexpm/hex branch latest
5985
```
6086

61-
- **Protobuf:**
62-
To serialize our websocket messages, we use Protobuf.
63-
Install running:
87+
## 5. Install Protobuf
88+
89+
Protobuf is used to serialize WebSocket messages. Install it with:
90+
6491
```bash
6592
brew install protobuf
66-
mix escript.install hex protobuf # Remember to add escripts folder to your $PATH. This step is not needed if you use devenv.
67-
# JS protobuf for game_client app.
93+
mix escript.install hex protobuf
94+
```
95+
96+
⚠️ **Note:** If you used `brew`, add the `escripts` folder to your `$PATH` (follow the instructions after installation).
97+
98+
## 6. Install JS Protobuf for the client
99+
100+
```bash
68101
cd assets
69102
npm install google-protobuf
70103
npm install -g protoc-gen-js
104+
cd ..
71105
```
72106

73-
## Start applications
107+
## 7. Start the applications
74108

75109
To build and run all the applications, run the following command:
110+
111+
From `mirra_backend/` folder, run:
112+
76113
```bash
77114
devenv up
78115
```
79-
Then navigate to the following link to start a game: http://localhost:3000/
80-
81116

82117
If you want to have access to the Elixir console, instead do:
118+
83119
```bash
84120
devenv shell postgres
85-
# Then in another terminal:
121+
```
122+
123+
Then in another terminal:
124+
125+
```bash
86126
devenv shell
87127
make start
88128
```
89-
_Note you need to have ran `devenv up` earlier._
129+
130+
⚠️ **Note:** Make sure you’ve run `devenv up` at least once before executing these commands.
90131

91132
## Applications
92133

0 commit comments

Comments
 (0)