docker-compose.yml 7.6 KB

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