@@ -43,7 +43,7 @@ type Option func(*Compose)
4343const dockerComposeContainerNamePrefix = "rss3_node"
4444
4545func NewCompose (options ... Option ) * Compose {
46- cockroachdbVolume := "cockroachdb "
46+ alloydbVolume := "alloydb "
4747
4848 compose := & Compose {
4949 Services : map [string ]Service {
@@ -58,19 +58,21 @@ func NewCompose(options ...Option) *Compose {
5858 Retries : 3 ,
5959 },
6060 },
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+ },
6971 Healthcheck : Healthcheck {
70- Test : []string {"CMD" , "curl" , "-f" , "http://localhost:8080/health?ready=1 " },
72+ Test : []string {"CMD-SHELL " , "pg_isready -U postgres " },
7173 Interval : 5 * time .Second ,
72- Timeout : 1 * time .Second ,
73- Retries : 3 ,
74+ Timeout : 5 * time .Second ,
75+ Retries : 5 ,
7476 },
7577 },
7678 fmt .Sprintf ("%s_core" , dockerComposeContainerNamePrefix ): {
@@ -91,7 +93,7 @@ func NewCompose(options ...Option) *Compose {
9193 },
9294 },
9395 Volumes : map [string ]* string {
94- cockroachdbVolume : nil ,
96+ alloydbVolume : nil ,
9597 },
9698 }
9799
@@ -159,14 +161,14 @@ func WithWorkers(workers []*config.Module) Option {
159161 }
160162}
161163
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 {
164166 return func (c * Compose ) {
165167 services := c .Services
166168 for k , v := range services {
167169 if strings .Contains (v .Image , "rss3/node" ) {
168170 v .DependsOn = map [string ]DependsOn {
169- fmt .Sprintf ("%s_cockroachdb " , dockerComposeContainerNamePrefix ): {
171+ fmt .Sprintf ("%s_alloydb " , dockerComposeContainerNamePrefix ): {
170172 Condition : "service_healthy" ,
171173 },
172174 fmt .Sprintf ("%s_redis" , dockerComposeContainerNamePrefix ): {
0 commit comments