Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Goで社内オペレーションを少し改善できた話
Search
Osamu
November 08, 2024
500
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Goで社内オペレーションを少し改善できた話
Asakusa.go #4のLT資料です
https://asakusago.connpass.com/event/334004/
Osamu
November 08, 2024
More Decks by Osamu
See All by Osamu
Claude Codeを"もう一人の自分"として運用するまでにやったこと
osamu_000
1
17
CursorとObsidianで実現する次世代メモ管理術
osamu_000
1
120
Featured
See All Featured
The Cost Of JavaScript in 2023
addyosmani
55
10k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
1
570
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
2
6.3k
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
WCS-LA-2024
lcolladotor
0
890
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
18k
Agile that works and the tools we love
rasmusluckow
331
22k
Being A Developer After 40
akosma
92
590k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.9k
エンジニアに許された特別な時間の終わり
watany
109
250k
From π to Pie charts
rasagy
1
400
How to build a perfect <img>
jonoalderson
1
6.1k
Transcript
©2024 Dr.’s Prime ,Inc. Goで社内オペレーションを 少し改善できた話 株式会社ドクターズプライム 石山 理
石山 理(Osamu Ishiyama) 株式会社ドクターズプライム エンジニr H 物理浅草のD H 2024年4月ドクターズプライム入g H
新規プロジェクトの開発してま5 H 最近ポケモンカード始めたのでやり方教えてください @osamu_000
なぜ改善する必要があったのか? どう改善したの? 実装イメージ ©2024 Dr.’s Prime ,Inc. 話すこと
なぜ改善する必要があったのか?
©2024 Dr.’s Prime ,Inc. なぜ改善する必要があったのか? - 前提 弊社では医師向けの勉強会プラットフォームを開発して ます 医師からもらった録画とスライドを編集して使用します
なので、以下の対応をする必要がある ・動画をストリーム用の形式にする ・勉強会の動画に対してスライドを登録する必要がある → 1枚1枚見れるようにするので分割して保存したい → スライドの容量もなるべくWeb最適化したい https://drsprime.com/service/academia
©2024 Dr.’s Prime ,Inc. なぜ改善する必要があったのか? - 生まれた課題 そこで自動処理したい作業が生まれた ・MP4/MOV →
HLSへの動画変換 ・HLSをCloudflareにアップ(ストレージサービス) ・PDFを一枚一枚WebPに変換する ・WebPをMicroCMSのassetsにアップ(CMS) でもあまりお金かけたくないな。。。
どう改善したの?
©2024 Dr.’s Prime ,Inc. どう改善したの? - 概要 自社でPCを組み立てて、稼働させました ・自動処理プログラムをGoで書く ・ビルドファイルをSSH経由でPCにアップ
・Cronで1分毎にビルドファイルを叩く ・環境構築周りはMakefileである程度楽に ・バージョン管理もできるようにビルドファイルもいい感じに分けた └ /.build/v1.0.*/build_file 名前はSynchan(しんちゃん)となりました ※自動でsyncしてくれるちゃん → Synchan
©2024 Dr.’s Prime ,Inc. どう改善したの? - アーキテクチャ The Go gopher
was designed by Renee French.
実装イメージ
©2024 Dr.’s Prime ,Inc. spf13/cobraを使用して実装 サブコマンドで”cron”を設定 flagは環境変数のパスを指定 Use: コマンド名 Run:
実行func 以下で実行できる % go run . cron video-upload --env <env_path> https://github.com/spf13/cobra 実装イメージ - コマンドライン実装
©2024 Dr.’s Prime ,Inc. HLSは解像度ごとにgoroutineで変換 ※HLSは帯域に応じて解像度を調整できるので 実際の変換はFFmpegを使用してます ※動画や音声をいい感じに変換してくれるやつ goroutineのエラーハンドリングは errgroupで
※goroutine内でエラーが起きた時に最初のエラーを返 してくれるやつ https://www.ffmpeg.org/ https://pkg.go.dev/golang.org/x/sync/errgroup 実装イメージ - MP4/MOV → HLS変換
©2024 Dr.’s Prime ,Inc. PDFのページごとにgoroutineをして WebPに変換 変換はimagickを使用してます ※画像をいい感じに処理してくれるやつ (ImageMagickのGoバインディング) filepathを使用するといい感じにパス操
作できます https://pkg.go.dev/gopkg.in/gographics/imagick.v2/ imagick https://pkg.go.dev/path/filepath 実装イメージ - PDF → WebP変換
©2024 Dr.’s Prime ,Inc. 採用情報 We are hiring! 職種 プロダクトエンジニア
現在、積極採用中です! 右のQRコードから カジュアル面談募集しています!