Skip to content

Commit

Permalink
Merge pull request #6 from Folcon/master
Browse files Browse the repository at this point in the history
Adding guestbook-datomic PR
  • Loading branch information
yogthos authored Jun 12, 2018
2 parents 7025bdf + 6290017 commit 7665e03
Show file tree
Hide file tree
Showing 42 changed files with 1,294 additions and 0 deletions.
14 changes: 14 additions & 0 deletions guestbook-datomic/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/target
/lib
/classes
/checkouts
pom.xml
dev-config.edn
test-config.edn
*.jar
*.class
/.lein-*
profiles.clj
/.env
.nrepl-port
/log
28 changes: 28 additions & 0 deletions guestbook-datomic/Capstanfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

#
# Name of the base image. Capstan will download this automatically from
# Cloudius S3 repository.
#
#base: cloudius/osv
base: cloudius/osv-openjdk8

#
# The command line passed to OSv to start up the application.
#
cmdline: /java.so -jar /guestbook-datomic/app.jar

#
# The command to use to build the application.
# You can use any build tool/command (make/rake/lein/boot) - this runs locally on your machine
#
# For Leiningen, you can use:
#build: lein uberjar
# For Boot, you can use:
#build: boot build

#
# List of files that are included in the generated image.
#
files:
/guestbook-datomic/app.jar: ./target/uberjar/guestbook-datomic.jar

8 changes: 8 additions & 0 deletions guestbook-datomic/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM java:8-alpine
MAINTAINER Your Name <[email protected]>

ADD target/uberjar/guestbook-datomic.jar /guestbook-datomic/app.jar

EXPOSE 3000

CMD ["java", "-jar", "/guestbook-datomic/app.jar"]
1 change: 1 addition & 0 deletions guestbook-datomic/Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: java -cp target/uberjar/guestbook-datomic.jar clojure.main -m guestbook-datomic.core
25 changes: 25 additions & 0 deletions guestbook-datomic/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# guestbook-datomic

generated using Luminus version "2.9.12.62"

FIXME

## Prerequisites

You will need [Leiningen][1] 2.0 or above installed.

[1]: https://github.com/technomancy/leiningen

## Running

To start a web server for the application, run:

lein run

Then in a second terminal run:

lein figwheel

## License

Copyright © 2018 FIXME
14 changes: 14 additions & 0 deletions guestbook-datomic/dev-config.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
;; WARNING
;; The dev-config.edn file is used for local environment variables, such as database credentials.
;; This file is listed in .gitignore and will be excluded from version control by Git.

{:dev true
:port 3000
;; when :nrepl-port is set the application starts the nREPL server on load
:nrepl-port 7000

; set your dev database connection URL here
; :database-url "datomic:free://localhost:4334/guestbook_datomic_dev"
; Don't forget you can also use the datomic mem db which can be useful when developing
:database-url "datomic:mem://guestbook_datomic_dev"
}
10 changes: 10 additions & 0 deletions guestbook-datomic/env/dev/clj/guestbook_datomic/dev_middleware.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
(ns guestbook-datomic.dev-middleware
(:require [ring.middleware.reload :refer [wrap-reload]]
[selmer.middleware :refer [wrap-error-page]]
[prone.middleware :refer [wrap-exceptions]]))

(defn wrap-dev [handler]
(-> handler
wrap-reload
wrap-error-page
wrap-exceptions))
14 changes: 14 additions & 0 deletions guestbook-datomic/env/dev/clj/guestbook_datomic/env.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
(ns guestbook-datomic.env
(:require [selmer.parser :as parser]
[clojure.tools.logging :as log]
[guestbook-datomic.dev-middleware :refer [wrap-dev]]))

(def defaults
{:init
(fn []
(parser/cache-off!)
(log/info "\n-=[guestbook-datomic started successfully using the development profile]=-"))
:stop
(fn []
(log/info "\n-=[guestbook-datomic has shut down successfully]=-"))
:middleware wrap-dev})
12 changes: 12 additions & 0 deletions guestbook-datomic/env/dev/clj/guestbook_datomic/figwheel.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
(ns guestbook-datomic.figwheel
(:require [figwheel-sidecar.repl-api :as ra]))

(defn start-fw []
(ra/start-figwheel!))

(defn stop-fw []
(ra/stop-figwheel!))

(defn cljs []
(ra/cljs-repl))

21 changes: 21 additions & 0 deletions guestbook-datomic/env/dev/clj/user.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
(ns user
(:require [guestbook-datomic.config :refer [env]]
[clojure.spec.alpha :as s]
[expound.alpha :as expound]
[mount.core :as mount]
[guestbook-datomic.figwheel :refer [start-fw stop-fw cljs]]
[guestbook-datomic.core :refer [start-app]]))

