Pastum is for quick & simple bookmarking of small pieces of text from the command line, inspired by Termbin.
Raw text is sent over a simple TCP connection, which can then can be read from the HTTP server.
After storing text, Pastum sends a URL then closes the connection.
╰─❯ nc localhost 9999 < lipsum
http://localhost:8080/ychqrful
╰─❯ curl http://localhost:8080/ychqrful
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent id arcu nisi. Quisque imperdiet placerat sollicitudin. Suspendisse aliquam tellus ut aliquet tristique. Ut varius risus a augue hendrerit sodales. Quisque eu nisi pharetra, sodales ipsum nec, laoreet massa. Nulla bibendum orci non nibh mollis tincidunt. Donec at eleifend mi. Morbi egestas augue imperdiet leo aliquet mattis. Fusce lobortis lobortis scelerisque. Donec id est et libero pretium scelerisque a eget lectus. Nam orci magna, viverra a sagittis vitae, tristique a felis. Suspendisse consectetur tortor eleifend purus efficitur tristique.
Production environments should use a proxy such as Caddy or NginX to terminate TLS/HTTPS in front of Pastum. Configure webUrlPrefix
to the public URL root proxied to Pastum. The TCP listener can be exposed directly or via TCP proxy.
A PostgreSQL server is required somewhere this service can connect to. The connection URI ("pgUri") is stored in config.json
. A configuration example is in the Deployment section of this document.
Runtime Dependencies:
-
Java (JDK 17+)
The following HTTP paths are used for monitoring, and should be blocked from public access:
-
/health*
-
/metrics*
The /metrics
path is configured for Prometheus until something else is needed. The /health
path is intended for use with e.g. node_exporter until there’s a reason to do everything with Micrometer/Prometheus.
Pastum comes with dev
and prod
environment templates in src/main/resources/conf/template.config.json
.
To configure your database in prod
:
-
Set PGCONNECTIONURI
-
Use jq to rewrite the
prod
(ordev
) stanza of the template to createsrc/main/resources/conf/config.json
╰─❯ PGCONNECTIONURI="postgresql://admin:admin@localhost:5432/lillop"
╰─❯ jq ".prod.pgUri=\""$PGCONNECTIONURI"\"" < template.config.json > src/main/resources/conf/config.json
The rest of the configuration variables may be set similarly
Set LILLOP_ENV to prod
via the process environment or the Java properties. The name of this environment variable may be changed by altering .appEnv
in config.json.
Examples:
╰─❯ java -DLILLOP_ENV=prod -jar target/pastum-1.0.0-SNAPSHOT-fat.jar
╰─❯ LILLOP_ENV=prod java -jar target/pastum-1.0.0-SNAPSHOT-fat.jar
To launch your tests:
./mvnw clean test
To package your application:
./mvnw clean package
To run your application:
./mvnw clean compile exec:java
I like building things that work and Vert.x really satisfies.
Template projects from https://start.vertx.io are excellent foundations, but I want a project stub with even more opinionated batteries included, specifically:
-
Full-cycle configuration management
-
Search classpath and CWD for conf/config.json
-
Config delivered to verticles through deployment descriptor
-
-
Web
-
Metrics
-
Database access (Postgres, of course)