Advertisement
Guest User

Untitled

a guest
Apr 19th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.60 KB | None | 0 0
  1. FROM couchbase/server
  2. ENTRYPOINT ["/code/scripts/entrypoint.sh", "couchbase-server"]
  3.  
  4. #!/bin/bash
  5.  
  6. cb_cli() {
  7. ${CB_CLI} ${@} ${CREDENTIALS}
  8. }
  9.  
  10. server_configured() {
  11. server_list=$(cb_cli server-list)
  12. return $([[ $? == 0 ]] && [[ $(echo ${server_list} | wc -l) != 0 ]])
  13. }
  14.  
  15. setup_couchbase_server() {
  16. cb_cli cluster-init --cluster-ramsize=${RAM_SIZE} --cluster-username=admin --cluster-password=admin123
  17. cb_cli bucket-create --bucket-ramsize=${RAM_SIZE} --bucket=${BUCKET_NAME}
  18. }
  19.  
  20. couchbase_config() {
  21. curl ${SERVER_ADDR} >&- 2>&-
  22. while [[ $? != 23 ]]; do
  23. sleep 3
  24. curl ${SERVER_ADDR}>&- 2>&-
  25. done
  26.  
  27. ! server_configured && {
  28. echo "Setting up couchbase server..."
  29. setup_couchbase_server && echo "Setup complete"
  30. }
  31. }
  32.  
  33. [[ "$1" == "couchbase-server" ]] && {
  34. /usr/sbin/runsvdir-start &
  35. couchbase_config
  36. echo "Starting Couchbase Server -- Web UI available at http://${SERVER_ADDR} and logs available in /opt/couchbase/var/lib/couchbase/logs"
  37. /usr/sbin/runsvdir-start
  38. }
  39.  
  40. version: '3'
  41. services:
  42. couchbase_server:
  43. build: .
  44. ports:
  45. - "8091-8094:8091-8094"
  46. - "11210:11210"
  47. volumes:
  48. - .:/code
  49. environment:
  50. - CB_CLI=opt/couchbase/bin/couchbase-cli
  51. - SERVER_ADDR=localhost:8091
  52. - CREDENTIALS=-u admin -p admin123 -c localhost:8091
  53. - RAM_SIZE=1024
  54. - BUCKET_NAME=sync_gateway
  55. sync_gateway:
  56. image: couchbase/sync-gateway
  57. links:
  58. - "couchbase_server:db"
  59. depends_on:
  60. - couchbase_server
  61. volumes:
  62. - ./sync_gateway_config.json:/code
  63. command: /code
  64. ports:
  65. - 4984:4984
  66. - 4985:4985
  67.  
  68. {
  69. "log": ["REST"],
  70. "interface": ":4984",
  71. "databases": {
  72. "sync_gateway": {
  73. "server": "http://db:8091",
  74. "username": "admin",
  75. "password": "admin123"
  76. }
  77. }
  78. }
  79.  
  80. couchbase_server_1 | Setting up couchbase server...
  81. couchbase_server_1 | SUCCESS: init/edit localhost
  82. couchbase_server_1 | SUCCESS: bucket-create
  83. couchbase_server_1 | Setup complete
  84. couchbase_server_1 | Starting Couchbase Server -- Web UI available at
  85. http://localhost:8091 and logs available in /opt/couchbase/var/lib
  86. /couchbase/logs
  87.  
  88. sync_gateway_1 | 2017-03-28T11:29:51.240Z Opening Couchbase
  89. database sync_gateway on <http://db:8091> as user "admin"
  90.  
  91. sync_gateway_1 | _time=2017-03-28T11:29:51.262+00:00 _level=INFO
  92. _msg=Non-healthy node; node details:
  93.  
  94. sync_gateway_1 | _time=2017-03-28T11:29:51.262+00:00 _level=INFO
  95. _msg=Hostname=172.20.0.2:8091, Status=warmup,
  96. CouchAPIBase=http://172.20.0.2:8092
  97. /sync_gateway%2B87e2e410d0e9da0295091c6de9ae5ae7,
  98. ThisNode=true
  99.  
  100. sync_gateway_1 | 2017-03-28T11:29:51.262Z WARNING: Error
  101. installing Couchbase design doc: no available couch rest URLs --
  102. db.installViews.func1() at database.go:577
  103.  
  104. sync_gateway_1 | _time=2017-03-28T11:29:51.263+00:00 _level=INFO
  105. _msg= Trying with
  106. http://172.20.0.2:8091/pools/default/bucketsStreaming/sync_gateway
  107.  
  108. sync_gateway_1 | _time=2017-03-28T11:29:51.268+00:00 _level=INFO
  109. _msg=Non-healthy node; node details:
  110.  
  111. sync_gateway_1 | _time=2017-03-28T11:29:51.268+00:00 _level=INFO
  112. _msg=Hostname=172.20.0.2:8091, Status=warmup,
  113. CouchAPIBase=http://172.20.0.2:8092
  114. /sync_gateway%2B87e2e410d0e9da0295091c6de9ae5ae7, ThisNode=true
  115.  
  116. sync_gateway_1 | 2017-03-28T11:29:51.268Z WARNING: Error
  117. installing Couchbase design doc: no available couch rest URLs --
  118. db.installViews.func1() at database.go:577
  119.  
  120. sync_gateway_1 | _time=2017-03-28T11:29:51.272+00:00 _level=INFO
  121. _msg=Got new configuration for bucket sync_gateway
  122.  
  123. sync_gateway_1 | _time=2017-03-28T11:29:51.279+00:00 _level=INFO
  124. _msg=Non-healthy node; node details:
  125.  
  126. sync_gateway_1 | _time=2017-03-28T11:29:51.280+00:00 _level=INFO
  127. _msg=Hostname=172.20.0.2:8091, Status=warmup,
  128. CouchAPIBase=
  129. http://172.20.0.2:8092/sync_gateway%2B87e2e410d0e9da0295091c6de9ae5ae7,
  130. ThisNode=true
  131.  
  132. sync_gateway_1 | 2017-03-28T11:29:51.280Z WARNING: Error
  133. installing Couchbase design doc: no available couch rest URLs --
  134. db.installViews.func1() at database.go:577
  135.  
  136. sync_gateway_1 | _time=2017-03-28T11:29:51.301+00:00 _level=INFO
  137. _msg=Non-healthy node; node details:
  138.  
  139. sync_gateway_1 | _time=2017-03-28T11:29:51.301+00:00 _level=INFO
  140. _msg=Hostname=172.20.0.2:8091, Status=warmup,
  141. CouchAPIBase=http://172.20.0.2:8092
  142. /sync_gateway%2B87e2e410d0e9da0295091c6de9ae5ae7, ThisNode=true
  143.  
  144. sync_gateway_1 | 2017-03-28T11:29:51.301Z WARNING: Error
  145. installing Couchbase design doc: no available couch rest URLs --
  146. db.installViews.func1() at database.go:577
  147.  
  148. sync_gateway_1 | _time=2017-03-28T11:29:51.330+00:00 _level=INFO
  149. _msg=Got new configuration for bucket sync_gateway
  150.  
  151. sync_gateway_1 | _time=2017-03-28T11:29:51.342+00:00 _level=INFO
  152. _msg= Trying with selected node 0
  153.  
  154. sync_gateway_1 | _time=2017-03-28T11:29:51.399+00:00 _level=INFO
  155. _msg= Trying with selected node 0
  156.  
  157. sync_gateway_1 | 2017-03-28T11:29:51.576Z WARNING: Error from Incr
  158. in sequence allocator (0) - attempt (1/3): MCResponse status=AUTH_ERROR,
  159. opcode=SASL_AUTH, opaque=0, msg:
  160. Auth failure -- db.(*sequenceAllocator).incrWithRetry() at
  161. sequence_allocator.go:88
  162.  
  163. sync_gateway_1 | 2017-03-28T11:29:51.589Z WARNING: Error from Incr
  164. in sequence allocator (0) - attempt (2/3): MCResponse status=AUTH_ERROR,
  165. opcode=SASL_AUTH, opaque=0, msg:
  166. Auth failure -- db.(*sequenceAllocator).incrWithRetry() at
  167. sequence_allocator.go:88
  168.  
  169. sync_gateway_1 | 2017-03-28T11:29:51.602Z WARNING: Error from Incr
  170. in sequence allocator (0) - attempt (3/3): MCResponse status=AUTH_ERROR,
  171. opcode=SASL_AUTH, opaque=0, msg:
  172. Auth failure -- db.(*sequenceAllocator).incrWithRetry() at
  173. sequence_allocator.go:88
  174.  
  175. sync_gateway_1 | 2017-03-28T11:29:51.613Z WARNING: Too many unsuccessful
  176. Incr attempts in sequence allocator - giving up (0): MCResponse status=
  177. AUTH_ERROR, opcode=SASL_AUTH, opaque=0, msg: Auth failure --
  178. db.(*sequenceAllocator).incrWithRetry()
  179. at sequence_allocator.go:94
  180.  
  181. sync_gateway_1 | 2017-03-28T11:29:51.613Z WARNING:
  182. Error from Incr in _reserveSequences(0): Unable to increment sequence:
  183. MCResponse status=AUTH_ERROR, opcode=SASL_AUTH, opaque=0, msg: Auth failure --
  184. db.(*sequenceAllocator)._reserveSequences() at sequence_allocator.go:65
  185.  
  186. sync_gateway_1 | 2017-03-28T11:29:51.613Z FATAL:
  187. Error opening database: Unable to increment sequence:
  188. MCResponse status=AUTH_ERROR, opcode=SASL_AUTH, opaque=0, msg: Auth failure --
  189. rest.RunServer() at config.go:677
  190.  
  191. setup_couchbase_server() {
  192. cb_cli cluster-init --cluster-ramsize=${CB_RAM_SIZE}
  193. cb_cli bucket-create --bucket-ramsize=${CB_RAM_SIZE} --bucket=${CB_SYNC_GATEWAY_BUCKET} --bucket-password=bucket_pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement