docker-compose.ci.yml 7.3 KB

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