Commit graph

672 commits

Author SHA1 Message Date
Shane Kilkelly
594009aeab Reduce memory limit to 50 percent 2021-06-17 14:24:07 +01:00
Shane Kilkelly
ed3507977b Switch to UseContainerSupport and MaxRAMPercentage 2021-06-16 17:23:38 +01:00
Shane Kilkelly
8a68c3aef0 Merge pull request #102 from overleaf/sk-add-sqlite-prod
Add sqlite3 package to the production image
2021-06-16 10:36:33 +01:00
Shane Kilkelly
cbad8bcfb6 Add sqlite3 package to the production image 2021-06-16 09:46:53 +01:00
Shane Kilkelly
d824cb8451 Add heap flags to production entry script 2021-06-15 14:48:45 +01:00
Shane Kilkelly
82ab89fab3 Remove exception from signature 2021-05-21 09:57:28 +01:00
Shane Kilkelly
2efc7f22a7 Remove old username/password settings
These were once used to secure interactions with the web api, back when
we allowed anonymous access to git repositories. This feature was
dropped in the migration to Overleaf v2, and we use OAuth on those
interactions anyway, so these settings are not actually used for
anything, and keeping these around is just confusing.
2021-05-20 15:59:26 +01:00
Shane Kilkelly
c043988027 Remove default user/pass in config template 2021-05-20 10:05:27 +01:00
Shane Kilkelly
ae08604417 Fix variable name in config template 2021-05-20 09:50:05 +01:00
Shane Kilkelly
bbc062f942 default user/pass for development 2021-05-18 16:08:59 +01:00
Christopher Hoskin
725a9e0669 Use CMD as in other apps 2021-05-12 12:32:14 +01:00
Christopher Hoskin
0827795fc7 Consistently use GIT_BRIDGE 2021-05-12 08:42:45 +01:00
Shane Kilkelly
b47f21a44e Configure from env vars at run time
In both local developent, and production.  Also, vendor the `envsubst`
binary from https://github.com/a8m/envsubst, as it supports default
values, which the gnu envsubst (from gettext-base) does not.
2021-05-07 09:47:49 +01:00
Christopher Hoskin
f1c9d6108e Generate a config file from env vars and template 2021-04-30 15:49:37 +01:00
Shane Kilkelly
927d401111 Merge branch 'jpa-silent-download' 2021-04-06 13:34:50 +01:00
Shane Kilkelly
465a39c564 Wait one second between checks in swap test 2021-02-04 09:52:13 +00:00
Shane Kilkelly
b010622442 Change default compressionMethod to gzip 2021-02-04 09:52:13 +00:00
Shane Kilkelly
b92c737814 Use configured compression method in swap job 2021-02-04 09:52:13 +00:00
Shane Kilkelly
c67014b859 Update SqliteDBStoreTest with swap/compression 2021-02-04 09:52:13 +00:00
Shane Kilkelly
961cec5bc8 Implement swap/restore in SqliteDBStore 2021-02-04 09:52:13 +00:00
Shane Kilkelly
a3d4976ce2 Implement swap/restore on NoopDbStore 2021-02-04 09:52:13 +00:00
Shane Kilkelly
83d9d122bf Add swap/restore methods to DBStore interface 2021-02-04 09:52:13 +00:00
Shane Kilkelly
21c524d8b6 Log actions when (un)compressing project 2021-02-04 09:52:13 +00:00
Shane Kilkelly
eba7cbe696 Implement gzip in FSGitRepoStore 2021-02-04 09:52:13 +00:00
Shane Kilkelly
1c81fcf501 Add gzip to RepoStore interface 2021-02-04 09:52:13 +00:00
Shane Kilkelly
8496871ab2 Add gzip support to Tar helper 2021-02-04 09:52:13 +00:00
Shane Kilkelly
169de1fead Configure swap compression method: bzip2 or gzip 2021-02-04 09:52:13 +00:00
Shane Kilkelly
c520ecd70d Allow configuration of AWS region 2021-01-27 10:41:32 +00:00
Jakob Ackermann
fcdc244a11 [misc] add --no-transfer-progress to all the mvn commands
Apparently `mvn clean` downloads all the packages when running
 `make package`.
