docker-compose.yml 7.7 KB

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