Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥

PHPCon福岡2024-Azureもなかなかいいですよ.pdf

 PHPCon福岡2024-Azureもなかなかいいですよ.pdf

Kaz Watanabe

June 22, 2024
Tweet

More Decks by Kaz Watanabe

Other Decks in Technology

Transcript

  1. • MSఏڙͷLinux؀ڥ • GithubͳͲ͔ΒCD • Φʔτεέʔϧ Up / Down •

    ෳ਺SlotରԠ • Azure portal্͔ΒSSHͰϩάΠϯՄೳ(Ұ෦੍ݶ͋Γ) QSPEVDUJPOQSFWJFXͷ༷ʹෳ਺ TMPUΛ࡞ͬͯ؆୯ʹ#(σϓϩΠ Azure App Service "[VSF"QQ4FSWJDFPO-JOVY 1PSUBMͰઃఆΛ͢ΔͱσϓϩΠʹ ඞཁͳઃఆ͕௥Ճ͞ΕɺXPSL fl PX ͕DPNNJU͞ΕΔ https://azure.microsoft.com/ja-jp/pricing/details/app-service/linux/
  2. Azure App Service "[VSF"QQ4FSWJDFPO-JOVY https://azure.microsoft.com/ja-jp/pricing/details/app-service/linux/ # Docs for the Azure

    Web Apps Deploy action: https://github.com/Azure/webapps-deploy # More GitHub Actions for Azure: https://github.com/Azure/actions name: Build and deploy PHP app to Azure Web App - phpconfuk on: push: branches: - main workflow_dispatch: jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: '8.3' - name: Check if composer.json exists id: check_files uses: andstor/file-existence-action@v1 with: files: 'composer.json' - name: Run composer install if composer.json exists if: steps.check_files.outputs.files_exists == 'true' run: composer validate --no-check-publish && composer install --prefer-dist --no-progress - name: Zip artifact for deployment run: zip release.zip ./* -r - name: Upload artifact for deployment job uses: actions/upload-artifact@v3 with: name: php-app path: release.zip deploy: runs-on: ubuntu-latest needs: build environment: name: 'Production' url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} permissions: id-token: write #This is required for requesting the JWT steps: - name: Download artifact from build job uses: actions/download-artifact@v3 with: name: php-app - name: Unzip artifact for deployment run: unzip release.zip - name: Login to Azure uses: azure/login@v1 with: client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_XXX }} tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_XXX }} subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_XXX }} - name: 'Deploy to Azure Web App' uses: azure/webapps-deploy@v2 id: deploy-to-webapp with: app-name: 'phpconfuk' slot-name: 'Production' package: . OpenID Connect(OIDC) Ͱೝূ(MSਪ঑) - name: Login to Azure uses: azure/login@v1 with: client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_… }} tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_… }} subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_… }}
  3. Azure App Service "[VSF"QQ4FSWJDFPO-JOVY DBUFUDPTSFMFBTF 13&55:@/".&%FCJBO(/6-JOVY CPPLXPSN  /".&%FCJBO(/6-JOVY 7&34*0/@*%

    7&34*0/ CPPLXPSN  ʜ DBUFUDEFCJBO@WFSTJPO  
 QIQWFSTJPO 1)1 DMJ  CVJMU.BS  /54  $PQZSJHIU D 5IF1)1(SPVQ ;FOE&OHJOFW $PQZSJHIU D ;FOE5FDIOPMPHJFT XJUI;FOE01DBDIFW $PQZSJHIU D CZ;FOE5FDIOPMPHJFT QTBY 1*%55:45"55*.&$0.."/%  4/TCJOCBTICJOJOJU@DPOUBJOFSTI  4/TTTIEVTSTCJOTTIE<MJTUFOFS>PGTUBSUVQT  4/CJOTIPQUTUBSUVQTUBSUVQTI  4/TOHJOYNBTUFSQSPDFTTVTSTCJOOHJOY  4/OHJOYXPSLFSQSPDFTT  4/TQIQGQNNBTUFSQSPDFTT VTSMPDBMFUDQIQGQNDPOG   4/QIQGQNQPPMXXX  4/QIQGQNQPPMXXX https://azure.microsoft.com/ja-jp/pricing/details/app-service/linux/
  4. • GithubͳͲ͔ΒCD • Φʔτεέʔϧ Up / Down • ෳ਺SlotରԠ •

    Azure portal্͔ΒSSHͰϩάΠϯՄೳ(Ұ෦੍ݶ͋Γ) sshdΛࢦఆͷํ๏Ͱ্͓͛ͯ͘ඞཁ͕͋Γ·͢ Azure App Service 8FC"QQTGPS$POUBJOFST https://azure.microsoft.com/ja-jp/pricing/details/app-service/linux/
  5. Azure Container Apps ֓ཁ • ϑϧϚωʔδυk8sϕʔεͷΞϓϦέʔγϣϯϓϥοτϑΥʔϜ • KEDAΛར༻ͨ͠ಈతεέʔϦϯά HTTP /

    TCP / Azure Storage Queue / Azure Service Bus / Azure Event Hubs etc… • ϓϥϯ • Consumption Plan(ফඅ) • Dedicated(ઐ༻) • ैྔ՝ۚϫʔΫϩʔυϓϩϑΝΠϧ • ઐ༻ϫʔΫϩʔυϓϩϑΝΠϧ
  6. Azure Container Apps ࣮ߦ؀ڥͷΠϝʔδ CONTAINER APP 1 CONTAINER(S) REPLICA REVISION

    1 CONTAINER(S) REPLICA REVISION 2 CONTAINER APP 2 CONTAINER(S) REPLICA REVISION 1 CONTAINER(S) REPLICA REVISION 2 CONTAINER APPS ENVIRONMENT
  7. ͜͜·Ͱͷ·ͱΊ 1)1Λ࣮ߦՄೳͳ1BB4 • Azure App Service on Linux MSۘ੡ͷLinux؀ڥ •

    Web Apps for Containers DockerΛ࣮ߦՄೳͳαʔϏε • Azure Container Instances ΦϯσϚϯυͰίϯςφΛ࣮ߦ͢ΔαʔϏε • Azure Container Apps ϑϧϚωʔδυk8sϕʔεͷΞϓϦέʔγϣϯϓϥοτϑΥʔϜ
  8. ͦͷ΄͔ͷΑ͘࢖͏αʔϏε • Azure Static Web Apps ϑϩϯτΞϓϦͳͲ੩తίϯςϯπΛ഑৴ • Azure Container

    Registry ίϯςφΠϝʔδͷ؅ཧ • Azure Front Door WAF / CDN • Azure Monitor / Log Analytics Workspace ϩά؅ཧ • Azure Application Insights ΞϓϦέʔγϣϯϩά؅ཧ(ϑϩϯτͷϩάऩू) • Azure Key Vault ೝূ৘ใͳͲൿಗੑͷߴ͍৘ใͷ؅ཧ • Azure Storage • Blob Storage Ϋϥ΢υετϨʔδ • Queue ϝοηʔδϯάετΞ • Azure Database for PostgreSQL / MySQL • Azure Web PubSub ϦΞϧλΠϜϝοηʔδϯά(WebSocket) • Bicep(ARM Template) IaCπʔϧ
  9. Azure Static WebApps ֓ཁ • ੩తίϯςϯπ഑৴༻ͷαʔϏε • ෳ਺ͷ؀ڥ(slotతͳ΋ͷ) • ΧελϜυϝΠϯରԠ(ূ໌ॻແྉɺࣗಈߋ৽)

    • ଳҬ෯ - 100 GB (αϒεΫϦϓγϣϯ͋ͨΓ) • ೝূ • API࿈ܞ(Functions / Container Apps) • ϓϥϯ • Free(ফඅ) • Standard(ઐ༻) • SLAɺଳҬ௒աՄೳ(ैྔ՝ۚ)
  10. ·ͱΊ • PHPͷ࣮ߦ؀ڥ Azure App Service on Linux Web Apps

    for Containers Azure Container Instances Azure Container Apps • ؔ࿈αʔϏε