mirror of
https://github.com/imtbl/hydrus-server-docker
synced 2024-05-02 19:53:02 +12:00
feat: Add initial version
This commit is contained in:
parent
2e02c7e902
commit
e32d069f7d
10
.editorconfig
Normal file
10
.editorconfig
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
indent_size = 2
|
||||||
|
indent_style = space
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
trim_trailing_whitespace = false
|
8
.travis.yml
Normal file
8
.travis.yml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
services:
|
||||||
|
- docker
|
||||||
|
install:
|
||||||
|
- docker build . -t hydrus-server
|
||||||
|
- docker run -d hydrus-server
|
||||||
|
script:
|
||||||
|
- '[ $(docker ps | grep -c hydrus-server) -eq 1 ]'
|
||||||
|
- docker inspect -f "{{ .State.Running }}" $(docker ps -aq) | grep -zoPq "true"
|
12
CHANGELOG.md
Normal file
12
CHANGELOG.md
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# Changelog
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
||||||
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
+ Initial release
|
43
Dockerfile
Normal file
43
Dockerfile
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
FROM debian:stretch
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y ffmpeg curl wget
|
||||||
|
|
||||||
|
ARG HOST_USER_ID=1000
|
||||||
|
ARG HOST_GROUP_ID=1000
|
||||||
|
|
||||||
|
ENV HOST_USER_ID=$HOST_USER_ID
|
||||||
|
ENV HOST_GROUP_ID=$HOST_GROUP_ID
|
||||||
|
|
||||||
|
RUN \
|
||||||
|
if [ $(getent group ${HOST_GROUP_ID}) ]; then \
|
||||||
|
useradd -r -u ${HOST_USER_ID} hydrus; \
|
||||||
|
else \
|
||||||
|
groupadd -g ${HOST_GROUP_ID} hydrus && \
|
||||||
|
useradd -r -u ${HOST_USER_ID} -g hydrus hydrus; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
|
RUN wget "https://www.github.com$( \
|
||||||
|
curl -sL https://github.com/hydrusnetwork/hydrus/releases/latest \
|
||||||
|
| grep 'Linux.-.Executable.tar.gz' \
|
||||||
|
| sed -n 's/.*href="\([^"]*\).*/\1/p')"
|
||||||
|
|
||||||
|
RUN tar zxvf $(ls | grep "Linux.-.Executable.tar.gz") --strip-components 1
|
||||||
|
RUN rm $(ls | grep "Linux.-.Executable.tar.gz") \
|
||||||
|
&& chown -R hydrus:hydrus /usr/src/app
|
||||||
|
|
||||||
|
RUN mkdir /data && chown -R hydrus:hydrus /data
|
||||||
|
|
||||||
|
VOLUME /data
|
||||||
|
|
||||||
|
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint
|
||||||
|
RUN chmod +x /usr/local/bin/docker-entrypoint
|
||||||
|
|
||||||
|
EXPOSE 45870/tcp
|
||||||
|
EXPOSE 45871/tcp
|
||||||
|
EXPOSE 45872/tcp
|
||||||
|
|
||||||
|
USER hydrus
|
||||||
|
|
||||||
|
ENTRYPOINT ["docker-entrypoint"]
|
21
LICENSE.md
Normal file
21
LICENSE.md
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
# MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2018 Michael Serajnik
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
173
README.md
173
README.md
|
@ -1,3 +1,172 @@
|
||||||
# hydrus-server-docker
|
# hydrus-server-docker [![hydrus server version][hydrus-server-badge]][hydrus-server-version] [![Build status][travis-badge]][travis] [![Docker Hub build][docker-hub-badge]][docker-hub]
|
||||||
|
|
||||||
> Built version of hydrus server running on Debian
|
> Built version of [hydrus server][hydrus-server] running on Debian
|
||||||
|
|
||||||
|
This is a simple Debian-based Docker setup for running the built version of
|
||||||
|
[hydrus server][hydrus-server]. It was mainly created for making it easier to
|
||||||
|
run hydrus server together with [hydrusrv][hydrusrv], but can of course also be
|
||||||
|
used on its own.
|
||||||
|
|
||||||
|
The latest build runs [hydrus server version 332][hydrus-server-version].
|
||||||
|
|
||||||
|
## Table of contents
|
||||||
|
|
||||||
|
+ [Install](#install)
|
||||||
|
+ [Dependencies](#dependencies)
|
||||||
|
+ [Updating](#updating)
|
||||||
|
+ [Usage](#usage)
|
||||||
|
+ [Additional configuration when building](#additional-configuration-when-building)
|
||||||
|
+ [UID/GID](#uidgid)
|
||||||
|
+ [Caveats](#caveats)
|
||||||
|
+ [Donate](#donate)
|
||||||
|
+ [Maintainer](#maintainer)
|
||||||
|
+ [Contribute](#contribute)
|
||||||
|
+ [License](#license)
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
The easiest way to install is via [Docker Hub][docker-hub]:
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
user@local:~$ docker pull mserajnik/hydrus-server-docker
|
||||||
|
```
|
||||||
|
|
||||||
|
By default, this will pull the latest build. To specify an image with a
|
||||||
|
specific version of hydrus server, provide the version number as tag, e.g.:
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
user@local:~$ docker pull mserajnik/hydrus-server-docker:332
|
||||||
|
```
|
||||||
|
|
||||||
|
See [here][docker-hub-tags] for all the available version numbers/tags.
|
||||||
|
|
||||||
|
Alternatively, you can clone this repository and build the image yourself:
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
user@local:~$ git clone https://github.com/mserajnik/hydrus-server-docker.git
|
||||||
|
user@local:~$ cd hydrus-server-docker
|
||||||
|
user@local:hydrus-server-docker$ docker build . -t hydrus-server-docker
|
||||||
|
```
|
||||||
|
|
||||||
|
### Dependencies
|
||||||
|
|
||||||
|
+ [Docker][docker]
|
||||||
|
|
||||||
|
### Updating
|
||||||
|
|
||||||
|
If you have installed via Docker Hub, just pull the updated image. Otherwise,
|
||||||
|
just pull from this repository and make a new build.
|
||||||
|
|
||||||
|
This repository follows [semantic versioning][semantic-versioning] and any
|
||||||
|
breaking changes that require additional attention will be released under a new
|
||||||
|
major version (e.g., `2.0.0`). Minor version updates (e.g., `1.1.0` or `1.2.0`)
|
||||||
|
are therefore always safe to simply install via the routine mentioned before.
|
||||||
|
|
||||||
|
When necessary, this section will be expanded with upgrade guides to new major
|
||||||
|
versions.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
hydrus-server-docker mounts a volume on `/data` that is used to store the
|
||||||
|
databases and media. It is highly recommended to create a named volume:
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
user@local:~$ docker volume create hydrus-server-data
|
||||||
|
```
|
||||||
|
|
||||||
|
Likewise, you need to bind the exposed ports. This can be done automatically
|
||||||
|
using `-P` but it is recommended to bind them manually instead since having
|
||||||
|
changing ports every time you run a new container might be annoying when used
|
||||||
|
in combination with other services.
|
||||||
|
|
||||||
|
hydrus-server-docker exposes the following three ports by default:
|
||||||
|
|
||||||
|
+ `45870/tcp`
|
||||||
|
+ `45871/tcp`
|
||||||
|
+ `45872/tcp`
|
||||||
|
|
||||||
|
These are used to access the different services. `45870` is the default port
|
||||||
|
for the server administration service while `45871` and `45872` are used for
|
||||||
|
repositories. You will generally have two (one for tags and one for files), but
|
||||||
|
if you add more, you will also need to expose additional ports.
|
||||||
|
|
||||||
|
After creating your named volume, you can run the container:
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
user@local:~$ docker run -p 45870:45870 -p 45871:45871 -p 45872:45872 -v hydrus-server-data:/data -d mserajnik/hydrus-server-docker
|
||||||
|
```
|
||||||
|
|
||||||
|
### Additional configuration when building
|
||||||
|
|
||||||
|
#### UID/GID
|
||||||
|
|
||||||
|
By default, the user that owns the data and runs the server inside the
|
||||||
|
container has the UID `1000` and the GID `1000`. You can make a build providing
|
||||||
|
the arguments `HOST_USER_ID` and `HOST_GROUP_ID` to change these defaults.
|
||||||
|
|
||||||
|
This is useful if you want to access the data outside the container with a user
|
||||||
|
with different ID's without hassle. In such a case, `HOST_USER_ID` and
|
||||||
|
`HOST_GROUP_ID` should match the user that is going to access the data on the
|
||||||
|
host.
|
||||||
|
|
||||||
|
## Caveats
|
||||||
|
|
||||||
|
+ The built image also includes the hydrus client due to the built releases
|
||||||
|
always including both of it and the server. This adds quite a bit of size to
|
||||||
|
the image.
|
||||||
|
+ To upgrade hydrus server to a new version, you need to either make a new
|
||||||
|
build yourself (when using `--no-cache` it will automatically download the
|
||||||
|
latest version of hydrus server), upgrade it directly inside the running
|
||||||
|
container or wait until I make a new release. I will try to keep up with
|
||||||
|
every new hydrus release (usually weekly on Wednesdays), but cannot make any
|
||||||
|
promises.
|
||||||
|
|
||||||
|
## Donate
|
||||||
|
|
||||||
|
If you like hydrus-server-docker and want to buy me a coffee, feel free to
|
||||||
|
donate via PayPal:
|
||||||
|
|
||||||
|
[![Donate via PayPal][paypal-image]][paypal]
|
||||||
|
|
||||||
|
Alternatively, you can also send me BTC:
|
||||||
|
|
||||||
|
![Donate BTC][btc-image]
|
||||||
|
`13jRyroNn8QF4mbGZxKS6mR3PsxjYTsGsu`
|
||||||
|
|
||||||
|
Donations are unnecessary, but very much appreciated. :)
|
||||||
|
|
||||||
|
## Maintainer
|
||||||
|
|
||||||
|
[mserajnik][maintainer]
|
||||||
|
|
||||||
|
## Contribute
|
||||||
|
|
||||||
|
You are welcome to help out!
|
||||||
|
|
||||||
|
[Open an issue][issues] or submit a pull request.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
[MIT](LICENSE.md) © Michael Serajnik
|
||||||
|
|
||||||
|
[hydrus-server]: http://hydrusnetwork.github.io/hydrus/
|
||||||
|
[hydrusrv]: https://github.com/mserajnik/hydrusrv
|
||||||
|
[hydrus-server-version]: https://github.com/hydrusnetwork/hydrus/releases/tag/v332
|
||||||
|
[docker-hub]: https://hub.docker.com/r/mserajnik/hydrus-server-docker/
|
||||||
|
[docker-hub-tags]: https://hub.docker.com/r/mserajnik/hydrus-server-docker/tags/
|
||||||
|
[docker]: https://www.docker.com/
|
||||||
|
[semantic-versioning]: https://semver.org/
|
||||||
|
|
||||||
|
[hydrus-server-badge]: https://img.shields.io/badge/hydrus%20server-version%20332-blue.svg
|
||||||
|
|
||||||
|
[travis]: https://travis-ci.com/mserajnik/hydrus-server-docker
|
||||||
|
[travis-badge]: https://travis-ci.com/mserajnik/hydrus-server-docker.svg
|
||||||
|
|
||||||
|
[docker-hub-badge]: https://img.shields.io/docker/automated/mserajnik/hydrus-server-docker.svg
|
||||||
|
|
||||||
|
[paypal]: https://www.paypal.me/mserajnik
|
||||||
|
[paypal-image]: https://www.paypalobjects.com/webstatic/en_US/i/btn/png/blue-rect-paypal-26px.png
|
||||||
|
[btc-image]: https://mserajnik.at/external/btc.png
|
||||||
|
|
||||||
|
[maintainer]: https://github.com/mserajnik
|
||||||
|
[issues]: https://github.com/mserajnik/hydrus-server-docker/issues/new
|
||||||
|
|
11
docker-entrypoint.sh
Normal file
11
docker-entrypoint.sh
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
stop_server() {
|
||||||
|
./server stop -d="/data"
|
||||||
|
}
|
||||||
|
|
||||||
|
trap "stop_server" SIGTERM
|
||||||
|
|
||||||
|
./server -d="/data" &
|
||||||
|
|
||||||
|
wait $!
|
Loading…
Reference in a new issue