From 5b35b5bc182c697423fda55963bb2ebf2b2ecdc6 Mon Sep 17 00:00:00 2001 From: simon Date: Wed, 22 Mar 2017 18:58:14 +0000 Subject: [PATCH] #30: Roughly working on Tomcat. Not perfect yet by a long way but good enough for alpha. --- env/dev/clj/user.clj | 19 +++++++++++++++++++ project.clj | 2 +- src/clj/youyesyet/db/core.clj | 9 ++++++--- src/cljc/youyesyet/ui_utils.cljc | 1 - 4 files changed, 26 insertions(+), 5 deletions(-) delete mode 100644 src/cljc/youyesyet/ui_utils.cljc diff --git a/env/dev/clj/user.clj b/env/dev/clj/user.clj index a8adafd..97cb362 100644 --- a/env/dev/clj/user.clj +++ b/env/dev/clj/user.clj @@ -13,4 +13,23 @@ (stop) (start)) +;; Roughly working under Tomcat. +;; Database setup using JNDI: see http://www.luminusweb.net/docs/deployment.md#deploying_to_tomcat +;; Note that this duplicates configuration in profiles.clj; one of these is wrong (and neither +;; should be in the Git repository but this is for now!) +(System/setProperty "java.naming.factory.initial" + "org.apache.naming.java.javaURLContextFactory") +(System/setProperty "java.naming.factory.url.pkgs" + "org.apache.naming") +(doto (new javax.naming.InitialContext) + (.createSubcontext "java:") + (.createSubcontext "java:comp") + (.createSubcontext "java:comp/env") + (.createSubcontext "java:comp/env/jdbc") + (.bind "java:comp/env/jdbc/testdb" + (doto (org.postgresql.ds.PGSimpleDataSource.) + (.setServerName "localhost") + (.setDatabaseName "youyesyet_dev") + (.setUser "youyesyet") + (.setPassword "thisisnotsecure")))) diff --git a/project.clj b/project.clj index 4fd0891..031c774 100644 --- a/project.clj +++ b/project.clj @@ -119,7 +119,7 @@ [org.clojure/core.cache "0.6.5"] [org.apache.httpcomponents/httpcore "4.4.6"] [clj-webdriver/clj-webdriver "0.7.2"] - [org.seleniumhq.selenium/selenium-server "3.3.1"] + [org.seleniumhq.selenium/selenium-server "3.3.1" :exclusions [org.seleniumhq.selenium/selenium-support]] [doo "0.1.7"] [binaryage/devtools "0.9.2"] [figwheel-sidecar "0.5.9"] diff --git a/src/clj/youyesyet/db/core.clj b/src/clj/youyesyet/db/core.clj index 536cc3b..e514d08 100644 --- a/src/clj/youyesyet/db/core.clj +++ b/src/clj/youyesyet/db/core.clj @@ -15,9 +15,12 @@ Timestamp PreparedStatement])) -(defstate ^:dynamic *db* - :start (conman/connect! {:jdbc-url (env :database-url)}) - :stop (conman/disconnect! *db*)) +(def ^:dynamic *db* {:name "java:comp/env/jdbc/EmployeeDB"}) +;; (defstate ^:dynamic *db* +;; :start (conman/connect! {:jdbc-url-env (env :database-url) +;; :jdbc-url "jdbc:postgresql://127.0.0.1/youyesyet_dev?user=youyesyet&password=thisisnotsecure" +;; :driver-class-name "org.postgresql.Driver"}) +;; :stop (conman/disconnect! *db*)) (conman/bind-connection *db* "sql/queries.sql") diff --git a/src/cljc/youyesyet/ui_utils.cljc b/src/cljc/youyesyet/ui_utils.cljc deleted file mode 100644 index 3139020..0000000 --- a/src/cljc/youyesyet/ui_utils.cljc +++ /dev/null @@ -1 +0,0 @@ -;; Ultimately it's the goal to use the same UI utils for both main site and single page app.