I hereby claim:
- I am dsabanin on github.
- I am dsabanin (https://keybase.io/dsabanin) on keybase.
- I have a public key ASCR4oyyMHmDzrg6nI3aHvWXodl8NimeCb3qxTnv7qscywo
To claim this, I am signing this object:
| (use 'ring.adapter.simpleweb) | |
| ;; Define a basic ring handler | |
| (defn handler [req] | |
| {:status 200 | |
| :headers {"Content-Type" "text/html"} | |
| :body "Hello world from SimpleWeb"}) | |
| ;; Start the server on the specified port, returning a connection | |
| (def connection (run-simpleweb handler {:port 8080})) |
| strace -qfFxv -s 1024 -p PROCESS-PID |
| (def first (fn [first] | |
| (fn [second] first))) | |
| (def second (fn [first] | |
| (fn [second] second))) | |
| (def make-pair (fn [first] (fn [second] (fn [func] ((func first) second))))) | |
| (def TRUE first) | |
| (def FALSE second) |
| def diffs(repo, from, to) | |
| repo.call_git("diff ?..?", from, to).stdout. | |
| strip. | |
| split(/diff --git.*?$/). | |
| map(&:strip). | |
| uniq. | |
| map { |d| d.blank? ? nil : d }. | |
| compact. | |
| map { |d| [diff_head(d), d] } | |
| end |
| (defmacro raise-on-match | |
| [matches & body] | |
| (loop [matches (->> matches (partition-all 2) (reverse)) | |
| res `(do ~@body)] | |
| (when matches | |
| (recur (rest matches) | |
| `(raise-on ~(first matches) ~res))) | |
| res)) | |
| ;; Usage |
| #!/bin/sh | |
| TARGET_HOST=9.9.9.9 | |
| TARGET_PORT=22 | |
| PROXY_PORT=23 | |
| echo 1 > /proc/sys/net/ipv4/ip_forward | |
| iptables -t nat -A PREROUTING -i eth0 -p tcp --dport $PROXY_PORT -j DNAT --to $TARGET_HOST:$TARGET_PORT | |
| iptables -t nat -A PREROUTING -p tcp --dport $PROXY_PORT -j DNAT --to $TARGET_HOST:$TARGET_PORT |
| # Execute as ./deploy.sh /data/project 19851203123502 | |
| # It will deploy final release as a symlink from /data/project/current to /data/project/releases/19851203123502 | |
| BASE=$1 | |
| TIMESTAMP=$2 | |
| RELEASE=$BASE/releases/$TIMESTAMP | |
| mkdir -p $BASE/releases $BASE/shared $BASE/logs | |
| cp -al $BASE/deploy-cache $RELEASE |
I hereby claim:
To claim this, I am signing this object:
| // The idea here is to make sure that ShipIt process that copies the updated app exits | |
| // before we launch the new version. The code below checks if the update is still in progress, | |
| // which means that we are running the old app still, it keeps checking until ShipIt exits and restarts | |
| // the app hoping that a new version will start up at that time. | |
| // | |
| // "find-process": "~1.2.1", | |
| import findProcess from 'find-process'; | |
| const BUNDLE_NAME = 'com.myorganization.bundleName'; | |
| const SHIP_IT_BINARY = 'ShipIt'; |