diff --git a/docs/setup/server/index.md b/docs/setup/server/index.md index 92a91eb..8853e97 100644 --- a/docs/setup/server/index.md +++ b/docs/setup/server/index.md @@ -44,9 +44,44 @@ npm run start If all went according to plan, you can now access your new {{ project.name }} instance at [http://localhost:3001](http://localhost:3001)! Congrats! -If you set up your server remotely, you can use `curl http://localhost:3001/api/ping` to verify the server is up and running, +If you set up your server remotely, you can use `curl http://localhost:3001/api/ping` to verify the server is up and running (you should set up a reverse proxy, next!). +# Connecting from remote machines + +For your server to be a bit more useful to those not on the same machine, you'll need to do a bit more configuration. + +The official Spacebar client does automatic discovery of the endpoints it uses to communicate with the server, +but it needs to retrieve those from somewhere, that being the API server. + +If you don't tell the API server where to find the other services, the official Spacebar client wont be able to connect. +Other clients which don't do automatic discovery will be, but that's because your users will need to provide the locations manually. + +We'll be doing some [server configuration](configuration) in this step, which is stored in your servers database by default. +By default, Spacebar uses an SQLite database in the project root called `database.db`, but you might not want to use that for production. +[If you're going to switch databases, do it now.](database.md) + +Once you've opened your database, navigate to the `config` table. You'll see 2 columns named `key` and `value`. +You'll want to set the `value` of the rows with the following keys to the correct values. + +| key | value | +| ------------------------ | -------------------------------------------------------- | +| `api_publicEndpoint` | Your API endpoint. Likely `"https://DOMAIN_NAME/api/v9"` | +| `cdn_publicEndpoint` | Your CDN endpoint. Likely `"https://DOMAIN_NAME` | +| `gateway_publicEndpoint` | Your Gateway endpoint. Likely `"wss://DOMAIN_NAME` | + +!!! warning "You must wrap these `value`s in doublequotes as they are parsed as JSON!" + +If you're in the CLI for this, heres some template SQL: + +=== "SQLite" + + ```sql + update config + set value = '"HTTPS_OR_WSS://SERVER_ADDRESS"' + where key = "THE_SERVICE_NAME_endpointPublic"; + ``` + ## Now what? Well, now you can configure {{ project.name }} to your liking!