docker-compose.yml 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  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. volumes:
  79. - ./test/acceptance/pg-init/:/docker-entrypoint-initdb.d/
  80. healthcheck:
  81. test: pg_isready --host=localhost --quiet
  82. interval: 1s
  83. retries: 20
  84. certs:
  85. image: node:20.18.2
  86. volumes:
  87. - ./test/acceptance/certs:/certs
  88. working_dir: /certs
  89. entrypoint: sh
  90. command:
  91. - '-cex'
  92. - |
  93. if [ ! -f ./certgen ]; then
  94. wget -O ./certgen "https://github.com/minio/certgen/releases/download/v1.3.0/certgen-linux-$(dpkg --print-architecture)"
  95. chmod +x ./certgen
  96. fi
  97. if [ ! -f private.key ] || [ ! -f public.crt ]; then
  98. ./certgen -host minio
  99. fi
  100. minio:
  101. image: minio/minio:RELEASE.2024-10-13T13-34-11Z
  102. command: server /data
  103. volumes:
  104. - ./test/acceptance/certs:/root/.minio/certs
  105. environment:
  106. MINIO_ROOT_USER: MINIO_ROOT_USER
  107. MINIO_ROOT_PASSWORD: MINIO_ROOT_PASSWORD
  108. depends_on:
  109. certs:
  110. condition: service_completed_successfully
  111. minio_setup:
  112. depends_on:
  113. certs:
  114. condition: service_completed_successfully
  115. minio:
  116. condition: service_started
  117. image: minio/mc:RELEASE.2024-10-08T09-37-26Z
  118. volumes:
  119. - ./test/acceptance/certs:/root/.mc/certs/CAs
  120. entrypoint: sh
  121. command:
  122. - '-cex'
  123. - |
  124. sleep 1
  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. || sleep 3 && \
  131. mc alias set s3 https://minio:9000 MINIO_ROOT_USER MINIO_ROOT_PASSWORD
  132. mc mb --ignore-existing s3/overleaf-test-history-chunks
  133. mc mb --ignore-existing s3/overleaf-test-history-deks
  134. mc mb --ignore-existing s3/overleaf-test-history-global-blobs
  135. mc mb --ignore-existing s3/overleaf-test-history-project-blobs
  136. mc admin user add s3 \
  137. OVERLEAF_HISTORY_S3_ACCESS_KEY_ID \
  138. OVERLEAF_HISTORY_S3_SECRET_ACCESS_KEY
  139. echo '
  140. {
  141. "Version": "2012-10-17",
  142. "Statement": [
  143. {
  144. "Effect": "Allow",
  145. "Action": [
  146. "s3:ListBucket"
  147. ],
  148. "Resource": "arn:aws:s3:::overleaf-test-history-chunks"
  149. },
  150. {
  151. "Effect": "Allow",
  152. "Action": [
  153. "s3:PutObject",
  154. "s3:GetObject",
  155. "s3:DeleteObject"
  156. ],
  157. "Resource": "arn:aws:s3:::overleaf-test-history-chunks/*"
  158. },
  159. {
  160. "Effect": "Allow",
  161. "Action": [
  162. "s3:ListBucket"
  163. ],
  164. "Resource": "arn:aws:s3:::overleaf-test-history-deks"
  165. },
  166. {
  167. "Effect": "Allow",
  168. "Action": [
  169. "s3:PutObject",
  170. "s3:GetObject",
  171. "s3:DeleteObject"
  172. ],
  173. "Resource": "arn:aws:s3:::overleaf-test-history-deks/*"
  174. },
  175. {
  176. "Effect": "Allow",
  177. "Action": [
  178. "s3:ListBucket"
  179. ],
  180. "Resource": "arn:aws:s3:::overleaf-test-history-global-blobs"
  181. },
  182. {
  183. "Effect": "Allow",
  184. "Action": [
  185. "s3:PutObject",
  186. "s3:GetObject",
  187. "s3:DeleteObject"
  188. ],
  189. "Resource": "arn:aws:s3:::overleaf-test-history-global-blobs/*"
  190. },
  191. {
  192. "Effect": "Allow",
  193. "Action": [
  194. "s3:ListBucket"
  195. ],
  196. "Resource": "arn:aws:s3:::overleaf-test-history-project-blobs"
  197. },
  198. {
  199. "Effect": "Allow",
  200. "Action": [
  201. "s3:PutObject",
  202. "s3:GetObject",
  203. "s3:DeleteObject"
  204. ],
  205. "Resource": "arn:aws:s3:::overleaf-test-history-project-blobs/*"
  206. }
  207. ]
  208. }' > policy-history.json
  209. mc admin policy create s3 overleaf-history policy-history.json
  210. mc admin policy attach s3 overleaf-history \
  211. --user=OVERLEAF_HISTORY_S3_ACCESS_KEY_ID
  212. gcs:
  213. image: fsouza/fake-gcs-server:1.45.2
  214. command: ["--port=9090", "--scheme=http"]
  215. healthcheck:
  216. test: wget --quiet --output-document=/dev/null http://localhost:9090/storage/v1/b
  217. interval: 1s
  218. retries: 20