Compare commits
No commits in common. "7f6911b73eba4a8183a89e36ab048f3912965099" and "7fc8cd9dcdf1b480d462335cc6bd30b7d035abfa" have entirely different histories.
7f6911b73e
...
7fc8cd9dcd
3 changed files with 8 additions and 28 deletions
|
|
@ -1,9 +1,5 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
export AWS_PROFILE=personal
|
export AWS_PROFILE=personal
|
||||||
|
|
||||||
docker buildx build --platform linux/amd64,linux/arm64 -t 853019563312.dkr.ecr.eu-central-1.amazonaws.com/micro-blog-fetchers-homelabstack:latest --push .
|
docker buildx build --platform linux/amd64,linux/arm64 -t 853019563312.dkr.ecr.eu-central-1.amazonaws.com/micro-blog-fetchers-homelabstack:latest --push .
|
||||||
|
|
||||||
echo "Image pushed to ECR"
|
|
||||||
|
|
@ -4,11 +4,10 @@
|
||||||
[micro-blog.config :refer [config]]
|
[micro-blog.config :refer [config]]
|
||||||
micro-blog.mastodon
|
micro-blog.mastodon
|
||||||
micro-blog.blue-sky
|
micro-blog.blue-sky
|
||||||
micro-blog.nostr
|
|
||||||
[taoensso.telemere :as tel]))
|
[taoensso.telemere :as tel]))
|
||||||
|
|
||||||
(defn mastodon-proc-handler [_request]
|
(defn mastodon-proc-handler [_request]
|
||||||
(let [msg "Procding Mastodon Scrape"]
|
(let [msg "Proceding Mastodon Scrape"]
|
||||||
(tel/log! :info msg)
|
(tel/log! :info msg)
|
||||||
(micro-blog.mastodon/run)
|
(micro-blog.mastodon/run)
|
||||||
{:status 200
|
{:status 200
|
||||||
|
|
@ -16,23 +15,14 @@
|
||||||
|
|
||||||
(defn blue-sky-proc-handler [_request]
|
(defn blue-sky-proc-handler [_request]
|
||||||
(let [msg "Procing BlueSky Scrape"]
|
(let [msg "Procing BlueSky Scrape"]
|
||||||
(tel/log! :info msg)
|
(tel/log! :info msg)
|
||||||
(micro-blog.mastodon/run)
|
(micro-blog.mastodon/run)
|
||||||
{:status 200
|
{:status 200
|
||||||
:body msg}))
|
:body msg}))
|
||||||
|
|
||||||
(defn nostr-proc-handler [_request]
|
|
||||||
(let [msg "Restarting Nostr scraper"]
|
|
||||||
(tel/log! :info msg)
|
|
||||||
(micro-blog.nostr/close)
|
|
||||||
(micro-blog.nostr/start)
|
|
||||||
{:status 200
|
|
||||||
:body msg}))
|
|
||||||
|
|
||||||
(def routes
|
(def routes
|
||||||
#{["/bluesky" :get blue-sky-proc-handler :route-name :blue-sky]
|
#{["/bluesky" :get blue-sky-proc-handler :route-name :blue-sky]
|
||||||
["/mastodon" :get mastodon-proc-handler :route-name :mastodon]
|
["/mastodon" :get mastodon-proc-handler :route-name :mastodon]})
|
||||||
["/nostr" :get nostr-proc-handler :route-name :nostr]})
|
|
||||||
|
|
||||||
(defn create-connector []
|
(defn create-connector []
|
||||||
(-> (conn/default-connector-map (:api-host @config) (Integer/parseInt (str (:api-port @config))))
|
(-> (conn/default-connector-map (:api-host @config) (Integer/parseInt (str (:api-port @config))))
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,6 @@
|
||||||
pb/save-post)))))
|
pb/save-post)))))
|
||||||
|
|
||||||
(def socket (atom nil))
|
(def socket (atom nil))
|
||||||
(declare start)
|
|
||||||
(defn connect []
|
(defn connect []
|
||||||
(tel/log! :info "Opening websocket connection to nostr relay")
|
(tel/log! :info "Opening websocket connection to nostr relay")
|
||||||
(reset! socket @(ws/websocket (@config :nostr-relay)
|
(reset! socket @(ws/websocket (@config :nostr-relay)
|
||||||
|
|
@ -61,11 +60,7 @@
|
||||||
:on-message (fn [_ws msg _last?]
|
:on-message (fn [_ws msg _last?]
|
||||||
(process-msg msg))
|
(process-msg msg))
|
||||||
:on-close (fn [_ws status reason]
|
:on-close (fn [_ws status reason]
|
||||||
(tel/log! {:level :warn :data {:status status :reason reason}} "WebSocket connection closed")
|
(tel/log! {:level :warn :data {:status status :reason reason}} "WebSocket connection closed"))})))
|
||||||
(future
|
|
||||||
(Thread/sleep (* 5 60 1000))
|
|
||||||
(tel/log! :info "Reconnecting WebSocket")
|
|
||||||
(start)))})))
|
|
||||||
|
|
||||||
(defn subscribe-to-author [pubkey since]
|
(defn subscribe-to-author [pubkey since]
|
||||||
(let [sub-id (@config :nostr-fetcher-id)
|
(let [sub-id (@config :nostr-fetcher-id)
|
||||||
|
|
@ -74,7 +69,6 @@
|
||||||
(.get (ws/send! @socket msg))))
|
(.get (ws/send! @socket msg))))
|
||||||
|
|
||||||
(defn close []
|
(defn close []
|
||||||
(tel/log! :info "Closing nostr socket")
|
|
||||||
(ws/close! @socket))
|
(ws/close! @socket))
|
||||||
|
|
||||||
(defn start []
|
(defn start []
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue