|
2 | 2 | title: Configuration |
3 | 3 | --- |
4 | 4 |
|
5 | | -import { Callout } from 'fumadocs-ui/components/callout'; |
| 5 | +## Introduction |
| 6 | + |
| 7 | +The focus here is on Basis Server specific configuration and not the many ways |
| 8 | +you can host game servers in the cloud. |
| 9 | + |
| 10 | +The multithreading on the server runs best the more cores avaiable but it has been shown to work well |
| 11 | +on as little as two cores. Social VR demands a lot of bandwidth so you'll want to keep that in mind when picking your |
| 12 | +service provider. |
| 13 | + |
| 14 | +This doc applies to an Unmodified Basis Server: Version 6 from the LTS branch as of May 2025 <!-- `commit 672035f0afe87b2fbe4e36bbd7f6cd340059d976` of lts branch --> |
| 15 | + |
| 16 | +:::tip Helpful Tip about Server Version |
| 17 | +You can find the **ServerVersion** in the code you cloned from the repo. |
| 18 | +Client and server code **must agree** on the version. |
| 19 | + |
| 20 | +```csharp |
| 21 | +BasisNetworkCore\BasisNetworkVersion.cs |
| 22 | +5: public static ushort ServerVersion = 6; |
| 23 | +``` |
| 24 | +::: |
| 25 | + |
| 26 | +<br /> |
| 27 | +<br /> |
| 28 | + |
| 29 | +### Run with Docker |
| 30 | + |
| 31 | +Using docker-compose is the easiest and fastest way to spin up a Basis server. Docker images of the server are published to github on both `long-term-support` and `developer` branches, under `latest` and `nightly` respectively. |
| 32 | + |
| 33 | +```yml |
| 34 | +services: |
| 35 | + basis-server: |
| 36 | + image: ghcr.io/basisvr/basis-server:latest # or :nightly for most recent changes |
| 37 | + container_name: basis-server |
| 38 | + init: true # handle process termination |
| 39 | + restart: unless-stopped |
| 40 | + environment: |
| 41 | + SetPort: 4296 # basis port |
| 42 | + HealthCheckPort: 10666 # http healthcheck port |
| 43 | + PromethusPort: 1234 # exists but is unused |
| 44 | + Password: default_password |
| 45 | + PeerLimit: 1024 # 1024 is the maximum supported |
| 46 | + EnableStatistics: true |
| 47 | + EnableConsole: false |
| 48 | + ports: |
| 49 | + - "4296:4296/udp" |
| 50 | + - "10666:10666/tcp" |
| 51 | + - "1234:1234/tcp" # unused |
| 52 | + volumes: |
| 53 | + - ./initialresources:/app/initialresources:ro |
| 54 | + - ./config:/app/config |
| 55 | + - ./logs:/app/logs |
| 56 | + # exercise health endpoint (optional) |
| 57 | + healthcheck: |
| 58 | + # http GET request |
| 59 | + test: ["CMD", "curl", "-f", "http://localhost:10666/health"] |
| 60 | + interval: 30s |
| 61 | + timeout: 10s |
| 62 | + retries: 3 |
| 63 | + start_period: 2s |
| 64 | +``` |
| 65 | +Run once to create `config.xml` (under `./config` in the example). Settings in xml will be overridden by enviornment variables. |
| 66 | + |
| 67 | +### Compile and Run on Windows |
| 68 | + |
| 69 | +Assuming you have cloned the LTS branch of the repo. |
| 70 | +`git clone -b long-term-support https://github.com/BasisVR/Basis.git` |
| 71 | + |
| 72 | +You will find the Visual Studio Solution file (sln) in the `Basis Server` directory. |
| 73 | +These steps assume Windows 11 using Microsoft Visual Studio Community 2022 (64-bit) - Version 17.12.3 |
| 74 | + |
| 75 | + |
| 76 | +The BasisNetworkConsole is the csproj you will need to target for compiling. |
| 77 | +You should be able to select that project from the start up item menu at the top. |
| 78 | +Once selected click the green arrow to build. |
| 79 | + |
| 80 | +Once compiled, navigate to `\Basis\Basis Server\BasisServerConsole\bin\Debug\net9.0\` |
| 81 | +to find the server exe and compiled dependencies. |
| 82 | + |
| 83 | +To run the server on Windows locally, open a command shell in this directory and run `.\BasisNetworkConsole.exe` |
| 84 | + |
| 85 | +`\Basis\Basis Server\BasisServerConsole\bin\Debug\net9.0> .\BasisNetworkConsole.exe` |
| 86 | + |
| 87 | +This should open a console and show something like the following: |
| 88 | + |
| 89 | +``` title="Example Server Console Output" |
| 90 | +[20:07] [INFO] Logs are saved to C:\Basis\Basis Server\BasisServerConsole\bin\Debug\net9.0\Logs\2025-05-10.log |
| 91 | +[20:07] [INFO] Server Booting |
| 92 | +[20:07] [INFO] HTTP health check started at 'http://localhost:10666/health' |
| 93 | +[20:07] [INFO] Loaded Admins 0 |
| 94 | +[20:07] [INFO] DidAuthIdentity initialized. |
| 95 | +[20:07] [INFO] Server Wiring up SetPort 4296 |
| 96 | +[20:07] [INFO] Server Worker Threads Booted |
| 97 | +[20:07] [INFO] CombinedURL: https://example.com/502c8e6c8405d50418.BEE, LoadAssetPassword: c661cfeaf9757e |
| 98 | +[20:07] [INFO] Adding Object world |
| 99 | +``` |
| 100 | + |
| 101 | + |
| 102 | +Be sure to point to `localhost` when running the Basis Demo Client. The option is in the advanced panel when |
| 103 | +you first start the client. |
| 104 | + |
| 105 | +<br /> |
| 106 | +<br /> |
| 107 | + |
| 108 | +### Compile and Run on Linux |
| 109 | + |
| 110 | +#### Prerequisits Assuming Debian/Ubuntu |
| 111 | + |
| 112 | +For Ubuntu 22.04, |
| 113 | +`sudo add-apt-repository ppa:dotnet/backports` |
| 114 | + |
| 115 | +For Debian or other qurirky setups: |
| 116 | + |
| 117 | +``` |
| 118 | +wget https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb -O packages-microsoft-prod.deb |
| 119 | +sudo dpkg -i packages-microsoft-prod.deb |
| 120 | +rm packages-microsoft-prod.deb |
| 121 | +``` |
| 122 | + |
| 123 | +Then continue installation: |
| 124 | + |
| 125 | +`sudo apt-get update && sudo apt-get install -y dotnet-sdk-9.0` |
| 126 | + |
| 127 | +#### Get Basis |
| 128 | + |
| 129 | +Change to the folder you wish to download Basis to, and execute the following command: |
| 130 | + |
| 131 | +`git clone -b long-term-support https://github.com/BasisVR/Basis` |
| 132 | + |
| 133 | +#### Build Basis Server |
| 134 | + |
| 135 | +Open a new terminal and cd /to/directory/with/Basis Server/, i.e. `cd Basis/Basis\ Server` |
| 136 | + |
| 137 | +`dotnet restore` |
| 138 | + |
| 139 | +Then build, with either: |
| 140 | + |
| 141 | +`dotnet build` (for debug) |
| 142 | + |
| 143 | +or |
| 144 | + |
| 145 | +`dotnet build --configuration Release` (For release) |
| 146 | + |
| 147 | +#### Executing |
| 148 | + |
| 149 | +Navigate to the BasisServerConsole directory (Something like `/BasisServerConsole/bin/Debug/net9.0/BasisNetworkConsole`) |
| 150 | +and run: |
| 151 | + |
| 152 | +`dotnet .\BasisNetworkConsole.dll` |
| 153 | + |
| 154 | +:::tip For More Targeted Linux Release |
| 155 | + |
| 156 | +You may compile with the following: |
| 157 | + |
| 158 | +`dotnet publish -f net9.0 --self-contained --os Linux` |
| 159 | + |
| 160 | +The `--self-contained` switch is added to allow running on a OS without dotnet installed. |
| 161 | + |
| 162 | +If you compile via this method (Or your build targeted the system) are on a you should be able to run |
| 163 | + |
| 164 | +`./BasisNetworkConsole` |
| 165 | + |
| 166 | +from `BasisServerConsole/bin/Debug/net9.0/BasisNetworkConsole`. |
| 167 | + |
| 168 | +::: |
| 169 | + |
| 170 | +## Firewall |
| 171 | + |
| 172 | +You may want to open ports: |
| 173 | + * 1234/tcp |
| 174 | + * 10666/tcp |
| 175 | + * 4296/udp |
| 176 | + |
| 177 | +<br /> |
| 178 | +<br /> |
6 | 179 |
|
7 | 180 | ## Configuration Files |
8 | 181 |
|
|
0 commit comments