SlideShare uma empresa Scribd logo
1 de 37
Inside Bokete:
Web Application with
Mojolicious and others.
Yusuke Wada a.k.a yusukebe
From Yokohama, Japan
2013-06-05
YAPC::NA 2013
Introduction of myself
- Yusuke Wada a.k.a yusukebe
- From Japan, Yokohama.
- A Web Application Enginner.
- CEO of Wadit Inc and CTO of Omoroki Inc.
- I got the award of the YAPC::Asia 2012 popularity vote.
- My trip is supported by Japan Perl Association.
Development of “Bokete”
My work
I spend a time to developing web site named “Bokete”. “Bokete” is my work.
What’s Bokete?
Bokete is Japanese popular entertainment web service like a 9gag.com.
- Japanese entertainment web service by Omoroki Inc.
- It’s like a 9gag.com
Bokete has ...
- Web site for PC browser and smart phone browser
- iOS App and Android App
- 3 hundred million Page View per month overall
- Backend system is written by me
Web site for PC and Smartphone browser, mobile application of iOS / Android are available in
Bokete. We have 3 hundred million page views per month overall. Backend system is written by
me.
http://bokete.jp/
Screenshot of web site
Screenshot of mobile App
Users generate contents
Bokete services
User who has funny things.
Post
See
User who want to laugh.
Bokete have a many contents generated by users. User who has funny things post the “boke” to
Bokete sites. And other users who want to laugh see these contents.
Boke
= Photo + Short Text
What are contents of Bokete?
So, what are contents of the Bokete? The answer is “Boke”. Boke is constructed of a photo and a
short text. Let’s see bokes on Bokete.
Boke No.1
You know, get this calmly.
You are hitting your referee.
Boke No.2
Who forgot a uniform ?
Boke No.3
Hey! You didn’t say UNO!!
Boke No.4
They give up.
Boke No.5
This man is the murderer.
How about bokes?
How about the bokes on Bokete? We have books of Bokete, so please ask me later if you have
interests of bokes. Then I’ll introduce backend system of Bokete.
System of Bokete
About using Perl
Technical topics
Bokete is made by Perl! We love Perl.
Structure of servers
Web App
EC2 Instances
Elastic Load Blancing
RDS
MySQL Master
RDS
MySQL Read Replica
API App
EC2 Instances
Elastic Load Blancing
Memcached Memcached
Browsers Mobile Apps
Using Mojolicious!
- Mojolicious as a Web Application Framework
- But Mojolicious is very “thin” not like a Ruby on Rails
- So, we should use other CPAN modules
- Many modules written by Japanese author are used
We use Mojolicious to implementing Bokete. Mojolicious is good Web Application Framework. But,
Mojolicious is very “thin” and too simple that is not like a Ruby on Rails. So, inside Bokete,
we use other CPAN modules that are written by Japanese Author. I think these modules are not so
popular in overseas from Japan. One of this talk theme is introduce Japanese CPAN modules.
PSGI/Plack
Interface between app and server
Enable to use Plack Middlewares and Starman/Starlet
as high-perfomance app server
PSGI
Web App
Web Application
Framework
Web Server
supports PSGI
Web App
Web Application
Framework
Web App
Web Application
Framework
Web Server
supports PSGI
Web Server
supports PSGI
Plack
Middleware
“.psgi” example
use Mojo::Server::PSGI;
use Plack::Builder;
use Bokete::Web;
my $psgi = Mojo::Server::PSGI->new( app => Bokete::Web->new );
my $app = $psgi->to_psgi_app;
builder {
enable "Runtime";
enable "ServerStatus::Lite",
path => '/server-status',
allow => [ '0.0.0.0/1' ],
scoreboard => '/var/run/server';
$psgi->to_psgi_app;
};
Add X-Runtime Header
It’s like a Apache’s mod_status
Mouse
Fast class builder
package Point;
use Mouse;
has 'x' => (is => 'rw', isa => 'Int');
has 'y' => (is => 'rw', isa => 'Int');
sub clear {
my($self) = @_;
$self->x(0);
$self->y(0);
}
1;
Moose compatible, Fast because using XS
and No dependencies.
DBIx::Skinny or Teng
Minimal O/R mapper
Supporting transaction, raw SQL, inflate/deflate
lightweight, and fast
Prepare your database on SQLite or MySQL, others.
package MyDB;
use DBIx::Skinny;
1;
Make some modules for Database access.
*Teng is newer version of DBIx::Skinny
Using DBIx::Skinny
use MyDB;
my $db = MyDB->new({ connect_info => [ 'dbi:SQLite:' ] });
$db->insert('table', { col => 'value' }); # Insert
my $row = $db->single('table', { id => 1 }); # Select
say $row->col;
my $iter = $db->search('table'); # Iterator instance
while ($row = $iter->next) {
say $row->col;
}
package MyDB::Schema;
use DBIx::Skinny::Schema;
install_table ‘table’ => schema {
pk ‘id’;
columns qw/id col/;
};
1;
FormValidator::Lite
A form validator
FormValidator::Lite->load_constraints(qw/Japanese Email/);
my $validator = FormValidator::Lite->new($self->req);
my $res -> $validator->check(
name => [qw/NOT_NULL/],
mail => [qw/EMAIL/],
{ mails => [qw/mail mail_confirm/] } => ['DUPLICATION']
);
if($validator->has_error) {
$self->stash->{messages} = $validator->get_error_messages();
return $self->render;
}
...;
Fast, simple, customizing error messages
HTML::FillInForm::Lite
fill HTML forms with Perl data
$self->helper(
render_fill => sub {
my ( $self, $template_name ) = @_;
my $html = $self->render_partial($template_name)->to_string;
return $self->render_text(
HTML::FillInForm::Lite->fill( $html, $self->req->params ),
format => 'html'
);
}
);
2 times faster than HTML::FillInForm
# In controller
return $self->render_fill(‘/post’) if $error;
HTML form is filled with request parameters
Shortcut method for controller
- Check request parameters
- Show error messages
- Fill HTML form with request parameters
sub post {
my $self = shift;
if($self->form('Post')->has_error) {
return $self->render_fill('/post');
}
}
Devel::KYTProf
Profiler for I/O blocking time
use Devel::KYTProf;
Carton / v0.9.15
Manager of Perl modules
Like a ruby bundler, using cpanfile
Carton manages
dependency of modules.
CPAN
modules
in App
An environment No.1
CPAN
modules
in App
An environment No.2
Same version modules
Carton is now
experimetal !
API is likely to chage.
Using Carton.
# on cpanfile
requires ‘Mojolicious’, 4.07;
requires ‘Mouse’;
requires ‘Teng’, 0.18;
$ carton install
$ carton exec -Ilib -- plackup myapp.psgi
carton.lock file is generated
and module files is installed into “local” directory
Execute perl command with core libraries and local libraries
Server::Starter
Daemon for hot-deploying
# On daemontools run script
start_server --port 8001 -- plackup -s Starman bokete_web.psgi
Supporting Starman/Starlet and other HTTP servers
$ sudo svc -h /service/bokete_web
To gracefully restart the server program,
sending SIGHUP to this daemon.
Cinnamon
Simple deployment tool
use Cinnamon::DSL;
set repository => 'git@github.com:yusukebe/MyApp.git';
role 'web' => [qw/001.server.name 002.server.name/],
{ deploy_to => '/home/user/www/myapp', branch => 'master', damoentools_dir => '/service/myapp' };
task deploy => {
setup => sub {
my ($host, @args) = @_;
my $repository = get('repository');
my $deploy_to = get('deploy_to');
my $branch = 'origin/' . get('branch');
remote {
run "git clone $repository $deploy_to && cd $deploy_to && git checkout -q $branch";
} $host;
}
};
$ cinnamon web deploy:setup
And many other modules
- Data::Validator - Validator for Perl data
- CloudForecast - Web Application for server monitoring
- Data::Page::Navigation - Pager
- Test::mysqld
- Plack::Middleware::ReverseProxy
- Plack::Middleware::AxsLog
- Starman
Bokete is supported by many CPAN Modules
Mojolicious is good but minimal.
We combine CPAN modules which is choosed.
It’s like LEGO blocks !!
Wrap-up
- I’ve talk about...
- Bokete as a Japanese entertainment web site
- We are using a Mojolicious !!
- Other CPAN modules by Japanese authors
- There is more than one way to develop web applications !!
And ...
YAPC::Asia 2013 will be held !
- September 19 - 21 on Keio University near the Tokyo .
- Early Bird Tickets On Sale ! - 1,000 JPY discounted .
- Talk submissions are accepted now .
- Most biggest YAPC in the world (Maybe) .
Thank you !!

