atomic-server
Status: Beta. Changelog
The easiest way to share Atomic Data on the web. Demo on atomicdata.dev
- No runtime dependencies, fast, runs on all platforms
- 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.
When should you use this
- You want to make (high-value) datasets as easily accessible as possible
- You can afford to create or find an Atomic Schema for your dataset (use
atomic-cli new class
for this). Example classes here. - You want to use and share linked data, but don't want to deal with most of the complexities of RDF, SPARQL, Triple Stores, Named Graphs and Blank Nodes.
- You like living on the edge (this application is not production ready)
Getting started
Run using docker
The dockerfile
is located in the project root, above this server
folder.
- Run:
docker run -p 80:80 -p 443:443 -v atomic-storage:/atomic-storage joepmeneer/atomic-server
- Take note of the Agent Subject and Private key, you should use these in the
atomic-cli
client for authorization.
Install from source
Install Cargo to build from source.
# Clone this repoo
# Optional, but recommended: Create a new .env using the template.
# Run the server. It creates a store in ~/.config/atomic/db by default
# Visit http://localhost
Running from cargo
You can also install with cargo install atomic-server
, but this binary will also require:
- the
/templates
directory - the
/static
directory
Usage
Check out ./example_requests.http for various HTTP requests to the server.
Set up on own domain
If you want to run Atomic Server on your own VPS + domain, make sure to correctly set the .env
.
See default.env
for a template and explanation of variables.
Use atomic-cli
as client
atomic-cli
is a useful terminal tool for interacting with atomic-server
.
It makes it easy to query and edit Atomic Data from the command line.
Check it out.
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.
HTTPS certificates are automatically renewed when the server is restarted, and the certs are 4 weeks or older.
Testing
# This also makes sure that cli and server work, plus it test the db feature
Performance benchmarking
# Install drill