docker-compose.ci.yml 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  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_started
  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. volumes:
  71. - ../../bin/shared/mongodb-init-replica-set.js:/docker-entrypoint-initdb.d/mongodb-init-replica-set.js
  72. environment:
  73. MONGO_INITDB_DATABASE: sharelatex
  74. extra_hosts:
  75. # Required when using the automatic database setup for initializing the
  76. # replica set. This override is not needed when running the setup after
  77. # starting up mongo.
  78. - mongo:127.0.0.1
  79. postgres:
  80. image: postgres:10
  81. environment:
  82. POSTGRES_USER: overleaf
  83. POSTGRES_PASSWORD: overleaf
  84. POSTGRES_DB: overleaf-history-v1-test
  85. volumes:
  86. - ./test/acceptance/pg-init/:/docker-entrypoint-initdb.d/
  87. healthcheck:
  88. test: pg_isready --quiet
  89. interval: 1s
  90. retries: 20
  91. certs:
  92. image: node:20.18.2
  93. volumes:
  94. - ./test/acceptance/certs:/certs
  95. working_dir: /certs
  96. entrypoint: sh
  97. command:
  98. - '-cex'
  99. - |
  100. if [ ! -f ./certgen ]; then
  101. wget -O ./certgen "https://github.com/minio/certgen/releases/download/v1.3.0/certgen-linux-$(dpkg --print-architecture)"
  102. chmod +x ./certgen
  103. fi
  104. if [ ! -f private.key ] || [ ! -f public.crt ]; then
  105. ./certgen -host minio
  106. fi
  107. minio:
  108. image: minio/minio:RELEASE.2024-10-13T13-34-11Z
  109. command: server /data
  110. volumes:
  111. - ./test/acceptance/certs:/root/.minio/certs
  112. environment:
  113. MINIO_ROOT_USER: MINIO_ROOT_USER
  114. MINIO_ROOT_PASSWORD: MINIO_ROOT_PASSWORD
  115. depends_on:
  116. certs:
  117. condition: service_completed_successfully
  118. minio_setup:
  119. depends_on:
  120. certs:
  121. condition: service_completed_successfully
  122. minio:
  123. condition: service_started
  124. image: minio/mc:RELEASE.2024-10-08T09-37-26Z
  125. volumes:
  126. - ./test/acceptance/certs:/root/.mc/certs/CAs
  127. entrypoint: sh
  128. command:
  129. - '-cex'
  130. - |
  131. sleep 1
  132. mc alias set s3 https://minio:9000 MINIO_ROOT_USER MINIO_ROOT_PASSWORD \
  133. || sleep 3 && \
  134. mc alias set s3 https://minio:9000 MINIO_ROOT_USER MINIO_ROOT_PASSWORD \
  135. || sleep 3 && \
  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. mc mb --ignore-existing s3/overleaf-test-history-chunks
  140. mc mb --ignore-existing s3/overleaf-test-history-deks
  141. mc mb --ignore-existing s3/overleaf-test-history-global-blobs
  142. mc mb --ignore-existing s3/overleaf-test-history-project-blobs
  143. mc admin user add s3 \
  144. OVERLEAF_HISTORY_S3_ACCESS_KEY_ID \
  145. OVERLEAF_HISTORY_S3_SECRET_ACCESS_KEY
  146. echo '
  147. {
  148. "Version": "2012-10-17",
  149. "Statement": [
  150. {
  151. "Effect": "Allow",
  152. "Action": [
  153. "s3:ListBucket"
  154. ],
  155. "Resource": "arn:aws:s3:::overleaf-test-history-chunks"
  156. },
  157. {
  158. "Effect": "Allow",
  159. "Action": [
  160. "s3:PutObject",
  161. "s3:GetObject",
  162. "s3:DeleteObject"
  163. ],
  164. "Resource": "arn:aws:s3:::overleaf-test-history-chunks/*"
  165. },
  166. {
  167. "Effect": "Allow",
  168. "Action": [
  169. "s3:ListBucket"
  170. ],
  171. "Resource": "arn:aws:s3:::overleaf-test-history-deks"
  172. },
  173. {
  174. "Effect": "Allow",
  175. "Action": [
  176. "s3:PutObject",
  177. "s3:GetObject",
  178. "s3:DeleteObject"
  179. ],
  180. "Resource": "arn:aws:s3:::overleaf-test-history-deks/*"
  181. },
  182. {
  183. "Effect": "Allow",
  184. "Action": [
  185. "s3:ListBucket"
  186. ],
  187. "Resource": "arn:aws:s3:::overleaf-test-history-global-blobs"
  188. },
  189. {
  190. "Effect": "Allow",
  191. "Action": [
  192. "s3:PutObject",
  193. "s3:GetObject",
  194. "s3:DeleteObject"
  195. ],
  196. "Resource": "arn:aws:s3:::overleaf-test-history-global-blobs/*"
  197. },
  198. {
  199. "Effect": "Allow",
  200. "Action": [
  201. "s3:ListBucket"
  202. ],
  203. "Resource": "arn:aws:s3:::overleaf-test-history-project-blobs"
  204. },
  205. {
  206. "Effect": "Allow",
  207. "Action": [
  208. "s3:PutObject",
  209. "s3:GetObject",
  210. "s3:DeleteObject"
  211. ],
  212. "Resource": "arn:aws:s3:::overleaf-test-history-project-blobs/*"
  213. }
  214. ]
  215. }' > policy-history.json
  216. mc admin policy create s3 overleaf-history policy-history.json
  217. mc admin policy attach s3 overleaf-history \
  218. --user=OVERLEAF_HISTORY_S3_ACCESS_KEY_ID
  219. gcs:
  220. image: fsouza/fake-gcs-server:1.45.2
  221. command: ["--port=9090", "--scheme=http"]
  222. healthcheck:
  223. test: wget --quiet --output-document=/dev/null http://localhost:9090/storage/v1/b
  224. interval: 1s
  225. retries: 20