== media-server
https://ci.codeberg.org/Mediathek/media-server[image:https://ci.codeberg.org/api/badges/Mediathek/media-server/status.svg[pipeline status]] https://goreportcard.com/report/codeberg.org/Mediathek/media-server[image:https://goreportcard.com/badge/codeberg.org/Mediathek/media-server[Go Report Card]]
This should become the Server of the OpenSource Mediathek and Streaming-Server.
For the Frontend, take a look here: https://codeberg.org/Mediathek/media-ui[media-ui]
=== Compile
[source,sh]
----
go get -v -u codeberg.org/Mediathek/media-server
----
=== Configuration
Copy link:./config_example.toml[`config_example.toml`] to `config.toml` and take a look there.
=== Pre-requierements
* PostgreSQL - Database (or cockroachdb)
For Testing we use a database called `media_server` with user `root`, take a look in link:./.github/workflows/ci.yml#L26-L51[CI-Scripts]
=== Startup
Everything is controlled by the `config.toml`. A database migration happens on every startup if necessary.
==== For Developers
[source,sh]
----
go run ./main.go
----
==== In Production
Create https://www.freedesktop.org/software/systemd/man/systemd.service.html[systemd.service] file under: `/etc/systemd/system/media-server.service`
[source,ini]
----
[Unit]
Description = media-server
[Service]
Type=simple
User=mediaserver
ExecStart=/usr/local/bin/media-server -c /etc/media-server.conf
Restart=always
RestartSec=5s
Environment=PATH=/usr/bin:/usr/local/bin
[Install]
WantedBy=multi-user.target
----
Store in `media-server.service` given path: - config file - binary
Enable service on Startup of service and start now:
[source,sh]
----
systemctl enable --now media-server.service
----