Mais conteúdo relacionado

Mais procurados

Mojolicious. Веб в коробке!
Mojolicious. Веб в коробке!Mojolicious. Веб в коробке!
Mojolicious. Веб в коробке!Anatoly Sharifulin
 
Keeping it small - Getting to know the Slim PHP micro framework
Keeping it small - Getting to know the Slim PHP micro frameworkKeeping it small - Getting to know the Slim PHP micro framework
Keeping it small - Getting to know the Slim PHP micro frameworkJeremy Kendall
 
Mojolicious: what works and what doesn't
Mojolicious: what works and what doesn'tMojolicious: what works and what doesn't
Mojolicious: what works and what doesn'tCosimo Streppone
 
Asynchronous programming patterns in Perl
Asynchronous programming patterns in PerlAsynchronous programming patterns in Perl
Asynchronous programming patterns in Perldeepfountainconsulting
 
Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)
Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)
Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)Dotan Dimet
 
Slim RedBeanPHP and Knockout
Slim RedBeanPHP and KnockoutSlim RedBeanPHP and Knockout
Slim RedBeanPHP and KnockoutVic Metcalfe
 
Keeping it small: Getting to know the Slim micro framework
Keeping it small: Getting to know the Slim micro frameworkKeeping it small: Getting to know the Slim micro framework
Keeping it small: Getting to know the Slim micro frameworkJeremy Kendall
 
