SlideShare a Scribd company logo
フレームワークでシステム管理アプリケーションプログラミングをもっと簡単に
About me Gosuke Miyashita mizzy.org Working at paperboy&co. Recently, released the photo album service “30days album” (http://30d.jp/) Total technical design, storage api programming, server settings I love Dr.Pepper
With lots of Dr.Peppers
 
System Admin Application Framework? A framework for system admin app WAF for sysadmin Func (Fedora Unified Network Controller) is a kind of it Although Func deoesn’t describe itself a framework I’m devloping Punc, a perl colne of Func.
System Admin Application? Basically “Exec some operations for multiple hosts” Easy to say, but ... How to select target hosts? How to connect to target hosts? How about security? How about getting results and parsing them How to reuse codes?
Framework? Hide the issues on previous page and you can concentrate for your really job Selecting target hosts? $punc = Punc::Client->new( ‘*’ ); $punc = Punc::Client->new( ‘www*’ ); Connect  to target hosts and security $res = $punc-> service -> status ({ service =>  ‘httpd’  }); You can get the status of httpd of all taget hosts. Behind it, JSON-RPC over HTTPS + SSLv3 Auth
Framework? (cont.) Getting results and parse them Scalar, hash or array via JSON-RPC Reusability of code Punc consists of small modules. $punc-> service -> status (); Programming with combination of small modules
Framework! use Punc::Client; my $punc = Punc::Client->new( '*' ); my $res  = $punc-> service -> status ({ service =>  'httpd' }); while ( my $r = $res->next ) { Punc::Client->new( $r->host ) -> service -> start ({ service =>  'httpd' }) if $r->result; }
 
Punc A perl clone of Func Why I’m developing Punc? Func only works on RedHat linux Func does not have abstract layer of different environments I LOVE Perl!
Architecture of Punc get a result call a module exec a module exec a module exec a module JSON-RPC over HTTPS + SSLv3 auth Manage target hosts Manage SSL certs master (puncmasterd) slave (puncd) slave (puncd) slave (puncd)
See http://coderepos.org/share/wiki/Punc
Checkout Punc $  svn co http://svn.coderepos.org/share/lang/perl/Punc/trunk Punc $ cd Punc
Start puncmasterd ; Create self-signed cert  ; automatically and start with https $ ./bin/puncmasterd Please contact me at: <URL:https://host.example.com:7081/>
Start puncd $ ./bin/puncd (Request  a CSR to puncmaster and waiting it signed)
Sign to the CSR $ ./bin/puncmaster-ca --list host.example.com $ ./bin/puncmaster-ca --sign host.example.com
Now puncd working! $ ./bin/puncd Please contact me at: <URL:https://host.example.com:7080/>
Use Punc with punc command $ ./bin/punc  &quot;*&quot;  call  service   description NAME Punc::Slave::Module::Service - Punc module for service control. SYNOPSIS # with punc command $ sudo punc &quot;*&quot; call service status --service=httpd # with Punc::Client module my $punc = Punc::Client->new($target); my $res = $punc->service->status({ service => 'httpd' }); ...
Use Punc with Punc::Client use Punc::Client; my $punc = Punc::Client->new( '*' ); my $res  = $punc-> service -> status ({ service => 'httpd‘ }); while ( my $r = $res->next ) { Punc->new($r->host)- >service -> start ({ service =>  'httpd'  }) if $r->result; }
 
virt module(not yet exist) my $punc = Punc::Client->new( '*' ); my $res  = $punc-> virt -> state ; while ( my $r = $res->next ) { next if $r->error; for my $vm ( @{ $r->vms } ) { if ( $vm->{state} eq  'shutdown'  ) { Punc->new($r->host)-> virt -> create ($vm->{domain}) } } }
smart module(not yet exist) my $punc  = Punc::Client->new( '*' ); my $result = $punc-> smart -> info ; while ( my $r = $result->next ) { unless ( $r->code ) { print &quot;$r->host has error: &quot;; print $r->detail . &quot;\n&quot;; } }
 
Punc module Module is distributed and executed on each targeted hosts Master host calls modules on targeted hosts via punc command or Punc::Client
Architecture of Punc(again) get a result call a module exec a module exec a module exec a module JSON-RPC over HTTPS + SSLv3 auth Manage target hosts Manage SSL certs master (puncmasterd) slave (puncd) slave (puncd) slave (puncd)
file module package Punc::Slave::Module::File; use Path::Class qw( dir file ); use Punc::Slave::Module { operatingsystem => [ qw/  .*  / ] }; sub md5sum { my ( $self, $args ) = @_; return `md5sum $args->{file}`; } sub copy { ...
service module(for Red Hat) package Punc::Slave::Module::Service::RedHat; use Punc::Slave::Module::Service { operatingsystem => [ qw /  redhat centos fedora  / ] }; use Moose; with 'Punc::Slave::Module::Service::Role'; sub status { my ( $self, $args ) = @_; return $self->_command($args->{service}, 'status');  }
service module(for Debian) package Punc::Slave::Module::Service::Debian; use Punc::Slave::Module::Service { operatingsystem => [ qw /  debian ubuntu  / ] }; use Moose; with 'Punc::Slave::Module::Service::Role'; sub status { my ( $self, $args ) = @_; return $self->_command($args->{service}, 'status');  }
Abstraction layer with Pfacter Automatically detect a targeted host’s environmant and execute a adequate module Punc uses Pfacter for this purpose Pfacter is a perl clone of Facter by Ruby Facter is used with Puppet
Return values of a module # return scalar, hash ref, or array ref on success return $result;  # return an error using Class::ErrorHandler return $self->error(‘error message’);
Module sync Mosules must be distributed to slaves Punc has punc-modulesync command punc-modulesync made with file module
Summary Punc is a framework for sysatem admin app programming Modules are executed on each slave node Master calls modules via JSON-RPC over HTTPS Programming with Punc is a combination of module calls Caller programs could be written by langauages other than Perl
Development in progress Code repository is in CodeRepos http://coderepos.org/share/ http://svn.coderepos.org/share/lang/perl/Punc/trunk Feel free to commit to trunk or make your branch! Please ask yappo if you don’t have a commit bit of CodeRepos #coderepos@freenode or #assurer@freenode
 

More Related Content

PPT
Assurer - a pluggable server testing/monitoring framework
PDF
Symfony2 Components - The Event Dispatcher
PDF
Node.js API 서버 성능 개선기
PPTX
Perl: Coro asynchronous
PDF
Any event intro
PDF
Asynchronous Programming FTW! 2 (with AnyEvent)
PDF
Asynchronous programming done right - Node.js
PDF
Beautiful code instead of callback hell using ES6 Generators, Koa, Bluebird (...
Assurer - a pluggable server testing/monitoring framework
Symfony2 Components - The Event Dispatcher
Node.js API 서버 성능 개선기
Perl: Coro asynchronous
Any event intro
Asynchronous Programming FTW! 2 (with AnyEvent)
Asynchronous programming done right - Node.js
Beautiful code instead of callback hell using ES6 Generators, Koa, Bluebird (...

What's hot (20)

PDF
Server-Side Push: Comet, Web Sockets come of age (OSCON 2013)
PPTX
Avoiding callback hell in Node js using promises
PDF
Workshop 10: ECMAScript 6
ODP
Anyevent
PPTX
C to perl binding
ODP
Integrating icinga2 and the HashiCorp suite
PDF
Speed up web APIs with Expressive and Swoole (PHP Day 2018)
PDF
Using Node.js to Build Great Streaming Services - HTML5 Dev Conf
PPTX
The Promised Land (in Angular)
PPTX
ES6, 잘 쓰고 계시죠?
PDF
Xdebug - Derick Rethans - Barcelona PHP Conference 2008
PPTX
Design patterns as power of programing
ODP
nginx mod PSGI
PPTX
Nevermore Unit Testing
PDF
Callbacks, promises, generators - asynchronous javascript
PDF
RabbitMQ for Perl mongers
PDF
Observability with Consul Connect
PDF
Implementações paralelas
ZIP
AnyMQ, Hippie, and the real-time web
PDF
Background Jobs - Com BackgrounDRb
Server-Side Push: Comet, Web Sockets come of age (OSCON 2013)
Avoiding callback hell in Node js using promises
Workshop 10: ECMAScript 6
Anyevent
C to perl binding
Integrating icinga2 and the HashiCorp suite
Speed up web APIs with Expressive and Swoole (PHP Day 2018)
Using Node.js to Build Great Streaming Services - HTML5 Dev Conf
The Promised Land (in Angular)
ES6, 잘 쓰고 계시죠?
Xdebug - Derick Rethans - Barcelona PHP Conference 2008
Design patterns as power of programing
nginx mod PSGI
Nevermore Unit Testing
Callbacks, promises, generators - asynchronous javascript
RabbitMQ for Perl mongers
Observability with Consul Connect
Implementações paralelas
AnyMQ, Hippie, and the real-time web
Background Jobs - Com BackgrounDRb
Ad

Viewers also liked (7)

PPT
Las Jornadas En La Prensa
PPT
Proyecto Les 5to
PPS
Leccionesdeestrategiaempresarial Tinci
PDF
Pembangunan Menuju Bangsa yang Maju dan Mandiri
PPS
Estas Muy Ocupado
PPS
PPS
Las Jornadas En La Prensa
Proyecto Les 5to
Leccionesdeestrategiaempresarial Tinci
Pembangunan Menuju Bangsa yang Maju dan Mandiri
Estas Muy Ocupado
Ad

Similar to Yapc::Asia 2008 Tokyo - Easy system administration programming with a framework by Gosuke Miyashita (16)

PDF
Puppet and the HashiStack
PPS
A Presentation about Puppet that I've made at the OSSPAC conference
ODP
Tame your Infrastructure with Puppet
PDF
Puppet at GitHub
PDF
PuppetDB: Sneaking Clojure into Operations
PDF
From SaltStack to Puppet and beyond...
PDF
The (mutable) config management showdown
KEY
Puppet for Java developers - JavaZone NO 2012
PDF
Puppet Systems Infrastructure Construction Kit
PDF
Demystifying puppet
KEY
Puppet
PDF
Creating a mature puppet system
PDF
Creating a Mature Puppet System
PDF
Islands: Puppet at Bulletproof Networks
PPT
Adventures in infrastructure as code
Puppet and the HashiStack
A Presentation about Puppet that I've made at the OSSPAC conference
Tame your Infrastructure with Puppet
Puppet at GitHub
PuppetDB: Sneaking Clojure into Operations
From SaltStack to Puppet and beyond...
The (mutable) config management showdown
Puppet for Java developers - JavaZone NO 2012
Puppet Systems Infrastructure Construction Kit
Demystifying puppet
Puppet
Creating a mature puppet system
Creating a Mature Puppet System
Islands: Puppet at Bulletproof Networks
Adventures in infrastructure as code

More from Gosuke Miyashita (20)

PDF
Walter ファミリーの紹介 at Shibuya.go#1
PDF
Serverspec at Testing Framework Meeting
PPTX
Serverspec at July Tech Festa 2013
PPTX
Serverspec at hbstudy #45
PPTX
NoSQLに関するまとめ
PPTX
イベント駆動プログラミングとI/O多重化
PPTX
Maglica - A Simple Internal Cloud Tool at #techkayac
PPTX
DevOps とは何か 何であるべきか
PPTX
Inside Sqale's Backend at RubyConf Taiwan 2012
PPTX
Ia型超新星とチャンドラセカール限界
PPTX
How Perl Changed My Life
PPTX
Inside Sqale's Backend at YAPC::Asia Tokyo 2012
PPTX
Inside Sqale's Backend at Sapporo Ruby Kaigi 2012
PPTX
Open Source System Administration Framework - Func
PPTX
10分でわかるDevOps
PPTX
DevOpsって何?
PPTX
Puppetのススメ
PPT
Puppet Best Practices? at COOKPAD
PPT
How Danga::Socket handles asynchronous processing and how to write asynchrono...
PPT
Danga::Socketの非同期処理の仕組みとPerlbalで非同期処理するプラグインを書く方法
Walter ファミリーの紹介 at Shibuya.go#1
Serverspec at Testing Framework Meeting
Serverspec at July Tech Festa 2013
Serverspec at hbstudy #45
NoSQLに関するまとめ
イベント駆動プログラミングとI/O多重化
Maglica - A Simple Internal Cloud Tool at #techkayac
DevOps とは何か 何であるべきか
Inside Sqale's Backend at RubyConf Taiwan 2012
Ia型超新星とチャンドラセカール限界
How Perl Changed My Life
Inside Sqale's Backend at YAPC::Asia Tokyo 2012
Inside Sqale's Backend at Sapporo Ruby Kaigi 2012
Open Source System Administration Framework - Func
10分でわかるDevOps
DevOpsって何?
Puppetのススメ
Puppet Best Practices? at COOKPAD
How Danga::Socket handles asynchronous processing and how to write asynchrono...
Danga::Socketの非同期処理の仕組みとPerlbalで非同期処理するプラグインを書く方法

Recently uploaded (20)

PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Machine Learning_overview_presentation.pptx
PDF
Encapsulation theory and applications.pdf
PDF
cuic standard and advanced reporting.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
A Presentation on Artificial Intelligence
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Machine Learning_overview_presentation.pptx
Encapsulation theory and applications.pdf
cuic standard and advanced reporting.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Network Security Unit 5.pdf for BCA BBA.
A Presentation on Artificial Intelligence
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Assigned Numbers - 2025 - Bluetooth® Document
“AI and Expert System Decision Support & Business Intelligence Systems”
Digital-Transformation-Roadmap-for-Companies.pptx
Per capita expenditure prediction using model stacking based on satellite ima...
Encapsulation_ Review paper, used for researhc scholars
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
NewMind AI Weekly Chronicles - August'25-Week II
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
Unlocking AI with Model Context Protocol (MCP)
Reach Out and Touch Someone: Haptics and Empathic Computing

Yapc::Asia 2008 Tokyo - Easy system administration programming with a framework by Gosuke Miyashita

  • 2. About me Gosuke Miyashita mizzy.org Working at paperboy&co. Recently, released the photo album service “30days album” (http://30d.jp/) Total technical design, storage api programming, server settings I love Dr.Pepper
  • 3. With lots of Dr.Peppers
  • 4.  
  • 5. System Admin Application Framework? A framework for system admin app WAF for sysadmin Func (Fedora Unified Network Controller) is a kind of it Although Func deoesn’t describe itself a framework I’m devloping Punc, a perl colne of Func.
  • 6. System Admin Application? Basically “Exec some operations for multiple hosts” Easy to say, but ... How to select target hosts? How to connect to target hosts? How about security? How about getting results and parsing them How to reuse codes?
  • 7. Framework? Hide the issues on previous page and you can concentrate for your really job Selecting target hosts? $punc = Punc::Client->new( ‘*’ ); $punc = Punc::Client->new( ‘www*’ ); Connect to target hosts and security $res = $punc-> service -> status ({ service => ‘httpd’ }); You can get the status of httpd of all taget hosts. Behind it, JSON-RPC over HTTPS + SSLv3 Auth
  • 8. Framework? (cont.) Getting results and parse them Scalar, hash or array via JSON-RPC Reusability of code Punc consists of small modules. $punc-> service -> status (); Programming with combination of small modules
  • 9. Framework! use Punc::Client; my $punc = Punc::Client->new( '*' ); my $res = $punc-> service -> status ({ service => 'httpd' }); while ( my $r = $res->next ) { Punc::Client->new( $r->host ) -> service -> start ({ service => 'httpd' }) if $r->result; }
  • 10.  
  • 11. Punc A perl clone of Func Why I’m developing Punc? Func only works on RedHat linux Func does not have abstract layer of different environments I LOVE Perl!
  • 12. Architecture of Punc get a result call a module exec a module exec a module exec a module JSON-RPC over HTTPS + SSLv3 auth Manage target hosts Manage SSL certs master (puncmasterd) slave (puncd) slave (puncd) slave (puncd)
  • 14. Checkout Punc $ svn co http://svn.coderepos.org/share/lang/perl/Punc/trunk Punc $ cd Punc
  • 15. Start puncmasterd ; Create self-signed cert ; automatically and start with https $ ./bin/puncmasterd Please contact me at: <URL:https://host.example.com:7081/>
  • 16. Start puncd $ ./bin/puncd (Request a CSR to puncmaster and waiting it signed)
  • 17. Sign to the CSR $ ./bin/puncmaster-ca --list host.example.com $ ./bin/puncmaster-ca --sign host.example.com
  • 18. Now puncd working! $ ./bin/puncd Please contact me at: <URL:https://host.example.com:7080/>
  • 19. Use Punc with punc command $ ./bin/punc &quot;*&quot; call service description NAME Punc::Slave::Module::Service - Punc module for service control. SYNOPSIS # with punc command $ sudo punc &quot;*&quot; call service status --service=httpd # with Punc::Client module my $punc = Punc::Client->new($target); my $res = $punc->service->status({ service => 'httpd' }); ...
  • 20. Use Punc with Punc::Client use Punc::Client; my $punc = Punc::Client->new( '*' ); my $res = $punc-> service -> status ({ service => 'httpd‘ }); while ( my $r = $res->next ) { Punc->new($r->host)- >service -> start ({ service => 'httpd' }) if $r->result; }
  • 21.  
  • 22. virt module(not yet exist) my $punc = Punc::Client->new( '*' ); my $res = $punc-> virt -> state ; while ( my $r = $res->next ) { next if $r->error; for my $vm ( @{ $r->vms } ) { if ( $vm->{state} eq 'shutdown' ) { Punc->new($r->host)-> virt -> create ($vm->{domain}) } } }
  • 23. smart module(not yet exist) my $punc = Punc::Client->new( '*' ); my $result = $punc-> smart -> info ; while ( my $r = $result->next ) { unless ( $r->code ) { print &quot;$r->host has error: &quot;; print $r->detail . &quot;\n&quot;; } }
  • 24.  
  • 25. Punc module Module is distributed and executed on each targeted hosts Master host calls modules on targeted hosts via punc command or Punc::Client
  • 26. Architecture of Punc(again) get a result call a module exec a module exec a module exec a module JSON-RPC over HTTPS + SSLv3 auth Manage target hosts Manage SSL certs master (puncmasterd) slave (puncd) slave (puncd) slave (puncd)
  • 27. file module package Punc::Slave::Module::File; use Path::Class qw( dir file ); use Punc::Slave::Module { operatingsystem => [ qw/ .* / ] }; sub md5sum { my ( $self, $args ) = @_; return `md5sum $args->{file}`; } sub copy { ...
  • 28. service module(for Red Hat) package Punc::Slave::Module::Service::RedHat; use Punc::Slave::Module::Service { operatingsystem => [ qw / redhat centos fedora / ] }; use Moose; with 'Punc::Slave::Module::Service::Role'; sub status { my ( $self, $args ) = @_; return $self->_command($args->{service}, 'status'); }
  • 29. service module(for Debian) package Punc::Slave::Module::Service::Debian; use Punc::Slave::Module::Service { operatingsystem => [ qw / debian ubuntu / ] }; use Moose; with 'Punc::Slave::Module::Service::Role'; sub status { my ( $self, $args ) = @_; return $self->_command($args->{service}, 'status'); }
  • 30. Abstraction layer with Pfacter Automatically detect a targeted host’s environmant and execute a adequate module Punc uses Pfacter for this purpose Pfacter is a perl clone of Facter by Ruby Facter is used with Puppet
  • 31. Return values of a module # return scalar, hash ref, or array ref on success return $result; # return an error using Class::ErrorHandler return $self->error(‘error message’);
  • 32. Module sync Mosules must be distributed to slaves Punc has punc-modulesync command punc-modulesync made with file module
  • 33. Summary Punc is a framework for sysatem admin app programming Modules are executed on each slave node Master calls modules via JSON-RPC over HTTPS Programming with Punc is a combination of module calls Caller programs could be written by langauages other than Perl
  • 34. Development in progress Code repository is in CodeRepos http://coderepos.org/share/ http://svn.coderepos.org/share/lang/perl/Punc/trunk Feel free to commit to trunk or make your branch! Please ask yappo if you don’t have a commit bit of CodeRepos #coderepos@freenode or #assurer@freenode
  • 35.