docker-compose.yml 7.7 KB

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