diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..a2a9cd5 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +target +full-stack +fixtures diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..dc3aecd --- /dev/null +++ b/Dockerfile @@ -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"] diff --git a/README.md b/README.md index c01b890..84d484d 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,6 @@ allow end user(s?) to exchange securities via the common exchange rules. ## Installation Okay, this should be easy but it is hard... -## Hack me ### Configuration All configuration are set in the `resources/config.edn` file. diff --git a/docker-compose.yml b/docker-compose.yml index 4985c43..0f13115 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,7 +16,6 @@ services: - ./full-stack/zoo1/data:/data - ./full-stack/zoo1/datalog:/datalog - kafka1: image: confluentinc/cp-kafka:4.1.0 hostname: kafka1 @@ -150,3 +149,16 @@ services: restart: unless-stopped depends_on: - 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" diff --git a/resources/config.edn b/resources/config.edn index c2c578c..9ecd30b 100644 --- a/resources/config.edn +++ b/resources/config.edn @@ -1,6 +1,6 @@ { :kafka - {:bootstrap.servers "localhost:9092" + {:bootstrap.servers #or [#env KAFKA_BOOTSTRAP_SERVERS "localhost:9092"] :topics-prefix "skirmish-01-"} :webserver ;; possible config from http-kit's run-server diff --git a/src/skirmish/kafka/book.clj b/src/skirmish/kafka/book.clj deleted file mode 100644 index bc62856..0000000 --- a/src/skirmish/kafka/book.clj +++ /dev/null @@ -1 +0,0 @@ -(ns skirmish.kafka.book) diff --git a/src/skirmish/kafka/exchange_simulator.clj b/src/skirmish/kafka/exchange_simulator.clj deleted file mode 100644 index 8632d26..0000000 --- a/src/skirmish/kafka/exchange_simulator.clj +++ /dev/null @@ -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")) \ No newline at end of file