Skip to content

Commit

Permalink
update deployment guide
Browse files Browse the repository at this point in the history
  • Loading branch information
aspriddell committed Nov 30, 2024
1 parent 90c9b96 commit 092bcbe
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 37 deletions.
81 changes: 47 additions & 34 deletions deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@ In order to deploy onionfruit-web a server is required:
- A Windows server with container support enabled
- A Linux server with docker installed

Additionally, a redis server (with TLS and ACL is recommended) is needed for storing Tor node info
Additionally, a redis server (with TLS and ACL is recommended) is required for storing Tor node info and uploaded file version tracking info.

### Worker
The worker task is responsible for generating the assets and populating the redis database used by the server process.

To deploy, create a config file in a persistent directory (in this example, we use `appsettings.json`):

```json5
{
// asp.net core logging config
// logging config
"Logging": {
"LogLevel": {
"Default": "Debug",
Expand All @@ -29,45 +28,59 @@ To deploy, create a config file in a persistent directory (in this example, we u
// see https://stackexchange.github.io/StackExchange.Redis/Configuration.html#configuration-options for options
"ConnectionString": "localhost:6379"
},
"Worker": {
// alternative location for sentry DSN
"Dsn": "",

"Exports": {
// see below for exports examples
}
"S3": {
// replace with your own s3 bucket details (endpoint can be replaced with region if using AWS)
"BucketName": "onionfruit",
"ExpireOldAssetsAfter": 30,
"Endpoint": "",
"AccessKey": "",
"SecretKey": ""
}
}
```

#### `Worker.Exports`
`Worker.Exports` is a dictionary of locations to export data to.
## Server

The server can be deployed in a similar way, but with a slightly different config file:

```json5
{
// the key used is only used for identification purposes (can be set to what you want)
"Folder-Export": {
"Type": "Folder",
"FolderPath": "OnionFruit-Assets",

// SpecialBasePath is optional - if it is set then the FolderPath will be relative to this directory.
// see https://source.dot.net/#System.Private.CoreLib/src/libraries/System.Private.CoreLib/src/System/Environment.SpecialFolder.cs,192440782c25956f for valid ids
"SpecialBasePath": "DesktopDirectory"
},
"Archive-Upload": {
"Type": "Archive",

// upload url to send a PUT request to
// the file name will be appended to the end of the request url
"UploadUrl": "https://example.com/assetupload/",

// optional asset .zip prefix (if null it will be set to onionfruit-data)
"Prefix": "asset-upload",

// optional redis pubsub channel to send a notification informing clients a new archive has been uploaded.
// if null, no message will be sent.
"RedisNotificationChannel": ""
// asp.net core logging config
"Logging": {
"LogLevel": {
"Default": "Debug",
"Microsoft.AspNetCore": "Warning"
}
},

// optional sentry.io DSN client key
"Dsn": "",

"Redis": {
// set redis connection string here
// see https://stackexchange.github.io/StackExchange.Redis/Configuration.html#configuration-options for options
"ConnectionString": "localhost:6379"
},

"Server": {
"UseBuiltInWorker": "true", // whether to use a built-in worker process (defaults to true if not set). if used, s3 is not required.
"RemoteAssetPublicUrl": "https://onionfruit-assets.dragonfruit.network/{0}" // only required if built-in worker is disabled.
}
}
```

You can then use compose file to deploy the server:

```yaml
services:
onionfruit-api:
container_name: onionfruit-api
image: dragonfruitdotnet/onionfruit-web:latest # change latest to worker if you want to run the worker separately
restart: always
volumes:
- /path/to/config/dir:/onionfruit-config:ro
ports:
- 80:80
environment:
CONFIG_FOLDER_PATH: /onionfruit-config
```
4 changes: 1 addition & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3.9"

services:
redis:
image: redis/redis-stack:latest
Expand All @@ -9,6 +7,6 @@ services:

worker:
image: dragonfruitnetwork/onionfruit-web:worker

server:
image: dragonfruitnetwork/onionfruit-web:server

0 comments on commit 092bcbe

Please sign in to comment.