|
2 | 2 | (:require
|
3 | 3 | [reagent.core :as r]
|
4 | 4 | [re-frame.core :as rf]
|
5 |
| - ["@mantine/core" :refer [Stack Group Paper Code Anchor]] |
6 |
| - ["@tabler/icons-react" :refer [IconBrandDocker IconBrandGithubFilled]] |
| 5 | + ["@mantine/core" :refer [Stack Group Paper Code Tabs Accordion Box Table Timeline Text]] |
| 6 | + ["@tabler/icons-react" :refer [IconBrandDocker IconExternalLink IconCpu |
| 7 | + IconBrandGithubFilled IconDownload IconTerminal]] |
7 | 8 | ["js-confetti" :as JSConfetti]
|
8 | 9 | [webclient.components.h :as h]
|
9 |
| - [webclient.components.ui.anchor :as anchor] |
10 |
| - [webclient.components.ui.text :as text])) |
| 10 | + [webclient.components.clipboard :as clipboard] |
| 11 | + [webclient.components.ui.title :as title] |
| 12 | + [webclient.components.ui.text :as text] |
| 13 | + [webclient.components.ui.anchor :as anchor])) |
| 14 | + |
| 15 | +(defn docker-installation [] |
| 16 | + (let [architectures [{:value "intel" |
| 17 | + :title "Intel Based Chips" |
| 18 | + :image "duckthq/proxy"} |
| 19 | + {:value "arm" |
| 20 | + :title "ARM64/Apple Silicon" |
| 21 | + :image "duckthq/proxy-arm64"}]] |
| 22 | + (fn [proxy-info] |
| 23 | + [:> Stack {:gap :lg} |
| 24 | + [:> Tabs {:defaultValue "intel"} |
| 25 | + [:> Tabs.List |
| 26 | + [:> Tabs.Tab {:value "intel"} "Intel Based Chips"] |
| 27 | + [:> Tabs.Tab {:value "arm"} "ARM64/Apple Silicon"]] |
| 28 | + |
| 29 | + (doall |
| 30 | + (for [a architectures] |
| 31 | + ^{:key (:value a)} |
| 32 | + [:> Tabs.Panel {:value (:value a) |
| 33 | + :py :lg |
| 34 | + :px :md} |
| 35 | + [:> Stack {:gap :lg} |
| 36 | + [:> Group |
| 37 | + [text/Dimmed "Image:"] |
| 38 | + [:> Code (:image a)] |
| 39 | + [clipboard/icon {:text (:image a)}]] |
| 40 | + |
| 41 | + [:> Table {:variant :vertical} |
| 42 | + [:> Table.Tbody |
| 43 | + [:> Table.Tr |
| 44 | + [:> Table.Th "Environment Variable"] |
| 45 | + [:> Table.Th "Value"]] |
| 46 | + (comment |
| 47 | + [:> Table.Tr |
| 48 | + [:> Table.Th "DUCKT_SERVER_URL"] |
| 49 | + [:> Table.Td "URL of the Duckt server"]]) |
| 50 | + [:> Table.Tr |
| 51 | + [:> Table.Th "PROXY_TOKEN"] |
| 52 | + [:> Table.Td (:proxy-key proxy-info)]]]] |
| 53 | + [:> Stack |
| 54 | + [h/h5 "You may also run the container locally"] |
| 55 | + [:> Paper {:withBorder true |
| 56 | + :p :md} |
| 57 | + [:> Group {:justify :end} |
| 58 | + [:> Code |
| 59 | + (str "docker run --rm -it -p 4445:4445" |
| 60 | + " -e PROXY_TOKEN=" (:proxy-key proxy-info) " " (:image a))]]]]]]))]]))) |
| 61 | + |
| 62 | +(defn bare-metal-installation [] |
| 63 | + (fn [proxy-info] |
| 64 | + [:> Stack |
| 65 | + [text/Base "You can download the standalone jar file and run it on any machine with Java installed."] |
| 66 | + [:> Timeline |
| 67 | + [:> Timeline.Item {:title "Download the standalone jar file" |
| 68 | + :bullet (r/as-element [:> IconBrandGithubFilled {:size 16}])} |
| 69 | + [text/Base |
| 70 | + [:span |
| 71 | + [:span "Download the latest proxy standalone jar file from the "] |
| 72 | + [anchor/Base {:href "https://github.com/duckthq/duckt/releases" |
| 73 | + :target "_blank"} |
| 74 | + [:span |
| 75 | + [:span "Duckt GitHub releases page."] |
| 76 | + [:> IconExternalLink {:size 14}]]]]]] |
| 77 | + [:> Timeline.Item {:title "Install Java" |
| 78 | + :bullet (r/as-element [:> IconDownload {:size 16}])} |
| 79 | + [text/Base [:span [:span "Make sure you have Java installed on your machine. "] |
| 80 | + [anchor/Base |
| 81 | + {:href "https://www.java.com/en/download/help/download_options.html" |
| 82 | + :target "_blank"} |
| 83 | + "You can download Java from the official website."]]]] |
| 84 | + [:> Timeline.Item {:title "Run the jar file" |
| 85 | + :bullet (r/as-element [:> IconTerminal {:size 16}])} |
| 86 | + [text/Base "Run the jar file replacing <version> with the actual downloaded version"] |
| 87 | + [:> Paper {:withBorder true |
| 88 | + :p :md} |
| 89 | + [:> Group |
| 90 | + [:> Code (str |
| 91 | + "PROXY_TOKEN=" (:proxy-key proxy-info) " " |
| 92 | + "java -jar proxy-standalone-<version>.jar")]]]]]])) |
11 | 93 |
|
12 | 94 | (defn panel []
|
13 | 95 | (let [new-proxy-info (rf/subscribe [:proxies->new-proxy-info])
|
14 | 96 | js-confetti (new JSConfetti)]
|
15 |
| - (println :new-proxy-info @new-proxy-info) |
16 | 97 | (fn []
|
17 |
| - (let [proxy-key (:proxy-key @new-proxy-info)] |
18 | 98 | (.addConfetti js-confetti
|
19 | 99 | (clj->js {:confettiRadius 2
|
20 | 100 | :confettiColors ["#999" "#ddd" "#aaa"]
|
21 | 101 | :confettiNumber 3000}))
|
22 |
| - [:> Stack {:p :md} |
| 102 | + [:> Stack {:p :md |
| 103 | + :gap :xl} |
23 | 104 | [h/page-title
|
24 | 105 | "Set up your proxy"
|
25 | 106 | "Deploy your proxy with the following information."]
|
26 |
| - [:> Stack |
27 |
| - [h/h3 "Using Docker"] |
28 |
| - [h/h5 "Pull the image"] |
29 |
| - [:> Paper {:withBorder true |
30 |
| - :p :md} |
31 |
| - [:> Group |
32 |
| - [:> IconBrandDocker {:size 24 |
33 |
| - :color "var(--mantine-color-blue-7)" |
34 |
| - :stroke 1}] |
35 |
| - [:> Code |
36 |
| - "docker pull duckthq/proxy"]]] |
37 |
| - [h/h5 "Run the container"] |
38 |
| - [:> Paper {:withBorder true |
39 |
| - :p :md} |
40 |
| - [:> Group |
41 |
| - [:> Code |
42 |
| - (str "docker run --rm -it -p 4445:4445" |
43 |
| - " -e DUCKT_SERVER_URL=" "URL" |
44 |
| - " -e PROXY_TOKEN=" proxy-key " duckthq/proxy")]]] |
45 |
| - ] |
46 |
| - [:> Stack |
47 |
| - [h/h3 "Build from source"] |
48 |
| - [:> Group |
49 |
| - [anchor/Dark {:href "https://github.com/duckthq/duckt/tree/main/proxy" |
50 |
| - :target "_blank" |
51 |
| - :inherit true} |
52 |
| - [:> Paper {:withBorder true |
53 |
| - :p :md} |
54 |
| - [:> Stack |
55 |
| - [:> Group {:gap :xs} |
56 |
| - [:> IconBrandGithubFilled {:size 20}] |
57 |
| - [h/h5 "GitHub"]] |
58 |
| - [text/Base |
59 |
| - "Visit our GitHub repository to build the proxy from source."]]]]]]])))) |
| 107 | + [:> Accordion {:variant :contained |
| 108 | + :defaultValue "Docker" |
| 109 | + :radius :lg} |
| 110 | + [:> Accordion.Item {:value "Docker"} |
| 111 | + [:> Accordion.Control {:icon (r/as-element |
| 112 | + [:> IconBrandDocker |
| 113 | + {:size 24 |
| 114 | + :stroke 1}])} |
| 115 | + [title/h3 "Docker"]] |
| 116 | + [:> Accordion.Panel [docker-installation @new-proxy-info]]] |
| 117 | + |
| 118 | + [:> Accordion.Item {:value "Bare Metal"} |
| 119 | + [:> Accordion.Control {:icon (r/as-element |
| 120 | + [:> IconCpu |
| 121 | + {:size 24 |
| 122 | + :stroke 1}])} |
| 123 | + [title/h3 "Bare Metal"]] |
| 124 | + [:> Accordion.Panel [bare-metal-installation @new-proxy-info]]]]]))) |
0 commit comments