Skip to content

Commit

Permalink
update doorlock daemon to first release version
Browse files Browse the repository at this point in the history
  • Loading branch information
akiroz authored Aug 15, 2016
2 parents 0d41e91 + 5a66789 commit 616240c
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,26 @@ Diagrams are saved as `txt` files, you can import them under `File > Import From

**Dependencies:**

* clojure
* leiningen

**Build:**
```
[~/]$ git clone ...
[~/doorlock/embedded]$ lein uberjar
```
The standalone JAR is now in `doorlock/embedded/target/doorlock-<version>-standalone.jar`.
The compiled JAR is now in `doorlock/embedded/target/doorlock-<version>-standalone.jar`.

### Deploy
**Embedded OS:** ArchLinux ARM

**Dependencies:**

* java
* wiringpi-git (AUR)

**Install as systemd service:**

1. copy the standalone JAR to `/home/oursky/`
1. copy the compiled JAR to `/home/oursky/doorlock.jar`
2. copy `doorlock.service` to `/etc/systemd/system/`
3. enable and start the service:
```
Expand Down
1 change: 0 additions & 1 deletion embedded/.npmrc

This file was deleted.

2 changes: 1 addition & 1 deletion embedded/doorlock.service
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Description=Doorlock Controller Daemon

[Service]
User=oursky
ExecStart=/usr/bin/java -jar /home/oursky/doorlock-1.0.0-SNAPSHOT-standalone.jar
ExecStart=/usr/bin/java -jar /home/oursky/doorlock.jar

[Install]
WantedBy=multi-user.target
2 changes: 1 addition & 1 deletion embedded/project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject com.oursky/doorlock "1.0.0-SNAPSHOT"
(defproject com.oursky/doorlock "1.0.0"
:min-lein-version "2.0.0"
:dependencies [[org.clojure/clojure "1.8.0"]
[org.clojure/core.async "0.2.385"]
Expand Down
10 changes: 5 additions & 5 deletions embedded/src/com/oursky/doorlock/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
; identify the trigger source by sending {:source <source>}
(def unlock-chan (chan))

(defn http-handler [req]
(>!! unlock-chan {:source :network})
{:status 200})

(defn -main [& args]
; setup GPIO via wiringpi CLI interface
; the clj-gpio library does not support internal pull-up
Expand Down Expand Up @@ -45,6 +41,10 @@
(log/info "Door Locked"))
(recur (<! unlock-chan)))

(run-server http-handler {:ip "0.0.0.0" :port 8090})
(run-server (fn [req]
(>!! unlock-chan {:source (or (get-in req [:headers "x-source"])
:network)})
{:status 200})
{:ip "0.0.0.0" :port 8090})

(log/info "=== Daemon Started ==="))

0 comments on commit 616240c

Please sign in to comment.