@@ -43,7 +43,7 @@ type Option func(*Compose)
43
43
const dockerComposeContainerNamePrefix = "rss3_node"
44
44
45
45
func NewCompose (options ... Option ) * Compose {
46
- cockroachdbVolume := "cockroachdb "
46
+ alloydbVolume := "alloydb "
47
47
48
48
compose := & Compose {
49
49
Services : map [string ]Service {
@@ -58,19 +58,21 @@ func NewCompose(options ...Option) *Compose {
58
58
Retries : 3 ,
59
59
},
60
60
},
61
- fmt .Sprintf ("%s_cockroachdb" , dockerComposeContainerNamePrefix ): {
62
- Command : "start-single-node --cluster-name=node --insecure" ,
63
- ContainerName : fmt .Sprintf ("%s_cockroachdb" , dockerComposeContainerNamePrefix ),
64
- Expose : []string {"26257" , "8080" },
65
- Image : "cockroachdb/cockroach:v23.2.5" ,
66
- Volumes : []string {fmt .Sprintf ("%s:/cockroach/cockroach-data" , cockroachdbVolume )},
67
- // we use similar healthcheck as the official cockroachdb operator
68
- // ref: https://github.com/cockroachdb/cockroach-operator/blob/28d139cb0c19d3c7984b2b2da1b25c5ba388d814/pkg/resource/testdata/TestStatefulSetBuilder/default_secure.golden#L76-L83
61
+ fmt .Sprintf ("%s_alloydb" , dockerComposeContainerNamePrefix ): {
62
+ ContainerName : fmt .Sprintf ("%s_alloydb" , dockerComposeContainerNamePrefix ),
63
+ Expose : []string {"5432" },
64
+ Image : "google/alloydbomni:latest" ,
65
+ Volumes : []string {fmt .Sprintf ("%s:/alloydb/alloydb-data" , alloydbVolume )},
66
+ Environment : map [string ]string {
67
+ "DATA_DIR" : "/var/lib/postgresql/data" ,
68
+ "HOST_PORT" : "5432" ,
69
+ "POSTGRES_PASSWORD" : "password" ,
70
+ },
69
71
Healthcheck : Healthcheck {
70
- Test : []string {"CMD" , "curl" , "-f" , "http://localhost:8080/health?ready=1 " },
72
+ Test : []string {"CMD-SHELL " , "pg_isready -U postgres " },
71
73
Interval : 5 * time .Second ,
72
- Timeout : 1 * time .Second ,
73
- Retries : 3 ,
74
+ Timeout : 5 * time .Second ,
75
+ Retries : 5 ,
74
76
},
75
77
},
76
78
fmt .Sprintf ("%s_core" , dockerComposeContainerNamePrefix ): {
@@ -91,7 +93,7 @@ func NewCompose(options ...Option) *Compose {
91
93
},
92
94
},
93
95
Volumes : map [string ]* string {
94
- cockroachdbVolume : nil ,
96
+ alloydbVolume : nil ,
95
97
},
96
98
}
97
99
@@ -159,14 +161,14 @@ func WithWorkers(workers []*config.Module) Option {
159
161
}
160
162
}
161
163
162
- // SetDependsOnCRDB would set all the rss3 node service to depend on the cockroachdb service
163
- func SetDependsOnCRDB () Option {
164
+ // SetDependsOnAlloyDB would set all the rss3 node service to depend on the AlloyDB service
165
+ func SetDependsOnAlloyDB () Option {
164
166
return func (c * Compose ) {
165
167
services := c .Services
166
168
for k , v := range services {
167
169
if strings .Contains (v .Image , "rss3/node" ) {
168
170
v .DependsOn = map [string ]DependsOn {
169
- fmt .Sprintf ("%s_cockroachdb " , dockerComposeContainerNamePrefix ): {
171
+ fmt .Sprintf ("%s_alloydb " , dockerComposeContainerNamePrefix ): {
170
172
Condition : "service_healthy" ,
171
173
},
172
174
fmt .Sprintf ("%s_redis" , dockerComposeContainerNamePrefix ): {
0 commit comments