Skip to content

Commit

Permalink
Merge pull request #11 from slr71/main
Browse files Browse the repository at this point in the history
CORE-2006: dependency updates.
  • Loading branch information
slr71 authored Aug 7, 2024
2 parents 8760665 + 2a289b6 commit 8e0d292
Show file tree
Hide file tree
Showing 12 changed files with 58 additions and 214 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
pom.xml
*jar
!opentelemetry-javaagent.jar
lib
classes
*~
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
pom.xml
*jar
!opentelemetry-javaagent.jar
lib
classes
*~
Expand All @@ -21,3 +20,5 @@ build/
build.xml
test2junit
resources/
.clj-kondo/
.lsp/
14 changes: 6 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
FROM clojure:openjdk-17-lein
FROM clojure:temurin-22-lein-jammy

WORKDIR /usr/src/app

#RUN apk add --no-cache --update git nodejs-lts npm && \
# rm -rf /var/cache/apk
RUN apt update && apt install -y nodejs npm
RUN apt-get update && \
apt-get install -y git nodejs npm && \
rm -rf /var/lib/apt/lists/*

RUN npm install -g grunt-cli

RUN ln -s "/usr/local/openjdk-17/bin/java" "/bin/kifshare"

ENV OTEL_TRACES_EXPORTER none
RUN ln -s "/opt/java/openjdk/bin/java" "/bin/kifshare"

COPY project.clj /usr/src/app/
RUN lein deps
Expand All @@ -26,7 +24,7 @@ COPY ui/ui.xml resources/
RUN lein uberjar
RUN cp target/kifshare-standalone.jar .

ENTRYPOINT ["kifshare", "-Dlogback.configurationFile=/etc/iplant/de/logging/kifshare-logging.xml", "-javaagent:/usr/src/app/opentelemetry-javaagent.jar", "-Dotel.resource.attributes=service.name=kifshare", "-cp", ".:resources:kifshare-standalone.jar", "kifshare.core"]
ENTRYPOINT ["kifshare", "-Dlogback.configurationFile=/etc/iplant/de/logging/kifshare-logging.xml", "-cp", ".:resources:kifshare-standalone.jar", "kifshare.core"]
CMD ["--help"]

ARG git_commit=unknown
Expand Down
32 changes: 0 additions & 32 deletions kifshare.properties.tmpl

This file was deleted.

Binary file removed opentelemetry-javaagent.jar
Binary file not shown.
39 changes: 17 additions & 22 deletions project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
(string/trim (:out (sh "git" "rev-parse" "HEAD")))
""))

(defproject org.cyverse/kifshare "2.12.0-SNAPSHOT"
(defproject org.cyverse/kifshare "3.0.1-SNAPSHOT"
:description "CyVerse Quickshare for iRODS"
:url "https://github.com/cyverse-de/kifshare"

Expand All @@ -17,49 +17,44 @@
:manifest {"Git-Ref" ~(git-ref)}
:uberjar-name "kifshare-standalone.jar"

:dependencies [[org.clojure/clojure "1.11.1"]
:dependencies [[org.clojure/clojure "1.11.4"]
[org.clojure/tools.logging "1.3.0"]
[ch.qos.logback/logback-classic "1.5.3"]
[net.logstash.logback/logstash-logback-encoder "7.4"]
[ch.qos.logback/logback-classic "1.5.6"]
[net.logstash.logback/logstash-logback-encoder "8.0"]
[hawk "0.2.11"]
[hiccup "1.0.2"]
[medley "1.4.0"]
[org.cyverse/clj-jargon "3.1.0"
[org.cyverse/clj-jargon "3.1.1"
:exclusions [[org.slf4j/slf4j-log4j12]
[log4j]]]
[org.cyverse/debug-utils "2.8.1"]
[org.cyverse/clojure-commons "2.8.0"]
[org.cyverse/common-cli "2.8.1"]
[org.cyverse/event-messages "0.0.1"]
[com.novemberain/langohr "3.5.1"]
[org.cyverse/debug-utils "2.9.0"]
[org.cyverse/clojure-commons "3.0.9"]
[org.cyverse/common-cli "2.8.2"]
[me.raynes/fs "1.4.6"]
[cheshire "5.12.0"
[cheshire "5.13.0"
:exclusions [[com.fasterxml.jackson.dataformat/jackson-dataformat-cbor]
[com.fasterxml.jackson.dataformat/jackson-dataformat-smile]
[com.fasterxml.jackson.core/jackson-annotations]
[com.fasterxml.jackson.core/jackson-databind]
[com.fasterxml.jackson.core/jackson-core]]]
[slingshot "0.12.2"]
[compojure "1.5.0"]
[de.ubercode.clostache/clostache "1.4.0"]
[compojure "1.7.1"]
[com.cemerick/url "0.1.1" :exclusions [com.cemerick/clojurescript.test]]
[ring-logger "1.1.1"]]
[ring/ring-core "1.12.2"]]

:eastwood {:exclude-namespaces [:test-paths]
:linters [:wrong-arity :wrong-ns-form :wrong-pre-post :wrong-tag :misplaced-docstrings]}

:ring {:init kifshare.config/init
:handler kifshare.core/app}

:profiles {:dev {:resource-paths ["build" "conf" "dev-resources"]
:jvm-opts ["-Dotel.javaagent.enabled=false"]}
:profiles {:dev {:resource-paths ["build" "conf" "dev-resources"]}
:uberjar {:aot :all}}

:plugins [[jonase/eastwood "1.4.2"]
:plugins [[jonase/eastwood "1.4.3"]
[lein-ancient "0.7.0"]
[lein-ring "0.7.5"]
[test2junit "1.2.2"]]
[lein-ring "0.12.6"]
[test2junit "1.4.4"]]

:main ^:skip-aot kifshare.core
:jvm-opts ["-Dlogback.configurationFile=/etc/iplant/de/logging/kifshare-logging.xml"
"-javaagent:./opentelemetry-javaagent.jar"
"-Dotel.resource.attributes=service.name=kifshare"])
:jvm-opts ["-Dlogback.configurationFile=/etc/iplant/de/logging/kifshare-logging.xml"])
33 changes: 0 additions & 33 deletions src/kifshare/amqp.clj

This file was deleted.

36 changes: 0 additions & 36 deletions src/kifshare/config.clj
Original file line number Diff line number Diff line change
Expand Up @@ -145,42 +145,6 @@
[]
(or (get @props "kifshare.irods.anon-user") "anonymous"))

(defn amqp-uri
[]
(or (get @props "kifshare.amqp.uri") "amqp://guest:guest@rabbit:5672/"))

(defn exchange-name
[]
(or (get @props "kifshare.amqp.exchange.name") "de"))

(defn exchange-durable?
[]
(if-let [val (get @props "kifshare.amqp.exchange.durable")]
(boolean (Boolean/valueOf val))
true))

(defn exchange-auto-delete?
[]
(if-let [val (get @props "kifshare.amqp.exchange.auto-delete")]
(boolean (Boolean/valueOf val))
false))

(defn queue-name
[]
(or (get @props "kifshare.amqp.queue.name") "events.kifshare.queue"))

(defn queue-durable?
[]
(if-let [val (get @props "kifshare.amqp.queue.durable")]
(boolean (Boolean/valueOf val))
true))

(defn queue-auto-delete?
[]
(if-let [val (get @props "kifshare.amqp.queue.auto-delete")]
(boolean (Boolean/valueOf val))
false))

(def jgcfg (atom nil))

(defn jargon-config [] @jgcfg)
Expand Down
56 changes: 22 additions & 34 deletions src/kifshare/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,15 @@
params
keyword-params
nested-params
multipart-params
stacktrace])
multipart-params])
(:require [clojure-commons.file-utils :as ft]
[clojure.tools.logging :as log]
[compojure.route :as route]
[ring.logger :as logger]
[ring.util.response :as resp]
[ring.util.http-response :as http-resp]
[kifshare.config :as cfg]
[kifshare.tickets-controllers :as t-c]
[kifshare.anon-controllers :as a-c]
[kifshare.amqp :as amqp]
[kifshare.events :as events]
[kifshare.ui-template :as ui]
[clojure.string :as string]
[common-cli.core :as ccli]
Expand Down Expand Up @@ -153,8 +149,7 @@
wrap-multipart-params
wrap-keyword-params
wrap-nested-params
wrap-params
wrap-stacktrace))
wrap-params))

(def app
(site-handler kifshare-routes))
Expand All @@ -171,32 +166,25 @@
(or (:buffer-size opts)
(* 1024 (Integer/parseInt (get @cfg/props "kifshare.app.download-buffer-size")))))

(defn listen-for-events
[]
(let [exchange-cfg (events/exchange-config)
queue-cfg (events/queue-config)]
(amqp/connect exchange-cfg queue-cfg {"events.kifshare.ping" events/ping-handler})))

(defn -main
[& args]

(let [{:keys [options]} (ccli/handle-args svc-info args cli-options)]
(when-not (fs/exists? (:config options))
(ccli/exit 1 (str "The config file does not exist.")))
(when-not (fs/readable? (:config options))
(ccli/exit 1 "The config file is not readable."))
(cfg/local-init (:config options))
(cfg/jargon-init)
(cfg/log-config)
(.start (Thread. listen-for-events))
(with-redefs [clojure.java.io/buffer-size override-buffer-size]
(let [port (Integer/parseInt (string/trim (get @cfg/props "kifshare.app.port")))]
(ui/read-template)
(hawk/watch! {:watcher :polling}
[{:paths ["resources/ui.xml"]
:handler (fn [ctx e]
(when (= (:kind e) :modify)
(ui/read-template)))}])
(log/warn "Configured listen port is: " port)
(require 'ring.adapter.jetty)
((eval 'ring.adapter.jetty/run-jetty) (logger/wrap-with-logger app) {:port port})))))

(let [{:keys [options]} (ccli/handle-args svc-info args cli-options)]
(when-not (fs/exists? (:config options))
(ccli/exit 1 (str "The config file does not exist.")))
(when-not (fs/readable? (:config options))
(ccli/exit 1 "The config file is not readable."))
(cfg/local-init (:config options))
(cfg/jargon-init)
(cfg/log-config)
(with-redefs [clojure.java.io/buffer-size override-buffer-size]
(let [port (Integer/parseInt (string/trim (get @cfg/props "kifshare.app.port")))]
(ui/read-template)
(hawk/watch! {:watcher :polling}
[{:paths ["resources/ui.xml"]
:handler (fn [ctx e]
(when (= (:kind e) :modify)
(ui/read-template)))}])
(log/warn "Configured listen port is: " port)
(require 'ring.adapter.jetty)
((eval 'ring.adapter.jetty/run-jetty) app {:port port})))))
29 changes: 0 additions & 29 deletions src/kifshare/events.clj

This file was deleted.

20 changes: 10 additions & 10 deletions src/kifshare/ui_template.clj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(ns kifshare.ui-template
(:require [kifshare.config :as cfg]
[clostache.parser :as prs]
[clojure.tools.logging :as log]
[clojure-commons.template :refer [render]]
[cheshire.core :as json])
(:import [org.apache.commons.io FileUtils]))

Expand All @@ -23,12 +23,12 @@
(defn landing-page
[ticket-id metadata-promise ticket-info]
(log/debug "entered kifshare.ui-template/landing-page")
(prs/render @tmpl
(assoc ticket-info
:metadata @metadata-promise
:filesize (FileUtils/byteCountToDisplaySize
(Long/parseLong (:filesize ticket-info)))
:irods-url (cfg/irods-url)
:de-url (cfg/de-url)
:ticket-info-json (json/generate-string
(ui-ticket-info ticket-info)))))
(render @tmpl
(assoc ticket-info
:metadata @metadata-promise
:filesize (FileUtils/byteCountToDisplaySize
(Long/parseLong (:filesize ticket-info)))
:irods-url (cfg/irods-url)
:de-url (cfg/de-url)
:ticket-info-json (json/generate-string
(ui-ticket-info ticket-info)))))
9 changes: 1 addition & 8 deletions test/kifshare/test/configs.clj
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,4 @@
(is (= (config/css-files)
(string/split config/default-css-files #"\s*,\s*")))
(is (= (config/javascript-files)
(string/split config/default-javascript-files #"\s*,\s*")))
(is (= (config/amqp-uri) "amqp://guest:guest@rabbit:5672/"))
(is (= (config/exchange-name) "de"))
(is (config/exchange-durable?))
(is (not (config/exchange-auto-delete?)))
(is (= (config/queue-name) "events.kifshare.queue"))
(is (config/queue-durable?))
(is (not (config/queue-auto-delete?)))))
(string/split config/default-javascript-files #"\s*,\s*")))))

0 comments on commit 8e0d292

Please sign in to comment.