SlideShare a Scribd company logo
GitBucket: 
The perfect Github clone by Scala 
Naoki Takezoe 
@takezoen 
BizReach, Inc
What’s GitBucket? 
https://github.com/takezoe/gitbucket
What’s GitBucket? 
• Open-Source Github clone based on 
Scala and JGit 
• Easy installation by pure JVM based 
solution 
• Main target is intranet users who can’t 
use Github by political reason
Demo 
Demo site (Thanks to @xuwei_k) 
http://gitbucket.herokuapp.com/
Over 3000 Stars, Thanks!! 
3197stars!! 
at 18 Aug 2014
Over 3000 Stars, Thanks!! 
Product Stars 
Scala 2785 
Slick 952 
Scalatra 1428 
sbt 1921 
Play2 5103 
at 18 Aug 2014 Play is Great!!
Features 
• Public / Private Git repository (http and ssh access) 
• Repository viewer and online file editing 
• Repository search (Code and Issues) 
• Wiki 
• Issues 
• Fork / Pull request 
• Mail notification 
• Activity timeline 
• User management (for Administrators) 
• Group (like Organization in Github) 
• LDAP integration 
• Gravatar support
Easy Installation 
$ wget https://github.com/takezoe/gitbucket/ 
releases/download/2.3/gitbucket.war 
!$ java -jar gitbucket.war
Showcase 
• docker-gitbucket 
https://github.com/f99aq8ove/docker-gitbucket 
• Jenkins GitBucket Plugin 
https://wiki.jenkins-ci.org/display/JENKINS/ 
GitBucket+Plugin 
• Amiage 
http://amiage.com/apps/gitbucket/
About development 
of GitBucket
GitBucket Team
and 36 Contributors
and 36 Contributors 
but our resource 
is not enough...
We need 
max development 
speed by the 
minimum cost
Technologies 
and 
Tools
Technologies 
• Scalatra 
• Twirl 
• Slick 
• JGit 
• H2 
• Jetty 
• Apache MINA 
(Server-side)
Technologies 
(Front-end) 
• jQuery + Plugins 
• Bootstrap2 
• jsdifflib 
• google-code-prettify 
• AceEditor 
• DropZone 
• ZeroClipboard
Architecture 
Git Client Web Browser 
SSH HTTP 
GitServlet Scalatra / Twirl 
Git Repository 
(Source code, Wiki) 
H2 
Jetty 
(Account, Issues etc) 
MINA SSHD 
JGit Slick
Technologies 
• Type safety supports our aggressive 
development 
• Based on existing Java resources 
• Pure JVM based solution makes easy 
installation
Scalatra 
• Simple and powerful servlet based 
web framework inspired by Sinatra 
• More dynamic than Play2, but high 
extendibility 
class MyServlet extends ScalatraServlet with ScalateSupport {! 
get("/") {! 
<html>! 
<body>! 
<h1>Hello, world!</h1>! 
Say <a href="hello-scalate">hello to Scalate</a>.! 
</body>! 
</html>! 
}! 
}
scalatra-forms 
• Extension library for Scalatra 
• Server side and client side validation 
at once 
case class SignInForm(userName: String, password: String)! 
! 
val form = mapping(! 
"userName" -> trim(label("Username", text(required))),! 
"password" -> trim(label("Password", text(required)))! 
)(SignInForm.apply)! 
!! 
post("/signin", form){ form =>! 
authenticate(context.settings, form.userName, form.password) match {! 
case Some(account) => signin(account)! 
case None => redirect("/signin")! 
}! 
}
scalatra-forms 
Send form data to /signin/validate by Ajax 
Validation result as JSON 
Web Browser Server 
Send form data to /signin if validation passed 
Response 
Added by scalatra-forms 
automatically 
Display errors if 
validation failed 
Validate again 
System error if 
validation failed
Twirl 
• Scala syntax template compiler 
• Also used in Play2 
@(systemSettings: service.SystemSettingsService.SystemSettings)(implicit context: app.Context)! 
@import context._! 
<div class="signin-form">! 
<div class="header-metal">! 
@if(systemSettings.allowAccountRegistration){! 
<div class="pull-right">! 
<a href="@path/register" class="btn btn-mini">Create new account</a>! 
</div>! 
}! 
Sign in! 
</div>! 
<div class="form-body">! 
<form action="@path/signin" method="POST" validate="true">! 
<label for="userName">Username:</label>! 
<span id="error-userName" class="error"></span>! 
<input type="text" name="userName" id="userName" style="width: 95%"/>! 
<label for="password">Password:</label>! 
<span id="error-password" class="error"></span>! 
<input type="password" name="password" id="password" style="width: 95%"/>! 
<div><input type="submit" class="btn btn-success" value="Sign in"/></div>! 
</form>! 
</div>! 
</div>
Slick 
• Typesafe database query library 
• GitBucket does not use native SQL 
Issues filter { t1 =>! 
condition.repo! 
.map { _.split('/') match { case array => Seq(array(0) -> array(1)) } }! 
.getOrElse (repos)! 
.map { case (owner, repository) => t1.byRepository(owner, repository) }! 
.foldLeft[Column[Boolean]](false) ( _ || _ ) &&! 
(t1.closed === (condition.state == "closed").bind) &&! 
(t1.milestoneId === condition.milestoneId.get.get.bind, condition.milestoneId.flatten.isDefined) &&! 
(t1.milestoneId.? isEmpty, condition.milestoneId == Some(None)) &&! 
(t1.assignedUserName === filterUser("assigned").bind, filterUser.get("assigned").isDefined) &&! 
(t1.openedUserName === filterUser("created_by").bind, filterUser.get("created_by").isDefined) &&! 
(t1.openedUserName =!= filterUser("not_created_by").bind, filterUser.get("not_created_by").isDefined) &&! 
(t1.pullRequest === true.bind, onlyPullRequest) &&! 
(IssueLabels filter { t2 =>! 
(t2.byIssue(t1.userName, t1.repositoryName, t1.issueId)) &&! 
(t2.labelId in! 
(Labels filter { t3 =>! 
(t3.byRepository(t1.userName, t1.repositoryName)) &&! 
(t3.labelName inSetBind condition.labels)! 
} map(_.labelId)))! 
} exists, condition.labels.nonEmpty)
JGit 
• Git implementation in Java 
• Includes GitServlet which provides Git 
server 
// Clone repository! 
Git.cloneRepository()! 
.setURI("https://github.com/takezoe/solr-scala-client.git")! 
.setDirectory(new File("git"))! 
.call()! 
! 
// Show logs! 
val logs = Git.open(new java.io.File("git")).log().call()! 
logs.asScala.foreach { rev =>! 
println(rev.getCommitterIdent().getEmailAddress() + " - " + rev.getCommitTime())! 
println(rev.getFullMessage())! 
}
H2 
• Embeddable pure Java RDBMS 
• GitBucket has automatic migration 
system on H2 
Differences of these 
SQLs are run in order.
Apache MINA 
• Apache MINA is a framework for NIO 
based network applications 
• GitBucket uses MINA SSHD which is an 
sshd implementation based on MINA
Apache MINA 
import org.apache.sshd.SshServer;! 
import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider;! 
import org.apache.sshd.server.shell.ProcessShellFactory;! 
import java.util.EnumSet;! 
! 
public class Main {! 
! 
public static void main(String[] args) throws Exception {! 
SshServer server = SshServer.setUpDefaultServer();! 
server.setPort(8080);! 
server.setKeyPairProvider(new SimpleGeneratorHostKeyProvider("key.ser"));! 
server.setPasswordAuthenticator((userName, password, serverSession) -> true);! 
server.setPublickeyAuthenticator((userName, publicKey, serverSession) -> true);! 
! 
server.setShellFactory(new ProcessShellFactory(new String[]{"cmd.exe"},! 
EnumSet.of(! 
ProcessShellFactory.TtyOptions.Echo,! 
ProcessShellFactory.TtyOptions.ONlCr,! 
ProcessShellFactory.TtyOptions.ICrNl)));! 
! 
server.start();! 
}! 
}
Development Tools 
• Github 
• IntelliJ IDEA 
• Gitter 
• ZenHub
Github 
• The greatest source code hosting 
service and social coding platform 
• We are always watching Github to 
catch up new features or changes
IntelliJ IDEA 
• The best IDE for Scala 
• Not perfect, but practical enough 
• GitBucket project has OpenSource 
license
Gitter 
• Chat service which has high affinity 
with Github 
• Sign-in by Github account 
• Chat room which corresponds to 
Github repository 
• Displays users who saw the message
ZenHub 
• Provides “Kanban” to Github Issues by 
Chrome Extension 
• Visualizes issue status and priority
Roadmap 
• Scala based plug-in system 
• Features for code review 
• Mobile support 
• Performance Improvement
Gist Plugin 
Perfect Gist clone built on GitBucket
Write plugin using Scala
Thanks! 
All feedback and contributions 
are always welcome. 
https://github.com/takezoe/gitbucket

More Related Content

What's hot (20)

PDF
#NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015
Matt Raible
 
PPTX
Play! Framework for JavaEE Developers
Teng Shiu Huang
 
PDF
Developing Modern Java Web Applications with Java EE 7 and AngularJS
Shekhar Gulati
 
PDF
CQ5 and Sling overview
Bertrand Delacretaz
 
PPTX
Nashorn: JavaScript that doesn’t suck (ILJUG)
Tomer Gabel
 
PDF
Play framework productivity formula
Sorin Chiprian
 
PDF
Node.js vs Play Framework
Yevgeniy Brikman
 
PPTX
Node.js Development with Apache NetBeans
Ryan Cuprak
 
PDF
Play Framework vs Grails Smackdown - JavaOne 2013
Matt Raible
 
KEY
modern module development - Ken Barber 2012 Edinburgh Puppet Camp
Puppet
 
PDF
RESTful Web Applications with Apache Sling
Bertrand Delacretaz
 
PDF
Jcon 2017 How to use Swagger to develop REST applications
johannes_fiala
 
PPTX
Faster java ee builds with gradle [con4921]
Ryan Cuprak
 
PDF
Apache Lucene for Java EE Developers
Virtual JBoss User Group
 
PPTX
Faster Java EE Builds with Gradle
Ryan Cuprak
 
PDF
Apache DeltaSpike the CDI toolbox
Antoine Sabot-Durand
 
PDF
Play vs Grails Smackdown - Devoxx France 2013
Matt Raible
 
PDF
Java Web Application Security - Utah JUG 2011
Matt Raible
 
PPT
Java 6 [Mustang] - Features and Enchantments
Pavel Kaminsky
 
PDF
Play framework
Andrew Skiba
 
#NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015
Matt Raible
 
Play! Framework for JavaEE Developers
Teng Shiu Huang
 
Developing Modern Java Web Applications with Java EE 7 and AngularJS
Shekhar Gulati
 
CQ5 and Sling overview
Bertrand Delacretaz
 
Nashorn: JavaScript that doesn’t suck (ILJUG)
Tomer Gabel
 
Play framework productivity formula
Sorin Chiprian
 
Node.js vs Play Framework
Yevgeniy Brikman
 
Node.js Development with Apache NetBeans
Ryan Cuprak
 
Play Framework vs Grails Smackdown - JavaOne 2013
Matt Raible
 
modern module development - Ken Barber 2012 Edinburgh Puppet Camp
Puppet
 
RESTful Web Applications with Apache Sling
Bertrand Delacretaz
 
Jcon 2017 How to use Swagger to develop REST applications
johannes_fiala
 
Faster java ee builds with gradle [con4921]
Ryan Cuprak
 
Apache Lucene for Java EE Developers
Virtual JBoss User Group
 
Faster Java EE Builds with Gradle
Ryan Cuprak
 
Apache DeltaSpike the CDI toolbox
Antoine Sabot-Durand
 
Play vs Grails Smackdown - Devoxx France 2013
Matt Raible
 
Java Web Application Security - Utah JUG 2011
Matt Raible
 
Java 6 [Mustang] - Features and Enchantments
Pavel Kaminsky
 
Play framework
Andrew Skiba
 

Viewers also liked (20)

PDF
Solid And Sustainable Development in Scala
Kazuhiro Sera
 
PDF
Introduction to Spark SQL and Catalyst / Spark SQLおよびCalalystの紹介
scalaconfjp
 
PDF
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
scalaconfjp
 
PDF
Scarab: SAT-based Constraint Programming System in Scala / Scala上で実現された制約プログラ...
scalaconfjp
 
PDF
The Evolution of Scala / Scala進化論
scalaconfjp
 
PDF
What's a macro?: Learning by Examples / Scalaのマクロに実用例から触れてみよう!
scalaconfjp
 
PDF
Scalable Generator: Using Scala in SIer Business (ScalaMatsuri)
TIS Inc.
 
PPTX
[ScalaMatsuri] グリー初のscalaプロダクト!チャットサービス公開までの苦労と工夫
gree_tech
 
PPTX
From Ruby to Scala
tod esking
 
PDF
sbt, past and future / sbt, 傾向と対策
scalaconfjp
 
PDF
Weaving Dataflows with Silk - ScalaMatsuri 2014, Tokyo
Taro L. Saito
 
PPTX
Building a Unified Data Pipline in Spark / Apache Sparkを用いたBig Dataパイプラインの統一
scalaconfjp
 
PDF
Node.js vs Play Framework (with Japanese subtitles)
Yevgeniy Brikman
 
PDF
GitHub for People Who Don't Code
Christopher Schmitt
 
PDF
Github - Social Coding
Thomas Fankhauser
 
PPT
Agile delivery facilitation
Vinay Aggarwal
 
PDF
芸者東京とScala〜おみせやさんから脳トレクエストまでの軌跡〜
scalaconfjp
 
PPTX
Introduction to Git and GitHub
Bioinformatics and Computational Biosciences Branch
 
PDF
Scala が支える医療系ウェブサービス #jissenscala
Kazuhiro Sera
 
KEY
Git and GitHub
James Gray
 
Solid And Sustainable Development in Scala
Kazuhiro Sera
 
Introduction to Spark SQL and Catalyst / Spark SQLおよびCalalystの紹介
scalaconfjp
 
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
scalaconfjp
 
Scarab: SAT-based Constraint Programming System in Scala / Scala上で実現された制約プログラ...
scalaconfjp
 
The Evolution of Scala / Scala進化論
scalaconfjp
 
What's a macro?: Learning by Examples / Scalaのマクロに実用例から触れてみよう!
scalaconfjp
 
Scalable Generator: Using Scala in SIer Business (ScalaMatsuri)
TIS Inc.
 
[ScalaMatsuri] グリー初のscalaプロダクト!チャットサービス公開までの苦労と工夫
gree_tech
 
From Ruby to Scala
tod esking
 
sbt, past and future / sbt, 傾向と対策
scalaconfjp
 
Weaving Dataflows with Silk - ScalaMatsuri 2014, Tokyo
Taro L. Saito
 
Building a Unified Data Pipline in Spark / Apache Sparkを用いたBig Dataパイプラインの統一
scalaconfjp
 
Node.js vs Play Framework (with Japanese subtitles)
Yevgeniy Brikman
 
GitHub for People Who Don't Code
Christopher Schmitt
 
Github - Social Coding
Thomas Fankhauser
 
Agile delivery facilitation
Vinay Aggarwal
 
芸者東京とScala〜おみせやさんから脳トレクエストまでの軌跡〜
scalaconfjp
 
Scala が支える医療系ウェブサービス #jissenscala
Kazuhiro Sera
 
Git and GitHub
James Gray
 
Ad

Similar to GitBucket: The perfect Github clone by Scala (20)

PDF
GitBucket: Open source self-hosting Git server built by Scala
takezoe
 
PDF
GitBucket: Git Centric Software Development Platform by Scala
takezoe
 
PDF
Securing Microservices using Play and Akka HTTP
Rafal Gancarz
 
PDF
Scalatra 2.2
Ivan Porto Carrero
 
PPTX
Spring Projects Infrastructure
Gunnar Hillert
 
PPTX
Spring Projects Infrastructure
Roy Clarkson
 
KEY
S2GX 2012 - Spring Projects Infrastructure
Gunnar Hillert
 
PDF
Spring Projects Infrastructure
Roy Clarkson
 
PPTX
RESTful Web Services
Gordon Dickens
 
PDF
ekbpy'2012- Юрий Юревич - Как сделать REST API на Python
it-people
 
PDF
ekb.py: KISS REST API
Yury Yurevich
 
PPTX
Great APIs
Chris Sinjakli
 
PDF
exploring-spring-boot-clients.pdf Spring Boot
baumi3
 
PDF
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
Aman Kohli
 
PDF
Scaling business app development with Play and Scala
Peter Hilton
 
PPTX
Build A Killer Client For Your REST+JSON API
Stormpath
 
KEY
The Why and How of Scala at Twitter
Alex Payne
 
KEY
Devignition 2011
tobiascrawley
 
PDF
Scala in a wild enterprise
Rafael Bagmanov
 
PDF
WebSocket Perspectives 2015 - Clouds, Streams, Microservices and WoT
Frank Greco
 
GitBucket: Open source self-hosting Git server built by Scala
takezoe
 
GitBucket: Git Centric Software Development Platform by Scala
takezoe
 
Securing Microservices using Play and Akka HTTP
Rafal Gancarz
 
Scalatra 2.2
Ivan Porto Carrero
 
Spring Projects Infrastructure
Gunnar Hillert
 
Spring Projects Infrastructure
Roy Clarkson
 
S2GX 2012 - Spring Projects Infrastructure
Gunnar Hillert
 
Spring Projects Infrastructure
Roy Clarkson
 
RESTful Web Services
Gordon Dickens
 
ekbpy'2012- Юрий Юревич - Как сделать REST API на Python
it-people
 
ekb.py: KISS REST API
Yury Yurevich
 
Great APIs
Chris Sinjakli
 
exploring-spring-boot-clients.pdf Spring Boot
baumi3
 
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
Aman Kohli
 
Scaling business app development with Play and Scala
Peter Hilton
 
Build A Killer Client For Your REST+JSON API
Stormpath
 
The Why and How of Scala at Twitter
Alex Payne
 
Devignition 2011
tobiascrawley
 
Scala in a wild enterprise
Rafael Bagmanov
 
WebSocket Perspectives 2015 - Clouds, Streams, Microservices and WoT
Frank Greco
 
Ad

More from takezoe (20)

PDF
Journey of Migrating Millions of Queries on The Cloud
takezoe
 
PDF
Testing Distributed Query Engine as a Service
takezoe
 
PDF
Revisit Dependency Injection in scala
takezoe
 
PDF
How to keep maintainability of long life Scala applications
takezoe
 
PDF
頑張りすぎないScala
takezoe
 
PDF
Non-Functional Programming in Scala
takezoe
 
PDF
Scala警察のすすめ
takezoe
 
PDF
Scala製機械学習サーバ「Apache PredictionIO」
takezoe
 
PDF
The best of AltJava is Xtend
takezoe
 
PDF
Scala Warrior and type-safe front-end development with Scala.js
takezoe
 
PDF
Tracing Microservices with Zipkin
takezoe
 
PDF
Type-safe front-end development with Scala
takezoe
 
PDF
Scala Frameworks for Web Application 2016
takezoe
 
PDF
Macro in Scala
takezoe
 
PDF
Java9 and Project Jigsaw
takezoe
 
PDF
Reactive database access with Slick3
takezoe
 
PDF
markedj: The best of markdown processor on JVM
takezoe
 
PDF
ネタじゃないScala.js
takezoe
 
PDF
Excel方眼紙を支えるJava技術 2015
takezoe
 
PDF
ビズリーチの新サービスをScalaで作ってみた 〜マイクロサービスの裏側 #jissenscala
takezoe
 
Journey of Migrating Millions of Queries on The Cloud
takezoe
 
Testing Distributed Query Engine as a Service
takezoe
 
Revisit Dependency Injection in scala
takezoe
 
How to keep maintainability of long life Scala applications
takezoe
 
頑張りすぎないScala
takezoe
 
Non-Functional Programming in Scala
takezoe
 
Scala警察のすすめ
takezoe
 
Scala製機械学習サーバ「Apache PredictionIO」
takezoe
 
The best of AltJava is Xtend
takezoe
 
Scala Warrior and type-safe front-end development with Scala.js
takezoe
 
Tracing Microservices with Zipkin
takezoe
 
Type-safe front-end development with Scala
takezoe
 
Scala Frameworks for Web Application 2016
takezoe
 
Macro in Scala
takezoe
 
Java9 and Project Jigsaw
takezoe
 
Reactive database access with Slick3
takezoe
 
markedj: The best of markdown processor on JVM
takezoe
 
ネタじゃないScala.js
takezoe
 
Excel方眼紙を支えるJava技術 2015
takezoe
 
ビズリーチの新サービスをScalaで作ってみた 〜マイクロサービスの裏側 #jissenscala
takezoe
 

Recently uploaded (20)

PPTX
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
PPTX
Finding Your License Details in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PPTX
Foundations of Marketo Engage - Powering Campaigns with Marketo Personalization
bbedford2
 
PPTX
Homogeneity of Variance Test Options IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PPTX
ChiSquare Procedure in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
Technical-Careers-Roadmap-in-Software-Market.pdf
Hussein Ali
 
PPTX
Comprehensive Risk Assessment Module for Smarter Risk Management
EHA Soft Solutions
 
PDF
Download Canva Pro 2025 PC Crack Full Latest Version
bashirkhan333g
 
PPTX
Agentic Automation: Build & Deploy Your First UiPath Agent
klpathrudu
 
PPTX
Build a Custom Agent for Agentic Testing.pptx
klpathrudu
 
PPTX
Smart Doctor Appointment Booking option in odoo.pptx
AxisTechnolabs
 
PDF
Wondershare PDFelement Pro Crack for MacOS New Version Latest 2025
bashirkhan333g
 
PPTX
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
PDF
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
PDF
Dipole Tech Innovations – Global IT Solutions for Business Growth
dipoletechi3
 
PPTX
Function & Procedure: Function Vs Procedure in PL/SQL
Shani Tiwari
 
PDF
Simplify React app login with asgardeo-sdk
vaibhav289687
 
PPTX
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
PDF
MiniTool Power Data Recovery 8.8 With Crack New Latest 2025
bashirkhan333g
 
PPTX
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
Finding Your License Details in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Foundations of Marketo Engage - Powering Campaigns with Marketo Personalization
bbedford2
 
Homogeneity of Variance Test Options IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
ChiSquare Procedure in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Technical-Careers-Roadmap-in-Software-Market.pdf
Hussein Ali
 
Comprehensive Risk Assessment Module for Smarter Risk Management
EHA Soft Solutions
 
Download Canva Pro 2025 PC Crack Full Latest Version
bashirkhan333g
 
Agentic Automation: Build & Deploy Your First UiPath Agent
klpathrudu
 
Build a Custom Agent for Agentic Testing.pptx
klpathrudu
 
Smart Doctor Appointment Booking option in odoo.pptx
AxisTechnolabs
 
Wondershare PDFelement Pro Crack for MacOS New Version Latest 2025
bashirkhan333g
 
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
Dipole Tech Innovations – Global IT Solutions for Business Growth
dipoletechi3
 
Function & Procedure: Function Vs Procedure in PL/SQL
Shani Tiwari
 
Simplify React app login with asgardeo-sdk
vaibhav289687
 
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
MiniTool Power Data Recovery 8.8 With Crack New Latest 2025
bashirkhan333g
 
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 

GitBucket: The perfect Github clone by Scala

  • 1. GitBucket: The perfect Github clone by Scala Naoki Takezoe @takezoen BizReach, Inc
  • 3. What’s GitBucket? • Open-Source Github clone based on Scala and JGit • Easy installation by pure JVM based solution • Main target is intranet users who can’t use Github by political reason
  • 4. Demo Demo site (Thanks to @xuwei_k) http://gitbucket.herokuapp.com/
  • 5. Over 3000 Stars, Thanks!! 3197stars!! at 18 Aug 2014
  • 6. Over 3000 Stars, Thanks!! Product Stars Scala 2785 Slick 952 Scalatra 1428 sbt 1921 Play2 5103 at 18 Aug 2014 Play is Great!!
  • 7. Features • Public / Private Git repository (http and ssh access) • Repository viewer and online file editing • Repository search (Code and Issues) • Wiki • Issues • Fork / Pull request • Mail notification • Activity timeline • User management (for Administrators) • Group (like Organization in Github) • LDAP integration • Gravatar support
  • 8. Easy Installation $ wget https://github.com/takezoe/gitbucket/ releases/download/2.3/gitbucket.war !$ java -jar gitbucket.war
  • 9. Showcase • docker-gitbucket https://github.com/f99aq8ove/docker-gitbucket • Jenkins GitBucket Plugin https://wiki.jenkins-ci.org/display/JENKINS/ GitBucket+Plugin • Amiage http://amiage.com/apps/gitbucket/
  • 10. About development of GitBucket
  • 13. and 36 Contributors but our resource is not enough...
  • 14. We need max development speed by the minimum cost
  • 16. Technologies • Scalatra • Twirl • Slick • JGit • H2 • Jetty • Apache MINA (Server-side)
  • 17. Technologies (Front-end) • jQuery + Plugins • Bootstrap2 • jsdifflib • google-code-prettify • AceEditor • DropZone • ZeroClipboard
  • 18. Architecture Git Client Web Browser SSH HTTP GitServlet Scalatra / Twirl Git Repository (Source code, Wiki) H2 Jetty (Account, Issues etc) MINA SSHD JGit Slick
  • 19. Technologies • Type safety supports our aggressive development • Based on existing Java resources • Pure JVM based solution makes easy installation
  • 20. Scalatra • Simple and powerful servlet based web framework inspired by Sinatra • More dynamic than Play2, but high extendibility class MyServlet extends ScalatraServlet with ScalateSupport {! get("/") {! <html>! <body>! <h1>Hello, world!</h1>! Say <a href="hello-scalate">hello to Scalate</a>.! </body>! </html>! }! }
  • 21. scalatra-forms • Extension library for Scalatra • Server side and client side validation at once case class SignInForm(userName: String, password: String)! ! val form = mapping(! "userName" -> trim(label("Username", text(required))),! "password" -> trim(label("Password", text(required)))! )(SignInForm.apply)! !! post("/signin", form){ form =>! authenticate(context.settings, form.userName, form.password) match {! case Some(account) => signin(account)! case None => redirect("/signin")! }! }
  • 22. scalatra-forms Send form data to /signin/validate by Ajax Validation result as JSON Web Browser Server Send form data to /signin if validation passed Response Added by scalatra-forms automatically Display errors if validation failed Validate again System error if validation failed
  • 23. Twirl • Scala syntax template compiler • Also used in Play2 @(systemSettings: service.SystemSettingsService.SystemSettings)(implicit context: app.Context)! @import context._! <div class="signin-form">! <div class="header-metal">! @if(systemSettings.allowAccountRegistration){! <div class="pull-right">! <a href="@path/register" class="btn btn-mini">Create new account</a>! </div>! }! Sign in! </div>! <div class="form-body">! <form action="@path/signin" method="POST" validate="true">! <label for="userName">Username:</label>! <span id="error-userName" class="error"></span>! <input type="text" name="userName" id="userName" style="width: 95%"/>! <label for="password">Password:</label>! <span id="error-password" class="error"></span>! <input type="password" name="password" id="password" style="width: 95%"/>! <div><input type="submit" class="btn btn-success" value="Sign in"/></div>! </form>! </div>! </div>
  • 24. Slick • Typesafe database query library • GitBucket does not use native SQL Issues filter { t1 =>! condition.repo! .map { _.split('/') match { case array => Seq(array(0) -> array(1)) } }! .getOrElse (repos)! .map { case (owner, repository) => t1.byRepository(owner, repository) }! .foldLeft[Column[Boolean]](false) ( _ || _ ) &&! (t1.closed === (condition.state == "closed").bind) &&! (t1.milestoneId === condition.milestoneId.get.get.bind, condition.milestoneId.flatten.isDefined) &&! (t1.milestoneId.? isEmpty, condition.milestoneId == Some(None)) &&! (t1.assignedUserName === filterUser("assigned").bind, filterUser.get("assigned").isDefined) &&! (t1.openedUserName === filterUser("created_by").bind, filterUser.get("created_by").isDefined) &&! (t1.openedUserName =!= filterUser("not_created_by").bind, filterUser.get("not_created_by").isDefined) &&! (t1.pullRequest === true.bind, onlyPullRequest) &&! (IssueLabels filter { t2 =>! (t2.byIssue(t1.userName, t1.repositoryName, t1.issueId)) &&! (t2.labelId in! (Labels filter { t3 =>! (t3.byRepository(t1.userName, t1.repositoryName)) &&! (t3.labelName inSetBind condition.labels)! } map(_.labelId)))! } exists, condition.labels.nonEmpty)
  • 25. JGit • Git implementation in Java • Includes GitServlet which provides Git server // Clone repository! Git.cloneRepository()! .setURI("https://github.com/takezoe/solr-scala-client.git")! .setDirectory(new File("git"))! .call()! ! // Show logs! val logs = Git.open(new java.io.File("git")).log().call()! logs.asScala.foreach { rev =>! println(rev.getCommitterIdent().getEmailAddress() + " - " + rev.getCommitTime())! println(rev.getFullMessage())! }
  • 26. H2 • Embeddable pure Java RDBMS • GitBucket has automatic migration system on H2 Differences of these SQLs are run in order.
  • 27. Apache MINA • Apache MINA is a framework for NIO based network applications • GitBucket uses MINA SSHD which is an sshd implementation based on MINA
  • 28. Apache MINA import org.apache.sshd.SshServer;! import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider;! import org.apache.sshd.server.shell.ProcessShellFactory;! import java.util.EnumSet;! ! public class Main {! ! public static void main(String[] args) throws Exception {! SshServer server = SshServer.setUpDefaultServer();! server.setPort(8080);! server.setKeyPairProvider(new SimpleGeneratorHostKeyProvider("key.ser"));! server.setPasswordAuthenticator((userName, password, serverSession) -> true);! server.setPublickeyAuthenticator((userName, publicKey, serverSession) -> true);! ! server.setShellFactory(new ProcessShellFactory(new String[]{"cmd.exe"},! EnumSet.of(! ProcessShellFactory.TtyOptions.Echo,! ProcessShellFactory.TtyOptions.ONlCr,! ProcessShellFactory.TtyOptions.ICrNl)));! ! server.start();! }! }
  • 29. Development Tools • Github • IntelliJ IDEA • Gitter • ZenHub
  • 30. Github • The greatest source code hosting service and social coding platform • We are always watching Github to catch up new features or changes
  • 31. IntelliJ IDEA • The best IDE for Scala • Not perfect, but practical enough • GitBucket project has OpenSource license
  • 32. Gitter • Chat service which has high affinity with Github • Sign-in by Github account • Chat room which corresponds to Github repository • Displays users who saw the message
  • 33. ZenHub • Provides “Kanban” to Github Issues by Chrome Extension • Visualizes issue status and priority
  • 34. Roadmap • Scala based plug-in system • Features for code review • Mobile support • Performance Improvement
  • 35. Gist Plugin Perfect Gist clone built on GitBucket
  • 37. Thanks! All feedback and contributions are always welcome. https://github.com/takezoe/gitbucket