feat/queue-messages (#19)

Co-authored-by: jon brookes <marshyon@gmail.com>
Reviewed-on: https://codeberg.org/headshed/share-lt/pulls/19
This commit is contained in:
Jon Brookes 2026-02-09 18:09:35 +01:00
parent 1a22fd156d
commit 74bc17d019
9 changed files with 88 additions and 8 deletions

View file

@ -14,10 +14,10 @@ steps:
- docker pull quay.io/marshyon/share-lt:latest || true
- echo "Building image for testing (amd64 only for CI compatibility)..."
- docker build --platform linux/amd64 --cache-from=quay.io/marshyon/share-lt:latest -t share-lt:test .
- echo "Tagging test image as quay.io/marshyon/share-lt:v0.0.5..."
- docker tag share-lt:test quay.io/marshyon/share-lt:v0.0.5
- echo "Tagging test image as quay.io/marshyon/share-lt:v0.0.6..."
- docker tag share-lt:test quay.io/marshyon/share-lt:v0.0.6
- echo "Generating SBOM..."
- docker run --rm -v /var/run/docker.sock:/var/run/docker.sock anchore/syft:latest scan quay.io/marshyon/share-lt:v0.0.5 -o cyclonedx-json > sbom.json
- docker run --rm -v /var/run/docker.sock:/var/run/docker.sock anchore/syft:latest scan quay.io/marshyon/share-lt:v0.0.6 -o cyclonedx-json > sbom.json
scan-vulnerabilities:
image: aquasec/trivy:0.67.2
volumes:
@ -41,7 +41,7 @@ steps:
repo: quay.io/marshyon/share-lt
platforms: linux/amd64
tags:
- v0.0.5
- v0.0.6
- latest
username:
from_secret: QUAY_USERNAME
@ -57,6 +57,6 @@ steps:
COSIGN_REGISTRY_PASSWORD:
from_secret: QUAY_PASSWORD
commands:
- cosign attach sbom --sbom sbom.json quay.io/marshyon/share-lt:v0.0.5 || echo "SBOM attach failed"
- cosign attach sbom --sbom sbom.json quay.io/marshyon/share-lt:v0.0.6 || echo "SBOM attach failed"
- echo "Done - trivy report saved to workspace for manual review"

View file

@ -1,5 +1,12 @@
# CHANGELOG
## 2026-02-09
added reference compose files
added basic NATS integration
## 2026-01-25
added s3, docker build

View file

@ -35,9 +35,14 @@ class ProcessEntryUpdate implements ShouldQueue
public function handle(): void
{
$subject = env('NATS_SUBJECT', 'entry_update');
$appUrl = env('APP_URL', 'http://localhost');
$incoming = [
'id' => $this->entryId,
'action' => $this->action,
'subject' => $subject,
'app_url' => $appUrl,
];
$jsonData = json_encode($incoming, JSON_THROW_ON_ERROR);

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash
LARAVEL_CONTAINER_NAME="quay.io/marshyon/share-lt"
CONTAINER_LABEL="v0.0.5"
CONTAINER_LABEL="v0.0.6"
CACHE="--no-cache"
# CACHE=""

View file

@ -0,0 +1,46 @@
#!/usr/bin/env bash
# This script creates a NATS stream using the nats CLI tool.
# It reads the stream name, password, and subject from an .env file.
ENV_FILE=".env"
if [ ! -f "$ENV_FILE" ]; then
echo ".env file not found at $ENV_FILE"
exit 1
fi
. "$ENV_FILE"
if [ -z "$NATS_STREAM" ]; then
echo "NATS_STREAM is not set in .env file"
exit 1
fi
if [ -z "$NATS_PASSWORD" ]; then
echo "NATS_PASSWORD is not set in .env file"
exit 1
fi
if [ -z "$NATS_SUBJECT" ]; then
echo "NATS_SUBJECT is not set in .env file"
exit 1
fi
nats \
stream add "$NATS_STREAM" \
--user ruser --password $NATS_PASSWORD \
--subjects "$NATS_SUBJECT" \
--storage file \
--dupe-window="2m" \
--replicas=1 \
--max-msgs-per-subject=-1 \
--no-allow-rollup \
--no-deny-delete \
--no-deny-purge \
--discard=old \
--max-msgs=-1 \
--max-bytes=-1 \
--max-msg-size=-1 \
--max-age=1h \
--retention limits

View file

@ -25,7 +25,7 @@ services:
# - nats
app:
image: quay.io/marshyon/share-lt:v0.0.5
image: quay.io/marshyon/share-lt:v0.0.6
restart: unless-stopped
tty: false
working_dir: /var/www

View file

@ -0,0 +1,22 @@
services:
nats:
image: nats:2.9.19-alpine
restart: unless-stopped
ports:
- 4222:4222
- 8222:8222
volumes:
- ./nats/nats-server.conf:/nats-server.conf
- nats-data:/opt/storage
command: ["-c", "/nats-server.conf"]
networks:
- nats
volumes:
nats-data:
driver: local
networks:
nats:
external: true

View file

@ -1,6 +1,6 @@
services:
app:
image: quay.io/marshyon/share-lt:v0.0.5
image: quay.io/marshyon/share-lt:v0.0.6
restart: unless-stopped
tty: false
working_dir: /var/www