docker-compose.yml 6.8 KB

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