Upgrade to Pro — share decks privately, control downloads, hide ads and more …

日々大量の素材を扱うために改善したこと/webgenba-meetup-03

 日々大量の素材を扱うために改善したこと/webgenba-meetup-03

2018/03/07 Web現場Meetup #3

hamuyuuki

March 08, 2018
Tweet

More Decks by hamuyuuki

Other Decks in Technology

Transcript

  1. ࣗݾ঺հ • ҏ౻ ༟ر • 2015/08 ʙ ϐΫελגࣜձࣾ • 2017/01

    ʙ PIXTA VIETNAM ʹग़޲ • 2018/01 ʙ ٕज़ਪਐάϧʔϓ 
  2. ձࣾ֓ཁ • ઃཱ೔: 2005/08/25 • ཧ೦: ࠽ೳΛͭͳ͗ɺੈքΛϙδςΟϒʹ͢Δ • ࣄۀ಺༰: PIXTA,

    fotowa, Snapmart ͷӡӦ • ڌ఺: ೔ຊ, ୆࿷, λΠ, γϯΨϙʔϧ, ϕτφϜ, ؖࠃ 
  3. چFTPΞοϓϩʔυγεςϜ  PIXTA (Batch) S3 FTP Server ΫϦΤΠλʔ ᶃΞοϓϩʔυ PIXTA

    (Admin) ϐΫελ ελοϑ ᶄ࿈བྷʢϚΠϖʔδ্ʣ ᶅFTP=>S3ಉظґཔ ᶅFTP=>S3ಉظґཔ ᶆS3ಉظ ᶇ݁ՌΛ௨஌ ᶈαϜωΠϧੜ੒ ᶉૉࡐ৘ใΛอଘ Worker
  4. چFTPΞοϓϩʔυγεςϜ  PIXTA (Batch) S3 FTP Server ΫϦΤΠλʔ ᶃΞοϓϩʔυ PIXTA

    (Admin) ϐΫελ ελοϑ ᶄ࿈བྷʢϚΠϖʔδ্ʣ ᶅFTP=>S3ಉظґཔ ᶅFTP=>S3ಉظґཔ ᶆS3ಉظ ᶇ݁ՌΛ௨஌ ᶈαϜωΠϧੜ੒ ᶉૉࡐ৘ใΛอଘ Worker
  5. Ξοϓϩʔυ݅਺ͷਪҠ  ,  ,  ,  , 

    , ೥ ೥ ೥ ೥ ೥ ೥
  6. چFTPΞοϓϩʔυγεςϜ  PIXTA (Batch) S3 FTP Server ΫϦΤΠλʔ ᶃΞοϓϩʔυ PIXTA

    (Admin) ϐΫελ ελοϑ ᶄ࿈བྷʢϚΠϖʔδ্ʣ ᶅFTP=>S3ಉظґཔ ᶅFTP=>S3ಉظґཔ ᶆS3ಉظ ᶇ݁ՌΛ௨஌ ᶈαϜωΠϧੜ੒ ᶉૉࡐ৘ใΛอଘ Worker
  7. ৽FTPΞοϓϩʔυγεςϜ  PIXTA (API) S3 FTP Server Lambda ΫϦΤΠλʔ ᶃΞοϓϩʔυ

    ᶄS3ʹಉظ ᶅΠϕϯττϦΨ ᶆαϜωΠϧੜ੒ʢಈըʣ ᶆαϜωΠϧอଘʢը૾ʣ ᶆૉࡐ৘ใΛอଘ S3 Worker
  8. چFTPΞοϓϩʔυγεςϜ  PIXTA (Batch) S3 FTP Server ΫϦΤΠλʔ ᶃΞοϓϩʔυ PIXTA

    (Admin) ϐΫελ ελοϑ ᶄ࿈བྷʢϚΠϖʔδ্ʣ ᶅFTP=>S3ಉظґཔ ᶅFTP=>S3ಉظґཔ ᶆS3ಉظ ᶇ݁ՌΛ௨஌ ᶈαϜωΠϧੜ੒ ᶉૉࡐ৘ใΛอଘ Worker
  9. ৽FTPΞοϓϩʔυγεςϜ  PIXTA (API) S3 FTP Server Lambda ΫϦΤΠλʔ ᶃΞοϓϩʔυ

    ᶄS3ʹಉظ ᶅΠϕϯττϦΨ ᶆαϜωΠϧੜ੒ʢಈըʣ ᶆαϜωΠϧอଘʢը૾ʣ ᶆૉࡐ৘ใΛอଘ S3 Worker
  10. چFTPΞοϓϩʔυγεςϜ  PIXTA (Batch) S3 FTP Server ΫϦΤΠλʔ ᶃΞοϓϩʔυ PIXTA

    (Admin) ϐΫελ ελοϑ ᶄ࿈བྷʢϚΠϖʔδ্ʣ ᶅFTP=>S3ಉظґཔ ᶅFTP=>S3ಉظґཔ ᶆS3ಉظ ᶇ݁ՌΛ௨஌ ᶈαϜωΠϧੜ੒ ᶉૉࡐ৘ใΛอଘ Worker
  11. ৽FTPΞοϓϩʔυγεςϜ  PIXTA (API) S3 FTP Server Lambda ΫϦΤΠλʔ ᶃΞοϓϩʔυ

    ᶄS3ʹಉظ ᶅΠϕϯττϦΨ ᶆαϜωΠϧੜ੒ʢಈըʣ ᶆαϜωΠϧอଘʢը૾ʣ ᶆૉࡐ৘ใΛอଘ S3 Worker
  12. ৽FTPΞοϓϩʔυγεςϜ  PIXTA (API) S3 FTP Server Lambda ΫϦΤΠλʔ ᶃΞοϓϩʔυ

    ᶄS3ʹಉظ ᶅΠϕϯττϦΨ ᶆαϜωΠϧੜ੒ʢಈըʣ ᶆαϜωΠϧอଘʢը૾ʣ ᶆૉࡐ৘ใΛอଘ S3 Worker
  13. ৽FTPΞοϓϩʔυγεςϜ  PIXTA (API) S3 FTP Server Lambda ΫϦΤΠλʔ ᶃΞοϓϩʔυ

    ᶄS3ʹಉظ ᶅΠϕϯττϦΨ ᶆαϜωΠϧੜ੒ʢಈըʣ ᶆαϜωΠϧอଘʢը૾ʣ ᶆૉࡐ৘ใΛอଘ S3 Worker
  14. ᶅΠϕϯττϦΨ • ΠϕϯττϦΨʹ S3 Λ௥Ճ • Suffix ʹର৅ͱͳΔϑΝΠϧΛࢦఆ • ը૾ɺಈըͦΕͧΕͷ֦ுࢠ

    • Event types ʹର৅ͱͳΔΠϕϯτΛࢦఆ • ObjectCreatedͰΦϒδΣΫτ࡞੒Λର৅ 
  15. ৽FTPΞοϓϩʔυγεςϜ  PIXTA (API) S3 FTP Server Lambda ΫϦΤΠλʔ ᶃΞοϓϩʔυ

    ᶄS3ʹಉظ ᶅΠϕϯττϦΨ ᶆαϜωΠϧੜ੒ʢಈըʣ ᶆαϜωΠϧอଘʢը૾ʣ ᶆૉࡐ৘ใΛอଘ S3 Worker
  16. ᶆLambda(ը૾αϜωΠϧੜ੒) import GraphicsMagick from 'gm'; export default class JpgProcessor {

    constructor({ awsRegion, srcBucket, srcKey }) { . this.gm = GraphicsMagick.subClass({ imageMagick: true }); . } processImage() { return this._resizeThumbnail(); } _resizeThumbnail() { return this.gm(this.imageDataBody) .resize(THUMBNAIL_SIZE, THUMBNAIL_SIZE) .toBuffer(this.imageType, (err, buffer) => { . . }; } }
  17. Amazon EBS ͷϚ΢ϯτ • ౰ॳɺFTPαʔόʔ্Ͱ s3fs Λ࢖ͬͯ s3 ΛϚ΢ ϯτ͍͕ͯͨ͠ɺύϑΥʔϚϯε͕ग़ͳ͔ͬͨ

    • FTPαʔόʔ Ͱ͸ɺ1000GBͷEBSΛϚ΢ϯτ ͍ͯ͠Δ • 5୆ಈ͍͍ͯͯίετ͕ 500$ ~ 1000$