Commit graph

522 commits

Author SHA1 Message Date
Shane Kilkelly
d6c509496c Fix postback url 2018-10-25 15:27:22 +01:00
Shane Kilkelly
ad5515953b Add oauth-app sql to readme 2018-10-25 14:56:42 +01:00
Shane Kilkelly
b6a44fdd33 Add local conf file, for dev environment 2018-10-25 14:48:48 +01:00
Shane Kilkelly
f898f43b4e Correct instructions for starting service 2018-10-25 11:30:17 +01:00
Shane Kilkelly
ceb8d8ad16 Update readme with instructions on how to set up with dev-env 2018-10-25 11:28:19 +01:00
Shane Kilkelly
394fd17dfa Working docker setup 2018-10-15 11:06:18 +01:00
Shane Kilkelly
a1ac1bf17f Fix makefile, seems to work now 2018-10-08 10:57:20 +01:00
Shane Kilkelly
9ba5517915 Add git to docker packages 2018-10-08 10:41:26 +01:00
Shane Kilkelly
33dbbe49ff Add makefile and basic dockerfile 2018-10-08 10:36:20 +01:00
Michael Walker
b91390c025 Fix gc job leak in tests 2018-03-09 11:25:01 +00:00
Michael Walker
b5e7327410 Fix swap job leak in tests 2018-03-09 11:16:51 +00:00
Michael Walker
86f60519a1 Queue a garbage collection after generating commits 2018-03-09 11:12:54 +00:00
Michael Walker
3f1eb2b0c3 Revert "Revert "Update dependencies to latest stable versions"" 2018-02-27 11:51:02 +00:00
Michael Walker
e68271747b Revert "Update dependencies to latest stable versions" 2018-02-27 11:46:28 +00:00
Michael Walker
e81931ef35 Merge pull request #40 from overleaf/msw-delete-temp-files
Small code improvements around temporary files
2018-02-27 11:16:57 +00:00
Michael Walker
513e83fa00 Clean up temporary file if tarTo raises an exception 2018-02-26 16:30:08 +00:00
Michael Walker
ddc524b588 Log an error if a DeletingFileInputStream is open at finalization 2018-02-26 14:48:18 +00:00
Michael Walker
55cb41f5b2 Use DeletingFileInputStream in tar method 2018-02-26 14:19:02 +00:00
Michael Walker
a627c7e9b3 Drop use of deprecated interface 2018-02-09 16:01:05 +00:00
Michael Walker
9bb7576f0b Replace com.ning/async-http-client with new package
Notice at:
https://github.com/ning/async-http-client
2018-02-09 16:00:58 +00:00
Michael Walker
7a01c054da Replace commons-lang/commons-lang with new package
Notice at:
https://mvnrepository.com/artifact/commons-lang/commons-lang
2018-02-09 14:45:18 +00:00
Michael Walker
c2b8e09f58 Update dependencies 2018-02-09 14:44:41 +00:00
Michael Walker
016281df3d Update test dependencies 2018-02-09 11:52:38 +00:00
Michael Walker
88d2a9523f Update maven plugins 2018-02-09 11:52:32 +00:00
Michael Walker
8b32084c5b Add links to mvnrepository for all dependencies 2018-02-09 11:47:42 +00:00
Michael Walker
c5e184f7cc Make mockito-core a test dependency 2018-02-09 11:38:19 +00:00
Michael Walker
1ca63e1ba1 Return a generic summary from MissingRepositoryException.getMessage 2018-02-07 14:25:04 +00:00
Michael Walker
4c237e84f5 Rename disabled project test 2018-02-07 13:27:31 +00:00
Michael Walker
25ccfe28fe Rename protected project test 2018-02-07 13:27:19 +00:00
Michael Walker
77e3bc0d3b Remove unused constructor 2018-02-07 13:01:41 +00:00
Michael Walker
647cf24bb6 Use a List<String> rather than hard-coding newlines 2018-02-07 10:39:26 +00:00
Michael Walker
63e28fede1 Enable the "cannot clone a protected project" test 2018-02-07 10:10:16 +00:00
Michael Walker
994ad9a933 410 is no longer "disabled" 2018-02-07 10:10:09 +00:00
Michael Walker
bd8e8688c3 Make GENERIC_REASON consistent with web messages. 2018-02-07 10:06:28 +00:00
Michael Walker
f13324134f Give 'unauthorized' and 'missing' better names 2018-02-07 09:39:35 +00:00
Michael Walker
44d3ddd9aa Display a more specific message for v2 projects 2018-02-06 15:06:49 +00:00
Michael Walker
3a374e0ba7 Send the MissingRepositoryException message to the client 2018-02-06 14:23:21 +00:00
Michael Walker
82c0873743 Report all 4xx from write-latex API as MissingRepositoryException 2018-02-06 14:23:21 +00:00
Michael Walker
6ae6acd826 Rename DisabledRepositoryException to MissingRepositoryException 2018-02-06 14:23:21 +00:00
Michael Walker
5e08f6f5c6 Add a test for cloning disabled projects 2018-02-05 16:11:45 +00:00
Michael Walker
20a748f14e Explain to the user that their project is inaccessible 2018-02-05 13:35:58 +00:00
Michael Walker
8b4c29ec83 Throw an exception if the API returns 410 2018-02-05 12:16:09 +00:00
Winston Li
90e3417aec Add tests for UrlResourceCache content lengths 2018-01-17 09:47:31 +00:00
Winston Li
6c71c2cb97 Add ning http headers class 2018-01-17 09:47:31 +00:00
Winston Li
34e558ab63 Create noop db store and test file 2018-01-17 09:47:31 +00:00
Winston Li
4e7636c94a Decouple http client from UrlResourceCache 2018-01-17 09:47:31 +00:00
Winston Li
ae65212f19 Create http client facade 2018-01-17 09:47:31 +00:00
Winston Li
11ee9c62a3 Update README for repoStore option 2018-01-17 09:46:40 +00:00
Michael Walker
1e4ef0cc5b Fully implement max file size
- add `repoStore.maxFileSize` key to config
- use maxFileSize in ResourceCache on both header path and blob
  download path