Perl: Hate it for the Right Reasons
Perl: Hate it for the Right ReasonsPerl: Hate it for the Right Reasons
Perl: Hate it for the Right ReasonsMatt Follett
 
Mojolicious, real-time web framework
Mojolicious, real-time web frameworkMojolicious, real-time web framework
Mojolicious, real-time web frameworktaggg
 
Keeping it Small: Getting to know the Slim Micro Framework
Keeping it Small: Getting to know the Slim Micro FrameworkKeeping it Small: Getting to know the Slim Micro Framework
Keeping it Small: Getting to know the Slim Micro FrameworkJeremy Kendall
 
Building Modern and Secure PHP Applications – Codementor Office Hours with Be...
Building Modern and Secure PHP Applications – Codementor Office Hours with Be...Building Modern and Secure PHP Applications – Codementor Office Hours with Be...
Building Modern and Secure PHP Applications – Codementor Office Hours with Be...Arc & Codementor
 
YAPC::Asia 2010 Twitter解析サービス
YAPC::Asia 2010 Twitter解析サービスYAPC::Asia 2010 Twitter解析サービス
YAPC::Asia 2010 Twitter解析サービスYusuke Wada
 
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryRemedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryTatsuhiko Miyagawa
 
AnyMQ, Hippie, and the real-time web
AnyMQ, Hippie, and the real-time webAnyMQ, Hippie, and the real-time web
AnyMQ, Hippie, and the real-time webclkao
 
A reviravolta do desenvolvimento web
A reviravolta do desenvolvimento webA reviravolta do desenvolvimento web
A reviravolta do desenvolvimento webWallace Reis
 
Extending the WordPress REST API - Josh Pollock
Extending the WordPress REST API - Josh PollockExtending the WordPress REST API - Josh Pollock
Extending the WordPress REST API - Josh PollockCaldera Labs
 

Mais procurados (20)

Mojolicious. Веб в коробке!
Mojolicious. Веб в коробке!Mojolicious. Веб в коробке!
Mojolicious. Веб в коробке!
 
Keeping it small - Getting to know the Slim PHP micro framework
Keeping it small - Getting to know the Slim PHP micro frameworkKeeping it small - Getting to know the Slim PHP micro framework
Keeping it small - Getting to know the Slim PHP micro framework
 
Mojolicious: what works and what doesn't
Mojolicious: what works and what doesn'tMojolicious: what works and what doesn't
Mojolicious: what works and what doesn't
 
Asynchronous programming patterns in Perl
Asynchronous programming patterns in PerlAsynchronous programming patterns in Perl
Asynchronous programming patterns in Perl
 
Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)
Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)
Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)
 
Mojolicious on Steroids
Mojolicious on SteroidsMojolicious on Steroids
Mojolicious on Steroids
 
Slim RedBeanPHP and Knockout
Slim RedBeanPHP and KnockoutSlim RedBeanPHP and Knockout
Slim RedBeanPHP and Knockout
 
Keeping it small: Getting to know the Slim micro framework
Keeping it small: Getting to know the Slim micro frameworkKeeping it small: Getting to know the Slim micro framework
Keeping it small: Getting to know the Slim micro framework
 
Perl: Hate it for the Right Reasons
Perl: Hate it for the Right ReasonsPerl: Hate it for the Right Reasons
Perl: Hate it for the Right Reasons
 
Mojolicious, real-time web framework
Mojolicious, real-time web frameworkMojolicious, real-time web framework
Mojolicious, real-time web framework
 
Keeping it Small: Getting to know the Slim Micro Framework
Keeping it Small: Getting to know the Slim Micro FrameworkKeeping it Small: Getting to know the Slim Micro Framework
Keeping it Small: Getting to know the Slim Micro Framework
 
