Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
daemontools-kobanashi
Search
yudoufu
August 11, 2015
Technology
0
72
daemontools-kobanashi
yudoufu
August 11, 2015
Tweet
Share
More Decks by yudoufu
See All by yudoufu
Project開始後に導入するAssetsの自動共有
yudoufu
2
3.4k
Drink Meetup with Mercari #36 Souzoh編
yudoufu
0
990
Casualにインフラテストへ入門した話
yudoufu
2
4k
5分で知るGo言語
yudoufu
0
160
Other Decks in Technology
See All in Technology
alecthomas/kong はいいぞ / kamakura.go#7
fujiwara3
1
300
ガバメントクラウドのセキュリティ対策事例について
fujisawaryohei
0
560
re:Invent 2024 Innovation Talks(NET201)で語られた大切なこと
shotashiratori
0
310
社外コミュニティで学び社内に活かす共に学ぶプロジェクトの実践/backlogworld2024
nishiuma
0
270
20241214_WACATE2024冬_テスト設計技法をチョット俯瞰してみよう
kzsuzuki
3
530
PHP ユーザのための OpenTelemetry 入門 / phpcon2024-opentelemetry
shin1x1
1
260
Storage Browser for Amazon S3
miu_crescent
1
210
How to be an AWS Community Builder | 君もAWS Community Builderになろう!〜2024 冬 CB募集直前対策編?!〜
coosuke
PRO
2
2.8k
DUSt3R, MASt3R, MASt3R-SfM にみる3D基盤モデル
spatial_ai_network
2
180
Turing × atmaCup #18 - 1st Place Solution
hakubishin3
0
490
10個のフィルタをAXI4-Streamでつなげてみた
marsee101
0
170
日本版とグローバル版のモバイルアプリ統合の開発の裏側と今後の展望
miichan
1
130
Featured
See All Featured
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
111
49k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
2
170
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.6k
Scaling GitHub
holman
458
140k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Docker and Python
trallard
42
3.1k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
95
17k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
Mobile First: as difficult as doing things right
swwweet
222
9k
Optimizing for Happiness
mojombo
376
70k
Why Our Code Smells
bkeepers
PRO
335
57k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
170
Transcript
daemontoolsখ @yudoufu 2015/08/11 ෦ษڧձ ͓ͬ͞ΜͬΆ͍Λ͠·͢
daemontoolsͬͯͬͯ͠Δʁ • αʔϏεͷdaemonӬଓԽπʔϧͱͯ͠༗໊ • ͓ͬ͞ΜΈΜͳ͓ੈʹͳͬͯΔ • ࠷ۙsupervisord ൊ;͑ͨͶ
ͦͦdaemontoolsͱ • UNIX/LinuxͷαʔϏεཧπʔϧ܈ͷ૯শ • djb࡞ • qmail / tcpserverͷ࡞ऀͰ͋Δ •
http://cr.yp.to/daemontools.html
daemontoolsͷத • daemonӬଓԽπʔϧ (svscan/supervise) • daemontoolsͬͯݴ͏ͱී௨͜ΕΛࢦ͢ • ҆શͳϩάهπʔϧ (multilog) •
αʔϏε/daemonԽͷิॿɾศརπʔϧ • ࠓ͔͜͜ΒϐοΫΞοϓͯ͠հ
daemontoolsͷิॿπʔϧ܈ • ͍͍ͪͪ໘ͩΑͶɺΛ࣮ݱͯ͘͠ΕΔখ • ୯Ͱ͑Δͷ͕ଟͯ͘UNIXత
setlock % setlock -n /path/to/hoge.lock command • command࣮ߦલʹlockΛߦ͍ɺϓϩηεͷॏ ෳىಈΛ͍Ͱ͘ΕΔ •
-n: ॏෳىಈcommand࣮ߦͤͣଈऴྃ • -N: ॏෳىಈϩοΫͷղ์Λ࣮ͬͯߦ • cronͱΈ߹Θͤͯ͏ͱศར
setlock - ༻ྫ 00 * * * * setlock -n
/var/run/cron.lock hugeprocess.sh • ͍͢͝Ͱ͔͍ॲཧΛຖ࣌Δ߹ • ສ͕Ұ࣍ͷ࣮ߦ͕࣌ؒདྷͯɺ࣍ͷϓϩηε ࣮ߦ͞Εͣऴྃ͢Δ setlock: fatal: unable to lock /var/run/cron.lock: temporary failure
setlock - ༻ྫ 00 * * * * setlock -N
/var/run/cron.lock preprocess.sh 30 * * * * setlock -N /var/run/cron.lock postprocess.sh • લॲཧͷ݁ՌΛड͚ͯޙॲཧΛ࣮ߦ͍ͨ͠ɺ ͱ͍͏ͷΛຖ࣌Δ߹ͳͲ • ಉ͡lockϑΝΠϧͳΒίϚϯυ͕ҧͬͯॲཧ Λͬͯ͘ΕΔ
envdir % envdir /path/to/env command • ୈ1ҾͰࢦఆͨ͠σΟϨΫτϦͷϑΝΠϧ Λɺڥมͱͯ͠ઃఆͯ͘͠ΕΔ
envdir - ࣮ߦྫ % cat /tmp/env/IP 192.168.1.1 % cat /tmp/env/LOGDIR
/var/log/hoge % envdir /tmp/env env | egrep "(IP|LOGIDIR)" IP=192.168.1.1 LOGDIR=/var/log/hoge • dirͷϑΝΠϧ໊Λม໊ʹɺ༰Λvalueʹ • ڥมͱεΫϦϓτΛผཧ͘͢͠ͳΔ
envuidgid % envuidgid user command • envͷ UID / GIDʹୈ1ҾͷuserΛઃఆ
• ࣮ߦϢʔβʔΛม͑ΔΘ͚͡Όͳ͍ envuidgid www-data env |egrep "(GID|UID|USER)" USER=yudoufu GID=33 UID=33
setuidgid % setuidgid user command • ࣮ߦ࣌ݖݶΛߜΓ͍ͨ߹ʹ͏ • جຊతʹroot࣮ߦͷεΫϦϓτͰ͏ •
αϒάϧʔϓΛө͠ͳ͍ͷͰͨ·ʹਏ͍ • https://github.com/bruceg/daemontools- encore • ༗ࢤ͕ͨ͠Γͯ͠Δ
softlimit % softlimit [-p… n] command • commandʹରͯ͠Ϧιʔε੍ݶΛ͔͚ΒΕΔ • ϓϩηε͝ͱͷdataηάϝϯτ੍ݶ
• ಉҰUIDͰͷϓϩηε੍ݶ • etc…
༨ஊ • εϥΠυΛmd2keyΛͬͯ࡞ͬͯΈͨ • https://github.com/k0kubun/md2key • ίϚϯυͷhighlight͍͍ײ͡ • จͷܗͬͺΓਓ͕Կͱ͔͢Δ •
·ͩେࡶʹ͋ͯ͜Ήπʔϧɺͱ͍͏ײ͡
·ͱΊ • daemontoolsͷαϙʔτπʔϧ܈ؾ͕ޮ͍ ͯͯศར