# Ordinary Server

[![crates.io](https://img.shields.io/crates/v/ordinaryd.svg)](https://crates.io/crates/ordinaryd)
[![docs.rs](https://docs.rs/ordinaryd/badge.svg)](https://docs.rs/ordinaryd/)
[![dependency status](https://deps.rs/crate/ordinaryd/0.5.51/status.svg)](https://deps.rs/crate/ordinaryd)
[![License: AGPL v3](https://img.shields.io/badge/License-AGPL_v3-blue.svg)](https://www.gnu.org/licenses/agpl-3.0)

Server daemon for Ordinary.

The Ordinary Server is primarily built on [axum](https://docs.rs/axum/latest/axum/)
and [Tokio](https://docs.rs/tokio/latest/tokio/).

OpenAPI docs are generated with [Utoipa](https://docs.rs/utoipa/latest/utoipa/).

CNAME verification is performed using [Hickory DNS](https://crates.io/crates/hickory-client).

## Installation

From [releases](https://codeberg.org/ordinarylabs/Ordinary/releases) or using cargo.

```sh
cargo install ordinaryd
```

## Quick Start

Initialize a new instance.

```sh
ordinaryd --init --password '******' --environment development --api-domain ordinaryd.local --api-contacts you@example.com --provision localhost --insecure --port 4433 --redirect-port 8080 --storage-size 10000000 --stdio-logs --swagger
```

Jsonart initialized instance.

```sh
ordinaryd --environment development --api-domain ordinaryd.local --api-contacts you@example.com --provision localhost --insecure --port 4433 --redirect-port 8080 --storage-size 10000000 --stdio-logs --swagger
```

## CLI Documentation

See: [DOCS.md](https://codeberg.org/ordinarylabs/Ordinary/src/branch/main/core/executables/daemon/DOCS.md).

## On Shutdown (terminate/ctrl-c)

When shutdown, the daemon will "gracefully" shut down all open http1/http2 connections
via [`hyper`'s](https://docs.rs/hyper/latest/hyper/)
[
`graceful_shutdown`](https://docs.rs/hyper-util/latest/hyper_util/server/conn/auto/struct.UpgradeableConnection.html#method.graceful_shutdown)
method; this should allow for all connection dependent tasks to resolve prior to termination.

Non-connection based background tasks (cache and log syncing) still need to be set up to run a final time prior to
termination
and after all connections have been closed.
