Complete Phase 1 and Hour 4 gallery/status polish
This commit is contained in:
2
poc/agent/agent.log
Normal file
2
poc/agent/agent.log
Normal 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)
|
||||
27
poc/agent/install-user-service.sh
Executable file
27
poc/agent/install-user-service.sh
Executable 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"
|
||||
@@ -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 {
|
||||
|
||||
BIN
poc/agent/photos/1000199397.jpg
Normal file
BIN
poc/agent/photos/1000199397.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.4 MiB |
BIN
poc/agent/photos/1000208662.jpg
Normal file
BIN
poc/agent/photos/1000208662.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.6 MiB |
15
poc/agent/systemd/memoric-agent.service
Normal file
15
poc/agent/systemd/memoric-agent.service
Normal 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
|
||||
Reference in New Issue
Block a user