Makes cloud functions installable remotely
This commit is contained in:
@@ -3,4 +3,4 @@ RUN yum update -y
|
|||||||
RUN yum install -y poppler-utils
|
RUN yum install -y poppler-utils
|
||||||
COPY target/auto-ap.jar /usr/local/
|
COPY target/auto-ap.jar /usr/local/
|
||||||
COPY config /usr/local/config/
|
COPY config /usr/local/config/
|
||||||
CMD java -Dlogback.configurationFile=logback-prod.xml -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=9090 -Dcom.sun.management.jmxremote.rmi.port=9090 -Djava.rmi.server.hostname=127.0.0.1 -Dcom.sun.management.jmxremote.local.only=false -XX:InitialRAMPercentage=75 -XX:MaxRAMPercentage=75 -jar /usr/local/auto-ap.jar
|
CMD java -Dlogback.configurationFile=logback-prod.xml -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=9090 -Dcom.sun.management.jmxremote.rmi.port=9090 -Djava.rmi.server.hostname=127.0.0.1 -Dcom.sun.management.jmxremote.local.only=false -XX:InitialRAMPercentage=20 -XX:MaxRAMPercentage=84 -jar /usr/local/auto-ap.jar
|
||||||
|
|||||||
@@ -34,3 +34,19 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(defn regenerate-literals []
|
||||||
|
(require 'com.github.ivarref.gen-fn)
|
||||||
|
(spit
|
||||||
|
"resources/functions.edn"
|
||||||
|
(let [datomic-fn @(resolve 'com.github.ivarref.gen-fn/datomic-fn)]
|
||||||
|
[(datomic-fn :pay #'iol-ion.tx.pay/pay)
|
||||||
|
(datomic-fn :plus #'iol-ion.tx.plus/plus)
|
||||||
|
(datomic-fn :propose-invoice #'iol-ion.tx.propose-invoice/propose-invoice)
|
||||||
|
(datomic-fn :reset-rels #'iol-ion.tx.reset-rels/reset-rels)
|
||||||
|
(datomic-fn :reset-scalars #'iol-ion.tx.reset-scalars/reset-scalars)
|
||||||
|
(datomic-fn :upsert-entity #'iol-ion.tx.upsert-entity/upsert-entity)
|
||||||
|
(datomic-fn :upsert-invoice #'iol-ion.tx.upsert-invoice/upsert-invoice)
|
||||||
|
(datomic-fn :upsert-ledger #'iol-ion.tx.upsert-ledger/upsert-ledger)
|
||||||
|
(datomic-fn :upsert-transaction #'iol-ion.tx.upsert-transaction/upsert-transaction)])))
|
||||||
|
|||||||
@@ -28,7 +28,6 @@
|
|||||||
(datomic.api/cancel {:cognitect.anomalies/category :cognitect.anomalies/incorrect
|
(datomic.api/cancel {:cognitect.anomalies/category :cognitect.anomalies/incorrect
|
||||||
:cognitect.anomalies/message
|
:cognitect.anomalies/message
|
||||||
(str "Cannot upsert without :db/id or :db/ident, " entity)}))
|
(str "Cannot upsert without :db/id or :db/ident, " entity)}))
|
||||||
[]
|
|
||||||
(let [e (or (:db/id entity) (:db/ident entity))
|
(let [e (or (:db/id entity) (:db/ident entity))
|
||||||
is-new? (string? e)
|
is-new? (string? e)
|
||||||
extant-entity (when-not is-new?
|
extant-entity (when-not is-new?
|
||||||
|
|||||||
@@ -68,7 +68,6 @@
|
|||||||
)
|
)
|
||||||
|
|
||||||
(defn upsert-invoice [db invoice]
|
(defn upsert-invoice [db invoice]
|
||||||
(println invoice)
|
|
||||||
(let [upserted-entity [[:upsert-entity invoice]]
|
(let [upserted-entity [[:upsert-entity invoice]]
|
||||||
with-invoice (dc/with db upserted-entity)
|
with-invoice (dc/with db upserted-entity)
|
||||||
invoice-id (or (-> with-invoice :tempids (get (:db/id invoice)))
|
invoice-id (or (-> with-invoice :tempids (get (:db/id invoice)))
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
(:journal-entry-line/client+account+location+date jel)
|
(:journal-entry-line/client+account+location+date jel)
|
||||||
(:db/id jel)]
|
(:db/id jel)]
|
||||||
})
|
})
|
||||||
(filter (fn line-must-match-client-account-location [result]
|
(take-while (fn line-must-match-client-account-location [result]
|
||||||
(and
|
(and
|
||||||
(= (take 3 (:journal-entry-line/client+account+location+date result))
|
(= (take 3 (:journal-entry-line/client+account+location+date result))
|
||||||
(take 3 (:journal-entry-line/client+account+location+date jel)))
|
(take 3 (:journal-entry-line/client+account+location+date jel)))
|
||||||
|
|||||||
1
resources/functions.edn
Normal file
1
resources/functions.edn
Normal file
File diff suppressed because one or more lines are too long
@@ -17,7 +17,10 @@
|
|||||||
[datomic.api :as dc]
|
[datomic.api :as dc]
|
||||||
[com.brunobonacci.mulog :as mu]
|
[com.brunobonacci.mulog :as mu]
|
||||||
[mount.core :as mount]
|
[mount.core :as mount]
|
||||||
[clojure.java.io :as io])
|
[clojure.java.io :as io]
|
||||||
|
[clojure.edn :as edn]
|
||||||
|
[datomic.db :refer [id-literal]]
|
||||||
|
[datomic.function :refer [construct]])
|
||||||
(:import
|
(:import
|
||||||
(java.util UUID)))
|
(java.util UUID)))
|
||||||
|
|
||||||
@@ -832,15 +835,9 @@
|
|||||||
)
|
)
|
||||||
|
|
||||||
(defn install-functions []
|
(defn install-functions []
|
||||||
@(datomic.api/transact auto-ap.datomic/conn [(datomic-fn :pay #'iol-ion.tx.pay/pay)
|
@(dc/transact conn
|
||||||
(datomic-fn :plus #'iol-ion.tx.plus/plus)
|
(edn/read-string {:readers {'db/id id-literal
|
||||||
(datomic-fn :propose-invoice #'iol-ion.tx.propose-invoice/propose-invoice)
|
'db/fn construct}} (slurp (io/resource "functions.edn")))))
|
||||||
(datomic-fn :reset-rels #'iol-ion.tx.reset-rels/reset-rels)
|
|
||||||
(datomic-fn :reset-scalars #'iol-ion.tx.reset-scalars/reset-scalars)
|
|
||||||
(datomic-fn :upsert-entity #'iol-ion.tx.upsert-entity/upsert-entity)
|
|
||||||
(datomic-fn :upsert-invoice #'iol-ion.tx.upsert-invoice/upsert-invoice)
|
|
||||||
(datomic-fn :upsert-ledger #'iol-ion.tx.upsert-ledger/upsert-ledger)
|
|
||||||
(datomic-fn :upsert-transaction #'iol-ion.tx.upsert-transaction/upsert-transaction)]))
|
|
||||||
|
|
||||||
(defn transact-schema [conn]
|
(defn transact-schema [conn]
|
||||||
@(dc/transact conn
|
@(dc/transact conn
|
||||||
|
|||||||
Reference in New Issue
Block a user