#server #postgresql #registry #component #warg #registries #in-memory

dev bin+lib warg-server

A server library for Warg component registries

8 releases (breaking)

new 0.6.0 May 9, 2024
0.5.0-dev Mar 7, 2024
0.4.4 May 9, 2024
0.2.0 Oct 20, 2023
0.0.0 Jan 31, 2023

#404 in Database interfaces

Download history 4/week @ 2024-01-17 97/week @ 2024-01-24 2/week @ 2024-01-31 16/week @ 2024-02-07 21/week @ 2024-02-14 99/week @ 2024-02-21 165/week @ 2024-02-28 313/week @ 2024-03-06 66/week @ 2024-03-13 12/week @ 2024-03-20 20/week @ 2024-03-27 118/week @ 2024-04-03 109/week @ 2024-04-10 38/week @ 2024-04-17 107/week @ 2024-04-24 97/week @ 2024-05-01

353 downloads per month
Used in 4 crates

Apache-2.0 WITH LLVM-exception

450KB
11K SLoC

Warg Registry Server

⚠️ This is prototype quality code at this time. ⚠️

Running the server

The registry server can be started with either in-memory or PostgreSQL storage.

In-memory storage

With in-memory storage, the server will store all data in-memory and the data will be lost when the server is stopped.

To start the server, provide the WARG_OPERATOR_KEY environment variable, which is used to sign the entries in the server's operator log:

Also, provide the WARG_NAMESPACE environment variable to define the initial namespace for package publishing.

$ WARG_NAMESPACE=example WARG_OPERATOR_KEY="ecdsa-p256:I+UlDo0HxyBBFeelhPPWmD+LnklOpqZDkrFP5VduASk=" cargo run -- --content-dir content
2023-04-18T23:48:52.149746Z  INFO warg_server::services::core: initializing core service
2023-04-18T23:48:52.170199Z  INFO warg_server::services::core: core service is running
2023-04-18T23:48:52.170233Z  INFO warg_server: listening on 127.0.0.1:8090

PostgreSQL storage

With PostgreSQL storage, the server will store all data in a PostgreSQL database.

Support for PostgreSQL storage is behind the postgres compilation feature flag.

The easiest way to start a PostgreSQL server is with Docker:

docker run -d --name postgres -e POSTGRES_PASSWORD=password -v /tmp/data:/var/lib/postgresql/data -p 5432:5432 postgres

With the above command, data will be stored in /tmp/data on the host machine.

To set up the database, install diesel-cli:

cargo install diesel_cli

And run the setup with:

diesel database setup --database-url postgres://postgres:password@localhost/registry

Here, registry is the database name that will be created.

To start the registry server, provide both the WARG_OPERATOR_KEY and WARG_DATABASE_URL environment variables:

WARG_NAMESPACE=example WARG_DATABASE_URL=postgres://postgres:password@localhost/registry WARG_OPERATOR_KEY="ecdsa-p256:I+UlDo0HxyBBFeelhPPWmD+LnklOpqZDkrFP5VduASk=" cargo run -p warg-server --features postgres -- --content-dir content --data-store postgres

The --data-store postgres flag starts the server with PostgreSQL data storage.

The server may now be restarted and will continue to use the same database.

Dependencies

~20–38MB
~605K SLoC