|
1 | 1 | # Server Setup |
2 | 2 |
|
3 | | -{{ project.name }}-server setup ranges in difficulty depending on how you want to configure your system. |
4 | | -This page provides a minimal setup guide to get you up and running, |
5 | | -you should check out the other pages on this site to take your instance to the next level. |
| 3 | +A basic {{ project.name }} server setup consist of three services: |
6 | 4 |
|
7 | | -For this guide, we assume you're familar with the terminal. |
8 | | - |
9 | | -We do **not** recommend or support running {{ project.name }} using services such as Ngrok, Heroku or vercel. |
10 | | -You **must** have access to a terminal for this guide. |
11 | | - |
12 | | -We do not recommend using Windows to run {{ project.name }}. |
13 | | - |
14 | | -## Dependencies |
15 | | - |
16 | | -- [Git](https://git-scm.com/) |
17 | | -- [NodeJS](https://nodejs.org). Version 24+ (for `npm`, `node` commands) |
18 | | - (NOTE: Ubuntu and Debian based systems often ship with an outdated version of NodeJS, so you can use [NodeSource](https://github.com/nodesource/distributions) to install a newer version) |
19 | | -- [Python](https://www.python.org/). Version 3.13 or later. Make sure this is executable via `python` in your terminal. |
20 | | - (See: `python-is-python3` package) |
21 | | -- [.NET SDK](https://dot.net). Version 9.0+. Optional, but used for the experimental [Admin API](adminApi). |
22 | | -- On Linux: `gcc`/`g++`. Packaged with `build-essential` on Debian/Ubuntu and `base-devel` on Arch. |
23 | | -- On Windows: [Visual Studio](https://visualstudio.microsoft.com/) (**NOT** VSCode) with the `Desktop development with C++` package. |
24 | | - You do not need the full Visual Studio install, the build tools are fine. |
25 | | -- Hint: If you have the [`nix`](https://nixos.org/download/) package manager installed, you can skip all of the above by running `nix develop .#` in your terminal. |
26 | | - |
27 | | -## Setup |
28 | | - |
29 | | -In your terminal: |
30 | | - |
31 | | -```bash |
32 | | -# Download {{ project.name }} |
33 | | -git clone {{ repositories.base_url }}/{{ repositories.server }}.git |
34 | | - |
35 | | -# Navigate to project root |
36 | | -cd server |
37 | | - |
38 | | -# Install javascript packages |
39 | | -npm i |
40 | | - |
41 | | -# Build and generate schema + openapi. Separately, they are `build:src`, `generate:schema` and `generate:openapi`. |
42 | | -npm run build |
43 | | - |
44 | | -# Start the bundle server ( API, CDN, Gateway in one ) |
45 | | -npm run start |
46 | | -``` |
| 5 | +- The API service provides a REST API for the client |
| 6 | +- The gateway service provides a websocket endpoint for the client |
| 7 | +- The CDN service serves static files such as uploaded images. |
47 | 8 |
|
48 | | -If all went according to plan, you can now access your new {{ project.name }} instance at [http://localhost:3001](http://localhost:3001)! Congrats! |
| 9 | +In most cases you do not need to configure these services separately. |
49 | 10 |
|
50 | | -If you set up your server remotely, you can use `curl http://localhost:3001/api/ping` to verify the server is up and running |
51 | | -(you should set up a reverse proxy, next!). |
| 11 | +The following sections will guide you through the setup of a {{ project.name }} server: |
52 | 12 |
|
53 | | -# Connecting from remote machines |
| 13 | +- [Installation](./installation/) explains how to install and run a server for the first time, |
| 14 | +- [Configuration](./configuration/) explains how to further configure your server to your needs, |
| 15 | +- [Security](./security/) contains details on how to harden a {{ project.name }} setup, |
| 16 | +- and a wide range of advanced topics can be found in the sidebar. |
54 | 17 |
|
55 | | -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. |
56 | | - |
57 | | -The official Spacebar client does automatic discovery of the endpoints it uses to communicate with the server, |
58 | | -but it needs to retrieve those from somewhere, that being the API server. |
59 | | - |
60 | | -If you don't tell the API server where to find the other services, the official Spacebar client wont be able to connect. |
61 | | -Other clients which don't do automatic discovery will be, but that's because your users will need to provide the locations manually. |
62 | | - |
63 | | -We'll be doing some [server configuration](configuration) in this step, which is stored in your servers database by default. |
64 | | -By default, Spacebar uses an SQLite database in the project root called `database.db`, but you might not want to use that for production. |
65 | | -[If you're going to switch databases, do it now.](database.md) |
66 | | - |
67 | | -Once you've opened your database, navigate to the `config` table. You'll see 2 columns named `key` and `value`. |
68 | | -You'll want to set the `value` of the rows with the following keys to the correct values. |
69 | | - |
70 | | -| key | value | |
71 | | -| ------------------------ | -------------------------------------------------------- | |
72 | | -| `api_endpointPublic` | Your API endpoint. Likely `"https://DOMAIN_NAME/api/v9"` | |
73 | | -| `cdn_endpointPublic` | Your CDN endpoint. Likely `"https://DOMAIN_NAME"` | |
74 | | -| `gateway_endpointPublic` | Your Gateway endpoint. Likely `"wss://DOMAIN_NAME"` | |
75 | | - |
76 | | -!!! warning "You must wrap these `value`s in doublequotes as they are parsed as JSON!" |
77 | | - |
78 | | -If you're in the CLI for this, heres some template SQL: |
79 | | - |
80 | | -=== "SQLite" |
81 | | - |
82 | | - ```sql |
83 | | - update config |
84 | | - set value = '"HTTPS_OR_WSS://SERVER_ADDRESS"' |
85 | | - where key = "THE_SERVICE_NAME_endpointPublic"; |
86 | | - ``` |
87 | | - |
88 | | -## Now what? |
89 | | - |
90 | | -Well, now you can configure {{ project.name }} to your liking! |
| 18 | +For this guide, we assume you're familar with the terminal. |
91 | 19 |
|
92 | | -- [Set up experimental and optional Admin API](adminApi) |
93 | | -- [Skip to server configuration](configuration) |
94 | | -- [Skip to reverse proxy / SSL](reverseProxy.md) |
95 | | -- [Skip to security](security) |
| 20 | +We do **not** recommend or support running {{ project.name }} using services such as Ngrok, Heroku or vercel. |
| 21 | +You **must** have access to a terminal for this guide. We do not recommend using Windows to run {{ project.name }}. |
0 commit comments