Building Modern and Secure PHP Applications – Codementor Office Hours with Be...
Building Modern and Secure PHP Applications – Codementor Office Hours with Be...Building Modern and Secure PHP Applications – Codementor Office Hours with Be...
Building Modern and Secure PHP Applications – Codementor Office Hours with Be...
 
YAPC::Asia 2010 Twitter解析サービス
YAPC::Asia 2010 Twitter解析サービスYAPC::Asia 2010 Twitter解析サービス
YAPC::Asia 2010 Twitter解析サービス
 
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryRemedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
 
Blog Hacks 2011
Blog Hacks 2011Blog Hacks 2011
Blog Hacks 2011
 
AnyMQ, Hippie, and the real-time web
AnyMQ, Hippie, and the real-time webAnyMQ, Hippie, and the real-time web
AnyMQ, Hippie, and the real-time web
 
Tatsumaki
TatsumakiTatsumaki
Tatsumaki
 
Plack - LPW 2009
Plack - LPW 2009Plack - LPW 2009
Plack - LPW 2009
 
A reviravolta do desenvolvimento web
A reviravolta do desenvolvimento webA reviravolta do desenvolvimento web
A reviravolta do desenvolvimento web
 
Extending the WordPress REST API - Josh Pollock
Extending the WordPress REST API - Josh PollockExtending the WordPress REST API - Josh Pollock
Extending the WordPress REST API - Josh Pollock
 

Semelhante a Inside Bokete: Web Application with Mojolicious and others

Habitat hack slides - Infracoders Meetup Graz
Habitat hack slides - Infracoders Meetup GrazHabitat hack slides - Infracoders Meetup Graz
Habitat hack slides - Infracoders Meetup GrazInfralovers
 
node.js: Javascript's in your backend
node.js: Javascript's in your backendnode.js: Javascript's in your backend
node.js: Javascript's in your backendDavid Padbury
 
RoR (Ruby on Rails)
RoR (Ruby on Rails)RoR (Ruby on Rails)
RoR (Ruby on Rails)scandiweb
 
Cocoapods and Most common used library in Swift
Cocoapods and Most common used library in SwiftCocoapods and Most common used library in Swift
Cocoapods and Most common used library in SwiftWan Muzaffar Wan Hashim
 
Work Queues
Work QueuesWork Queues
Work Queuesciconf
 
DATABASE AUTOMATION with Thousands of database, monitoring and backup
DATABASE AUTOMATION with Thousands of database, monitoring and backupDATABASE AUTOMATION with Thousands of database, monitoring and backup
DATABASE AUTOMATION with Thousands of database, monitoring and backupSaewoong Lee
 
Ruby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developerRuby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developergicappa
 
Gearman and CodeIgniter
Gearman and CodeIgniterGearman and CodeIgniter
Gearman and CodeIgniterErik Giberti
 
DiUS Computing Lca Rails Final
DiUS  Computing Lca Rails FinalDiUS  Computing Lca Rails Final
DiUS Computing Lca Rails FinalRobert Postill
 
Rails Presentation (Anton Dmitriyev)
Rails Presentation (Anton Dmitriyev)Rails Presentation (Anton Dmitriyev)
Rails Presentation (Anton Dmitriyev)True-Vision
 
Using Ember to Make a Bazillion Dollars
Using Ember to Make a Bazillion DollarsUsing Ember to Make a Bazillion Dollars
Using Ember to Make a Bazillion DollarsMike Pack
 
CoffeeScript: A beginner's presentation for beginners copy
CoffeeScript: A beginner's presentation for beginners copyCoffeeScript: A beginner's presentation for beginners copy
CoffeeScript: A beginner's presentation for beginners copyPatrick Devins
 
Deploying your rails application to a clean ubuntu 10
Deploying your rails application to a clean ubuntu 10Deploying your rails application to a clean ubuntu 10
Deploying your rails application to a clean ubuntu 10Maurício Linhares
 
Intro to SpringBatch NoSQL 2021
Intro to SpringBatch NoSQL 2021Intro to SpringBatch NoSQL 2021
Intro to SpringBatch NoSQL 2021Slobodan Lohja
 
Practical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.jsPractical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.jsasync_io
 

Semelhante a Inside Bokete: Web Application with Mojolicious and others (20)

rails.html
rails.htmlrails.html
rails.html
 
rails.html
rails.htmlrails.html
rails.html
 
Habitat hack slides - Infracoders Meetup Graz
Habitat hack slides - Infracoders Meetup GrazHabitat hack slides - Infracoders Meetup Graz
Habitat hack slides - Infracoders Meetup Graz
 
