docker-compose.yml 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. # This file was auto-generated, do not edit it directly.
  2. # Instead run bin/update_build_scripts from
  3. # https://github.com/overleaf/internal/
  4. version: "2.3"
  5. services:
  6. test_unit:
  7. build:
  8. context: ../..
  9. dockerfile: services/history-v1/Dockerfile
  10. target: base
  11. volumes:
  12. - .:/overleaf/services/history-v1
  13. - ../../node_modules:/overleaf/node_modules
  14. - ../../libraries:/overleaf/libraries
  15. working_dir: /overleaf/services/history-v1
  16. environment:
  17. MOCHA_GREP: ${MOCHA_GREP}
  18. LOG_LEVEL: ${LOG_LEVEL:-}
  19. NODE_ENV: test
  20. NODE_OPTIONS: "--unhandled-rejections=strict"
  21. command: npm run --silent test:unit
  22. user: node
  23. test_acceptance:
  24. build:
  25. context: ../..
  26. dockerfile: services/history-v1/Dockerfile
  27. target: base
  28. volumes:
  29. - .:/overleaf/services/history-v1
  30. - ../../node_modules:/overleaf/node_modules
  31. - ../../libraries:/overleaf/libraries
  32. - ./test/acceptance/certs:/certs
  33. working_dir: /overleaf/services/history-v1
  34. environment:
  35. ELASTIC_SEARCH_DSN: es:9200
  36. MONGO_HOST: mongo
  37. POSTGRES_HOST: postgres
  38. AWS_S3_ENDPOINT: https://minio:9000
  39. AWS_S3_PATH_STYLE: 'true'
  40. AWS_ACCESS_KEY_ID: OVERLEAF_HISTORY_S3_ACCESS_KEY_ID
  41. AWS_SECRET_ACCESS_KEY: OVERLEAF_HISTORY_S3_SECRET_ACCESS_KEY
  42. MINIO_ROOT_USER: MINIO_ROOT_USER
  43. MINIO_ROOT_PASSWORD: MINIO_ROOT_PASSWORD
  44. GCS_API_ENDPOINT: http://gcs:9090
  45. GCS_PROJECT_ID: fake
  46. STORAGE_EMULATOR_HOST: http://gcs:9090/storage/v1
  47. MOCHA_GREP: ${MOCHA_GREP}
  48. LOG_LEVEL: ${LOG_LEVEL:-}
  49. NODE_ENV: test
  50. NODE_OPTIONS: "--unhandled-rejections=strict"
  51. user: node
  52. depends_on:
  53. mongo:
  54. condition: service_healthy
  55. postgres:
  56. condition: service_healthy
  57. certs:
  58. condition: service_completed_successfully
  59. minio:
  60. condition: service_started
  61. minio_setup:
  62. condition: service_completed_successfully
  63. gcs:
  64. condition: service_healthy
  65. command: npm run --silent test:acceptance
  66. mongo:
  67. image: mongo:6.0.13
  68. command: --replSet overleaf
  69. healthcheck:
  70. test: "mongosh --quiet localhost/test --eval 'quit(db.runCommand({ ping: 1 }).ok ? 0 : 1)'"
  71. interval: 1s
  72. retries: 20
  73. postgres:
  74. image: postgres:10
  75. environment:
  76. POSTGRES_USER: overleaf
  77. POSTGRES_PASSWORD: overleaf
  78. POSTGRES_DB: overleaf-history-v1-test
  79. volumes:
  80. - ./test/acceptance/pg-init/:/docker-entrypoint-initdb.d/
  81. healthcheck:
  82. test: pg_isready --host=localhost --quiet
  83. interval: 1s
  84. retries: 20
  85. certs:
  86. image: node:20.18.2
  87. volumes:
  88. - ./test/acceptance/certs:/certs
  89. working_dir: /certs
  90. entrypoint: sh
  91. command:
  92. - '-cex'
  93. - |
  94. if [ ! -f ./certgen ]; then
  95. wget -O ./certgen "https://github.com/minio/certgen/releases/download/v1.3.0/certgen-linux-$(dpkg --print-architecture)"
  96. chmod +x ./certgen
  97. fi
  98. if [ ! -f private.key ] || [ ! -f public.crt ]; then
  99. ./certgen -host minio
  100. fi
  101. minio:
  102. image: minio/minio:RELEASE.2024-10-13T13-34-11Z
  103. command: server /data
  104. volumes:
  105. - ./test/acceptance/certs:/root/.minio/certs
  106. environment:
  107. MINIO_ROOT_USER: MINIO_ROOT_USER
  108. MINIO_ROOT_PASSWORD: MINIO_ROOT_PASSWORD
  109. depends_on:
  110. certs:
  111. condition: service_completed_successfully
  112. minio_setup:
  113. depends_on:
  114. certs:
  115. condition: service_completed_successfully
  116. minio:
  117. condition: service_started
  118. image: minio/mc:RELEASE.2024-10-08T09-37-26Z
  119. volumes:
  120. - ./test/acceptance/certs:/root/.mc/certs/CAs
  121. entrypoint: sh
  122. command:
  123. - '-cex'
  124. - |
  125. sleep 1
  126. mc alias set s3 https://minio:9000 MINIO_ROOT_USER MINIO_ROOT_PASSWORD \
  127. || sleep 3 && \
  128. mc alias set s3 https://minio:9000 MINIO_ROOT_USER MINIO_ROOT_PASSWORD \
  129. || sleep 3 && \
  130. mc alias set s3 https://minio:9000 MINIO_ROOT_USER MINIO_ROOT_PASSWORD \
  131. || sleep 3 && \
  132. mc alias set s3 https://minio:9000 MINIO_ROOT_USER MINIO_ROOT_PASSWORD
  133. mc mb --ignore-existing s3/overleaf-test-history-chunks
  134. mc mb --ignore-existing s3/overleaf-test-history-deks
  135. mc mb --ignore-existing s3/overleaf-test-history-global-blobs
  136. mc mb --ignore-existing s3/overleaf-test-history-project-blobs
  137. mc admin user add s3 \
  138. OVERLEAF_HISTORY_S3_ACCESS_KEY_ID \
  139. OVERLEAF_HISTORY_S3_SECRET_ACCESS_KEY
  140. echo '
  141. {
  142. "Version": "2012-10-17",
  143. "Statement": [
  144. {
  145. "Effect": "Allow",
  146. "Action": [
  147. "s3:ListBucket"
  148. ],
  149. "Resource": "arn:aws:s3:::overleaf-test-history-chunks"
  150. },
  151. {
  152. "Effect": "Allow",
  153. "Action": [
  154. "s3:PutObject",
  155. "s3:GetObject",
  156. "s3:DeleteObject"
  157. ],
  158. "Resource": "arn:aws:s3:::overleaf-test-history-chunks/*"
  159. },
  160. {
  161. "Effect": "Allow",
  162. "Action": [
  163. "s3:ListBucket"
  164. ],
  165. "Resource": "arn:aws:s3:::overleaf-test-history-deks"
  166. },
  167. {
  168. "Effect": "Allow",
  169. "Action": [
  170. "s3:PutObject",
  171. "s3:GetObject",
  172. "s3:DeleteObject"
  173. ],
  174. "Resource": "arn:aws:s3:::overleaf-test-history-deks/*"
  175. },
  176. {
  177. "Effect": "Allow",
  178. "Action": [
  179. "s3:ListBucket"
  180. ],
  181. "Resource": "arn:aws:s3:::overleaf-test-history-global-blobs"
  182. },
  183. {
  184. "Effect": "Allow",
  185. "Action": [
  186. "s3:PutObject",
  187. "s3:GetObject",
  188. "s3:DeleteObject"
  189. ],
  190. "Resource": "arn:aws:s3:::overleaf-test-history-global-blobs/*"
  191. },
  192. {
  193. "Effect": "Allow",
  194. "Action": [
  195. "s3:ListBucket"
  196. ],
  197. "Resource": "arn:aws:s3:::overleaf-test-history-project-blobs"
  198. },
  199. {
  200. "Effect": "Allow",
  201. "Action": [
  202. "s3:PutObject",
  203. "s3:GetObject",
  204. "s3:DeleteObject"
  205. ],
  206. "Resource": "arn:aws:s3:::overleaf-test-history-project-blobs/*"
  207. }
  208. ]
  209. }' > policy-history.json
  210. mc admin policy create s3 overleaf-history policy-history.json
  211. mc admin policy attach s3 overleaf-history \
  212. --user=OVERLEAF_HISTORY_S3_ACCESS_KEY_ID
  213. gcs:
  214. image: fsouza/fake-gcs-server:1.45.2
  215. command: ["--port=9090", "--scheme=http"]
  216. healthcheck:
  217. test: wget --quiet --output-document=/dev/null http://localhost:9090/storage/v1/b
  218. interval: 1s
  219. retries: 20