mirror of
https://github.com/samsonjs/agate.git
synced 2026-04-05 10:55:48 +00:00
55 lines
2.3 KiB
Markdown
55 lines
2.3 KiB
Markdown
# Agate
|
|
|
|
## Simple Gemini server for static files
|
|
|
|
Agate is a server for the [Gemini] network protocol, built with the [Rust] programming language. Agate has very few features, and can only serve static files. It uses async I/O, and should be quite efficient even when running on low-end hardware and serving many concurrent requests.
|
|
|
|
## Learn more
|
|
|
|
* Home page: [gemini://gem.limpet.net/agate/][home]
|
|
* [Cargo package][crates.io]
|
|
* [Source code][source]
|
|
|
|
## Installation and setup
|
|
|
|
1. Download and unpack the [pre-compiled binary](https://github.com/mbrubeck/agate/releases).
|
|
|
|
Or, if you have the Rust toolchain installed, run `cargo install agate` to
|
|
install agate from crates.io.
|
|
|
|
Or download the source code and run `cargo build --release` inside the
|
|
source repository, then find the binary at `target/release/agate`.
|
|
|
|
2. Generate a self-signed TLS certificate and private key. For example, if you have OpenSSL 1.1 installed, you can use a command like the following. (Replace the hostname with the address of your Gemini server.)
|
|
|
|
```
|
|
openssl req -x509 -newkey rsa:4096 -keyout key.rsa -out cert.pem \
|
|
-days 3650 -nodes -subj "/CN=example.com"
|
|
```
|
|
|
|
3. Run the server. You can use the following arguments to specify the locations of the content directory, certificate and key files, IP address and port to listen on, and (optionally) a domain that will be used to validate request URLs:
|
|
|
|
```
|
|
agate --content path/to/content/ \
|
|
--key key.rsa \
|
|
--cert cert.pem \
|
|
--addr 0.0.0.0:1965 \
|
|
--hostname example.com
|
|
```
|
|
|
|
All of the command-line arguments are optional. Run `agate --help` to see the default values used when arguments are omitted.
|
|
|
|
When a client requests the URL `gemini://example.com/foo/bar`, Agate will respond with the file at `path/to/content/foo/bar`. If there is a directory at that path, Agate will look for a file named `index.gmi` inside that directory.
|
|
|
|
To enable console logging, set a log level via the `AGATE_LOG` environment variable. Logging is powered by the [env_logger crate](https://crates.io/crates/env_logger):
|
|
|
|
```
|
|
AGATE_LOG=info agate --content path/to/content/
|
|
```
|
|
|
|
[Gemini]: https://gemini.circumlunar.space/
|
|
[Rust]: https://www.rust-lang.org/
|
|
[home]: gemini://gem.limpet.net/agate/
|
|
[rustup]: https://www.rust-lang.org/tools/install
|
|
[source]: https://github.com/mbrubeck/agate
|
|
[crates.io]: https://crates.io/crates/agate
|