Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved setup docs #116

Merged
merged 4 commits into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

# Base ASP.NET image
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

# Build Hive
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["NuGet.Config", "."]
Expand All @@ -22,10 +24,16 @@ COPY . .
WORKDIR "/src/src/Hive"
RUN dotnet build "Hive.csproj" -c Release -o /app/build

# Publish Hive
FROM build AS publish
RUN dotnet publish "Hive.csproj" -c Release -o /app/publish --framework net6.0

# Pull in HiveCorePlugins
FROM ghcr.io/atlas-rhythm/hivecoreplugins:master AS plugins

# Copy files into final image and run
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
COPY --from=plugins /Plugins /app/plugins
ENTRYPOINT ["dotnet", "Hive.dll"]
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

A general backend project for modding communities.

## Setup

To setup an instance of Hive, you can follow our [Setup guide](docs/Hive/Setup.md).

## Building

### Dependencies
Expand Down Expand Up @@ -49,4 +53,4 @@ Update the password fields in `docker-compose.yml`, as well as any other setting

Run the compose file with `docker-compose up`.

Plugins are loaded by mapping a volume with a host machine. See the commented out line in the compose file example.
Plugins are loaded by mapping a volume with a host machine. See the compose file example.
21 changes: 19 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,31 @@ services:
# Make sure that User ID matches POSTGRES_USER in the [db] service environment.
# Make sure that Password matches POSTGRES_PASSWORD in the [db] service environment.
- ConnectionStrings__Default=User ID=postgres;Password=please-change-me;Host=db;Port=5432;Database=hive;Pooling=true;

# Plugin configuration can be done using environment variables, formatted as PLUGIN__<Plugin name, "." replaced with "_">__<Configuration key>

# See Hive.FileSystemCdnProvider configuration at https://github.com/Atlas-Rhythm/HiveCorePlugins/blob/master/docs/Hive.FileSystemCdnProvider/Configuration.md
# This particular configuration entry defines the public URL that is used to construct download links. Please change it to your public facing URL.
- PLUGIN__Hive_FileSystemCdnProvider__PublicUrlBase=please-change-me
depends_on:
- db
ports:
# 21034 is the port that Hive can be accessed from the host machine. You are free to change it to something that works for you.
- "21034:80"

# volumes:
# - /path/to/hive/plugins:/app/plugins
# Please re-map these volumes to directories on your machine.
volumes:
# Where CDN objects (actual plugins) are stored
- /path/to/cdn/objects:/app/cdn/objects

# Where metadata about CDN objects are stored
- /path/to/cdn/metadata:/app/cdn/metadata

# Where Hive permission rules are stored
- /path/to/rules:/app/Rules

# Where external Hive plugins will be loaded from
#- /path/to/hive/plugins:/app/plugins
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented intentionally?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. HiveCorePlugins is already included in the Hive docker image, so mounting the plugins folder is only necessary if the administrator wants to load third party plugins.

db:
image: postgres:12.8
restart: unless-stopped
Expand Down
87 changes: 87 additions & 0 deletions docs/Hive/Setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Hive Setup Guide

Follow this setup guide to create your own instance of the Hive back-end.

## Running Hive With Docker

If you are accustomed to using and operating Docker containers, running Hive through Docker may be appealing to you.

Included in the Hive repository is the [`docker-compose.yml`](https://github.com/Atlas-Rhythm/Hive/blob/master/docker-compose.yml) file. To run Hive in a Docker environment, please download this file.

**Do not use this file as-is!**

The Docker Compose file contains some configuration that should be changed before deployment. Please open `docker-compose.yml` in any text environment, and make any necessary modification and configuration to match your deployment environment.

When you are ready to deploy Hive, run `docker-compose up`.

## Downloading Hive

If you do not want to use Docker, you can download the latest release of Hive through [the Releases page](https://github.com/Atlas-Rhythm/Hive/releases).

Simply unzip the Hive release wherever you wish to host Hive.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you also need plugins for this? Or do the releases have plugins bundled with them?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If not, might be nice to clarify

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think ideally, when we do go to make releases, we'd want to bundle HiveCorePlugins into the release zip. A major pain point in deployment right now is having to manually download and install the HiveCorePlugins to even use Hive, so I believe bundling core plugins wherever possible is a good idea.


**Be warned!** You may have to install the [.NET 6 Runtime](https://dotnet.microsoft.com/en-us/download/dotnet/6.0) and [PostgreSQL 12](https://www.postgresql.org/) to run Hive outside of a Docker container.

## Downloading External Plugins

Plugins are an essential part of Hive. Hive comes with its [own set of core plugins](https://github.com/Atlas-Rhythm/HiveCorePlugins), which comes included with a Docker deployment of Hive.

If you wish to use third party plugins, or need to download Hive core plugins outside of a Docker environment, simply download the latest release from their respective repositories.

Hive expects the `Plugins` folder to be organized. Plugins *must* be included in a subdirectory of the same name, within the `Plugins` folder.

For example, using some of Hive's core plugins, your plugins folder should look like this:

```
Plugins/
|- Hive.FileSystemCdnProvider/
| |- Hive.FileSystemCdnProvider.dll
| |- ...
|
|- Hive.FileSystemRuleProvider/
| |- Hive.FileSystemRuleProvider.dll
| |- ...
|
|- Hive.Tags/
| |- Hive.Tags.dll
| |- ...
```

**Docker users be warned!** If you want to use third party plugins, you need to map a volume to `/app/plugins` in the Docker container.

## Setting up Auth0

An authentication service is required to use Hive. [Auth0](https://auth0.com/) is Hive's default authentication service. Unless you plan on using a separate authentication plugin, you need to setup Auth0.

[Follow our dedicated Auth0 guide](https://github.com/Atlas-Rhythm/Hive/tree/master/docs/Auth0) to set up Auth0 for your Hive installation.

## Hive Configuration

Configuration for Hive's core is done through the `appsettings.json` file at the root of the Hive directory.

[We have dedicated documentation pages for configuring the various settings of Hive's core.](https://github.com/Atlas-Rhythm/Hive/blob/master/docs/Hive/Configuration.md)

By default, configuring Hive *plugins* is also done through `appsettings.json`, using a format that looks like this:

```jsonc
{
"Plugins": {
"PluginConfigurations": {
"Hive.FileSystemCdnProvider": {
// Configuration for Hive.FileSystemCdnProvider
},
"Hive.FileSystemRuleProvider": {
// Configuration for Hive.FileSystemRuleProvider
},
"Hive.Tags": {
// Configuration for Hive.Tags
}
// ...and so on.
}
}
}
```

Plugin configuration can also be done through environment variables, using the format `PLUGIN__<Plugin name, "." replaced with "_">__<Configuration key>`.

See the [Using Plugins](https://github.com/Atlas-Rhythm/Hive/blob/master/docs/Hive.Plugins/Using.md) page for more information on plugin configuration.
Loading