Skip to content

Commit

Permalink
Docs and release upgrades (#335)
Browse files Browse the repository at this point in the history
* Docs and releases

* added specific files for package

* added readme

* moved odin.md to README.md in odin folder

* http-server to huginn

* ignore files
  • Loading branch information
mbround18 authored Apr 23, 2021
1 parent e0729d6 commit 6224967
Show file tree
Hide file tree
Showing 22 changed files with 250 additions and 56 deletions.
3 changes: 1 addition & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@
target/
tmp/
docs/
.github/
.run

release/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ target/
tmp/
*.env*
docker-compose.*.yml
release
22 changes: 11 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

members = [
"src/odin",
"src/http-server"
"src/huginn"
]

[profile.dev]
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ ENV PUID=1000 \
COPY ./src/scripts/*.sh /home/steam/scripts/
COPY ./src/scripts/entrypoint.sh /entrypoint.sh
COPY --from=runtime /usr/local/bin/odin /usr/local/bin/odin
COPY --from=runtime /usr/local/bin/odin-http-server /usr/local/bin/odin-http-server
COPY --from=runtime /usr/local/bin/huginn /usr/local/bin/huginn
COPY ./src/scripts/steam_bashrc.sh /home/steam/.bashrc

RUN usermod -u ${PUID} steam \
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.odin
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ RUN cargo-make make -p production release
FROM debian:buster-slim as runtime
WORKDIR /data/odin
COPY --from=builder /data/odin/target/release/odin /usr/local/bin
COPY --from=builder /data/odin/target/release/odin-http-server /usr/local/bin
COPY --from=builder /data/odin/target/release/huginn /usr/local/bin
ENTRYPOINT ["/usr/local/bin/odin"]
CMD ["--version"]
4 changes: 2 additions & 2 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ condition = { profiles = ["production"] }
command = "cargo"
args = ["build", "--release", "--bin", "odin"]

# Run http-server release
# Run huginn release
[tasks.release-http-server]
workspace = false
condition = { profiles = ["production"] }
command = "cargo"
args = ["build", "--release", "--bin", "odin-http-server"]
args = ["build", "--release", "--bin", "huginn"]

[tasks.release]
workspace = false
Expand Down
48 changes: 26 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,26 @@

# [Valheim]

<a href="https://hub.docker.com/r/mbround18/valheim">
<img src="https://img.shields.io/docker/pulls/mbround18/valheim?style=for-the-badge" alt="">
</a>
<a href="https://hub.docker.com/r/mbround18/valheim"><img src="https://img.shields.io/docker/pulls/mbround18/valheim?style=for-the-badge" alt=""></a>
<a href="https://github.com/mbround18/valheim-docker/actions/workflows/docker-publish.yml"><img src="https://img.shields.io/github/workflow/status/mbround18/valheim-docker/Rust?label=Rust&style=for-the-badge" alt=""></a>
<a href="https://github.com/mbround18/valheim-docker/actions/workflows/rust.yml"><img src="https://img.shields.io/github/workflow/status/mbround18/valheim-docker/Rust?label=Docker&style=for-the-badge" alt=""></a>

<a href="https://github.com/mbround18/valheim-docker/actions/workflows/docker-publish.yml">
<img src="https://img.shields.io/github/workflow/status/mbround18/valheim-docker/Rust?label=Rust&style=for-the-badge" alt="">
</a>
## Running on Linux Server

<a href="https://github.com/mbround18/valheim-docker/actions/workflows/rust.yml">
<img src="https://img.shields.io/github/workflow/status/mbround18/valheim-docker/Rust?label=Docker&style=for-the-badge" alt="">
</a>
This repo bundles its tools in a way that you can run them without having to install docker!
If you purely want to run this on a Linux based system, without docker, take a look at the links below <3

## Docker
- [Installing & Using Odin](./src/odin/README.md)
The tool [Odin] runs the show and does almost all the heavy lifting in this repo. It starts, stops, and manages your Valheim server instance.

- [Installing & Using Huginn](./src/huginn/README.md)
Looking for a way to view the status of your server? Look no further than [Huginn]!
The [Huginn] project is a http server built on the same source as [Odin] and uses these capabilities to expose a few http endpoints.

> Using the binaries to run on an Ubuntu Server, you will have to be more involved and configure a few things manually.
> If you want a managed, easy one-two punch to manage your server. Then look at the Docker section <3
## Running with Docker

> [If you are looking for a guide on how to get started click here](https://github.com/mbround18/valheim-docker/discussions/28)
>
Expand Down Expand Up @@ -50,6 +57,7 @@
| WEBHOOK_URL | `<nothing>` | FALSE | Supply this to get information regarding your server's status in a webhook or Discord notification! [Click here to learn how to get a webhook url for Discord](https://help.dashe.io/en/articles/2521940-how-to-create-a-discord-webhook-url) |
| UPDATE_ON_STARTUP | `1` | FALSE | Tries to update the server the container is started. |


#### Container Env Variables

| Variable | Default | Required | Description |
Expand Down Expand Up @@ -82,7 +90,7 @@ Auto update job, queries steam and compares it against your internal steam files

Auto backup job produces an output of a `*.tar.gz` file which should average around 30mb for a world that has an average of 4 players consistently building on. You should be aware that if you place the server folder in your saves folder your backups could become astronomical in size. This is a common problem that others have observed, to avoid this please follow the guide for how volume mounts should be made in the `docker-compose.yml`.

#### Http Server
#### [Huginn] Http Server

| Variable | Default | Required | Description |
| --------- | --------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------- |
Expand Down Expand Up @@ -159,7 +167,7 @@ services:
This repo has a CLI tool called [Odin] in it! It is used for managing the server inside the container. If you are looking for instructions for it click here: [Odin]
[Click here to see advanced environment variables for Odin](./docs/odin.md)
[Click here to see advanced environment variables for Odin](src/odin/README.md)
### [BepInEx Support](./docs/bepinex.md)
Expand All @@ -183,19 +191,14 @@ This is a tutorial of a recommended path to transfering files. This can be done
## Sponsors
<a href="https://github.com/AtroposOrbis">
<img width=50 src="https://avatars.githubusercontent.com/u/8618455?s=460&u=935d96983cafa4f0e5dd822dad10c23e8c1b021e&v=4" />
</a>
<a href="https://github.com/AtroposOrbis"><img width=50 src="https://avatars.githubusercontent.com/u/13275296?s=460&v=4" /></a>
<a href="https://github.com/arevak"><img src="https://avatars.githubusercontent.com/u/839250?s=460&v=4" width=50 /></a>
<a href="https://github.com/AtroposOrbis"><img width=50 src="https://avatars.githubusercontent.com/u/8618455?s=460&u=935d96983cafa4f0e5dd822dad10c23e8c1b021e&v=4" alt="AtroposOrbis"/></a>
<a href="https://github.com/arevak"><img src="https://avatars.githubusercontent.com/u/839250?s=460&v=4" width=50 alt="arevak"/></a>
## Release Notifications
If you would like to have release notifications tied into your Discord server, click here:
<a href="https://discord.gg/3kTNUZz276">
<img src="https://img.shields.io/badge/Discord-Release%20Notifications-blue?label=Docker&style=for-the-badge" />
</a>
<a href="https://discord.gg/3kTNUZz276"><img src="https://img.shields.io/badge/Discord-Release%20Notifications-blue?label=Docker&style=for-the-badge" alt="Discord Banner"/></a>
**Note**: The discord is PURELY for release notifications and any + all permissions involving sending chat messages has been disabled.
[Any support for this repository must take place on the Discussions.](https://github.com/mbround18/valheim-docker/discussions)
Expand Down Expand Up @@ -230,7 +233,7 @@ If you would like to have release notifications tied into your Discord server, c
- Has a bug where the script has two entries for the world argument.
- 1.0.0 (Stable):
- It works! It will start your server and stop when you shut down.
- This supports passing in environment variables or arguments to `odin`
- These supports passing in environment variables or arguments to `odin`
- Has a bug in which it does not read passed in variables appropriately to Odin. Env variables are not impacted see [#3].

[//]: <> (Github Issues below...........)
Expand All @@ -251,7 +254,8 @@ If you would like to have release notifications tied into your Discord server, c
[#3]: https://github.com/mbround18/valheim-docker/issues/3

[//]: <> (Links below...................)
[Odin]: ./docs/odin.md
[Odin]: src/odin/README.md
[Huginn]: src/huginn/README.md
[Valheim]: https://www.valheimgame.com/
[Getting started with mods]: ./docs/getting*started_with_mods.md
[If you need help figuring out a cron schedule click here]: https://crontab.guru/#0_1*\_\_\_\_\*
Expand Down
2 changes: 1 addition & 1 deletion docs/_config.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
theme: jekyll-theme-midnight
theme: jekyll-theme-hacker
4 changes: 3 additions & 1 deletion docs/bepinex.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# BepInEx Support

> [As of March 2021, this repo now has an env flag to run with BepInEx or ValheimPlus Click Here to find out more](tutorials/getting_started_with_mods.md)
## Installing BepInEx

> Due to the fact that there are so many variants of installing and running BepInEx; we will be covering only the basics.
Expand Down Expand Up @@ -57,4 +59,4 @@
| DYLD_LIBRARY_PATH | `"/home/steam/valheim/doorstop_libs"` | TRUE | Sets the library paths. NOTE: This variable is weird and MUST have quotes around it! |
| DYLD_INSERT_LIBRARIES | `/home/steam/valheim/doorstop_libs/libdoorstop_x64.so` | TRUE | Sets which library to load. |

[odin]: ./odin.md
[odin]: ../src/odin/README.md
31 changes: 31 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Valheim Docker

## About

Welcome! Valheim Docker powered by Odin.
The Valheim dedicated game server manager which is designed with resiliency in mind by providing automatic updates,
world backup support, and a user-friendly cli interface.

## Links

- [Getting Started](../README.md)

The repositories Readme contains all relevant information for running with Docker

- [Discussion for Help and Info](https://github.com/mbround18/valheim-docker/discussions)

Discussions are what we use for support as they are easily searchable.

- [Getting Started With & Using Odin](../src/odin/README.md)

You can run your Valheim server without docker! Take a look at Odin's docs.

- [Getting Started With & Using Huginn](../src/huginn/README.md)

Want to see the status of your server? Take a look at Huginn! It can run independently of Odin and this repo.

## Tutorials

- [Getting Started With Mods](tutorials/getting_started_with_mods.md)
- [How to transfer files](tutorials/how-to-transfer-files.md)

File renamed without changes.
14 changes: 12 additions & 2 deletions src/http-server/Cargo.toml → src/huginn/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
[package]
name = "odin-http-server"
name = "huginn"
version = "0.1.0"
authors = ["mbround18"]
edition = "2018"
license = "BSD-3-Clause License"
description = "Valheim http status"
readme = "README.md"
homepage = "https://github.com/mbround18/valheim-docker"
repository = "https://github.com/mbround18/valheim-docker"
include = [
"**/*.rs",
"**/*.yaml",
"Cargo.toml",
]

