Skip to content

Commit 3b7a83c

Browse files
Venn v0.0.3-alpha (#64)
1 parent 7461762 commit 3b7a83c

File tree

49 files changed

+779
-560
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+779
-560
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ pom.xml.asc
1414
log
1515
1
1616
projects/**/target
17-
development/resources/system.edn
17+
18+
data/*.db
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{:ns com.vennbilling.agent.migrations.create-events
2+
:up-fn migrate-up
3+
:down-fn migrate-down
4+
:transaction? true}
Lines changed: 5 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,8 @@
1-
{:system/env #profile {:dev :dev
2-
:test :test
1+
{:system/env #profile {:development :development
32
:prod :prod}
43

5-
:http/server
6-
{:host #profile {:dev "0.0.0.0"
7-
:test "0.0.0.0"
4+
:system/server
5+
{:host #profile {:development "0.0.0.0"
86
:prod #env VENN_AGENT_HTTP_HOST}
9-
:port #profile {:dev 8080
10-
:test 8080
11-
:prod #env VENN_AGENT_HTTP_PORT}}
12-
13-
:db/server
14-
{:db {:dbtype "postgresql"
15-
:dbname #profile {:dev "venn_development"
16-
:test "venn_test"
17-
:prod #env VENN_AGENT_DB_NAME}
18-
:host #profile {:dev "0.0.0.0"
19-
:test "0.0.0.0"
20-
:prod #env VENN_AGENT_DB_HOST}
21-
:port #profile {:dev 5432
22-
:test 5433
23-
:prod #env VENN_AGENT_DB_PORT}
24-
:user #profile {:dev "venn"
25-
:test "venn"
26-
:prod #env VENN_AGENT_DB_USER}
27-
:password #profile {:dev "password"
28-
:test "password"
29-
:prod #env VENN_AGENT_DB_PASSWORD}
30-
31-
;; Migration-related configs
32-
:store :database
33-
:migration-dir "../components/database/resources/database/migrations"
34-
:migration-table-name "schema_migrations"
35-
;; Script to initialize the DB
36-
:init-script #profile {:dev "schema.sql"
37-
:test "schema.sql"
38-
:prod nil}
39-
;; Managed connections allow migration commands to re-use the same connection
40-
:managed-connection? #profile {:dev true
41-
:test true
42-
:prod false}}}}
7+
:port #profile {:development 8080
8+
:prod #env VENN_AGENT_HTTP_PORT}}}

bases/agent/src/com/vennbilling/agent/core.clj

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@
22
(:gen-class)
33
(:require
44
[clojure.java.io :as io]
5-
[com.vennbilling.healthcheck.interface :as healthcheck]
5+
[com.vennbilling.http.interface :as http]
66
[com.vennbilling.logging.interface :as log]
7-
[com.vennbilling.spec.interface :as venn-spec]
87
[com.vennbilling.system.interface :as system]))
98

109
(def api-routes
1110
["/v1"
12-
[venn-spec/identify-route
13-
healthcheck/simple-route]])
11+
http/agent-routes
12+
http/healthcheck-routes])
1413

1514
(def ^:const banner (slurp (io/resource "agent/banner.txt")))
1615
(def config-file (io/resource "agent/system.edn"))

bases/agent/src/com/vennbilling/agent/migrations/.gitkeep

Whitespace-only changes.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
(ns com.vennbilling.agent.migrations.create-events
2+
3+
(:require [com.vennbilling.database.interface :as database]))
4+
5+
(def up-query {:create-table [:events :if-not-exists]
6+
:with-columns
7+
[[:uuid :text {:primary-key true}
8+
:payload :text {:not-null true}
9+
:timestamp :integer {:not-null true}
10+
:flushed_at :integer {:not-null true}]]})
11+
12+
(def down-query {:drop-table :events})
13+
14+
(defn migrate-up
15+
[{:keys [db]}]
16+
(let [{:keys [datasource]} db]
17+
(database/exec! datasource up-query)))
18+
19+
(defn migrate-down
20+
[{:keys [db]}]
21+
(let [{:keys [datasource]} db]
22+
(database/exec! datasource down-query)))

bases/server/resources/server/system.edn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{:system/env #profile {:dev :dev
22
:prod :prod}
33

4-
:http/server
4+
:system/server
55
{:host #profile {:dev "0.0.0.0"
66
:prod #env VENN_SERVER_HTTP_HOST}
77
:port #profile {:dev 8080

bases/server/src/com/vennbilling/server/core.clj

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,14 @@
22
(:gen-class)
33
(:require
44
[clojure.java.io :as io]
5-
[com.vennbilling.customer.interface :as customer]
6-
[com.vennbilling.healthcheck.interface :as healthcheck]
5+
[com.vennbilling.http.interface :as http]
76
[com.vennbilling.logging.interface :as log]
87
[com.vennbilling.system.interface :as system]))
98

109
(def api-routes
1110
["/v1"
12-
[customer/list-route
13-
customer/show-route
14-
15-
healthcheck/simple-route]])
11+
[http/server-routes
12+
http/healthcheck-routes]])
1613

1714
(def ^:const banner (slurp (io/resource "server/banner.txt")))
1815
(def config-file (io/resource "server/system.edn"))

components/customer/src/com/vennbilling/customer/core.clj

Lines changed: 0 additions & 62 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
(ns com.vennbilling.customer.handlers)
2+
3+
(defn list-handler
4+
[_]
5+
[:ok []])
6+
7+
(defn show-handler
8+
[_]
9+
[:not-found {}])

0 commit comments

Comments
 (0)