docker-compose.yml 7.8 KB

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