diff --git a/README.md b/README.md index 3ecfed6..1c10baf 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ instance. - [x] BlueSky - [ ] Pixelfed -- [ ] Mastodon +- [x] Mastodon - [ ] Nostr @@ -33,7 +33,7 @@ $ java -jar ./target/micro-blog-standalone.jar Build new docker image and push it to ECR ```shell -$ docker buildx build --platform linux/amd64,linux/arm64 -t 853019563312.dkr.ecr.eu-central-1.amazonaws.com/micro-blog-fetchers:2.0.1 --push . +$ docker buildx build --platform linux/amd64,linux/arm64 -t 853019563312.dkr.ecr.eu-central-1.amazonaws.com/micro-blog-fetchers-homelabstack:latest --push . ``` ## Project history @@ -44,3 +44,4 @@ $ docker buildx build --platform linux/amd64,linux/arm64 -t 853019563312.dkr.ec cluster running I'm switching most of my personal apps to on-prem. Pocketbase instance is already running on-prem. For this app I swap Serverless for docker container. App now deployed on-prem and the docker containers run once per hour thanks to Nomad's job scheduling. +- July 2025: Start rewrite in Clojure with a long running docker container deployment instead of scheduled runs. diff --git a/src/micro_blog/main.clj b/src/micro_blog/main.clj index 6041778..098c302 100644 --- a/src/micro_blog/main.clj +++ b/src/micro_blog/main.clj @@ -3,12 +3,17 @@ (:import [java.time Instant Duration]) (:require [chime.core :as chime] [taoensso.telemere :as tel] - [micro-blog.blue-sky :as blue-sky])) + [micro-blog.blue-sky :as blue-sky] + [micro-blog.mastodon :as masto])) + +(def crons [blue-sky/run + masto/run]) (defn -main [] (tel/log! :info "Setting up crons") - (chime/chime-at (chime/periodic-seq (Instant/now) (Duration/ofMinutes 30)) - (fn [_time] - (blue-sky/run))) - + (doseq [[i cron] (map-indexed vector crons)] + (let [start (.plus (Instant/now) (Duration/ofMinutes (* i 5)))] + (chime/chime-at (chime/periodic-seq start (Duration/ofMinutes 30)) + (fn [_time] + (cron))))) @(promise))