(alter-var-root #'s/*explain-out* (constantly expound/printer))

(defn start []
(mount/start-without #'guestbook-datomic.core/repl-server))

(defn stop []
(mount/stop-except #'guestbook-datomic.core/repl-server))

(defn restart []
(stop)
(start))


13 changes: 13 additions & 0 deletions guestbook-datomic/env/dev/cljs/guestbook_datomic/app.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
(ns ^:figwheel-no-load guestbook-datomic.app
(:require [guestbook-datomic.core :as core]
[cljs.spec.alpha :as s]
[expound.alpha :as expound]
[devtools.core :as devtools]))

(set! s/*explain-out* expound/printer)

(enable-console-print!)

(devtools/install!)

(core/init!)
1 change: 1 addition & 0 deletions guestbook-datomic/env/dev/resources/config.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
35 changes: 35 additions & 0 deletions guestbook-datomic/env/dev/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<statusListener class="ch.qos.logback.core.status.NopStatusListener" />
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<!-- encoders are assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder>
<charset>UTF-8</charset>
<pattern>%date{ISO8601} [%thread] %-5level %logger{36} - %msg %n</pattern>
</encoder>
</appender>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>log/guestbook-datomic.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/guestbook-datomic.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!-- keep 30 days of history -->
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<charset>UTF-8</charset>
<pattern>%date{ISO8601} [%thread] %-5level %logger{36} - %msg %n</pattern>
</encoder>
</appender>
<logger name="org.apache.http" level="warn" />
<logger name="org.xnio.nio" level="warn" />
<logger name="io.undertow.session" level="warn" />
<logger name="io.undertow.request" level="warn" />
<root level="DEBUG">
<appender-ref ref="STDOUT" />
<appender-ref ref="FILE" />
</root>
</configuration>
11 changes: 11 additions & 0 deletions guestbook-datomic/env/prod/clj/guestbook_datomic/env.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
(ns guestbook-datomic.env
(:require [clojure.tools.logging :as log]))

(def defaults
{:init
(fn []
(log/info "\n-=[guestbook-datomic started successfully]=-"))
:stop
(fn []
(log/info "\n-=[guestbook-datomic has shut down successfully]=-"))
:middleware identity})
7 changes: 7 additions & 0 deletions guestbook-datomic/env/prod/cljs/guestbook_datomic/app.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
(ns guestbook-datomic.app
(:require [guestbook-datomic.core :as core]))

;;ignore println statements in prod
(set! *print-fn* (fn [& _]))

(core/init!)
2 changes: 2 additions & 0 deletions guestbook-datomic/env/prod/resources/config.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{:prod true
:port 3000}
24 changes: 24 additions & 0 deletions guestbook-datomic/env/prod/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<statusListener class="ch.qos.logback.core.status.NopStatusListener" />
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>log/guestbook-datomic.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/guestbook-datomic.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!-- keep 30 days of history -->
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<charset>UTF-8</charset>
<pattern>%date{ISO8601} [%thread] %-5level %logger{36} - %msg %n</pattern>
</encoder>
</appender>
<logger name="org.apache.http" level="warn" />
<logger name="org.xnio.nio" level="warn" />
<root level="INFO">
<appender-ref ref="FILE" />
</root>
</configuration>
1 change: 1 addition & 0 deletions guestbook-datomic/env/test/resources/config.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
35 changes: 35 additions & 0 deletions guestbook-datomic/env/test/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<statusListener class="ch.qos.logback.core.status.NopStatusListener" />
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<!-- encoders are assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder>
<charset>UTF-8</charset>
<pattern>%date{ISO8601} [%thread] %-5level %logger{36} - %msg %n</pattern>
</encoder>
</appender>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>log/guestbook-datomic.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/guestbook-datomic.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!-- keep 30 days of history -->
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<charset>UTF-8</charset>
<pattern>%date{ISO8601} [%thread] %-5level %logger{36} - %msg %n</pattern>
</encoder>
</appender>
<logger name="org.apache.http" level="warn" />
<logger name="org.xnio.nio" level="warn" />
<logger name="io.undertow.session" level="warn" />
<logger name="io.undertow.request" level="warn" />
<root level="DEBUG">
<appender-ref ref="STDOUT" />
<appender-ref ref="FILE" />
</root>
</configuration>
Empty file.
Loading

0 comments on commit 7665e03

Please sign in to comment.