docker-compose.ci.yml 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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. volumes:
  5. minio-certs:
  6. services:
  7. test_unit:
  8. image: ci/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER
  9. user: node
  10. volumes:
  11. - ../../bin/shared/wait_for_it:/overleaf/bin/shared/wait_for_it
  12. entrypoint: /overleaf/bin/shared/wait_for_it mongo:27017 --timeout=60 --
  13. command: npm run test:unit:_run
  14. environment:
  15. MONGO_CONNECTION_STRING: mongodb://mongo/test-overleaf
  16. NODE_ENV: test
  17. NODE_OPTIONS: "--unhandled-rejections=strict"
  18. REDIS_HOST: redis_test
  19. QUEUES_REDIS_HOST: redis_test
  20. HISTORY_REDIS_HOST: redis_test
  21. ANALYTICS_QUEUES_REDIS_HOST: redis_test
  22. depends_on:
  23. mongo:
  24. condition: service_started
  25. redis_test:
  26. condition: service_healthy
  27. test_acceptance:
  28. build: .
  29. image: ci/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER
  30. environment:
  31. ELASTIC_SEARCH_DSN: es:9200
  32. REDIS_HOST: redis_test
  33. QUEUES_REDIS_HOST: redis_test
  34. HISTORY_REDIS_HOST: redis_test
  35. ANALYTICS_QUEUES_REDIS_HOST: redis_test
  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. NODE_ENV: test
  49. NODE_OPTIONS: "--unhandled-rejections=strict"
  50. volumes:
  51. - minio-certs:/certs
  52. - ../../bin/shared/wait_for_it:/overleaf/bin/shared/wait_for_it
  53. depends_on:
  54. mongo:
  55. condition: service_started
  56. redis_test:
  57. condition: service_healthy
  58. postgres:
  59. condition: service_healthy
  60. certs:
  61. condition: service_completed_successfully
  62. minio:
  63. condition: service_started
  64. minio_setup:
  65. condition: service_completed_successfully
  66. gcs:
  67. condition: service_healthy
  68. user: node
  69. entrypoint: /overleaf/bin/shared/wait_for_it mongo:27017 --timeout=60 --
  70. command: npm run test:acceptance
  71. tar:
  72. build: .
  73. image: ci/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER
  74. volumes:
  75. - ./:/tmp/build/
  76. command: tar -czf /tmp/build/build.tar.gz --exclude=build.tar.gz --exclude-vcs .
  77. user: root
  78. redis_test:
  79. image: redis:7.4.3
  80. healthcheck:
  81. test: ping="$$(redis-cli ping)" && [ "$$ping" = 'PONG' ]
  82. interval: 1s
  83. retries: 20
  84. mongo:
  85. image: mongo:8.0.11
  86. command: --replSet overleaf
  87. volumes:
  88. - ../../bin/shared/mongodb-init-replica-set.js:/docker-entrypoint-initdb.d/mongodb-init-replica-set.js
  89. - ../../bin/shared/mongodb-docker-entrypoint-wait.sh:/mongodb-docker-entrypoint-wait.sh
  90. entrypoint: /mongodb-docker-entrypoint-wait.sh
  91. environment:
  92. MONGO_INITDB_DATABASE: sharelatex
  93. extra_hosts:
  94. # Required when using the automatic database setup for initializing the
  95. # replica set. This override is not needed when running the setup after
  96. # starting up mongo.
  97. - mongo:127.0.0.1
  98. postgres:
  99. image: postgres:10
  100. environment:
  101. POSTGRES_USER: overleaf
  102. POSTGRES_PASSWORD: overleaf
  103. POSTGRES_DB: overleaf-history-v1-test
  104. volumes:
  105. - ./test/acceptance/pg-init/:/docker-entrypoint-initdb.d/
  106. healthcheck:
  107. test: pg_isready --quiet
  108. interval: 1s
  109. retries: 20
  110. certs:
  111. build:
  112. dockerfile_inline: |
  113. FROM node:22.18.0
  114. RUN wget -O /certgen "https://github.com/minio/certgen/releases/download/v1.3.0/certgen-linux-$(dpkg --print-architecture)"
  115. RUN chmod +x /certgen
  116. volumes:
  117. - minio-certs:/certs
  118. working_dir: /certs
  119. entrypoint: sh
  120. command:
  121. - '-cex'
  122. - |
  123. if [ ! -f private.key ] || [ ! -f public.crt ]; then
  124. /certgen -host minio
  125. fi
  126. minio:
  127. image: minio/minio:RELEASE.2024-10-13T13-34-11Z
  128. command: server /data
  129. volumes:
  130. - minio-certs:/root/.minio/certs
  131. environment:
  132. MINIO_ROOT_USER: MINIO_ROOT_USER
  133. MINIO_ROOT_PASSWORD: MINIO_ROOT_PASSWORD
  134. depends_on:
  135. certs:
  136. condition: service_completed_successfully
  137. minio_setup:
  138. depends_on:
  139. certs:
  140. condition: service_completed_successfully
  141. minio:
  142. condition: service_started
  143. image: minio/mc:RELEASE.2024-10-08T09-37-26Z
  144. volumes:
  145. - minio-certs:/root/.mc/certs/CAs
  146. entrypoint: sh
  147. command:
  148. - '-cex'
  149. - |
  150. sleep 1
  151. mc alias set s3 https://minio:9000 MINIO_ROOT_USER MINIO_ROOT_PASSWORD \
  152. || sleep 3 && \
  153. mc alias set s3 https://minio:9000 MINIO_ROOT_USER MINIO_ROOT_PASSWORD \
  154. || sleep 3 && \
  155. mc alias set s3 https://minio:9000 MINIO_ROOT_USER MINIO_ROOT_PASSWORD \
  156. || sleep 3 && \
  157. mc alias set s3 https://minio:9000 MINIO_ROOT_USER MINIO_ROOT_PASSWORD
  158. mc mb --ignore-existing s3/overleaf-test-history-chunks
  159. mc mb --ignore-existing s3/overleaf-test-history-deks
  160. mc mb --ignore-existing s3/overleaf-test-history-global-blobs
  161. mc mb --ignore-existing s3/overleaf-test-history-project-blobs
  162. mc admin user add s3 \
  163. OVERLEAF_HISTORY_S3_ACCESS_KEY_ID \
  164. OVERLEAF_HISTORY_S3_SECRET_ACCESS_KEY
  165. echo '
  166. {
  167. "Version": "2012-10-17",
  168. "Statement": [
  169. {
  170. "Effect": "Allow",
  171. "Action": [
  172. "s3:ListBucket"
  173. ],
  174. "Resource": "arn:aws:s3:::overleaf-test-history-chunks"
  175. },
  176. {
  177. "Effect": "Allow",
  178. "Action": [
  179. "s3:PutObject",
  180. "s3:GetObject",
  181. "s3:DeleteObject"
  182. ],
  183. "Resource": "arn:aws:s3:::overleaf-test-history-chunks/*"
  184. },
  185. {
  186. "Effect": "Allow",
  187. "Action": [
  188. "s3:ListBucket"
  189. ],
  190. "Resource": "arn:aws:s3:::overleaf-test-history-deks"
  191. },
  192. {
  193. "Effect": "Allow",
  194. "Action": [
  195. "s3:PutObject",
  196. "s3:GetObject",
  197. "s3:DeleteObject"
  198. ],
  199. "Resource": "arn:aws:s3:::overleaf-test-history-deks/*"
  200. },
  201. {
  202. "Effect": "Allow",
  203. "Action": [
  204. "s3:ListBucket"
  205. ],
  206. "Resource": "arn:aws:s3:::overleaf-test-history-global-blobs"
  207. },
  208. {
  209. "Effect": "Allow",
  210. "Action": [
  211. "s3:PutObject",
  212. "s3:GetObject",
  213. "s3:DeleteObject"
  214. ],
  215. "Resource": "arn:aws:s3:::overleaf-test-history-global-blobs/*"
  216. },
  217. {
  218. "Effect": "Allow",
  219. "Action": [
  220. "s3:ListBucket"
  221. ],
  222. "Resource": "arn:aws:s3:::overleaf-test-history-project-blobs"
  223. },
  224. {
  225. "Effect": "Allow",
  226. "Action": [
  227. "s3:PutObject",
  228. "s3:GetObject",
  229. "s3:DeleteObject"
  230. ],
  231. "Resource": "arn:aws:s3:::overleaf-test-history-project-blobs/*"
  232. }
  233. ]
  234. }' > policy-history.json
  235. mc admin policy create s3 overleaf-history policy-history.json
  236. mc admin policy attach s3 overleaf-history \
  237. --user=OVERLEAF_HISTORY_S3_ACCESS_KEY_ID
  238. gcs:
  239. image: fsouza/fake-gcs-server:1.45.2
  240. command: ["--port=9090", "--scheme=http"]
  241. healthcheck:
  242. test: wget --quiet --output-document=/dev/null http://localhost:9090/storage/v1/b
  243. interval: 1s
  244. retries: 20