Mojolicious
MojoliciousMojolicious
Mojolicious
 
Hack Rio/OS
Hack Rio/OSHack Rio/OS
Hack Rio/OS
 
node.js: Javascript's in your backend
node.js: Javascript's in your backendnode.js: Javascript's in your backend
node.js: Javascript's in your backend
 
RoR (Ruby on Rails)
RoR (Ruby on Rails)RoR (Ruby on Rails)
RoR (Ruby on Rails)
 
Cocoapods and Most common used library in Swift
Cocoapods and Most common used library in SwiftCocoapods and Most common used library in Swift
Cocoapods and Most common used library in Swift
 
Work Queues
Work QueuesWork Queues
Work Queues
 
DATABASE AUTOMATION with Thousands of database, monitoring and backup
DATABASE AUTOMATION with Thousands of database, monitoring and backupDATABASE AUTOMATION with Thousands of database, monitoring and backup
DATABASE AUTOMATION with Thousands of database, monitoring and backup
 
Ruby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developerRuby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developer
 
Gearman and CodeIgniter
Gearman and CodeIgniterGearman and CodeIgniter
Gearman and CodeIgniter
 
DiUS Computing Lca Rails Final
DiUS  Computing Lca Rails FinalDiUS  Computing Lca Rails Final
DiUS Computing Lca Rails Final
 
Rails Presentation (Anton Dmitriyev)
Rails Presentation (Anton Dmitriyev)Rails Presentation (Anton Dmitriyev)
Rails Presentation (Anton Dmitriyev)
 
Using Ember to Make a Bazillion Dollars
Using Ember to Make a Bazillion DollarsUsing Ember to Make a Bazillion Dollars
Using Ember to Make a Bazillion Dollars
 
CoffeeScript: A beginner's presentation for beginners copy
CoffeeScript: A beginner's presentation for beginners copyCoffeeScript: A beginner's presentation for beginners copy
CoffeeScript: A beginner's presentation for beginners copy
 
Sinatra for REST services
Sinatra for REST servicesSinatra for REST services
Sinatra for REST services
 
Deploying your rails application to a clean ubuntu 10
Deploying your rails application to a clean ubuntu 10Deploying your rails application to a clean ubuntu 10
Deploying your rails application to a clean ubuntu 10
 
Intro to SpringBatch NoSQL 2021
Intro to SpringBatch NoSQL 2021Intro to SpringBatch NoSQL 2021
Intro to SpringBatch NoSQL 2021
 
Practical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.jsPractical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.js
 

Mais de Yusuke Wada

僕がつくった 70個のうちの48個のWebサービス達
僕がつくった 70個のうちの48個のWebサービス達僕がつくった 70個のうちの48個のWebサービス達
僕がつくった 70個のうちの48個のWebサービス達Yusuke Wada
 
スッとGoを取り入れる
スッとGoを取り入れるスッとGoを取り入れる
スッとGoを取り入れるYusuke Wada
 
東京脱出計画中
東京脱出計画中東京脱出計画中
東京脱出計画中Yusuke Wada
 
Extreme remote working
Extreme remote workingExtreme remote working
Extreme remote workingYusuke Wada
 
Podcastを支える技術、エンジニアのためのWebメディア、そしてCPAN
Podcastを支える技術、エンジニアのためのWebメディア、そしてCPANPodcastを支える技術、エンジニアのためのWebメディア、そしてCPAN
Podcastを支える技術、エンジニアのためのWebメディア、そしてCPANYusuke Wada
 
創造のプロセスを回せ!v0.01
創造のプロセスを回せ!v0.01創造のプロセスを回せ!v0.01
創造のプロセスを回せ!v0.01Yusuke Wada
 
It's not only about "REMOTE"
It's not only about "REMOTE"It's not only about "REMOTE"
It's not only about "REMOTE"Yusuke Wada
 
事故からはじまるスケールチャンス
事故からはじまるスケールチャンス事故からはじまるスケールチャンス
事故からはじまるスケールチャンスYusuke Wada
 
Google BigQueryを使ってみた!
Google BigQueryを使ってみた!Google BigQueryを使ってみた!
Google BigQueryを使ってみた!Yusuke Wada
 
Webサービスのコンテンツパターン 或いはデータの活⽤
Webサービスのコンテンツパターン 或いはデータの活⽤Webサービスのコンテンツパターン 或いはデータの活⽤
Webサービスのコンテンツパターン 或いはデータの活⽤Yusuke Wada
 
とある Perl Monger の働き方
とある Perl Monger の働き方とある Perl Monger の働き方
とある Perl Monger の働き方Yusuke Wada
 
