docker-compose.yml 7.3 KB

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