Skip to content

Commit 025f43f

Browse files
committed
feat: build server docs
1 parent c61eb00 commit 025f43f

6 files changed

Lines changed: 197 additions & 1 deletion

File tree

astro.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export default defineConfig({
1515
starlightImageZoom(),
1616
],
1717
title: "Drop OSS",
18+
logo: { src: "./src/assets/wordmark.png", replacesTitle: true},
1819
social: [
1920
{
2021
icon: "github",

src/assets/drop.svg

Lines changed: 5 additions & 0 deletions
Loading

src/assets/wordmark.png

28.9 KB
Loading

src/content/docs/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Welcome to the Drop OSS project documentation.
44
hero:
55
tagline: Welcome to the Drop OSS project documentation.
66
image:
7-
file: ../../assets/houston.webp
7+
file: ../../assets/drop.svg
88
actions:
99
- text: Quickstart
1010
link: /admin/quickstart
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
title: Building Drop client
3+
---
Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
---
2+
title: Building Drop server
3+
---
4+
5+
import { Steps } from "@astrojs/starlight/components";
6+
7+
The Drop server is compromised of the following components, and are built with the associated tools:
8+
9+
| Project | Tools |
10+
| -------------- | ------------------------------- |
11+
| Frontend & API | Node.js, `pnpm` |
12+
| `droplet` | Node.js, Rust (nightly), `yarn` |
13+
| `torrential` | Rust (nightly) |
14+
15+
Then, to be run outside the Docker container, Drop needs the following:
16+
17+
- NGINX, available on `$PATH`, as `nginx`
18+
- `torrential`, available in the [search path](#torrential-search-algorithm)
19+
- Node.js, or some other equivalent runtime
20+
- Postgresql, with migrations ran using `prisma`
21+
22+
## Building `droplet`
23+
24+
:::tip
25+
This step is optional, you can use our pre-built binaries hosted on the NPM. They will be installed automatically if you skip this step.
26+
:::
27+
28+
`droplet` is required at build-time for the API server, so we need to build before we can continue with that.
29+
30+
<Steps>
31+
1. ### Clone the repo and open it
32+
```bash
33+
git clone https://github.com/Drop-OSS/droplet.git && cd droplet
34+
```
35+
36+
2. ### Install Node.js dependencies
37+
38+
```bash
39+
yarn
40+
```
41+
42+
3. ### Build with `yarn`
43+
44+
```bash
45+
yarn build
46+
```
47+
48+
:::note
49+
Take note this of directory you built `droplet` in, we will need it later.
50+
:::
51+
52+
</Steps>
53+
54+
## Building `drop`
55+
56+
<Steps>
57+
1. ### Clone the repo and recurse submodules
58+
```bash
59+
git clone https://github.com/Drop-OSS/drop.git && cd drop
60+
```
61+
62+
Drop also packages some components as submodules, so we will need to clone those too:
63+
```bash
64+
git submodule update --init --recursive
65+
```
66+
67+
2. ### [Optional] Link `droplet`
68+
69+
Use the directory from the `droplet` build:
70+
71+
```bash
72+
pnpm install <droplet dir>
73+
```
74+
75+
3. ### Install Node.js dependencies using `pnpm`
76+
77+
```bash
78+
pnpm install
79+
```
80+
81+
4. ### Build the application
82+
83+
```bash
84+
pnpm run build
85+
```
86+
87+
</Steps>
88+
89+
## Building `torrential`
90+
91+
To build `torrential`, you only need to run:
92+
93+
```bash
94+
cargo build --release
95+
```
96+
97+
## Set up Drop runtime environment
98+
99+
As mentioned above, you will need a few more things to run Drop outside the Docker container. These requirements are for the **runtime** server, the actual application can be built elsewhere, and then copied to your runtime server.
100+
101+
You will need to install:
102+
103+
- NGINX
104+
- Node.js, with a package manager (`npm` comes prebundled and works fine)
105+
- Your copy of `torrential`, to somewhere in the [search path](#torrential-search-algorithm)
106+
- PostgreSQL
107+
108+
<Steps>
109+
1. ### Prepare your run directory
110+
You will need to copy the following files to your run directory:
111+
- `prisma.config.ts` from the `drop` repository (contains database configuration)
112+
- `prisma` folder from the `drop` repository (contains database migrations)
113+
- `.output` from the `drop` repository (the built application)
114+
- `build/nginx.conf` from the `drop` repository (built-in reverse proxy configuration)
115+
116+
2. ### Figure out your `DATABASE_URL`
117+
118+
The example `compose.yaml` uses `postgres://drop:drop@postgres:5432/drop` as the database URL. You will need to customise this to point to your PostgreSQL installation.
119+
120+
3. ### Install `prisma` and run migrations
121+
122+
Use your Node.js package manager to install prisma, either to the local directory or globally:
123+
124+
```bash
125+
npm install prisma@6.11.1 # local installation using npm
126+
```
127+
128+
Then, with your database running:
129+
130+
```bash
131+
DATABASE_URL=<your database url> prisma migrate deploy
132+
```
133+
134+
If you've installed it locally, you might need to run:
135+
136+
```bash
137+
DATABASE_URL=<your database url> <package manager> prisma migrate deploy
138+
```
139+
140+
4. ### Create your launch script
141+
142+
You will need to set several environment variables to configure Drop, both because you're running it outside the Docker container, and it's the intended way to configure Drop.
143+
144+
It's best to create a launch script to configure them for you, like this:
145+
146+
```bash
147+
# required environment variables
148+
NGINX_CONF=./nginx.conf # potentially update if you've renamed the nginx.conf
149+
DATABASE_URL=<your database url>
150+
DATA=./data # potentially update if you'd like Drop to store data somewhere else (not library)
151+
152+
# optional variables
153+
# TORRENTIAL_PATH=<custom torrential path> # may be required if torrential isn't in your $PATH
154+
# ... see the rest of the document for other options ...
155+
156+
# run application
157+
# (node can be swapped for another runtime, if wanted)
158+
node ./.output/server/index.mjs
159+
```
160+
161+
5. ### Run Drop
162+
163+
Make your launch executable (`chmod +x <script>`), and then run in it your runtime directory. Drop should start up.
164+
165+
:::caution
166+
If you're using relative paths (this guide does), make sure you run the script from your runtime directory.
167+
:::
168+
169+
</Steps>
170+
171+
### `torrential` search algorithm
172+
173+
Drop searches for a torrential binary in the following order:
174+
175+
<Steps>
176+
1. `torrential` **directory** in working directory: Drop executes `cargo run
177+
--manifest-path ./torrential/Cargo.toml`.
178+
179+
2. `torrential` **file** in working
180+
directory: Drop executes it.
181+
182+
3. If `TORRENTIAL_PATH` is provided in env, Drop
183+
executes it.
184+
185+
4. Drop defaults executing it normally, so on the `$PATH`.
186+
187+
</Steps>

0 commit comments

Comments
 (0)