docker-compose.yml 7.6 KB

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