Skip to content

Commit

Permalink
Merge pull request #27 from slr71/main
Browse files Browse the repository at this point in the history
CORE-2006: dependency updates.
  • Loading branch information
slr71 authored Aug 6, 2024
2 parents 2844b25 + 54b5ce8 commit cfb5786
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 135 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
pom.xml
pom.xml.asc
*.jar
!opentelemetry-javaagent.jar
*.class
/.lein-*
/.nrepl-port
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
pom.xml
pom.xml.asc
*.jar
!opentelemetry-javaagent.jar
*.class
.eastwood
/.lein-*
Expand All @@ -15,3 +14,5 @@ build.xml
test2junit
/.idea
*.iml
.clj-kondo
.lsp
12 changes: 6 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM clojure:openjdk-17-lein-alpine
FROM clojure:temurin-22-lein-jammy

WORKDIR /usr/src/app

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

RUN ln -s "/opt/openjdk-17/bin/java" "/bin/iplant-groups"

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

COPY project.clj /usr/src/app/
RUN lein deps
Expand All @@ -17,7 +17,7 @@ COPY . /usr/src/app
RUN lein do clean, uberjar && \
cp target/iplant-groups-standalone.jar .

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

ARG git_commit=unknown
Expand Down
Binary file removed opentelemetry-javaagent.jar
Binary file not shown.
42 changes: 19 additions & 23 deletions project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -7,44 +7,40 @@
(string/trim (:out (sh "git" "rev-parse" "HEAD")))
""))

(defproject org.cyverse/iplant-groups "2.8.1-SNAPSHOT"
(defproject org.cyverse/iplant-groups "3.0.1-SNAPSHOT"
:description "A REST front-end for Grouper."
:url "https://github.com/cyverse-de/iplant-groups"
:license {:name "BSD"
:url "http://iplantcollaborative.org/sites/default/files/iPLANT-LICENSE.txt"}
:url "https://cyverse.org/license"}
:manifest {"Git-Ref" ~(git-ref)}
:uberjar-name "iplant-groups-standalone.jar"
:dependencies [[org.clojure/clojure "1.11.1"]
[cheshire "5.12.0"]
[clj-http "3.12.3"]
:dependencies [[org.clojure/clojure "1.11.3"]
[cheshire "5.13.0"]
[clj-http "3.13.0"]
[clj-time "0.15.2"]
[com.cemerick/url "0.1.1" :exclusions [com.cemerick/clojurescript.test]]
[medley "1.4.0"]
[metosin/compojure-api "1.1.13"]
[metosin/compojure-api "1.1.14"]
[me.raynes/fs "1.4.6"]
[org.cyverse/clojure-commons "3.0.7"]
[org.cyverse/common-cfg "2.8.2"]
[org.cyverse/common-cli "2.8.1"]
[org.cyverse/common-swagger-api "3.4.4"]
[org.cyverse/clojure-commons "3.0.9"]
[org.cyverse/common-cfg "2.8.3"]
[org.cyverse/common-cli "2.8.2"]
[org.cyverse/common-swagger-api "3.4.5"]
[org.cyverse/event-messages "0.0.1"]
[org.cyverse/service-logging "2.8.3"]
[com.novemberain/langohr "3.5.1"]
[ring/ring-core "1.11.0"]
[ring/ring-jetty-adapter "1.11.0"]]
:eastwood {:exclude-namespaces [:test-paths]
:linters [:wrong-arity :wrong-ns-form :wrong-pre-post :wrong-tag :misplaced-docstrings]}
:plugins [[jonase/eastwood "1.4.2"]
[org.cyverse/service-logging "2.8.4"]
[com.novemberain/langohr "5.4.0"]
[ring/ring-core "1.12.2"]
[ring/ring-jetty-adapter "1.12.2"]]
:eastwood {:exclude-linters [:unlimited-use]}
:plugins [[jonase/eastwood "1.4.3"]
[lein-ancient "0.7.0"]
[lein-ring "0.12.6"]
[test2junit "1.1.3"]]
:profiles {:dev {:resource-paths ["conf/test"]
:jvm-opts ["-Dotel.javaagent.enabled=false"]}
[test2junit "1.4.4"]]
:profiles {:dev {:resource-paths ["conf/test"]}
:uberjar {:aot :all}}
:main ^:skip-aot iplant-groups.core
:ring {:handler iplant-groups.routes/app
:init iplant-groups.core/init-service
:port 31310}
:uberjar-exclusions [#"(?i)META-INF/[^/]*[.](SF|DSA|RSA)"]
:jvm-opts ["-Dlogback.configurationFile=/etc/iplant/de/logging/iplant-groups-logging.xml"
"-javaagent:./opentelemetry-javaagent.jar"
"-Dotel.resource.attributes=service.name=iplant-groups"])
:jvm-opts ["-Dlogback.configurationFile=/etc/iplant/de/logging/iplant-groups-logging.xml"])
28 changes: 0 additions & 28 deletions src/iplant_groups/amqp.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,11 @@
[iplant-groups.util.config :as config]
[langohr.core :as rmq]
[langohr.channel :as lch]
[langohr.queue :as lq]
[langohr.consumers :as lc]
[langohr.exchange :as le]
[langohr.basic :as lb]
[service-logging.thread-context :as tc]
[slingshot.slingshot :refer [try+]]
[cheshire.core :as cheshire]))