2021-01-04 10:31:40 +00:00
Jakob Ackermann
275bb1b330 [misc] hide the download progress of dependencies 2021-01-04 10:31:39 +00:00
Jakob Ackermann
4644faf212 [misc] integrate git-bridge with overleaf dev-env and prod setup
- Add `base` target for dev-env
- Add `node` user for dev-env and prod
- Use `make` all the way
2020-12-10 17:37:09 +00:00
Jakob Ackermann
3e7cf07c8e Merge branch 'master' into jpa-docker-image
# Conflicts:
#	README.md
2020-12-10 14:28:03 +00:00
Eric Mc Sween
8a5027255a Merge pull request #86 from overleaf/em-handle-history-error
Handle errors from the history service
2020-12-09 09:05:24 -05:00
Eric Mc Sween
8bbeee0f8d Strip token from blob URLs when using cache
Blob URLs coming from web may now contain a token for authentication
with history v1. This token will change every request, which makes the
URL not suitable as a cache key. Removing the token fixes that.
2020-12-04 15:15:10 -05:00
Eric Mc Sween
2430d5fe1d Handle errors from the history service
If the history service returns a non-success status code when we request
a blob, chances are the payload is not the expected blob contents. We
throw an exception in that case, which will abort the git operation.
2020-12-04 11:27:00 -05:00
Shane Kilkelly
f89fab5abb Upgrade to JGit 5.9.0 2020-10-20 10:23:06 +01:00
Shane Kilkelly
de23035e80 Add test for pulling ignored file 2020-09-29 13:00:36 +01:00
Shane Kilkelly
c6cfd51fb4 Use the NoGitignoreIterator recursively 2020-09-29 12:44:33 +01:00
Shane Kilkelly
03af20113f Force add the test file, sigh. 2020-09-24 13:29:39 +01:00
Shane Kilkelly
935770e2ab Add test for reset before pull 2020-09-24 11:24:47 +01:00
Shane Kilkelly
d07ecd2a1b During pull: reset repo before writing data 2020-09-23 11:38:22 +01:00
Shane Kilkelly
bb7831012b When logging IOException for put, include error 2020-09-01 13:28:35 +01:00
Shane Kilkelly
2b8f3f4de8 Use 422 status when rejecting Git LFS request 2020-08-05 13:00:20 +01:00
Shane Kilkelly
f7125b9159 Handle Git LFS requests, with error message
We don't support Git LFS. This change adds a handler for
POST requests to "<project>.git/info/lfs/objects/batch",
and sends back a 406 response, with json data that the
client can use to print a nice error message.
2020-08-05 10:08:40 +01:00
Shane Kilkelly
e7b19ea4a0 Update src/main/java/uk/ac/ic/wlgitbridge/server/StatusHandler.java
Co-authored-by: John Lees-Miller <jdleesmiller@gmail.com>
2020-06-26 13:37:18 +01:00
Shane Kilkelly
4161416659 Update src/main/java/uk/ac/ic/wlgitbridge/server/HealthCheckHandler.java
Co-authored-by: John Lees-Miller <jdleesmiller@gmail.com>
2020-06-26 13:37:09 +01:00
Shane Kilkelly
5e31a11938 Respond to HEAD request in /status, /health_check 2020-06-26 11:54:18 +01:00
Shane Kilkelly
a9a7f54a96 Handle trailing slash on status and health_check 2020-06-25 16:43:57 +01:00
Shane Kilkelly
6ff3877dd1 Fix status and healthcheck tests 2020-06-19 15:50:51 +01:00
Shane Kilkelly
ec278ffe0a Fix log lines 2020-06-19 15:50:42 +01:00
Shane Kilkelly
ed778639a8 Move the status and healthcheck to root level 2020-06-19 15:50:27 +01:00
Shane Kilkelly
8def058d85 Fix log level 2020-06-19 15:50:16 +01:00
Shane Kilkelly
3c6ef38036 Fix alignment of function 2020-06-18 15:00:17 +01:00
Shane Kilkelly
40a171d44a Also check we can touch the filesystem in healthcheck 2020-06-18 14:56:50 +01:00
Shane Kilkelly
973a18b1b8 Clean up new healthcheck test 2020-06-18 14:56:38 +01:00
Shane Kilkelly
badeea3e0b Add test for status and health-check endpoints 2020-06-18 13:54:10 +01:00
Shane Kilkelly
689362b24f Use the bridge.healthCheck method 2020-06-18 11:45:21 +01:00
Shane Kilkelly
86769eedea Add a healthCheck method to the Bridge, check db 2020-06-18 11:45:04 +01:00
Shane Kilkelly
1befc3582b wip: add skeleton health-check handler 2020-06-17 16:15:40 +01:00
Shane Kilkelly
eba6c907e9 wip: status handler 2020-06-17 16:05:53 +01:00
Jakob Ackermann
090e58a953 [misc] add documentation on how to run commands from the dev-environment 2020-03-11 11:46:46 +01:00
Jakob Ackermann
f98212e96b [misc] make: skip tests for the build and package target
http://maven.apache.org/plugins-archives/maven-surefire-plugin-2.12.4/examples/skipping-test.html
2020-03-10 15:35:50 +01:00
Ersun Warncke
d89dbb7ff8 Revert "add debug"
This reverts commit 0d28d39563ad5de0db666c9e67493f5c814fe930.
2019-11-27 09:05:18 -04:00
Ersun Warncke
b6812462d6 add debug 2019-11-25 10:20:43 -04:00
Ersun Warncke
b1262ff06e pass client ip as url param 2019-11-19 12:08:35 -04:00
Ersun Warncke
5188e7c06a add file limit error 2019-11-12 11:16:54 -04:00
Shane Kilkelly
ffcb382f0c Update test to match new setup/teardown pattern 2019-08-02 13:34:43 +01:00
Shane Kilkelly
ac4f4082c8 Use 404 code when rejecting invalid project id 2019-08-02 13:31:27 +01:00
Shane Kilkelly
76b349591c Refactor to use new helper to send error response 2019-08-02 13:31:27 +01:00
Shane Kilkelly
b0ab2e07c5 Reject requests when the project uri begins with '/project' 2019-08-02 13:31:27 +01:00
Shane Kilkelly
abf525f43a Update test to match new setup/teardown pattern 2019-08-01 16:34:49 +01:00
Shane Kilkelly
3fac2cc825 Merge pull request #59 from das7pad/tests/cleanup-resources
[tests] cleanup resources
2019-08-01 16:26:51 +01:00
Shane Kilkelly
88adce3a02 Use UUID in file url, not (encoded) file path.
This fixes a bunch of issues where funny characters in the file path
(spaces, unicode, etc) would cause the file server in this process to
respond with a 404 when asked for the file. The 404 would then cause
the push to fail.

