~pepe/neil

d6c2aec8db1b7dd6dfdb281634934a692dd4f3e0 — Josef Pospíšil 3 months ago cc7fba8
Fix ws url for certbot
2 files changed, 10 insertions(+), 6 deletions(-)

M neil/service.janet
M neil/service/acts.janet
M neil/service.janet => neil/service.janet +2 -1
@@ 8,7 8,8 @@
   :stop Stop
   :start Start
   :restart Restart
   :sync SyncImage
   :sync-image SyncImage
   :sync-config SyncConfig
   :init Init
   :nginx Nginx
   :init-infrastructure InitInfracstructure})

M neil/service/acts.janet => neil/service/acts.janet +8 -5
@@ 42,11 42,13 @@
  [(ssh sn (string/format " git clone %s %s" rp cp))
   (log "=== Initialized")])

(define-watch Release [_ {:config file :server-name sn
                          :code-path cp :conf-path cfp} _]
(define-watch SyncConfig [_ {:config file :server-name sn :conf-path cfp} _]
  [(log "==== Syncing config")
   (rsync file (. sn ":" cfp))])

(define-watch Release [_ {:server-name sn :code-path cp} _]
  [(log "=== Releasing latest version to production")
   (log "==== Syncing config")
   (rsync file (. sn ":" cfp))
   SyncConfig
   (log "==== Releasing new code")
   (ssh sn (string/format "cd %s && git pull && jpm deps && jpm clean &&
                           jpm build && jpm install" cp))


@@ 92,8 94,9 @@
  (os/execute ["service" "nginx" "reload"] :p))

(define-effect GetCertificate [_ {:http http :ws ws} _]
  (def ws-url (match-first '(* (thru "//") '(to -1)) (ws :url)))
  (os/execute ["certbot" "--nginx" "-d" (http :url)] :p)
  (os/execute ["certbot" "--nginx" "-d" (ws :url)] :p))
  (os/execute ["certbot" "--nginx" "-d" ws-url] :p))

(define-watch Nginx [&]
  [RenderNginx