docker-compose.yml 8.3 KB

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