|
1
|
|
|
<?php declare(strict_types=1); |
|
2
|
|
|
|
|
3
|
|
|
namespace Cocotte\Help; |
|
4
|
|
|
|
|
5
|
|
|
final class DefaultExamples implements CommandExamples |
|
6
|
|
|
{ |
|
7
|
|
|
public function install( |
|
8
|
|
|
string $token = 'xxxx', |
|
9
|
|
|
string $traefikHostname = 'traefik.mydomain.com', |
|
10
|
|
|
string $traefikPassword = 'password', |
|
11
|
|
|
string $traefikUsername = 'username' |
|
12
|
|
|
): string { |
|
13
|
|
|
return <<<EOF |
|
14
|
|
|
docker run -it --rm \ |
|
15
|
|
|
-v "$(pwd)":/host \ |
|
16
|
|
|
-v /var/run/docker.sock:/var/run/docker.sock:ro \ |
|
17
|
|
|
chrif/cocotte install \ |
|
18
|
|
|
--digital-ocean-api-token="$token" \ |
|
19
|
|
|
--traefik-ui-hostname="{$traefikHostname}" \ |
|
20
|
|
|
--traefik-ui-password="{$traefikPassword}" \ |
|
21
|
|
|
--traefik-ui-username="{$traefikUsername}"; |
|
22
|
|
|
EOF; |
|
23
|
|
|
} |
|
24
|
|
|
|
|
25
|
|
|
public function staticSite( |
|
26
|
|
|
string $token = 'xxxx', |
|
27
|
|
|
string $namespace = 'static-site', |
|
28
|
|
|
string $hostname = 'static-site.mydomain.com' |
|
29
|
|
|
): string { |
|
30
|
|
|
return |
|
31
|
|
|
<<<EOF |
|
32
|
|
|
docker run -it --rm \ |
|
33
|
|
|
-v "$(pwd)":/host \ |
|
34
|
|
|
-v /var/run/docker.sock:/var/run/docker.sock:ro \ |
|
35
|
|
|
chrif/cocotte static-site \ |
|
36
|
|
|
--digital-ocean-api-token="{$token}" \ |
|
37
|
|
|
--namespace="{$namespace}" \ |
|
38
|
|
|
--hostname="{$hostname}"; |
|
39
|
|
|
EOF; |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
public function uninstall( |
|
43
|
|
|
string $token = 'xxxx', |
|
44
|
|
|
string $traefikHostname = 'traefik.mydomain.com' |
|
45
|
|
|
): string { |
|
46
|
|
|
return <<<EOF |
|
47
|
|
|
docker run -it --rm \ |
|
48
|
|
|
-v "$(pwd)":/host \ |
|
49
|
|
|
-v /var/run/docker.sock:/var/run/docker.sock:ro \ |
|
50
|
|
|
chrif/cocotte uninstall \ |
|
51
|
|
|
--digital-ocean-api-token="{$token}" \ |
|
52
|
|
|
--traefik-ui-hostname="{$traefikHostname}"; |
|
53
|
|
|
EOF; |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
public function installInteractive(): string |
|
57
|
|
|
{ |
|
58
|
|
|
return <<<EOF |
|
59
|
|
|
docker run -it --rm \ |
|
60
|
|
|
-v "$(pwd)":/host \ |
|
61
|
|
|
-v /var/run/docker.sock:/var/run/docker.sock:ro \ |
|
62
|
|
|
chrif/cocotte install; |
|
63
|
|
|
EOF; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
public function uninstallInteractive(): string |
|
67
|
|
|
{ |
|
68
|
|
|
return <<<EOF |
|
69
|
|
|
docker run -it --rm \ |
|
70
|
|
|
-v "$(pwd)":/host \ |
|
71
|
|
|
-v /var/run/docker.sock:/var/run/docker.sock:ro \ |
|
72
|
|
|
chrif/cocotte uninstall; |
|
73
|
|
|
EOF; |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
public function staticSiteInteractive(): string |
|
77
|
|
|
{ |
|
78
|
|
|
return <<<EOF |
|
79
|
|
|
docker run -it --rm \ |
|
80
|
|
|
-v "$(pwd)":/host \ |
|
81
|
|
|
-v /var/run/docker.sock:/var/run/docker.sock:ro \ |
|
82
|
|
|
chrif/cocotte static-site; |
|
83
|
|
|
EOF; |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
} |
|
87
|
|
|
|