(defn- declare-queue
[channel {exchange-name :name} queue-cfg topics]
(lq/declare channel (:name queue-cfg) (assoc queue-cfg :exclusive false))
(doseq [key topics]
(lq/bind channel (:name queue-cfg) exchange-name {:routing-key key})))

(defn- declare-exchange
[channel {exchange-name :name :as exchange-cfg}]
(le/topic channel exchange-name exchange-cfg))

(defn- message-router
[handlers channel {:keys [delivery-tag routing-key] :as metadata} msg]
(let [handler (get handlers routing-key)]
(if-not (nil? handler)
(handler channel metadata msg)
(log/error (format "[amqp/message-router] [%s] [%s] unroutable" routing-key (String. msg))))))

(defn connect
[exchange-cfg queue-cfg handlers]
(let [channel (lch/open (rmq/connect {:uri (config/amqp-uri)}))]
(log/info (format "[amqp/connect] [%s]" (config/amqp-uri)))
(declare-exchange channel exchange-cfg)
(declare-queue channel exchange-cfg queue-cfg (keys handlers))
(lc/blocking-subscribe channel (:name queue-cfg) (partial message-router handlers))))

(defn publish-msg
[routing-key msg]
(try+
Expand Down
4 changes: 2 additions & 2 deletions src/iplant_groups/clients/grouper.clj
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
([]
(act-as-subject-lookup default-act-as-subject-id)))

(defn- parse-boolean
(defn- coerce-boolean
[bool-str]
(when bool-str (Boolean/parseBoolean bool-str)))

Expand Down Expand Up @@ -867,7 +867,7 @@
:roleLookups (format-role-lookup params)
:actions (format-action-names-lookup params)
:wsSubjectLookups (subject-lookups [subject_id])
:immediateOnly (parse-boolean immediate_only)})})
:immediateOnly (coerce-boolean immediate_only)})})

(defn permission-assignment-search*
[request-body]
Expand Down
9 changes: 0 additions & 9 deletions src/iplant_groups/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
(:gen-class)
(:require [iplant-groups.routes :as routes]
[iplant-groups.util.config :as config]
[iplant-groups.events :as events]
[iplant-groups.amqp :as amqp]
[me.raynes.fs :as fs]
[clj-http.client :as http]
[clojure.tools.logging :as log]
Expand All @@ -25,12 +23,6 @@
["-v" "--version" "Print out the version number."]
["-h" "--help"]])

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

(defn run-jetty
[]
(require 'ring.adapter.jetty)
Expand All @@ -42,6 +34,5 @@
(tc/with-logging-context config/svc-info
(let [{:keys [options arguments errors summary]} (ccli/handle-args config/svc-info args cli-options)]
(init-service (:config options))
(.start (Thread. listen-for-events))
(http/with-connection-pool {:timeout 5 :threads 10 :insecure? false :default-per-route 10}
(run-jetty)))))
29 changes: 0 additions & 29 deletions src/iplant_groups/events.clj

This file was deleted.

71 changes: 35 additions & 36 deletions src/iplant_groups/routes.clj
Original file line number Diff line number Diff line change
Expand Up @@ -17,40 +17,39 @@
(defapi app
{:exceptions cx/exception-handlers}
(swagger-routes
{:ui config/docs-uri
:options {:ui {:validatorUrl nil}}
:data {:info {:title "RESTful Service Facade for Grouper"
:description "Documentation for the iplant-groups API"
:version "2.8.0"}
:tags [{:name "folders", :description "Folder Information"}
{:name "groups", :description "Group Information"}
{:name "service-info", :description "Service Status Information"}
{:name "subjects", :description "Subject Information"}
{:name "attributes", :description "Attribute/Permission Information"}]}})
(middleware
[clean-context
wrap-keyword-params
wrap-query-params
[wrap-routes wrap-logging]]
(context "/" []
{:ui config/docs-uri
:options {:ui {:validatorUrl nil}}
:data {:info {:title "RESTful Service Facade for Grouper"
:description "Documentation for the iplant-groups API"
:version "2.8.0"}
:tags [{:name "folders", :description "Folder Information"}
{:name "groups", :description "Group Information"}
{:name "service-info", :description "Service Status Information"}
{:name "subjects", :description "Subject Information"}
{:name "attributes", :description "Attribute/Permission Information"}]}})
(context "/" []
:tags ["service-info"]
status-routes/status))
(middleware
[clean-context
wrap-keyword-params
wrap-query-params
add-user-to-context
wrap-logging]
(context "/folders" []
:tags ["folders"]
folder-routes/folders)
(context "/groups" []
:tags ["groups"]
group-routes/groups)
(context "/subjects" []
:tags ["subjects"]
subject-routes/subjects)
(context "/attributes" []
:tags ["attributes"]
attribute-routes/attributes)
(undocumented (route/not-found (json/encode {:success false :msg "unrecognized service path"})))))
:middleware [clean-context
wrap-keyword-params
wrap-query-params
[wrap-routes wrap-logging]]
status-routes/status)
(context "/" []
:middleware [clean-context
wrap-keyword-params
wrap-query-params
add-user-to-context
wrap-logging]
(context "/folders" []
:tags ["folders"]
folder-routes/folders)
(context "/groups" []
:tags ["groups"]
group-routes/groups)
(context "/subjects" []
:tags ["subjects"]
subject-routes/subjects)
(context "/attributes" []
:tags ["attributes"]
attribute-routes/attributes)
(undocumented (route/not-found (json/encode {:success false :msg "unrecognized service path"})))))

0 comments on commit cfb5786

Please sign in to comment.