docker-compose.ci.yml 7.2 KB

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