[[bin]]
name = "odin-http-server"
name = "huginn"
path = "main.rs"

[dependencies]
Expand Down
84 changes: 84 additions & 0 deletions src/huginn/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Huginn

Huginn is a status server used to check the status of your Valheim server.

> [Who is Huginn?](https://en.wikipedia.org/wiki/Huginn_and_Muninn)
## Setup

1. Install Rust & git
2. Clone the repo
3. `cargo install cargo-make`
4. `makers -e production release`
5. `chmod +x ./target/debug/huginn`
6. Copy `./target/debug/huginn` to `/usr/local/bin`

## Usage

### Environment Variables

| Variable | Default | Required | Description |
| --------- | --------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------- |
| ADDRESS | `Your Public IP` | FALSE | This setting is used in conjunction with `odin status` and setting this will stop `odin` from trying to fetch your public IP |
| HTTP_PORT | `anything above 1024` | FALSE | Setting this will spin up a little http server that provides two endpoints for you to call. |


### Manually Launching

Simply launch `huginn` in the background with:

```shell
cd /path/to/your/valheim/server/folder
huginn &
```

### Systemd service

1. With the root user or using sudo run

```shell
nano /etc/systemd/system/huginn.service
```

2. Copy and paste the text below

```toml
[Unit]
Description=Huginn Valheim Status Server
After=network.target
StartLimitIntervalSec=0

[Service]
Type=simple
Restart=always
RestartSec=1
User=steam
Environment="HTTP_PORT=3000" "ADDRESS=127.0.0.1:2457"
WorkingDirectory=/home/steam/valheim
ExecStart=/usr/bin/env /usr/local/bin/huginn

[Install]
WantedBy=multi-user.target
```

3. Make any necessary changes to the service to fit your needs.
(Remember, the port you use in your `ADDRESS` must be your query port which is +1 of your game port.)

4. Next save the file and start the service.

```shell
sudo systemctl start huginn
```

5. To have the server start on server launch, run:

```shell
sudo systemctl enable huginn
```

## Endpoints

| Endpoint | Description |
|------------|------------|
| `/metrics` | Provides a Prometheus compatible output of the server status. [Click here to see a guide on how to get a dashboard setup.](https://github.com/mbround18/valheim-docker/discussions/330) |
| `/status` | Provides a more traditional JSON output of the server status. |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
13 changes: 13 additions & 0 deletions src/odin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@ name = "odin"
version = "1.4.0"
authors = ["mbround18"]
edition = "2018"
license = "BSD-3-Clause License"
description = "Valheim server manager"
readme = "README.md"
homepage = "https://github.com/mbround18/valheim-docker"
repository = "https://github.com/mbround18/valheim-docker"
keywords = ["cli", "valheim", "gameserver"]
categories = ["command-line-utilities"]
include = [
"**/*.rs",
"**/*.yaml",
"Cargo.toml",
]


[[bin]]
name = "odin"
Expand Down
Loading

0 comments on commit 6224967

Please sign in to comment.