types.go 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. package config
  2. import "github.com/rancherio/rancher-compose/librcompose/project"
  3. const (
  4. CONSOLE_CONTAINER = "console"
  5. DOCKER_BIN = "/usr/bin/docker"
  6. DOCKER_SYSTEM_HOME = "/var/lib/system-docker"
  7. DOCKER_SYSTEM_HOST = "unix:///var/run/system-docker.sock"
  8. DOCKER_HOST = "unix:///var/run/docker.sock"
  9. IMAGES_PATH = "/"
  10. IMAGES_PATTERN = "images*.tar"
  11. SYS_INIT = "/sbin/init-sys"
  12. USER_INIT = "/sbin/init-user"
  13. MODULES_ARCHIVE = "/modules.tar"
  14. DEBUG = false
  15. LABEL = "label"
  16. HASH = "io.rancher.os.hash"
  17. ID = "io.rancher.os.id"
  18. DETACH = "io.rancher.os.detach"
  19. REMOVE = "io.rancher.os.remove"
  20. CREATE_ONLY = "io.rancher.os.createonly"
  21. RELOAD_CONFIG = "io.rancher.os.reloadconfig"
  22. SCOPE = "io.rancher.os.scope"
  23. SYSTEM = "system"
  24. )
  25. var (
  26. VERSION string
  27. OsConfigFile = "/os-config.yml"
  28. CloudConfigFile = "/var/lib/rancher/conf/cloud-config-rancher.yml"
  29. ConfigFile = "/var/lib/rancher/conf/rancher.yml"
  30. PrivateConfigFile = "/var/lib/rancher/conf/rancher-private.yml"
  31. )
  32. type ContainerConfig struct {
  33. Id string `yaml:"id,omitempty"`
  34. Cmd string `yaml:"run,omitempty"`
  35. MigrateVolumes bool `yaml:"migrate_volumes,omitempty"`
  36. ReloadConfig bool `yaml:"reload_config,omitempty"`
  37. CreateOnly bool `yaml:create_only,omitempty`
  38. Service *project.ServiceConfig `yaml:service,omitempty`
  39. }
  40. type Repository struct {
  41. Url string `yaml:url,omitempty`
  42. }
  43. type Repositories map[string]Repository
  44. type Config struct {
  45. Environment map[string]string `yaml:"environment,omitempty"`
  46. Services map[string]*project.ServiceConfig `yaml:"services,omitempty"`
  47. BootstrapContainers map[string]*project.ServiceConfig `yaml:"bootstrap,omitempty"`
  48. Autoformat map[string]*project.ServiceConfig `yaml:"autoformat,omitempty"`
  49. BootstrapDocker DockerConfig `yaml:"bootstrap_docker,omitempty"`
  50. CloudInit CloudInit `yaml:"cloud_init,omitempty"`
  51. Console ConsoleConfig `yaml:"console,omitempty"`
  52. Debug bool `yaml:"debug,omitempty"`
  53. Disable []string `yaml:"disable,omitempty"`
  54. ServicesInclude map[string]bool `yaml:"services_include,omitempty"`
  55. Modules []string `yaml:"modules,omitempty"`
  56. Network NetworkConfig `yaml:"network,omitempty"`
  57. Repositories Repositories `yaml:"repositories,omitempty"`
  58. Ssh SshConfig `yaml:"ssh,omitempty"`
  59. State StateConfig `yaml:"state,omitempty"`
  60. SystemContainers map[string]*project.ServiceConfig `yaml:"system_containers,omitempty"`
  61. SystemDocker DockerConfig `yaml:"system_docker,omitempty"`
  62. Upgrade UpgradeConfig `yaml:"upgrade,omitempty"`
  63. UserContainers []ContainerConfig `yaml:"user_containers,omitempty"`
  64. UserDocker DockerConfig `yaml:"user_docker,omitempty"`
  65. }
  66. type ConsoleConfig struct {
  67. Tail bool `yaml:"tail,omitempty"`
  68. Persistent bool `yaml:"persistent,omitempty"`
  69. }
  70. type UpgradeConfig struct {
  71. Url string `yaml:"url,omitempty"`
  72. Image string `yaml:"image,omitempty"`
  73. Rollback string `yaml:"rollback,omitempty"`
  74. }
  75. type DnsConfig struct {
  76. Nameservers []string `yaml:"nameservers,flow,omitempty"`
  77. Search []string `yaml:"search,flow,omitempty"`
  78. Domain string `yaml:"domain,omitempty"`
  79. }
  80. type NetworkConfig struct {
  81. Dns DnsConfig `yaml:"dns,omitempty"`
  82. Interfaces map[string]InterfaceConfig `yaml:"interfaces,omitempty"`
  83. PostRun *ContainerConfig `yaml:"post_run,omitempty"`
  84. }
  85. type InterfaceConfig struct {
  86. Match string `yaml:"match,omitempty"`
  87. DHCP bool `yaml:"dhcp,omitempty"`
  88. Address string `yaml:"address,omitempty"`
  89. IPV4LL bool `yaml:"ipv4ll,omitempty"`
  90. Gateway string `yaml:"gateway,omitempty"`
  91. MTU int `yaml:"mtu,omitempty"`
  92. Bridge bool `yaml:"bridge,omitempty"`
  93. }
  94. type DockerConfig struct {
  95. TLS bool `yaml:"tls,omitempty"`
  96. TLSArgs []string `yaml:"tls_args,flow,omitempty"`
  97. Args []string `yaml:"args,flow,omitempty"`
  98. ExtraArgs []string `yaml:"extra_args,flow,omitempty"`
  99. ServerCert string `yaml:"server_cert,omitempty"`
  100. ServerKey string `yaml:"server_key,omitempty"`
  101. CACert string `yaml:"ca_cert,omitempty"`
  102. CAKey string `yaml:"ca_key,omitempty"`
  103. }
  104. type SshConfig struct {
  105. Keys map[string]string `yaml:"keys,omitempty"`
  106. }
  107. type StateConfig struct {
  108. FsType string `yaml:"fstype,omitempty"`
  109. Dev string `yaml:"dev,omitempty"`
  110. Required bool `yaml:"required,omitempty"`
  111. Autoformat []string `yaml:"autoformat,omitempty"`
  112. FormatZero bool `yaml:"formatzero,omitempty"`
  113. }
  114. type CloudInit struct {
  115. Datasources []string `yaml:"datasources,omitempty"`
  116. }
  117. func init() {
  118. if VERSION == "" {
  119. VERSION = "v0.0.0-dev"
  120. }
  121. }