docker-compose.yml 6.9 KB

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