-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcake
More file actions
executable file
·81 lines (64 loc) · 1.96 KB
/
cake
File metadata and controls
executable file
·81 lines (64 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/local/bin/bb
(require '[babashka.process :refer [sh shell]])
(def *CONTAINER-NAME* "cas-app")
(def *IMAGE-NAME* "cas-app")
(def *TAG* "latest")
(def *TAGGED-IMAGE* (str *IMAGE-NAME* ":" *TAG*))
(def *REGISTRY* "registry.digitalocean.com/daniel-reg")
(def *QUALIFIED-IMAGE* (str *REGISTRY* "/" *TAGGED-IMAGE*))
(defn docker-build []
(shell "docker" "build" "-t" *IMAGE-NAME* "."))
(defn shadow-compile []
(shell "shadow-cljs release :app"))
(defn ghetto-deploy []
(let [file-loc "resources/public/js/compiled/main.js"]
(shell "scp" file-loc (str "cas-app:/root/cas/" file-loc))))
(defn shadow-full-deploy []
(shadow-compile)
(ghetto-deploy))
(defn ssh []
(shell "ssh cas-app"))
(defn set-update []
(shell "scp update.sh cas-app:/root/cas/update.sh"))
(defn build []
(shadow-compile)
(docker-build))
(defn open-public []
(shell"firefox tinyurl.com/cas-cockpit")
#_(shell"firefox http://143.198.121.188:8080/cockpit")
)
(defn do-push []
(shell "docker tag" *TAGGED-IMAGE* *QUALIFIED-IMAGE*)
(shell "docker push" *QUALIFIED-IMAGE*))
(defn docker-run []
(shell "docker create --rm"
"--name" *CONTAINER-NAME*
"-p" "8080:8080"
"-p" "50504:50504"
"-p" "50505:50505"
*IMAGE-NAME*)
(shell "docker" "start" *CONTAINER-NAME*))
(defn docker-debug []
(shell "docker run -it --rm --name" *CONTAINER-NAME*
"-p" "8080:8080"
"-p" "50504:50504"
"-p" "50505:50505"
*IMAGE-NAME*
"/bin/bash"))
(declare commands)
(defn default []
(println "need one of:" (->> commands keys (interpose ", ") (apply str) )))
(def commands
{"build" build
"docker-build" docker-build
"do-push" do-push
"debug" docker-debug
"open-public" open-public
"run" docker-run
"shadow-compile" shadow-compile
"ghetto-deploy" ghetto-deploy
"shadow-full-deploy" shadow-full-deploy
"ssh" ssh
"set-update" set-update
})
((get commands (first *command-line-args*) default))