Commit graph

666 commits

Author SHA1 Message Date
Simon Detheridge
f6e0c3ea88 Merge pull request #134 from overleaf/dependabot-npm_and_yarn-lodash-4.17.20
Bump lodash from 4.17.15 to 4.17.20
2020-09-17 11:59:45 +01:00
Simon Detheridge
473a044209 Upgrade node to 12.18.4 2020-09-17 11:41:42 +01:00
dependabot[bot]
02c4d9304a Bump lodash from 4.17.15 to 4.17.20
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.20.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.20)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-16 10:23:11 +00:00
dependabot[bot]
4086d38a09 Bump node-fetch from 2.6.0 to 2.6.1
Bumps [node-fetch](https://github.com/bitinn/node-fetch) from 2.6.0 to 2.6.1.
- [Release notes](https://github.com/bitinn/node-fetch/releases)
- [Changelog](https://github.com/node-fetch/node-fetch/blob/master/docs/CHANGELOG.md)
- [Commits](https://github.com/bitinn/node-fetch/compare/v2.6.0...v2.6.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-12 15:07:58 +00:00
dependabot[bot]
cc3ccc2713 Bump bl from 2.2.0 to 2.2.1
Bumps [bl](https://github.com/rvagg/bl) from 2.2.0 to 2.2.1.
- [Release notes](https://github.com/rvagg/bl/releases)
- [Commits](https://github.com/rvagg/bl/compare/v2.2.0...v2.2.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-03 19:03:30 +00:00
Christopher Hoskin
6968d5d17b [misc] bump logger-sharelatex to version 2.2.0 2020-08-13 09:02:46 +01:00
Jakob Ackermann
7b64820484 [misc] add back environment variables for gcs buckets 2020-08-10 18:01:52 +01:00
Jakob Ackermann
f0551307d2 [misc] bump the dev-env to 3.3.2 2020-08-10 17:01:12 +01:00
Simon Detheridge
de81ab2f70 Merge pull request #129 from overleaf/spd-remove-gcs-module
Move @google-cloud/storage to a dev dependency
2020-07-23 14:13:43 +01:00
Simon Detheridge
cb86ee8c10 Initialise metrics before logger 2020-07-23 13:35:52 +01:00
Simon Detheridge
4bb6509b9c Update object-persistor and make aws a dev dependency 2020-07-23 10:45:27 +01:00
Simon Detheridge
5329cf24b0 Remove unneeded @google-cloud/storage module from main deps 2020-07-22 17:18:17 +01:00
Simon Detheridge
89fc640ec4 Use METRICS_APP_NAME env var to initialise metrics, if present 2020-07-22 16:57:41 +01:00
Simon Detheridge
a64bbc9285 Load logger module first 2020-07-21 15:58:01 +01:00
Simon Detheridge
14834abf83 Move config settings to correct place for new persistor module 2020-07-08 10:32:41 +01:00
Simon Detheridge
6c853de5d5 Migrate to new object-persistor module (#122)
* Migrate to new object-persistor module

* Support updated persistor module using ES6 classes

* Update object-persistor

* Upgrade new persistor code to OError3

* Update to latest minor release for outdated packages

* Update package hashes to sha512

* Point object-persistor at master branch
2020-07-07 13:49:54 +01:00
Ersun Warncke
046c8d916b remove un-needed config change in unit test 2020-07-06 09:27:12 -04:00
Ersun Warncke
83f6eabaf6 upgarde logger-sharelatex 2020-07-06 09:26:59 -04:00
Ersun Warncke
e83f6b609b pr fixes 2020-06-25 08:27:14 -04:00
Ersun Warncke
0e4be81406 upgrade to o-error v3 2020-06-24 22:40:04 -04:00
Simon Detheridge
7b6299e05a Update GcsPersistor range unit test 2020-06-09 13:55:03 +01:00
Simon Detheridge
5d9f78322d Don't increment range end when passing to GCS backend 2020-06-09 10:01:47 +01:00
Simon Detheridge
0027d27473 Use latest version of gcs server for tests 2020-06-09 10:01:20 +01:00
Simon Detheridge
b37f97e2e3 Pin fake-gcs to 1.18 2020-06-03 10:52:10 +01:00
Simon Detheridge
06e7c6f22a npm audit fix 2020-06-03 10:08:45 +01:00
Simon Detheridge
37e3531cc9 Upgrade Node to 12.18.0 2020-06-03 09:59:54 +01:00
Miguel Serrano
e014aeb100 Fixed regular expression to insert/delete files not supporting templates api 2020-05-26 17:21:21 +02:00
Simon Detheridge
3637cd70ae Add support for redirecting to signed URLs 2020-04-15 12:22:54 +01:00
Simon Detheridge
2b9b165d72 Merge pull request #114 from overleaf/spd-fastcrc
Add fast-crc32c library
2020-04-03 17:12:03 +01:00
Simon Detheridge
256cebf7a7 Add fast-crc32c library 2020-04-03 17:06:41 +01:00
Eric Mc Sween
003d54e8f0 Fix error handler returning two responses
The error handler mistakenly sent two responses on error, the first
being a 200.
2020-04-03 11:57:33 -04:00
Simon Detheridge
13ab7b5ca1 Fix unit tests for pipeline changes 2020-04-02 16:49:45 +01:00
Simon Detheridge
114883a9e9 Ensure streams are always drained on close or error 2020-04-02 15:56:23 +01:00
Simon Detheridge
ccf5f8b9e8 Add acceptance test for leaked sockets on aborted connections 2020-04-02 15:56:19 +01:00
Simon Detheridge
cce4049153 Merge pull request #112 from overleaf/spd-more-stream-destruction
Destroy download streams on close
2020-03-31 20:29:20 +01:00
Simon Detheridge
ec94a0692a Merge pull request #111 from overleaf/spd-no-extra-deletes
Only delete the converted-cache folder if conversions are enabled
2020-03-31 20:29:02 +01:00
Simon Detheridge
383ea4e831 Merge pull request #110 from overleaf/msm-update-deps
Update dependencies
2020-03-31 20:28:42 +01:00
Simon Detheridge
60ede0bf46 Find more ways to destroy streams 2020-03-31 17:00:39 +01:00
Simon Detheridge
dceef85ccb Update app/js/FileHandler.js
Co-Authored-By: Jakob Ackermann <das7pad@outlook.com>
2020-03-31 16:03:38 +01:00
Simon Detheridge
4489670497 Only delete the converted-cache folder if conversions are enabled 2020-03-31 15:38:42 +01:00
Simon Detheridge
f440cec8ec Check if streams are already destroyed before destroying 2020-03-31 11:07:31 +01:00
Simon Detheridge
5fadafaf96 Destroy streams handled by getReadyPipeline on error 2020-03-30 17:14:46 +01:00
Simon Detheridge
87b8f8e194 Destroy file-download stream on error 2020-03-30 17:13:40 +01:00
mserranom
70e4dd9fde updated sinon, mocha 2020-03-30 16:15:21 +02:00
mserranom
a067198619 updated minor and patch dependencies 2020-03-30 16:05:25 +02:00
Simon Detheridge
4cb4d450be Call end() when handing ERR_STREAM_PREMATURE_CLOSE 2020-03-30 15:03:09 +01:00
Simon Detheridge
64562dffb0 eslint-disable => eslint-disable-next-line 2020-03-26 22:07:37 +00:00
Simon Detheridge
a1ae68f6b5 Tidy up 'getReadyPipeline' 2020-03-26 16:57:55 +00:00
Simon Detheridge
1f037ef653 Catch errors from pipeline and stream when waiting for streams to be readable 2020-03-26 16:57:55 +00:00
Simon Detheridge
238d96ed44 Fail acceptance tests on unhandled promise rejection 2020-03-26 16:57:55 +00:00
Simon Detheridge
7e45a82c35 Use autodestroy on Transform stream 2020-03-26 15:09:56 +00:00
Simon Detheridge
82599bce67 Merge pull request #105 from overleaf/jpa-logger-1-9-1
[misc] bump logger-sharelatex to 1.9.1
2020-03-26 10:31:33 +00:00
Simon Detheridge
d073fe75ca Use single pipeline when calculating md5 2020-03-25 16:59:51 +00:00
Jakob Ackermann
2ce3c8f97e [misc] bump logger-sharelatex to 1.9.1 2020-03-23 16:18:07 +01:00
Simon Detheridge
65f19346f0 Fix fallback to custom s3 buckets 2020-03-19 11:10:31 +00:00
Simon Detheridge
cb4bdd99f4 Use an ISODate for deleted file names 2020-03-18 20:19:12 +00:00
Simon Detheridge
9d32d4ec16 Don't modify 'opts' parameter 2020-03-16 15:57:37 +00:00
Simon Detheridge
b37c52fc3a Make GCS delete concurrency configurable 2020-03-16 15:54:05 +00:00
Simon Detheridge
9b658dda18 Copy-on-delete before unlocking 2020-03-16 15:53:45 +00:00
Simon Detheridge
06c4c0f74f Fix incorrect key when deleting projects 2020-03-16 11:35:01 +00:00
Simon Detheridge
9f74aac1a0 Add acceptance tests for directory deletion 2020-03-16 11:34:45 +00:00
Simon Detheridge
ce52f8aa60 Update FSPersistor deleteDirectory behaviour to match S3 and GCS 2020-03-16 11:33:51 +00:00
Simon Detheridge
47e96a4d94 Add endpoint to delete a project
Needs acceptance tests
2020-03-14 14:56:29 +00:00
Simon Detheridge
fc80aa3954 Move directory key validation into FileHandler 2020-03-14 14:31:30 +00:00
Simon Detheridge
58db14456a Add timestamp to files in deleted bucket 2020-03-14 14:11:17 +00:00
Simon Detheridge
edf1ce1f7e Delete files from a directory in parallel 2020-03-14 14:02:58 +00:00
Simon Detheridge
183cb0179a Add support to GCS persistor for unlocking files and copying on delete 2020-03-13 16:18:45 +00:00
Simon Detheridge
28c3fe4a56 Validate key names when deleting directory with a configurable regex 2020-03-10 17:54:09 +00:00
Simon Detheridge
2509b51883 Add optional gcs config to override gcs settings (for fake gcs server) 2020-03-05 17:23:47 +00:00
Simon Detheridge
eb93ae4b10 Use Bucket.deleteFiles to delete directory contents, instead of iterating 2020-03-05 14:12:15 +00:00
Simon Detheridge
460dd96b17 Cosmetic clean-up of GCS Persistor & tests 2020-03-05 13:45:46 +00:00
Simon Detheridge
3bb956b38e Use http for the fake GCS server 2020-03-04 17:01:20 +00:00
Simon Detheridge
30114cd79b Remove unnecessary try/catch around 'createReadStream' 2020-03-04 16:38:05 +00:00
Simon Detheridge
a7198764cb Improve/add some comments for clarity 2020-03-04 16:25:11 +00:00
Simon Detheridge
def383574e Simplify getMeteredStream to record metric directly 2020-03-04 16:17:36 +00:00
Simon Detheridge
76243fd75a 'bucket' -> 'bucketName' in GCS Persistor 2020-03-04 16:04:26 +00:00
Simon Detheridge
6979b8638a Add 'Buffer' global for GCS unit tests 2020-03-04 15:42:16 +00:00
Simon Detheridge
12274e1427 Add unit tests for GCS Persistor 2020-03-04 15:38:18 +00:00
Simon Detheridge
e58284aefe Move base64/hex methods to PersistorHelper
Also add some null-safety checks
2020-03-04 15:38:18 +00:00
Simon Detheridge
d9c9d74994 Remove unnecessary test for S3 file deletion
S3 does not throw a not-found error when deleting a file that does not exist
2020-03-04 15:38:18 +00:00
Simon Detheridge
e2f3dd23c9 Switch back to official fake-gcs-server image 2020-03-04 15:38:18 +00:00
Simon Detheridge
9dddf25209 Add note on gcs config to config file 2020-03-04 15:38:18 +00:00
Simon Detheridge
2cfab8d313 Add GCS-specific acceptance tests 2020-03-04 15:38:16 +00:00
Simon Detheridge
366ce97169 Add GCS Persistor 2020-03-04 15:09:14 +00:00
Simon Detheridge
e6cf0687a9 Add gcs client library 2020-03-04 15:09:14 +00:00
Simon Detheridge
7292d93dab Add fake GCS server, and fix health checks 2020-03-04 15:08:19 +00:00
Simon Detheridge
d06b74b0f8 Bump metrics to 2.5.0 2020-03-04 10:55:01 +00:00
Simon Detheridge
9807568de8 Add missing 'process' global for settings tests 2020-03-04 10:08:31 +00:00
Simon Detheridge
a3782422b7 Upgrade to node 12 2020-03-04 10:06:18 +00:00
Simon Detheridge
8905d393f7 Merge pull request #95 from overleaf/jpa-test-cleanup
[misc] test cleanup
2020-03-04 10:01:39 +00:00
Simon Detheridge
b5e4345855 Merge pull request #96 from overleaf/jpa-dependencies-cleanup
[misc] dependencies cleanup
2020-03-04 10:00:56 +00:00
Simon Detheridge
467af9885a Merge pull request #97 from overleaf/jpa-3rd-party-s3-via-env
[config] add support for third party s3 which uses path-style buckets
2020-03-04 09:59:48 +00:00
Simon Detheridge
62b2aa8f02 Merge pull request #98 from overleaf/jpa-promisify-filehandler
[misc] promisify FileHandler and remove dependency on async
2020-03-04 09:59:15 +00:00
Jakob Ackermann
2b15729658 [misc] promisify FileHandler and remove dependency on async
Signed-off-by: Jakob Ackermann <das7pad@outlook.com>
2020-03-02 18:23:17 +01:00
Jakob Ackermann
ada6ac0764 [misc] revert eslint rules 2020-03-02 18:12:55 +01:00
Jakob Ackermann
1276fb426a [misc] bump buildscript version to 1.3.6 2020-03-02 17:50:45 +01:00
Simon Detheridge
0312b00150 Fix prettier task 2020-03-02 16:31:35 +00:00
Jakob Ackermann
4b7c6fafd2 [misc] drop unused dependency pngcrush 2020-03-02 17:11:56 +01:00
Jakob Ackermann
3c61e53918 [misc] move mocha to the devDependencies 2020-03-02 17:11:39 +01:00
Jakob Ackermann
6f27f7a1bf [misc] drop the /heapdump route and related heapdump package 2020-03-02 17:09:35 +01:00
Jakob Ackermann
32557ab1d7 [SafeExec] replace _.once with lodash.once 2020-03-02 17:08:42 +01:00
Jakob Ackermann
0db4a17a14 [HealthCheckController] use fs.copyFile instead of fs-extra.copy
the fs-extra method has a HUGE overhead of JS code and also syscalls for
 no particular benefit in this case: just copy the tiny.pdf file.

Here is an overview of the major operations: paths are relative to
  https://github.com/jprichardson/node-fs-extra/blob/1.0.0

We start in /lib/copy/copy.js
- sys: check that the source file exists
- sys: check that the source file has an existing parent directory?!
Continue in /lib/copy/ncp.js
- sys: more stat calls on both source and dest to determine permissions
- read/write streams to pipe the file content through the process
- sys: chmod on the destination to match the source permissions

What we actually need is a call to the binding and let node/the os
 figure out the best way to copy the contents.

Signed-off-by: Jakob Ackermann <das7pad@outlook.com>
2020-03-02 17:02:35 +01:00
Simon Detheridge
c13d7f4197 Bump aws-sdk version in package.json 2020-03-02 11:18:06 +00:00
Brian Gough
ebabe52632 fix settings unit test 2020-02-28 15:27:29 +00:00
Brian Gough
e3011b2521 run npm update 2020-02-28 14:51:57 +00:00
Jakob Ackermann
b4e3d7de62 [config] add support for third party s3 which uses path-style buckets
Signed-off-by: Jakob Ackermann <das7pad@outlook.com>
2020-02-28 12:48:52 +01:00
Jakob Ackermann
2b9d0868c5 [misc] test/acceptance: retrieve ingress metrics just before using it
The upload request can bump the ingress metric.
The content hash validation might require a full download
in case the ETag field of the upload response is not a md5 sum.
2020-02-28 12:27:06 +01:00
Jakob Ackermann
516102e6fb [misc] test/acceptance: do not hard code fake credentials 2020-02-28 12:26:46 +01:00
Jakob Ackermann
847f124d7b [misc] test/acceptance: skip the shutdown in case we did not start yet
Signed-off-by: Jakob Ackermann <das7pad@outlook.com>
2020-02-28 12:26:24 +01:00
Jakob Ackermann
6589aa6ae0 [misc] test/acceptance: harden the startup check for s3
Signed-off-by: Jakob Ackermann <das7pad@outlook.com>
2020-02-28 12:26:24 +01:00
Jakob Ackermann
94b8a7f891 [misc] test/unit: KeybuilderTests: use a unique suite label 2020-02-28 12:26:23 +01:00
Jakob Ackermann
54e3b57772 [misc] test/unit: add missing globals that are lazy loaded 2020-02-28 12:26:23 +01:00
Jakob Ackermann
7920570dd8 [misc] test/unit: add missing require stubs for metrics and settings 2020-02-28 12:26:22 +01:00
Simon Detheridge
6e19a650d2 Write to error log on unhandled rejection/exception 2020-02-27 10:33:48 +00:00
Simon Detheridge
492f8abc9f Update config/settings.defaults.coffee
Co-Authored-By: Jakob Ackermann <das7pad@outlook.com>
2020-02-18 10:24:29 +00:00
Simon Detheridge
8acc9ef0ae Make S3 partSize a setting 2020-02-17 14:06:15 +00:00
Simon Detheridge
7c4bf97a7f Avoid fetching file a second time when source md5 can't be fetched 2020-02-17 14:06:05 +00:00
Simon Detheridge
9e7eec7a19 Add acceptance test for large files 2020-02-17 14:05:56 +00:00
Simon Detheridge
2f2a819b74 Re-fetch file to calculate md5 if etag is not in correct format 2020-02-17 14:05:43 +00:00
Simon Detheridge
5adfb3e2c0 Use large upload chunks 2020-02-17 14:05:31 +00:00
Simon Detheridge
4e507197fc Revert "Merge pull request #91 from overleaf/revert-78-spd-migration-persistor"
This reverts commit 0cce792604c258538cf012486e7329fa1be7da0f, reversing
changes made to 08b606e22f855121b2d8a2832a5d7e2f45836c3f.
2020-02-17 14:04:42 +00:00
Simon Detheridge
df2ddbe0e1 Revert "Add Migration Persistor, to send missing file requests to a fallback persistor" 2020-02-14 14:26:33 +00:00
Simon Detheridge
e4926e09a7 Move error handler to be the last middleware 2020-02-14 10:58:46 +00:00
dependabot[bot]
31f2572e57 Bump lodash from 4.17.11 to 4.17.15
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.11 to 4.17.15.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.11...4.17.15)

Signed-off-by: dependabot[bot] <support@github.com>
2020-02-14 09:39:06 +00:00
Simon Detheridge
485cfce6d3 Merge pull request #85 from overleaf/jpa-dependencies-cleanup
[misc] rename npm-shrinkwrap.json to package-lock.json and run npm i
2020-02-14 09:24:43 +00:00
Simon Detheridge
16d1674eab Merge pull request #84 from overleaf/bg-remove-travis-yml
Remove unused .travis.yml file
2020-02-14 09:21:03 +00:00
Jakob Ackermann
84a80930eb [misc] rename npm-shrinkwrap.json to package-lock.json and run npm i 2020-02-14 09:19:29 +00:00
Simon Detheridge
44fbc6a733 Merge pull request #82 from overleaf/spd-error-handler-error
Fix log info assignment in error handler
2020-02-14 09:18:16 +00:00
Simon Detheridge
3b011258d2 Tidy up md5 hash generation 2020-02-12 13:27:12 +00:00
Simon Detheridge
49ad408b30 Remove unused imports and format correctly 2020-02-12 13:27:12 +00:00
Simon Detheridge
93cd55fb79 Refactor persistors to use a helper for common things 2020-02-12 13:27:12 +00:00
Simon Detheridge
304fdfd35c Explicitly resume stream after adding listener 2020-02-12 13:21:53 +00:00
Simon Detheridge
6dcf351377 Remove unnecessary 'async' 2020-02-12 13:21:53 +00:00
Simon Detheridge
f4a16cd972 Update tests to properly check for copied files 2020-02-12 13:21:53 +00:00
Simon Detheridge
42a5d168df Remove unused packages 2020-02-12 13:21:52 +00:00
Simon Detheridge
9e0b378948 Remove minipass as dependency and refactor to make things clearer 2020-02-12 13:21:52 +00:00
Simon Detheridge
5d5d325691 Preserve all error information when cleanup of copied file fails 2020-02-12 13:21:52 +00:00
Simon Detheridge
b4b7fd226e Add mechanisms to transfer files with md5-based integrity checks
Fix error in settings and tidy up tests

Remove unused variable declaration

Remove .only from tests and update eslint rules to catch it in future

Use  to catch errors more safely getting md5 hash

Avoid unnecessary call to S3 to get md5 response
2020-02-12 13:21:52 +00:00
Simon Detheridge
2625e03a31 Add MigrationPersistor for sending 404 requests to a fallback persistor 2020-02-12 13:19:48 +00:00
Simon Detheridge
f877f51775 Rename *PersistorManager to *Persistor 2020-02-12 13:19:48 +00:00
Brian Gough
a2e1591e93 remove unused .travis.yml file 2020-02-12 12:37:00 +00:00
Simon Detheridge
e3613e52db Fix log info assignment in error handler 2020-02-12 10:34:56 +00:00
Jakob Ackermann
1341af04f5 [misc] update the build scripts to 1.3.5 2020-02-11 18:58:55 +01:00
Jakob Ackermann
ca94225c19 Merge pull request #80 from overleaf/jpa-cleanup-install-deps
[misc] cleanup install deps
2020-02-10 17:16:44 +01:00
Brian Gough
14ba1ea1c1 update to node 10.19.0 2020-02-07 14:16:31 +00:00
Jakob Ackermann
ac4361d560 [misc] dockerignore: hide the local data dirs 2020-01-31 15:50:53 +01:00
Jakob Ackermann
c1d81dc1ea [misc] install a maintained ghostscript version and delete package lists
also do not install vim and bail out in case any command exited with a
 non zero exit code.
2020-01-31 15:50:53 +01:00
Simon Detheridge
997434c930 Remove redundant 'res.logInfo' 2020-01-14 20:55:33 +00:00
Simon Detheridge
035364b62e Fix RequestLogger object lifecycle 2020-01-14 17:15:01 +00:00
Simon Detheridge
28fb998719 Refactor request logger into a class 2020-01-14 12:02:39 +00:00