Skip to content

Commit

Permalink
git: Merge branch 'main' into branch 'CleanUp-host2'
Browse files Browse the repository at this point in the history
  • Loading branch information
heysokam committed Jan 8, 2024
1 parent 9cdfda2 commit 2acf03f
Show file tree
Hide file tree
Showing 106 changed files with 1,870 additions and 1,876 deletions.
3 changes: 1 addition & 2 deletions docs/manual/04_host/00_intro.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Hosting Manual
Learn how to host your own Ethereal Engine worlds.

_This page will contain an introduction to the Hosting Manual._
<!-- TODO: This page will contain an introduction to the Hosting Manual. -->
104 changes: 54 additions & 50 deletions docs/manual/04_host/01_installation/00_intro.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,52 @@
import CloneInstructions from '../_partials/cloneInstructions.md'
import AcceptCertificates from '../_partials/acceptCertificates.md'

# Installation

Getting up and running requires just a few steps, but this can be tricky,
depending on your platform and current environment. Please follow the directions
for your environment.
Getting up and running requires just a few steps, but this can be tricky, depending on your platform and current environment.
Please follow the directions for your specific environment.

## Pre-Install Checklist
- [ ] Ensure you have at least 16GB of RAM - you may run into issues running the full development setup with less
- [ ] Clone the repository to a location whose path __contains no spaces__.
- [ ] Install Node.js 16 or 18 (earlier versions not guaranteed to work)
- [ ] Install Python >=3.6 + [PIP](https://pypi.org/project/pip/), C++, and other build tools.
See the [Mediasoup install instructions](https://mediasoup.org/documentation/v3/mediasoup/installation/) for full details.
- [ ] Install Docker
_(Optionally)_ If you're NOT using docker, install MariaDB, Redis and MinIO manually and update repo's `.env.local` accordingly.
1. Ensure you have at least 16GB of RAM
_You may run int issues running the full development setup with less_
2. Clone the repository to a location whose path **contains no spaces**.
3. Install Node.js 18
_(versions earlier than 16 are not guaranteed to work)_
4. Install Python >=3.6, [PIP](https://pypi.org/project/pip/), C++, and other build tools
_See the [Mediasoup install instructions](https://mediasoup.org/documentation/v3/mediasoup/installation/) for full details._
5. Install Docker
_Optionally: If you're NOT using docker, install MariaDB, Redis and MinIO manually and update repo's `.env.local` accordingly._

You should now be ready to follow the [Quick Start](#quick-start) instructions.

### Clone the repository
A lot has changed during development, and our monorepo has gotten quite large.
To avoid cloning the entire thing, use this command:
```
git clone https://github.com/etherealengine/etherealengine --depth 1
```
A lot has changed during development, and our monorepo has gotten quite large.
To avoid cloning everything, use this command:

<CloneInstructions />

### Ensure you are running Node 16 or 18
The engine to date has only been confirmed to work perfectly with Node 16.x and 18.x. Earlier or later major versions
are not guaranteed to work properly.
### Ensure you are running Node 18
The engine to date has only been confirmed to work with Node 16.x and 18.x.
Earlier or later major versions are not guaranteed to work properly.

A version manager can be helpful for this:
- NodeJS only: [NVM](https://github.com/nvm-sh/nvm)
- Polyglot: [ASDF](https://github.com/asdf-vm/asdf)
The best way to install and manage Node.js versions is by using a version manager:
1. Install [NVM](https://github.com/nvm-sh/nvm)
2. Install Node.js 18 with `nvm install 18`
3. _(Optional)_ Make Node.js 18 your default node version with `nvm alias default 18`

Before running the engine, please check `node --version`
If you are using a node version below 16, please update or nothing will work.
You will know you are having issues if you try to install at root and are
getting dependency errors.
_Note: Polyglot [ASDF](https://github.com/asdf-vm/asdf) can also be used for managing node versions._

Please check the output of `node --version` before running the engine.
If you are using a node version below 16, please update or nothing will work.
You will know that you are having issues if you try to install packages at root with `npm install` and you get package dependency errors.

### Docker is your friend
You don't need to use [Docker](https://docs.docker.com/), but it will make your life much easier.
If you don't wish to use Docker, you will need to setup mariadb and redis on your machine. You can find credentials in `/scripts/docker-compose.yml`

## Quick Start
If you are lucky, this will just work. However, you may encounter some issues. Make sure you are running Node 16, and check your dependencies.
If you are lucky, this will just work. However, you may encounter some issues.
Make sure you are running Node 18, and check your dependencies.
```
cd path/to/etherealengine
cp .env.local.default .env.local
Expand All @@ -49,44 +55,42 @@ npm run dev-docker
npm run dev-reinit
npm run dev
```
Now run Ethereal Engine in browser by navigating to [this link](https://127.0.0.1:3000/location/default).
Now run Ethereal Engine in your browser by navigating to [this link](https://localhost:3000/location/default).

### Accept Certificates
You'll have to tell your browser to ignore the insecure connections when you try to load the website.
1. If it keeps displaying 'loading routes' progress for a long time, it is due to the fact that you have to allow certificates.
2. Open Developer tools in your browser by clicking the side menu with three dots, then `More tools > Developer tools` (or use `Ctrl+Shift+I`) and then go to the 'Console' tab.
3. You will see some errors in URL address starting with 'wss'. Replace 'wss' with 'https' and open it in new tab. Accept the certificate and reload your Ethereal Engine tab.
4. You will see some errors in URL address starting with 'https://localhost:9000'. Open of the that URL and accept the certificate afterwards reload your Ethereal Engine tab.
<AcceptCertificates />

### Admin System and User Setup
You can administrate many features from the admin panel at https://localhost:3000/admin

To make a user an admin, open a page and open the profile menu. There is a button labelled `Show User ID`
which opens a text field with your userId. Paste it in and run the following command in
your terminal:

`npm run make-user-admin -- --id={COPIED_USER_ID}`

Example:
`npm run make-user-admin -- --id=c06b0210-453e-11ec-afc3-c57a57eeb1ac`
You can administrate many features from the admin panel found at the `/admin` route of your deployment.
_eg: `https://localhost:3000/admin` when working in a local deployment._

To give administration rights to a user:
- Open any page in your Ethereal Engine deployment
- Open the user menu _(icon at the top-right of the screen)_
- Click on `Show API key`
- Copy that key to your clipboard _(note: there is an icon to the right of this box for this purpose)_
- Open a terminal and go to the folder where EtherealEngine was cloned.
- Run the command `npm run make-user-admin -- --id={COPIED_USER_ID}` where `COPIED_USER_ID` is the key you just copied on the previous step.
Example: `npm run make-user-admin -- --id=c06b0210-453e-11ec-afc3-c57a57eeb1ac`

![image](./images/userid.png)

#### Alternate Method:
Look up in User table and change userRole to 'admin'
(It helps to use a graphical database explorer, we recommend [beekeeperstudio.io](https://beekeeperstudio.io/))
> Alternate Method:
> Open the `User` table of your deployment's database and change `userRole` to `admin`
_(It helps to use a graphical database explorer, we recommend [beekeeperstudio.io](https://beekeeperstudio.io/))_
The location of the database can be found in your `.env.local` file.

Test user Admin privileges by going to `/admin`
Test user Admin privileges by going to the `/admin` route of your deployment.


## Advanced Installation and Troubleshooting
If you run into any trouble with the Quick Start instructions:
- Please make sure you've followed the
[Mediasoup installation instructions](https://mediasoup.org/documentation/v3/mediasoup/installation/)
- Check your OS-specific instructions:
- [Installing on Windows (10+)](3_windows.md)
- [Installing on Mac OS X](2_mac_os_x.md)
- [Installation Troubleshooting](6_install_troubleshooting.md)
- [Advanced Setup](4_advanced_setup.md)
- [Installing on Windows (10+)](./02_windows.md)
- [Installing on Mac OS X](./01_macOSX.md)
- [Installation Troubleshooting](./06_troubleshooting.md)
- [Advanced Setup](./04_advancedSetup.md)
- [Vite dev server is stalling](https://vitejs.dev/guide/troubleshooting.html#dev-server)

61 changes: 25 additions & 36 deletions docs/manual/04_host/01_installation/01_macOSX.md
Original file line number Diff line number Diff line change
@@ -1,57 +1,46 @@
# Installing on Mac OS X

1. Go to the root and run

```
1. Go to the root folder where Ethereal Engine is stored and run
```bash
npm install
npm run dev-docker
npm run dev-reinit
```
Or if you are on a M1 based Mac:
```bash
# Recommended
1. Duplicate the Terminal app, and configure it to run in Rosetta
2. Run the above commands in Rosetta Terminal

Or if you are on a M1 based Mac

(Recommended)
1) Duplicate the Terminal app, and configure it to run in Rosetta
2) Run the above in Rosetta Terminal

(Not recommended)
```
# Not recommended
yarn install
```
> _`node-darwin` sometimes doesn't get installed properly On Apple chips. Using yarn fixes this issue._
This is because on Apple chips the node-darwin sometimes doesn't get installed
properly and by using yarn it fixes the issue.

2. Have docker started in the background and then in the terminal type

```
2. Start docker in the background and then run:
```bash
npm run dev
```
This will open the MariaDB and SQL scripts on the docker and will start the servers

This will open the mariaDB and SQL scripts on the docker and will start the servers
3. To make sure your environment is set and running properly go to:
https://localhost:3000/location/default
You should be able to walk around an empty 3D scene.

3. To make sure your environment is set and running properly just go to
https://localhost:3000/location/default and you should be able to walk around an empty 3D scene

```
Note : Make sure you are on Node >= 16 and have docker running.
```
> _Note: Make sure you are on Node.js >= 18 and have docker running._
## Troubleshooting Mac

* If you find issues on your terminal that says that access-denied for user
`server@localhost` then you can use this command

```
- If you find issues on your terminal saying
`access-denied for user server@localhost`
then you can use this command:
```bash
brew services stop mysql
```

* If you find issue on your terminal that says
`An unexpected error occurred: "expected workspace package`
while using yarn then you can use this command in your terminal

```
- If you find issues on your terminal saying
`An unexpected error occurred: "expected workspace package`
while using yarn then you can use this command
```bash
yarn policies set-version 1.18.0
```

As yarn > 1.18 sometimes doesn't work properly with lerna.
> _Note: This happens because yarn > 1.18 sometimes doesn't work properly with `lerna`_
31 changes: 16 additions & 15 deletions docs/manual/04_host/01_installation/02_windows.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
# Installing on Windows 10+
1. Install python 3 and add python installation directory path to 'PATH' env variable.
2. Install node js
3. Install Visual studio community edition with build tools.
> Note: If mediasoup is not installed properly then modify Visual studio setup to add c++ and Node.js support.
4. Add path of MSbuild.exe (which is present in visual studio folder) into 'path' env variable (for example:` C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin`)
5. Make sure to install all windows prerequisites for mediasoup as mentioned on: [https://mediasoup.org/documentation/v3/mediasoup/installation/#windows](https://mediasoup.org/documentation/v3/mediasoup/installation/#windows)
6. Install all dependencies using `npm i`.
7. If error persists then check for typos in environment variables.
8. If you are on Windows, you can use docker-compose to start the `scripts/docker-compose.yml` file, or install mariadb and copy credentials (database name, username, password) from docker-compose or `.env.local` -- you will need to create an empty database with the matching name.
1. Install Python 3 and add python installation directory path to `PATH` env variable.
2. Install Node.js 18
3. Install Visual Studio Community Edition with build tools.
> Note: If mediasoup is not installed properly then modify Visual studio setup to add c++ and Node.js support.
4. Add the path to `MSbuild.exe` _(which stored in Visual Studio's folder)_ into the `PATH` env variable
_eg: `C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin`_
5. Make sure to install all windows prerequisites for Mediasoup as mentioned on: [https://mediasoup.org/documentation/v3/mediasoup/installation/#windows](https://mediasoup.org/documentation/v3/mediasoup/installation/#windows)
6. Install all dependencies using `npm install` from the root folder where you cloned Ethereal Engine.

`./start-db.sh` only needs to be run once. If the docker image has stopped, start it again with:
> Troubleshooting:
```
docker container start etherealengine_db
```
> 7. If the error persists: Check for typos in your environment variables.
8. Check your WSL config for any incorrect networking settings.
https://docs.microsoft.com/en-us/windows/wsl/wsl-config#network
> 8. _(Optional):_ you can use `docker-compose` to start the `scripts/docker-compose.yml` file, or install MariaDB and copy the credentials _(database name, username, password)_ from docker-compose or `.env.local`. You will need to create an empty database with the matching name.
> Note: `./start-db.sh` only needs to be run once. If the docker image has stopped, start it again with:
`docker container start etherealengine_db`

> 9. Check your WSL config for any incorrect networking settings.
> https://docs.microsoft.com/en-us/windows/wsl/wsl-config#network
Loading

0 comments on commit 2acf03f

Please sign in to comment.