From 9727259d0ca3f2f46f200358c42b6656c27c1b1e Mon Sep 17 00:00:00 2001 From: dariko Date: Sun, 22 Jan 2017 09:37:19 +0100 Subject: [PATCH 1/2] add temp_dir parameter --- README.md | 1 + src/main/java/JettyLauncher.java | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4cb606b1e..0cdb89414 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ You can specify following options: - `--prefix=[CONTEXTPATH]` - `--host=[HOSTNAME]` - `--gitbucket.home=[DATA_DIR]` +- `--temp_dir=[TEMP_DIR]` You can also deploy gitbucket.war to a servlet container which supports Servlet 3.0 (like Jetty, Tomcat, JBoss, etc) diff --git a/src/main/java/JettyLauncher.java b/src/main/java/JettyLauncher.java index 01168e0f4..d81094181 100644 --- a/src/main/java/JettyLauncher.java +++ b/src/main/java/JettyLauncher.java @@ -12,6 +12,7 @@ public class JettyLauncher { int port = 8080; InetSocketAddress address = null; String contextPath = "/"; + String tmpDirPath=""; boolean forceHttps = false; for(String arg: args) { @@ -29,6 +30,8 @@ public class JettyLauncher { } } else if(dim[0].equals("--gitbucket.home")){ System.setProperty("gitbucket.home", dim[1]); + } else if(dim[0].equals("--temp_dir")){ + tmpDirPath = dim[1]; } } } @@ -53,9 +56,21 @@ public class JettyLauncher { WebAppContext context = new WebAppContext(); - File tmpDir = new File(getGitBucketHome(), "tmp"); - if(!tmpDir.exists()){ - tmpDir.mkdirs(); + File tmpDir; + if(tmpDirPath.equals("")){ + tmpDir = new File(getGitBucketHome(), "tmp"); + if(!tmpDir.exists()){ + tmpDir.mkdirs(); + } + } else { + tmpDir = new File(tmpDirPath); + if(!tmpDir.exists()){ + throw new java.io.FileNotFoundException( + String.format("temp_dir \"%s\" not found", tmpDirPath)); + } else if(!tmpDir.isDirectory()) { + throw new IllegalArgumentException( + String.format("temp_dir \"%s\" is not a directory", tmpDirPath)); + } } context.setTempDirectory(tmpDir); From 75f4903ffbf7dba93900d1fe05de12563f36439b Mon Sep 17 00:00:00 2001 From: dariko Date: Mon, 23 Jan 2017 12:48:57 +0100 Subject: [PATCH 2/2] --temp_dir parameter documentation --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 0cdb89414..ed89d3838 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,13 @@ You can specify following options: - `--gitbucket.home=[DATA_DIR]` - `--temp_dir=[TEMP_DIR]` +`TEMP_DIR` is used as the [temporary directory for the jetty application context](https://www.eclipse.org/jetty/documentation/9.3.x/ref-temporary-directories.html). +This is the directory into which the gitbucket.war file is unpacked, the source +files are compiled, etc. +If given this parameter **must** match the path of an existing directory +or the application will quit reporting an error; if not given the path used +will be a `tmp` directory inside the gitbucket home. + You can also deploy gitbucket.war to a servlet container which supports Servlet 3.0 (like Jetty, Tomcat, JBoss, etc) For more information about installation on Mac or Windows Server (with IIS), or configuration of Apache or Nginx and also integration with other tools or services such as Jenkins or Slack, see [Wiki](https://github.com/gitbucket/gitbucket/wiki).