2016/02~ CoreOS
ϗετϚγϯͷϝϯςφϯεʹඅ͕͢Ͱ͔͍
Chef Λۦஞ͍ͨ͠
@dtan4 ͷϥοϓτοϓͱϓϩϏδϣχϯά༻ΠϯελϯεͰ͔͠ಈ͔ͳ͔ͬͨ
ϗετ OS Λ CoreOS ʹҠߦ
+ systemd ʹΑΔαʔϏεཧ
Slide 14
Slide 14 text
CoreOS
ίϯςφલఏͷܰྔ Linux Distribution
ͯ͢ͷΞϓϦέʔγϣϯΛ
Docker ίϯςφ্Ͱಈ͔͢
Chrome ͱಉ͡ Update System
Update channel: beta
Reboot strategy: no
https://coreos.com/assets/images/media/Host-Diagram.png
Slide 15
Slide 15 text
Infrastructure at Wantedly
Web, DB, Storage
DNS
AWS
EC2, ELB, RDS, Elasticache, S3,
Route53, VPC, Lambda
DNSimple
Slide 16
Slide 16 text
Infrastructure at Wantedly
Logging
App Monitoring
Infrastucture Monitoring
Incident Management
Logentries
New Relic
Datadog
Pagerduty
Slide 17
Slide 17 text
Elasticsearch nginx-image-server
Web
Web Worker
Scheduler
nginx-image-server
Elasticsearch cluster
VPC
Nginx
Slide 18
Slide 18 text
systemd
journald
Docker
Registry
dd-agent
Web
Container
EC2 Instance
Slide 19
Slide 19 text
Web (Rails)
Docker image 2ஈߏ
ि1Ͱ intermediate image ΛϏϧυ
σϓϩΠ࣌ʹ web image ΛϏϧυ
bundle install
git clone wantedly/wantedly
Ruby
FROM Ubuntu 14.04
rake assets:precompile
bundle install
git checkout
git fetch
FROM intermediate
web
intermediate
Slide 20
Slide 20 text
Web (Rails)
ࠩͷΈͷ fetch + bundle install Ͱ
σϓϩΠΛߴԽ
intermediate Chef + Packer
bundle install
git clone wantedly/wantedly
Ruby
FROM Ubuntu 14.04
rake assets:precompile
bundle install
git checkout
git fetch
FROM intermediate
web
intermediate
All services on Docker
Facebook ࣄ૬ஊ bot (Python)
จॻϓϨϏϡʔ࡞αʔό (Golang)
ࣾ Slack bot (Node.js)
...
৽نαʔϏεϦϙδτϦʹ Dockerfile Λஔ͍ͯΒ͏
Slide 25
Slide 25 text
Private Docker Registry (S3 backed) Λհͨ͠
Docker image ͷΓऔΓ
Deploy
Web
Build server
$ docker push $ docker pull
$ git fetch
$ docker build $ docker run
Slide 26
Slide 26 text
ϗετϨϕϧͰͷ Blue-Green Deployment
Deploy
Web Blue
Web Green
if (-e /etc/nginx/switch/blue) {
proxy_pass http://blue-container;
}
if (-e /etc/nginx/switch/green) {
proxy_pass http://green-container;
}
Slide 27
Slide 27 text
Heroku ಉͷΠϯλʔϑΣΠεΛ࣋ͭ CLI (Capistrano)
Deploy
$ cap -T
cap config # Display the config vars for an app
cap deploy[revision] # Deploy an application
cap deploy:diff[ref] # Display diff deployed revision and the revision to
cap deploy:rollback # Rollback application
cap logs:t[container_name] # Display stream logs for an container
cap maintenance:on # Enable maintenance mode
cap ps # Display web, worker, scheduler, run type containers
cap ps:scale[role,num] # Scale out/in containers
cap ps:restart:web[color,chained_task?] # Start web containers
cap releases # Display deploy history
cap run[command] # Run on-off commands
cap scheduler # Display scheduling
cap scheduler:clear # Clear scheduler config
cap scheduler:update # Update scheduler
cap status # Show application status
Solution 2: API
Wantedly ͷ API Λ࡞ΓɺAPI ܦ༝Ͱͯ͢ͷΞΫγϣϯΛߦ͏
Slide 45
Slide 45 text
Solution 2: API
React.js ϜʔϒϝϯτʹΑΔ Web ϑϩϯτΤϯυͷ
Kong Λར༻ͨ͠ೝূ͖ͭ API Gateway
apig ʹΑΔϞσϧఆ͔ٛΒͷ
REST API αʔόɺυΩϡϝϯτͷੜ
webmock-proxy ʹΑΔαʔϏεؒ Integration Test ؆ུԽ
wantedly/apig
wantedly/webmock-proxy