- make failures during commit less fragile
2018-01-17 09:46:40 +00:00
John Lees-Miller
72f8fb553c Fix typos 2018-01-16 18:30:17 +00:00
Winston Li
6b94fcf1b4 Decouple Bridge from network, JGit from disk 2018-01-15 11:56:04 +00:00
Michael Walker
918e3d9975 Remove an unneeded import 2018-01-15 11:56:04 +00:00
Michael Walker
e437c14d72 Refactor ResourceFetcherTest 2018-01-15 11:56:04 +00:00
Michael Walker
1f35b6dec3 Raise an error if files exceed the max file size 2018-01-15 11:39:29 +00:00
Winston Li
806002f273 Path was static instead of final 2017-09-20 08:20:16 +01:00
Winston Li
705b88933c Fix log message 2017-09-20 08:20:16 +01:00
Michael Mazour
976419b2d2 More logging fields for unauthorized requests
When a request requires authentication, log username, IP address, and the status code returned by the auth attempt. Previously logged projectName only.
2017-09-08 10:15:45 +01:00
Michael Mazour
a3a41640b9 Merge pull request #26 from overleaf/custom-error-page
Simple Error Page to Replace Default
2017-09-06 06:53:57 +01:00
hugh-obrien
d9e368ac35 Add a JSON response instead of default error page
Use custom error handler instead of default that leaks server info.

- Use in API context
- Use in default/web context
- Add tests
2017-09-05 13:32:23 +01:00
Winston Li
f9307c7110 Check file size on tar input path and use stream copying instead of buffering fully 2017-08-02 21:40:00 +01:00
Winston Li
045eea8282 Add messages to precondition checks 2017-08-02 20:58:26 +01:00
Winston Li
fd743d1bf3 Fix #3705 2017-08-02 20:58:15 +01:00
Winston Li
ad687e5f58 Add failing test for #3705 2017-08-02 20:51:20 +01:00
Michael Walker
ced34d91d4 Delete temporary files created by Tar on close
The SwapJob creates temporary files indirectly through Tar.bz2.zip.
These files are deleted with File.deleteOnExit, but there is no other
deletion mechanism.  This means that temporary files will build up as
the git bridge runs, only being deleted when the JVM finally
terminates.

