atomic-server
Status: alpha, not ready for production usage. Can panic at runtime.
The easiest way to share Atomic Data on the web. Demo on atomicdata.dev
- No runtime dependencies, fast, runs on all platforms (including on your Raspberry Pi)
- Embedded HTTP / HTTPS / HTTP2.0 server
- Serialization to HTML, JSON, Linked Data (RDF/XML, N-Triples / Turtle / JSON-LD) and AD3
Powered by Rust, atomic_lib, actix-web, Sled and more.
Progress
- Respond to GET request for individual resources
- HTML serialization
- JSON serialization
- JSON-LD serialization
- AD3 serialization
- RDF (Turtle / N-Triples) serialization
- Basic error handling
- TPF endpoint
- Homepage
- Static asset support for .css / .ico / etc.
- HTTPS (WIP, kind of working)
- Content-type negotiation
- Basic design / use CSS framework
- Eliminate all preventable runtime panics (most already done)
- URL extension recognition (.json, .ad3, .nt, etc.)
- Collections / dynamic resources #17
- Write / Mutations support (might need #16)
- Auth support (WebID-OICD possibly?) #13
- Be able to manage the AtomicData.dev website without git
Install from source
Install Cargo to build from source.
# Create a new .env using the template
# Run the server. It creates a store in ~/.config/atomic/db by default
# Visit http://localhost:8080/test
- Run
atomic-server
inside a directory with/static
folder for files - If you want to use HTTPS / TLS, set
ATOMIC_CERT_INIT
totrue
and run the server. After that, set it tofalse
and setATOMIC_HTTPS
totrue
. - If no
.ad3
store path is given, a new store will be created from memory.
Running from cargo
You can also install with cargo install atomic-server
, but this binary will also require:
- the
.env
from this repo, although the defaults should work just fine. - the
/templates
directory - the
/static
directory
Usage
Get individual resources
You can fetch individual items by sending a GET request to their URL.
# Fetch as AD3 triples
# Fetch as JSON-LD
# Fetch as JSON
# Fetch as Turtle / N3
Query the store with Triple Pattern Fragments
# Fetch as AD3 triples
HTTPS Setup
You'll probably want to make your Atomic Data available through HTTPS.
You can use the embedded HTTPS / TLS setup powered by LetsEncrypt, acme_lib and rustls.
To setup HTTPS, we'll need to set some environment variables.
Open .env
and set:
ATOMIC_EMAIL=youremail@example.com
ATOMIC_DOMAIN=example.com
Run the server cargo run
.
Make sure the server is accessible at ATOMIC_DOMAIN
at port 80, because Let's Encrypt will send an HTTP request to this server's /.well-known
directory to check the keys.
It will now initialize the certificate.
Read the logs, watch for errors.
Note that there is no logic yet for renewing certificates - I think removing the generated .https
folder is the easiest approach.
Testing
# This also makes sure that cli and server work, plus it test the db feature
Performance benchmarking
# Install drill