From 092bcbe3c8df5a8e26f9a264c3813a5450a41353 Mon Sep 17 00:00:00 2001 From: Albie Spriddell Date: Sat, 30 Nov 2024 09:45:26 +0000 Subject: [PATCH] update deployment guide --- deployment.md | 81 +++++++++++++++++++++++++++------------------- docker-compose.yml | 4 +-- 2 files changed, 48 insertions(+), 37 deletions(-) diff --git a/deployment.md b/deployment.md index eaf08ec..7881822 100644 --- a/deployment.md +++ b/deployment.md @@ -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", @@ -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 +``` diff --git a/docker-compose.yml b/docker-compose.yml index 66080c6..16a8ba9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,3 @@ -version: "3.9" - services: redis: image: redis/redis-stack:latest @@ -9,6 +7,6 @@ services: worker: image: dragonfruitnetwork/onionfruit-web:worker - + server: image: dragonfruitnetwork/onionfruit-web:server \ No newline at end of file