Now we just use a UUID as an opaque and unambiguous identifier for each file.
2019-07-05 11:07:47 +01:00
Shane Kilkelly
11e42ecb6f Point local config to v2 2019-07-03 09:37:11 +01:00
Shane Kilkelly
a68afc2e28 Merge pull request #67 from overleaf/sk-dont-catch-throwable-swap-impl
Don't catch `Throwable` in swap-job, catch Exception
2019-06-13 12:11:01 +01:00
Shane Kilkelly
591617f996 Merge pull request #68 from overleaf/sk-fix-unicode-file-paths
Encode file path when building url, allows unicode
2019-06-13 12:10:55 +01:00
Shane Kilkelly
71df1b0a31 Encode file path when building url, allows unicode 2019-06-07 14:17:33 +01:00
Shane Kilkelly
28865e2956 Don't catch Throwable in swap-job, catch Exception 2019-06-07 10:26:55 +01:00
Shane Kilkelly
552e0955da Tell user to remove .git folder 2019-05-29 11:05:53 +01:00
Shane Kilkelly
545a9240d3 Merge pull request #61 from overleaf/spd-colon-passwords
GitBridge: Allow colons in passwords
2019-05-29 10:33:38 +01:00
Shane Kilkelly
b1d7a0cf63 Merge pull request #65 from overleaf/sk-handle-409-has-dot-git
Handle a 409 response with code=projectHasDotGit
2019-05-29 10:33:22 +01:00
Shane Kilkelly
b6fc48645a Merge pull request #64 from overleaf/sk-skip-failing-projects-in-swap-job
Skip failing projects in swap job, and give up after a certain number
2019-05-29 10:33:06 +01:00
Shane Kilkelly
719f0c3661 Give up on projects that cannot be swapped, rather than spinning the loop forever 2019-05-29 10:20:37 +01:00
Shane Kilkelly
2492c95c0b Handle a 409 response with code=projectHasDotGit 2019-05-29 10:18:49 +01:00
Shane Kilkelly
f237efa6d5 Log and trap/ignore gc errors during swap 2019-05-23 11:14:02 +01:00
Shane Kilkelly
c7d8c1c6b5 Run GC on a project at start of swap job.
When there is an exception during swap, add project name to log
2019-05-16 11:42:13 +01:00
Simon Detheridge
d51f2fecfc Allow colons in passwords
bug: overleaf/issues#1393
2019-05-16 10:03:27 +01:00
Jakob Ackermann
f547b6d494 Revert "Add git, make, and curl to docker image"
This reverts commit 02a2c9cd429b26ff44fabb97d3649e791b9edea4

