-
Notifications
You must be signed in to change notification settings - Fork 10
/
struct.go
85 lines (80 loc) · 2.43 KB
/
struct.go
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
82
83
84
85
package proxy
import (
"github.com/ironstar-io/tokaido/conf"
"github.com/ironstar-io/tokaido/constants"
)
// DockerCompose ...
type DockerCompose struct {
Version string `yaml:"version"`
Services struct {
Unison struct {
Hostname string `yaml:"hostname,omitempty"`
Entrypoint []string `yaml:"entrypoint,omitempty"`
User string `yaml:"user,omitempty"`
Cmd string `yaml:"cmd,omitempty"`
Volumesfrom []string `yaml:"volumes_from,omitempty"`
Dependson []string `yaml:"depends_on,omitempty"`
Image string `yaml:"image"`
Environment []string `yaml:"environment"`
Ports []string `yaml:"ports"`
Volumes []string `yaml:"volumes"`
Networks []string `yaml:"networks"`
} `yaml:"unison,omitempty"`
Proxy struct {
Hostname string `yaml:"hostname,omitempty"`
Entrypoint []string `yaml:"entrypoint,omitempty"`
User string `yaml:"user,omitempty"`
Cmd string `yaml:"cmd,omitempty"`
Dependson []string `yaml:"depends_on,omitempty"`
Environment []string `yaml:"environment,omitempty"`
Volumes []string `yaml:"volumes,omitempty"`
Volumesfrom []string `yaml:"volumes_from,omitempty"`
Image string `yaml:"image"`
Ports []string `yaml:"ports"`
Networks []string `yaml:"networks"`
} `yaml:"proxy"`
} `yaml:"services"`
}
// ComposeDefaults - Template byte array for proxy `docker-compose.yml`
func ComposeDefaults() []byte {
return []byte(`version: "2"
services:
proxy:
image: tokaido/proxy:` + conf.GetConfig().Tokaido.Stability + `
ports:
- "` + constants.ProxyPort + `:` + constants.ProxyPort + `"
volumes:
- ./client:/tokaido/proxy/config/client
networks:
- default
- tokaido_proxy
`)
}
// ComposeDefaultsUnison - Template for proxy's docker-compose file used if Unison sync is enabled
func ComposeDefaultsUnison() []byte {
return []byte(`version: "2"
services:
unison:
image: tokaido/unison:2.51.2
environment:
- UNISON_DIR=/tokaido/proxy/config/client
- UNISON_UID=1002
- UNISON_GID=1001
ports:
- "5000"
volumes:
- /tokaido/proxy/config/client
networks:
- default
- tokaido_proxy
proxy:
image: tokaido/proxy:` + conf.GetConfig().Tokaido.Stability + `
ports:
- "` + constants.ProxyPort + `:` + constants.ProxyPort + `"
volumes_from:
- unison
networks:
- default
- tokaido_proxy
`)
}