Instead, we can delete these temporary files as soon as they are no
longer needed.  The files are wrapped in a FileInputStream and not
directly exposed, so we can simply delete the underlying file when the
stream is closed, as then the file is inaccessible.
2017-07-14 12:08:50 +01:00
Winston Li
21b769170d Minor name change to keep swap job / s3 decoupled 2017-04-04 13:09:43 +01:00
Winston Li
5dcc4128b4 Remove sleep and reset jgit version 2017-02-17 15:57:09 +00:00
Winston Li
ee61d72e2e Implementation and tests of GC, GcJob, S3 files 2017-02-17 13:44:11 +00:00
Winston Li
8a8d308365 Remove old printing from failing test 2017-02-16 09:16:51 +00:00
Winston Li
f29c7395d2 Tests: fix config for git init and factor all git commands into method calls 2017-01-05 14:34:03 +00:00
Winston Li
034c064c25 Fix for zip unzip test 2017-01-05 13:21:15 +00:00
Winston Li
af49325b88 Make submodule test more verbose 2017-01-04 22:35:48 +00:00
Winston Li
9c63f06d4e Change InvalidGitRepository message 2016-12-22 13:40:12 +00:00
Winston Li
6d563ed40e Better javadoc, improve handling of submodules 2016-12-19 12:56:58 +00:00
Winston Li
76eb0a3200 Improve javadoc and logging 2016-12-17 16:09:01 +00:00
Winston Li
d3fd17aab5 Improve javadocs around swapping/repos 2016-12-17 15:20:08 +00:00
Winston Li
25a988daa3 Add JavaDoc, minor refactor 2016-10-09 21:13:11 +01:00
Winston Li
c23c11973a Add test confirming the dangling meta char exception is not thrown anymore (fix #1025) 2016-10-09 08:47:57 +01:00
Winston Li
d3eb737120 Ignore .gitignore files on git.overleaf.com repos (fix #1281) 2016-10-08 16:12:20 +01:00
Winston Li
a8bad0539c Create/delete larger files in df test 2016-09-19 10:07:46 +01:00
Winston Li
fe058e8695 Use df equivalent as default for calculating used space 2016-09-19 10:01:07 +01:00
Winston Li
9a0f18e516 Increase postback timeout to 60s 2016-09-19 09:34:45 +01:00
Winston Li
e9ffcfe19e Remove extra comma 2016-09-12 15:42:18 +01:00
Winston Li
00d512725a Fix "evicated" typo 2016-09-12 15:16:20 +01:00
Winston Li
9b78138314 Remove duplicate call to create the last_accessed index 2016-09-12 15:13:55 +01:00
Winston Li
a8c743cb9c Schedule next swap job after previous job finishes 2016-09-12 15:11:56 +01:00
Winston Li
d6f3682df4 Update README about running tests 2016-09-12 14:27:00 +01:00
Winston Li
d225b8cbd9 Add New Relic stuff 2016-09-06 09:13:34 +01:00
Winston Li
95a7cb2b8b Add check for last_accessed column in case adding failed due to an error rather than because it already exists 2016-09-06 09:13:20 +01:00
Winston Li
5c878ccc70 Put files in directories that weren't commited 2016-09-06 09:13:09 +01:00
Winston Li
ea803b53d8 Remove swap table and put last_accessed column in projects 2016-09-06 09:11:53 +01:00
Winston Li
2cdf254830 README formatting 2016-09-06 09:11:32 +01:00
Winston Li
a7ba5ef59b Ignore .idea and *.iml again. 2016-09-06 09:11:32 +01:00
Winston Li
523ea5139e Update example conf and README 2016-09-06 09:11:32 +01:00
Winston Li
eb77d166e2 Add checkDB to upgrade the DB 2016-09-06 09:11:32 +01:00
Winston Li
52e5d2921f Sanitise s3 info and fix for s3 2016-09-06 09:11:32 +01:00
Winston Li
9936fbe3c9 Implement and test the swap job, and add integration test 2016-09-06 09:11:32 +01:00
Winston Li
dd5694104d Delete the SnapshotRepositoryBuilder and WLBridgedProject abominations. Set accessed time after update and push. 2016-09-06 09:11:32 +01:00
Winston Li
c459cd57af Implement and test SwapJobImpl 2016-09-06 09:11:32 +01:00
Winston Li
a595acd0a6 Add and test GetNumProjects 2016-09-06 09:11:32 +01:00
Winston Li
4b014826d3 Add and test InMemorySwapStore 2016-09-06 09:11:32 +01:00
Winston Li
f036ff2c8b Add and test an SQL update for only setting a project's last_accessed if it's missing 2016-09-06 09:11:32 +01:00
Winston Li
9d19cdd261 Implement and test DBStore swap_table functionality 2016-09-06 09:11:32 +01:00
Winston Li
d2b628d904 Move stuff to bridge package 2016-09-06 09:11:32 +01:00
Winston Li
f3eb32e2ec Catch more exceptions in db init 2016-09-06 09:11:32 +01:00
Winston Li
cfc02bbcc8 Remove DB fluff layer 2016-09-06 09:11:32 +01:00
Winston Li
c3609803c0 Change DBStore to target a file 2016-09-06 09:11:32 +01:00
Winston Li
25fea8ef58 Implement bz2 support and test 2016-09-06 09:11:32 +01:00
Winston Li
8c0937511e Add implementations, implement S3SwapStore (with only tars), FSRepoStore, Tar and File utils, add tests 2016-09-06 09:11:32 +01:00
Winston Li
692b979098 Large refactor of parts into distinct components / interfaces 2016-09-05 15:45:57 +01:00
Winston Li
5b810b64ba Decouple jgit's Repository class from the Bridge 2016-09-05 15:45:57 +01:00
Winston Li
598ea8a6fb Ugrade jgit and jgit.http.server to 4.4.1.201607150455-r and fix tests 2016-08-20 13:22:07 +01:00
Winston Li
3389615ef6 Use better error message for problems building repo (#1576) 2016-08-20 12:15:34 +01:00
Marc Egea i Sala
d143baf489 Add more logging to commit action (#16) 2016-06-09 10:26:22 +01:00
Marc Egea i Sala
cb2e12d3b0 Merge pull request #15 from overleaf/handler-refactor
Put API handlers into their own namespace
2016-06-07 07:57:07 +01:00
John Lees-Miller
4fb9cbdf19 Restore a removed logging statement 2016-06-03 16:45:16 +01:00
John Lees-Miller
7cb82f3c18 Add tests for file content API 2016-06-03 16:22:10 +01:00
John Lees-Miller
42d1236063 Check for missing project before checking key 2016-06-03 16:11:31 +01:00
John Lees-Miller
1ac07526dc Reorganise postbacks and files under /api 2016-06-03 16:11:02 +01:00
Marc Egea i Sala
2a87513603 Merge pull request #14 from overleaf/performance-improvements
Build RepositoryObjectTreeWalker only once per commit
2016-06-03 15:46:32 +01:00
Marc Egea i Sala
f4d4ce0da1 Build RepositoryObjectTreeWalker only once per commit 2016-06-03 15:40:48 +01:00
John Lees-Miller
7ed93bc2cc Log to temp file when running tests 2016-06-03 11:47:25 +01:00
John Lees-Miller
64b49904e4 Use logback so we can use two log streams
We want all logs on stdout, for debugging, and warnings and errors
on stderr, for remote monitoring. The SLF4J SimpleLogger can't seem
to do this, but logback does, and we can still use the same SLF4J
interface.
2016-06-03 11:47:25 +01:00
John Lees-Miller
758bc3eb8c Add missing newline at end of file 2016-06-02 12:59:23 +01:00
John Lees-Miller
9c63ea6c93 Upgrade some testing dependencies 2016-06-02 12:41:24 +01:00
John Lees-Miller
13a75fdb95 Upgrade google http and oauth clients to 1.22.0 2016-06-02 12:26:58 +01:00
John Lees-Miller
c3725e3246 Upgrade async-http-client to 1.9.38 2016-06-02 12:22:14 +01:00
John Lees-Miller
dbaa78928e Upgrade sqlite-jdbc to 3.8.11.2 2016-06-02 12:13:17 +01:00
John Lees-Miller
bbde2d31d8 Upgrade gson to 2.6.2 2016-06-02 12:13:13 +01:00
John Lees-Miller
ad81e7a2ee Upgrade joda-time to 2.9.4 2016-06-02 12:01:35 +01:00
John Lees-Miller
1edaf5fe77 Upgrade to jetty 9.3.9 2016-06-02 11:57:04 +01:00
John Lees-Miller
465db49a22 Remove installation scripts
We now handle production deployment using some ansible playbooks based
on these scripts, so rather than having slightly different versions in
two places, I think it’s safer to remove them for now.
2016-06-02 10:39:21 +01:00
John Lees-Miller
8ea3ed5dbe Add IDEA project files
Using this .gitignore file to decide what to commit:
https://github.com/github/gitignore/blob/master/Global/JetBrains.gitigno
re
2016-06-02 10:15:14 +01:00
Marc Egea i Sala
6a57dd2d9b Improve indentation 2016-05-23 16:16:40 +01:00
Marc Egea i Sala
45254bf34a Add minimal git config to repos
The test don't pass unless a minimal configuration for Git is provided.
With this change, we don't rely on the final user to provide this
configuration.

Every time a repository is cloned on tests we're adding a configuration
only for that repository that's not going to clash with any other
configuration already set.
2016-05-23 15:59:24 +01:00
Winston Li
d582e3e1cf Remove and replace Util.sout and .serr 2016-04-18 11:03:55 +01:00
Winston Li
a409a15f07 Fix #1384, possibly #1174 too 2016-04-05 20:39:36 +01:00
Winston Li
bb619bfaf1 Add tests that reproduce #1384. 2016-04-05 04:17:15 +01:00
Winston Li
08f3497a9e Improve logging around main operations.
PostbackManager.java: check for actual postback promise before waiting.
2016-04-03 12:17:06 +01:00
Winston Li
ab09d044a8 Improve logging for catching #1174, and fix tests. 2016-04-01 05:23:59 +01:00
Winston Li
a4df78c73d Improve logging.
- Add sanitised Config and test
- Fix issue with file permissions
2016-03-31 06:35:09 +01:00
Winston Li
559b32a22f Integrate slf4j simple logger and change some messages. Declare some exceptions in tests 2016-03-11 09:46:03 +00:00
Marc Egea i Sala
7048032463 Exception to handle files too big to be processed 2016-02-04 10:22:18 +00:00
Marc Egea i Sala
b3e140ed40 Provide custom message on 401 errors 2016-01-19 10:44:03 +00:00
Winston Li
850cbcf0c6 Merge bug fixes with oauth2 skipping 2016-01-04 04:34:26 +00:00
Winston Li
53d3033b5c Implement auth skipping on non-protected projects 2016-01-04 04:14:50 +00:00
Winston Li
a9a74890d2 Delete stuff that should be gitignored 2016-01-04 02:53:40 +00:00
Marc Egea i Sala
866f7dedee Fix error log folder
Error log is stored under /var/log/err.log. This PR fixes it and stores the log under /var/log/wlgb/err.log
2015-11-30 11:06:00 +00:00
Marc Egea i Sala
dfb4835cc1 Merge pull request #6 from overleaf/version-update
Update local version after processing snapshots
2015-11-30 11:00:41 +00:00
John Lees-Miller
318e11deeb mock the persistent store with jmock 2015-11-24 12:06:43 +00:00
John Lees-Miller
e2574ab163 fix whitespace 2015-11-24 12:06:05 +00:00