Signed-off-by: Jakob Ackermann <das7pad@outlook.com>
2019-05-05 18:34:01 +02:00
Jakob Ackermann
5907172463 Merge remote-tracking branch 'upstream/master' into misc/docker-build
# Conflicts:
#	Dockerfile
2019-05-05 18:32:35 +02:00
Jakob Ackermann
35ac848f43 [docker] install git in the app image
Signed-off-by: Jakob Ackermann <das7pad@outlook.com>
2019-04-26 23:59:59 +02:00
Jakob Ackermann
a333aabfa9 [WLGitBridgeIntegrationTest] adjust the urls for the individual tests
Signed-off-by: Jakob Ackermann <das7pad@outlook.com>
2019-04-26 23:56:54 +02:00
Jakob Ackermann
5040b4d7f0 [WLGitBridgeIntegrationTest] ensure that we stop the started servers
Signed-off-by: Jakob Ackermann <das7pad@outlook.com>
2019-04-26 23:56:47 +02:00
Shane Kilkelly
c3308e565b Add git, make, and curl to docker image 2019-04-26 15:29:44 +01:00
Jakob Ackermann
a517c15053 [docker] include the LICENSE file in the image
Signed-off-by: Jakob Ackermann <das7pad@outlook.com>
2019-04-17 23:10:08 +02:00
Jakob Ackermann
2ebae69044 [docker] build the git-bridge in docker
Signed-off-by: Jakob Ackermann <das7pad@outlook.com>
2019-04-17 13:45:21 +02:00
Jakob Ackermann
85a8e377fc [docker] use a base image that already contains maven and openjdk
Signed-off-by: Jakob Ackermann <das7pad@outlook.com>
2019-04-17 11:21:41 +02:00
Shane Kilkelly
8f72cb89c8 Reject v1 ids earlier in the pipeline 2019-03-08 11:45:31 +00:00
Shane Kilkelly
788fad5ce7 Remove a deprecated method, no longer compatible with JGit 5.2 2019-03-06 11:43:27 +00:00
Shane Kilkelly
600aa8d9cf Do mvn clean before build.
We've had build issues be hidden by caching. So we should build from
clean each time, in immitation of the prod build process.
2019-03-06 11:41:59 +00:00
Shane Kilkelly
c1e7969342 Revert "Revert "Upgrade JGit dependency to 5.2.1""
This reverts commit 42b5a32670e43b307ec2b0a34380e373b16be1fe.
2019-03-06 10:59:40 +00:00
Shane Kilkelly
0943248334 Revert "Upgrade JGit dependency to 5.2.1"
This reverts commit c0d9fb961396aa285e7ebf563b707c9fb299776c.
2019-03-06 10:31:07 +00:00
Shane Kilkelly
6d9e8d38e9 Merge pull request #53 from overleaf/sk-refuse-v1-ids
Refuse to process project-ids that look like they come from v1
2019-03-06 10:17:17 +00:00
Shane Kilkelly
a517035e2c Refuse to process project-ids that look like they come from v1 2019-03-06 10:16:55 +00:00
Shane Kilkelly
845397639e Upgrade JGit dependency to 5.2.1 2019-03-04 10:15:34 +00:00
Shane Kilkelly
0f130096a2 Increase postback timeout to six minutes, to help users posting large payloads 2019-01-15 10:52:30 +00:00
Shane Kilkelly
4dc140aced Add integration test to cover imported-but-not-changed projects 2019-01-10 10:21:31 +00:00
Shane Kilkelly
4f1168a590 Add comments pointing to github issue 2019-01-09 14:24:04 +00:00
Shane Kilkelly
b8d252244c Tolerate case where there is no latest version timestamp in version info 2019-01-09 12:23:26 +00:00
Shane Kilkelly
ba8ba001d6 Fetch snapshots in edge-case where version-id is zero 2019-01-09 12:23:00 +00:00
Shane Kilkelly
779778fdb1 Use newUrl if supplied when v1 is deprecated 2019-01-08 09:47:01 +00:00
Shane Kilkelly
0d0c5458dd Handle when v1 is deprecated, print a message instead of an error 2019-01-07 11:54:44 +00:00
Shane Kilkelly
40add6985f Remove override of connect timeout 2018-12-17 09:39:19 +00:00
Shane Kilkelly
2195af88dd Set timeouts on Post requests too 2018-12-14 16:34:48 +00:00
Shane Kilkelly
46904bfe73 Set timeouts on http requests to 3 minutes, up from the default of 20 seconds. 2018-12-14 16:13:58 +00:00
Shane Kilkelly
0bc82e6936 Merge pull request #46 from overleaf/sk-increase-push-timeout
Change push timeout to three minutes
2018-12-14 09:46:46 +00:00
Shane Kilkelly
9ee39ae930 Wrap the generic repository-missing message correctly
Now appears to the client as:

