docker-compose.ci.yml 7.0 KB

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