Add SurrealDB helpers and promo screenshot assets
- Add local SurrealDB install, update, and run scripts for Forge - Update setup docs and package the server SurrealDB helpers
This commit is contained in:
parent
d2811a3c43
commit
01dda0e060
2
.gitignore
vendored
2
.gitignore
vendored
@ -34,3 +34,5 @@ Thumbs.db
|
|||||||
|
|
||||||
# Arma
|
# Arma
|
||||||
arma/ui/map-viewer/
|
arma/ui/map-viewer/
|
||||||
|
arma/server/surrealdb/forge.db/
|
||||||
|
promo/
|
||||||
|
|||||||
@ -18,6 +18,7 @@ include = [
|
|||||||
"config.example.toml",
|
"config.example.toml",
|
||||||
"LICENSE.md",
|
"LICENSE.md",
|
||||||
"README.md",
|
"README.md",
|
||||||
|
"surrealdb/**/*",
|
||||||
]
|
]
|
||||||
exclude = []
|
exclude = []
|
||||||
|
|
||||||
|
|||||||
3
arma/server/surrealdb/AllInOne.bat
Normal file
3
arma/server/surrealdb/AllInOne.bat
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
@echo off
|
||||||
|
call "%~dp0UpdateMe.bat"
|
||||||
|
call "%~dp0RunMe.bat"
|
||||||
74
arma/server/surrealdb/README.md
Normal file
74
arma/server/surrealdb/README.md
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
# Forge SurrealDB
|
||||||
|
|
||||||
|
Forge uses SurrealDB as the durable database for the server extension. These
|
||||||
|
helpers install the SurrealDB CLI and start a local RocksDB-backed Forge
|
||||||
|
database from this directory.
|
||||||
|
|
||||||
|
These scripts are for local development and single-host Forge servers. For a
|
||||||
|
public or shared production host, change the root password and review bind,
|
||||||
|
firewall, TLS, backup, and upgrade policy before exposing the database.
|
||||||
|
|
||||||
|
## Windows
|
||||||
|
|
||||||
|
Install or update SurrealDB:
|
||||||
|
|
||||||
|
```bat
|
||||||
|
UpdateMe.bat
|
||||||
|
```
|
||||||
|
|
||||||
|
If this is the first install and the terminal cannot find `surreal` after the
|
||||||
|
script finishes, open a new terminal so Windows reloads `PATH`.
|
||||||
|
|
||||||
|
Start Forge's local database:
|
||||||
|
|
||||||
|
```bat
|
||||||
|
RunMe.bat
|
||||||
|
```
|
||||||
|
|
||||||
|
Install and start in one step:
|
||||||
|
|
||||||
|
```bat
|
||||||
|
AllInOne.bat
|
||||||
|
```
|
||||||
|
|
||||||
|
## Linux or macOS
|
||||||
|
|
||||||
|
Install SurrealDB:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./setup.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Start Forge's local database:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./run.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Update SurrealDB:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./update.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
## Manual Command
|
||||||
|
|
||||||
|
The run scripts execute:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
surreal start --user root --pass root --bind 127.0.0.1:8000 rocksdb://forge.db
|
||||||
|
```
|
||||||
|
|
||||||
|
The database files are created under `arma/server/surrealdb/forge.db`.
|
||||||
|
|
||||||
|
Forge's extension config should match the local SurrealDB server:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[surreal]
|
||||||
|
endpoint = "127.0.0.1:8000"
|
||||||
|
namespace = "forge"
|
||||||
|
database = "main"
|
||||||
|
username = "root"
|
||||||
|
password = "root"
|
||||||
|
connect_timeout_ms = 5000
|
||||||
|
```
|
||||||
3
arma/server/surrealdb/RunMe.bat
Normal file
3
arma/server/surrealdb/RunMe.bat
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
@echo off
|
||||||
|
cd /d "%~dp0"
|
||||||
|
surreal start --user root --pass root --bind 127.0.0.1:8000 rocksdb://forge.db
|
||||||
14
arma/server/surrealdb/UpdateMe.bat
Normal file
14
arma/server/surrealdb/UpdateMe.bat
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
@echo off
|
||||||
|
where surreal >nul 2>nul
|
||||||
|
if %errorlevel% equ 0 (
|
||||||
|
surreal upgrade
|
||||||
|
surreal version
|
||||||
|
) else (
|
||||||
|
powershell -NoProfile -ExecutionPolicy Bypass -Command "iwr https://windows.surrealdb.com -useb | iex"
|
||||||
|
where surreal >nul 2>nul
|
||||||
|
if %errorlevel% equ 0 (
|
||||||
|
surreal version
|
||||||
|
) else (
|
||||||
|
echo SurrealDB install finished. Open a new terminal if the surreal command is not available yet.
|
||||||
|
)
|
||||||
|
)
|
||||||
6
arma/server/surrealdb/run.sh
Normal file
6
arma/server/surrealdb/run.sh
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
|
surreal start --user root --pass root --bind 127.0.0.1:8000 rocksdb://forge.db
|
||||||
15
arma/server/surrealdb/setup.sh
Normal file
15
arma/server/surrealdb/setup.sh
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
if command -v surreal >/dev/null 2>&1; then
|
||||||
|
surreal version
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v brew >/dev/null 2>&1; then
|
||||||
|
brew install surrealdb/tap/surreal
|
||||||
|
else
|
||||||
|
curl -sSf https://install.surrealdb.com | sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
surreal version
|
||||||
10
arma/server/surrealdb/update.sh
Normal file
10
arma/server/surrealdb/update.sh
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
if command -v brew >/dev/null 2>&1; then
|
||||||
|
brew upgrade surrealdb/tap/surreal || brew install surrealdb/tap/surreal
|
||||||
|
else
|
||||||
|
curl -sSf https://install.surrealdb.com | sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
surreal version
|
||||||
@ -14,7 +14,23 @@ hosting the live Arma server.
|
|||||||
Official SurrealDB resources:
|
Official SurrealDB resources:
|
||||||
|
|
||||||
- [SurrealDB install page](https://surrealdb.com/install)
|
- [SurrealDB install page](https://surrealdb.com/install)
|
||||||
- [SurrealDB CLI `start` reference](https://surrealdb.com/docs/reference/cli/surrealdb-cli/commands/start)
|
- [SurrealDB CLI `start` reference](https://surrealdb.com/docs/surrealdb/cli/start)
|
||||||
|
|
||||||
|
Forge also includes helper scripts under `arma/server/surrealdb`:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
cd arma/server/surrealdb
|
||||||
|
.\UpdateMe.bat
|
||||||
|
.\RunMe.bat
|
||||||
|
```
|
||||||
|
|
||||||
|
On Linux or macOS:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd arma/server/surrealdb
|
||||||
|
./setup.sh
|
||||||
|
./run.sh
|
||||||
|
```
|
||||||
|
|
||||||
Install SurrealDB with the official method for your platform:
|
Install SurrealDB with the official method for your platform:
|
||||||
|
|
||||||
@ -37,9 +53,12 @@ For Forge, start a persistent local database instead of the default in-memory
|
|||||||
mode:
|
mode:
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
surreal start surrealkv://forge.db --bind 127.0.0.1:8000 --user root --pass root
|
surreal start --user root --pass root --bind 127.0.0.1:8000 rocksdb://forge.db
|
||||||
```
|
```
|
||||||
|
|
||||||
|
`root`/`root` is only the local development default. For a public or shared
|
||||||
|
server, set a real password and keep `config.toml` aligned.
|
||||||
|
|
||||||
Then copy `arma/server/extension/config.example.toml` to `config.toml` next to
|
Then copy `arma/server/extension/config.example.toml` to `config.toml` next to
|
||||||
`forge_server_x64.dll` and keep the values aligned with the database you
|
`forge_server_x64.dll` and keep the values aligned with the database you
|
||||||
started:
|
started:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user