Complete Phase 1 and Hour 4 gallery/status polish

This commit is contained in:
2026-05-14 17:54:01 +08:00
parent 728a6749a8
commit 6af248861b
14 changed files with 516 additions and 214 deletions

2
poc/agent/agent.log Normal file
View File

@@ -0,0 +1,2 @@
2026/05/14 15:57:34 connected to broker at wss://memory.clouderized.com/agent
2026/05/14 15:57:48 served 1000208662.jpg (2713195 bytes)

View File

@@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
APP_DIR="${HOME}/.local/share/memoric-agent"
SYSTEMD_USER_DIR="${HOME}/.config/systemd/user"
mkdir -p "${APP_DIR}"
mkdir -p "${SYSTEMD_USER_DIR}"
echo "[1/4] Building agent binary..."
cd "${SCRIPT_DIR}"
go build -o "${APP_DIR}/memoric-agent" .
echo "[2/4] Installing systemd unit..."
cp "${SCRIPT_DIR}/systemd/memoric-agent.service" "${SYSTEMD_USER_DIR}/memoric-agent.service"
echo "[3/4] Reloading user daemon..."
systemctl --user daemon-reload
echo "[4/4] Enabling and starting memoric-agent..."
systemctl --user enable --now memoric-agent
echo
echo "MemoriC agent service installed."
echo "Check status with: systemctl --user status memoric-agent"
echo "View logs with: journalctl --user -u memoric-agent -f"

View File

@@ -11,7 +11,7 @@ import (
)
const brokerURL = "wss://memory.clouderized.com/agent"
const storageDir = "./photos"
const defaultStorageDir = "./photos"
type Message struct {
Type string `json:"type"`
@@ -22,9 +22,15 @@ type Message struct {
}
func main() {
storageDir := os.Getenv("STORAGE_DIR")
if storageDir == "" {
storageDir = defaultStorageDir
}
if err := os.MkdirAll(storageDir, 0755); err != nil {
log.Fatal(err)
}
log.Println("photo storage directory:", storageDir)
conn, _, err := websocket.DefaultDialer.Dial(brokerURL, nil)
if err != nil {

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 MiB

View File

@@ -0,0 +1,15 @@
[Unit]
Description=MemoriC Agent
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
WorkingDirectory=%h/.local/share/memoric-agent
Environment=STORAGE_DIR=%h/memoric/photos
ExecStart=%h/.local/share/memoric-agent/memoric-agent
Restart=always
RestartSec=5
[Install]
WantedBy=default.target