Added proper dockerfile and docker compose

This commit is contained in:
didier amyot committed 2018-07-08 15:11:12 -04:00
1 parent 1dbae11b21
commit 7fbb3484a1
7 files changed
+31 -26

No files matched your search

+3
View File
@@ -0,0 +1,3 @@
target
full-stack
fixtures
+14
View File
@@ -0,0 +1,14 @@
FROM clojure
# Set the working directory to /app
WORKDIR /app
# Copy the current directory contents into the container at /app
ADD . /app
# Install any needed packages
RUN lein deps
EXPOSE 8080
CMD ["lein", "run"]
-1
View File
@@ -9,7 +9,6 @@ allow end user(s?) to exchange securities via the common exchange rules.
## Installation ## Installation
Okay, this should be easy but it is hard... Okay, this should be easy but it is hard...
## Hack me
### Configuration ### Configuration
All configuration are set in the `resources/config.edn` file. All configuration are set in the `resources/config.edn` file.
+13 -1
View File
@@ -16,7 +16,6 @@ services:
- ./full-stack/zoo1/data:/data - ./full-stack/zoo1/data:/data
- ./full-stack/zoo1/datalog:/datalog - ./full-stack/zoo1/datalog:/datalog
kafka1: kafka1:
image: confluentinc/cp-kafka:4.1.0 image: confluentinc/cp-kafka:4.1.0
hostname: kafka1 hostname: kafka1
@@ -150,3 +149,16 @@ services:
restart: unless-stopped restart: unless-stopped
depends_on: depends_on:
- zoo1 - zoo1
# skirmish
skirmish-api:
image: skirmish
command: ["lein", "run", "webserver"]
depends_on:
- kafka-topics-ui # basically, we need all kafka
environment:
PORT: 1602 # https://en.wikipedia.org/wiki/Euronext_Amsterdam
KAFKA_BOOTSTRAP_SERVERS: "kafka1:9092"
ports:
- "1602:1602"
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
:kafka :kafka
{:bootstrap.servers "localhost:9092" {:bootstrap.servers #or [#env KAFKA_BOOTSTRAP_SERVERS "localhost:9092"]
:topics-prefix "skirmish-01-"} :topics-prefix "skirmish-01-"}
:webserver ;; possible config from http-kit's run-server :webserver ;; possible config from http-kit's run-server
-1
View File
@@ -1 +0,0 @@
(ns skirmish.kafka.book)
-22
View File
@@ -1,22 +0,0 @@
(ns skirmish.kafka.exchange-simulator
(:require [kinsky.client :as client]))
(def mock-kafka-messages
[[:sell-1 {:action :received :order {:type :sell :quantity 10 :price 10 :book.order/id :sell-1}}]
[:sell-1 {:action :inserted-in-book :order {:type :sell :quantity 10 :price 10 :book.order/id :sell-1}}]
[:sell-2 {:action :received :order {:type :sell :quantity 5 :price 9 :book.order/id :sell-2}}]
[:sell-2 {:action :inserted-in-book :order {:type :sell :quantity 5 :price 9 :book.order/id :sell-2}}]
[:buy-1 {:action :received :order {:type :buy :quantity 7 :price 9 :book.order/id :buy-1}}]
[:buy-1 {:action :executed-before :order {:type :buy :quantity 7 :price 9 :book.order/id :buy-1}}]])
(defn -main [config]
(let [p (client/producer {:bootstrap.servers (-> config :kafka :bootstrap.servers)}
(client/keyword-serializer)
(client/edn-serializer))]
(doseq [[key val] mock-kafka-messages]
@(client/send! p "account" key val)
(println "<<>>" key "--" val)))
(print "finished"))