5 minutes - YAPC::Asia Tokyo 2014
5 minutes - YAPC::Asia Tokyo 20145 minutes - YAPC::Asia Tokyo 2014
5 minutes - YAPC::Asia Tokyo 2014Yusuke Wada
 
Podcastをカジュアルに 支える技術
Podcastをカジュアルに 支える技術Podcastをカジュアルに 支える技術
Podcastをカジュアルに 支える技術Yusuke Wada
 
The master plan of scaling a web application
The master plan ofscaling a web applicationThe master plan ofscaling a web application
The master plan of scaling a web applicationYusuke Wada
 
そのWebサービスは本当に「あたりまえ」だったのか?
そのWebサービスは本当に「あたりまえ」だったのか?そのWebサービスは本当に「あたりまえ」だったのか?
そのWebサービスは本当に「あたりまえ」だったのか?Yusuke Wada
 
Mojoliciousでつくる! Webアプリ入門
Mojoliciousでつくる! Webアプリ入門Mojoliciousでつくる! Webアプリ入門
Mojoliciousでつくる! Webアプリ入門Yusuke Wada
 
10 things to learn from Bokete
10 things to learn from Bokete10 things to learn from Bokete
10 things to learn from BoketeYusuke Wada
 
僕らの履歴書
僕らの履歴書僕らの履歴書
僕らの履歴書Yusuke Wada
 
僕らがWebサービスをつくる5つの理由
僕らがWebサービスをつくる5つの理由僕らがWebサービスをつくる5つの理由
僕らがWebサービスをつくる5つの理由Yusuke Wada
 
僕らがつくるための 「5W」について
僕らがつくるための 「5W」について僕らがつくるための 「5W」について
僕らがつくるための 「5W」についてYusuke Wada
 

Mais de Yusuke Wada (20)

僕がつくった 70個のうちの48個のWebサービス達
僕がつくった 70個のうちの48個のWebサービス達僕がつくった 70個のうちの48個のWebサービス達
僕がつくった 70個のうちの48個のWebサービス達
 
スッとGoを取り入れる
スッとGoを取り入れるスッとGoを取り入れる
スッとGoを取り入れる
 
東京脱出計画中
東京脱出計画中東京脱出計画中
東京脱出計画中
 
Extreme remote working
Extreme remote workingExtreme remote working
Extreme remote working
 
Podcastを支える技術、エンジニアのためのWebメディア、そしてCPAN
Podcastを支える技術、エンジニアのためのWebメディア、そしてCPANPodcastを支える技術、エンジニアのためのWebメディア、そしてCPAN
Podcastを支える技術、エンジニアのためのWebメディア、そしてCPAN
 
創造のプロセスを回せ!v0.01
創造のプロセスを回せ!v0.01創造のプロセスを回せ!v0.01
創造のプロセスを回せ!v0.01
 
It's not only about "REMOTE"
It's not only about "REMOTE"It's not only about "REMOTE"
It's not only about "REMOTE"
 
事故からはじまるスケールチャンス
事故からはじまるスケールチャンス事故からはじまるスケールチャンス
事故からはじまるスケールチャンス
 
Google BigQueryを使ってみた!
Google BigQueryを使ってみた!Google BigQueryを使ってみた!
Google BigQueryを使ってみた!
 
Webサービスのコンテンツパターン 或いはデータの活⽤
Webサービスのコンテンツパターン 或いはデータの活⽤Webサービスのコンテンツパターン 或いはデータの活⽤
Webサービスのコンテンツパターン 或いはデータの活⽤
 
とある Perl Monger の働き方
とある Perl Monger の働き方とある Perl Monger の働き方
とある Perl Monger の働き方
 
5 minutes - YAPC::Asia Tokyo 2014
5 minutes - YAPC::Asia Tokyo 20145 minutes - YAPC::Asia Tokyo 2014
5 minutes - YAPC::Asia Tokyo 2014
 
Podcastをカジュアルに 支える技術
Podcastをカジュアルに 支える技術Podcastをカジュアルに 支える技術
Podcastをカジュアルに 支える技術
 
The master plan of scaling a web application
The master plan ofscaling a web applicationThe master plan ofscaling a web application
The master plan of scaling a web application
 
そのWebサービスは本当に「あたりまえ」だったのか?
そのWebサービスは本当に「あたりまえ」だったのか?そのWebサービスは本当に「あたりまえ」だったのか?
そのWebサービスは本当に「あたりまえ」だったのか?
 
Mojoliciousでつくる! Webアプリ入門
Mojoliciousでつくる! Webアプリ入門Mojoliciousでつくる! Webアプリ入門
Mojoliciousでつくる! Webアプリ入門
 