```
fatal: remote error: no git access
This Overleaf project currently has no git access, either because
the project does not exist, or because git access is not enabled
for the project.
```
2018-12-13 12:37:42 +00:00
Shane Kilkelly
abcaf8242e Include message along with error description lines 2018-12-13 12:37:21 +00:00
Shane Kilkelly
a766482a00 Remove stray import 2018-12-13 12:37:09 +00:00
Shane Kilkelly
bf7be6071d Handle GitUserException, with multiple lines of output 2018-12-13 11:41:07 +00:00
Shane Kilkelly
2f18feb136 Keep the default constructor for MissingRepositoryException 2018-12-13 11:40:08 +00:00
Shane Kilkelly
27e1152095 Fix wording of the generic-error when a repository is missing 2018-12-13 10:34:09 +00:00
Shane Kilkelly
a72146aa8d Better report to user on push timeout 2018-12-12 10:38:26 +00:00
Shane Kilkelly
3f85dc80f4 When user clone/pull/etc a project which doesn't exist, print a nice message
The old behaviour was to just show an equivalent of a 500 error.
This way, we catch the 404 from the API, and print an appropriate message
to the user.
2018-12-11 12:35:21 +00:00
Shane Kilkelly
c435eccc43 Change push timeout to three minutes 2018-12-11 09:24:09 +00:00
Shane Kilkelly
d22d5829bb Remove redundant try/catch around directory copy operation 2018-12-06 09:45:07 +00:00
Shane Kilkelly
67d365e661 Remove commas because grammer 2018-12-06 09:40:09 +00:00
Shane Kilkelly
6b8101d278 Init the new repo from existing repository, avoid creating files then deleting 2018-12-05 16:54:58 +00:00
Shane Kilkelly
8cb715014c More concise handling of optional migratedFromId in test 2018-12-05 15:00:00 +00:00
Shane Kilkelly
709cb0887c Remove old constructor without the migratedFromId param 2018-12-05 14:59:41 +00:00
Shane Kilkelly
925ebc2133 Check project state inside the lock 2018-12-05 14:58:51 +00:00
Shane Kilkelly
439d55d805 Update wording of the change-your-remote message shown to user 2018-12-05 10:42:58 +00:00
Shane Kilkelly
007dfe1420 Change new_remote to newRemote 2018-12-04 10:43:48 +00:00
Shane Kilkelly
8005ebf5d0 Remove test exception 2018-12-04 10:14:39 +00:00
Shane Kilkelly
c0b52c5851 Add 'please' to message shown to client for migrated project 2018-12-03 11:53:34 +00:00
Shane Kilkelly
326d0a0722 When a repo has migrated to v2, print message about updating remote 2018-12-03 11:49:06 +00:00
Shane Kilkelly
c553094a60 Add a test for when migrated-from project is not present 2018-12-03 10:13:10 +00:00
Shane Kilkelly
aa267a59da fix whitespace 2018-11-30 16:13:33 +00:00
Shane Kilkelly
267d324870 Alter the classloader workaround, and leave link to SO page describing the problem 2018-11-30 15:21:48 +00:00
Shane Kilkelly
dd2e9b6945 More closely match the semantics of projectExists 2018-11-29 11:39:56 +00:00
Shane Kilkelly
f852cd603d Use FileUtils to handle copying of migrated repository 2018-11-29 11:39:30 +00:00
Shane Kilkelly
1a646d3fd0 Add an integration test for migrating repository 2018-11-29 10:22:22 +00:00
Shane Kilkelly
8bdf7031c5 Fix log line 2018-11-28 14:17:30 +00:00
Shane Kilkelly
245cd67a39 Fix tests 2018-11-27 16:24:50 +00:00
Shane Kilkelly
b061608124 Re-instate tests 2018-11-27 16:24:40 +00:00
Shane Kilkelly
a524bfbac1 Minor cleanup 2018-11-27 16:07:42 +00:00
Shane Kilkelly
66fa946cb8 set timestamp on new record too 2018-11-27 16:07:26 +00:00
Shane Kilkelly
4f3021cca1 Speculative solution 2018-11-27 11:35:22 +00:00
Shane Kilkelly
19075f18bc Add migratedFromID property to GetDocResult 2018-11-22 12:01:28 +00:00
Shane Kilkelly
51957ab78b Update api base url 2018-11-12 11:23:04 +00:00
Shane Kilkelly
cf31ccbea0 Update to account for dev-env changes 2018-11-06 13:55:58 +00:00