10 things to learn from Bokete
10 things to learn from Bokete10 things to learn from Bokete
10 things to learn from Bokete
 
僕らの履歴書
僕らの履歴書僕らの履歴書
僕らの履歴書
 
僕らがWebサービスをつくる5つの理由
僕らがWebサービスをつくる5つの理由僕らがWebサービスをつくる5つの理由
僕らがWebサービスをつくる5つの理由
 
僕らがつくるための 「5W」について
僕らがつくるための 「5W」について僕らがつくるための 「5W」について
僕らがつくるための 「5W」について
 

Último

Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 

Último (20)

Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 

Inside Bokete: Web Application with Mojolicious and others

  • 1. Inside Bokete: Web Application with Mojolicious and others. Yusuke Wada a.k.a yusukebe From Yokohama, Japan 2013-06-05 YAPC::NA 2013
  • 2. Introduction of myself - Yusuke Wada a.k.a yusukebe - From Japan, Yokohama. - A Web Application Enginner. - CEO of Wadit Inc and CTO of Omoroki Inc. - I got the award of the YAPC::Asia 2012 popularity vote. - My trip is supported by Japan Perl Association.
  • 3. Development of “Bokete” My work I spend a time to developing web site named “Bokete”. “Bokete” is my work.
  • 4. What’s Bokete? Bokete is Japanese popular entertainment web service like a 9gag.com. - Japanese entertainment web service by Omoroki Inc. - It’s like a 9gag.com
  • 5. Bokete has ... - Web site for PC browser and smart phone browser - iOS App and Android App - 3 hundred million Page View per month overall - Backend system is written by me Web site for PC and Smartphone browser, mobile application of iOS / Android are available in Bokete. We have 3 hundred million page views per month overall. Backend system is written by me. http://bokete.jp/
  • 8. Users generate contents Bokete services User who has funny things. Post See User who want to laugh. Bokete have a many contents generated by users. User who has funny things post the “boke” to Bokete sites. And other users who want to laugh see these contents.
  • 9. Boke = Photo + Short Text What are contents of Bokete? So, what are contents of the Bokete? The answer is “Boke”. Boke is constructed of a photo and a short text. Let’s see bokes on Bokete.
  • 10. Boke No.1 You know, get this calmly. You are hitting your referee.
  • 11. Boke No.2 Who forgot a uniform ?
  • 12. Boke No.3 Hey! You didn’t say UNO!!
  • 14. Boke No.5 This man is the murderer.
  • 15. How about bokes? How about the bokes on Bokete? We have books of Bokete, so please ask me later if you have interests of bokes. Then I’ll introduce backend system of Bokete.
  • 16. System of Bokete About using Perl Technical topics Bokete is made by Perl! We love Perl.
  • 17. Structure of servers Web App EC2 Instances Elastic Load Blancing RDS MySQL Master RDS MySQL Read Replica API App EC2 Instances Elastic Load Blancing Memcached Memcached Browsers Mobile Apps
  • 18. Using Mojolicious! - Mojolicious as a Web Application Framework - But Mojolicious is very “thin” not like a Ruby on Rails - So, we should use other CPAN modules - Many modules written by Japanese author are used We use Mojolicious to implementing Bokete. Mojolicious is good Web Application Framework. But, Mojolicious is very “thin” and too simple that is not like a Ruby on Rails. So, inside Bokete, we use other CPAN modules that are written by Japanese Author. I think these modules are not so popular in overseas from Japan. One of this talk theme is introduce Japanese CPAN modules.
  • 19. PSGI/Plack Interface between app and server Enable to use Plack Middlewares and Starman/Starlet as high-perfomance app server PSGI Web App Web Application Framework Web Server supports PSGI Web App Web Application Framework Web App Web Application Framework Web Server supports PSGI Web Server supports PSGI Plack Middleware
  • 20. “.psgi” example use Mojo::Server::PSGI; use Plack::Builder; use Bokete::Web; my $psgi = Mojo::Server::PSGI->new( app => Bokete::Web->new ); my $app = $psgi->to_psgi_app; builder { enable "Runtime"; enable "ServerStatus::Lite", path => '/server-status', allow => [ '0.0.0.0/1' ], scoreboard => '/var/run/server'; $psgi->to_psgi_app; }; Add X-Runtime Header It’s like a Apache’s mod_status
  • 21. Mouse Fast class builder package Point; use Mouse; has 'x' => (is => 'rw', isa => 'Int'); has 'y' => (is => 'rw', isa => 'Int'); sub clear { my($self) = @_; $self->x(0); $self->y(0); } 1; Moose compatible, Fast because using XS and No dependencies.
  • 22. DBIx::Skinny or Teng Minimal O/R mapper Supporting transaction, raw SQL, inflate/deflate lightweight, and fast Prepare your database on SQLite or MySQL, others. package MyDB; use DBIx::Skinny; 1; Make some modules for Database access. *Teng is newer version of DBIx::Skinny
  • 23. Using DBIx::Skinny use MyDB; my $db = MyDB->new({ connect_info => [ 'dbi:SQLite:' ] }); $db->insert('table', { col => 'value' }); # Insert my $row = $db->single('table', { id => 1 }); # Select say $row->col; my $iter = $db->search('table'); # Iterator instance while ($row = $iter->next) { say $row->col; } package MyDB::Schema; use DBIx::Skinny::Schema; install_table ‘table’ => schema { pk ‘id’; columns qw/id col/; }; 1;
  • 24. FormValidator::Lite A form validator FormValidator::Lite->load_constraints(qw/Japanese Email/); my $validator = FormValidator::Lite->new($self->req); my $res -> $validator->check( name => [qw/NOT_NULL/], mail => [qw/EMAIL/], { mails => [qw/mail mail_confirm/] } => ['DUPLICATION'] ); if($validator->has_error) { $self->stash->{messages} = $validator->get_error_messages(); return $self->render; } ...; Fast, simple, customizing error messages
  • 25. HTML::FillInForm::Lite fill HTML forms with Perl data $self->helper( render_fill => sub { my ( $self, $template_name ) = @_; my $html = $self->render_partial($template_name)->to_string; return $self->render_text( HTML::FillInForm::Lite->fill( $html, $self->req->params ), format => 'html' ); } ); 2 times faster than HTML::FillInForm # In controller return $self->render_fill(‘/post’) if $error;
  • 26. HTML form is filled with request parameters
  • 27. Shortcut method for controller - Check request parameters - Show error messages - Fill HTML form with request parameters sub post { my $self = shift; if($self->form('Post')->has_error) { return $self->render_fill('/post'); } }
  • 28. Devel::KYTProf Profiler for I/O blocking time use Devel::KYTProf;
  • 29. Carton / v0.9.15 Manager of Perl modules Like a ruby bundler, using cpanfile Carton manages dependency of modules. CPAN modules in App An environment No.1 CPAN modules in App An environment No.2 Same version modules Carton is now experimetal ! API is likely to chage.
  • 30. Using Carton. # on cpanfile requires ‘Mojolicious’, 4.07; requires ‘Mouse’; requires ‘Teng’, 0.18; $ carton install $ carton exec -Ilib -- plackup myapp.psgi carton.lock file is generated and module files is installed into “local” directory Execute perl command with core libraries and local libraries
  • 31. Server::Starter Daemon for hot-deploying # On daemontools run script start_server --port 8001 -- plackup -s Starman bokete_web.psgi Supporting Starman/Starlet and other HTTP servers $ sudo svc -h /service/bokete_web To gracefully restart the server program, sending SIGHUP to this daemon.
  • 32. Cinnamon Simple deployment tool use Cinnamon::DSL; set repository => 'git@github.com:yusukebe/MyApp.git'; role 'web' => [qw/001.server.name 002.server.name/], { deploy_to => '/home/user/www/myapp', branch => 'master', damoentools_dir => '/service/myapp' }; task deploy => { setup => sub { my ($host, @args) = @_; my $repository = get('repository'); my $deploy_to = get('deploy_to'); my $branch = 'origin/' . get('branch'); remote { run "git clone $repository $deploy_to && cd $deploy_to && git checkout -q $branch"; } $host; } }; $ cinnamon web deploy:setup
  • 33. And many other modules - Data::Validator - Validator for Perl data - CloudForecast - Web Application for server monitoring - Data::Page::Navigation - Pager - Test::mysqld - Plack::Middleware::ReverseProxy - Plack::Middleware::AxsLog - Starman
  • 34. Bokete is supported by many CPAN Modules Mojolicious is good but minimal. We combine CPAN modules which is choosed. It’s like LEGO blocks !!
  • 35. Wrap-up - I’ve talk about... - Bokete as a Japanese entertainment web site - We are using a Mojolicious !! - Other CPAN modules by Japanese authors - There is more than one way to develop web applications !! And ...
  • 36. YAPC::Asia 2013 will be held ! - September 19 - 21 on Keio University near the Tokyo . - Early Bird Tickets On Sale ! - 1,000 JPY discounted . - Talk submissions are accepted now . - Most biggest YAPC in the world (Maybe) .