diff --git a/.github/workflows/main_final-xyz.yml b/.github/workflows/main_final-xyz.yml new file mode 100644 index 000000000..f3b40e249 --- /dev/null +++ b/.github/workflows/main_final-xyz.yml @@ -0,0 +1,75 @@ +# 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 - FINAL-XYZ + +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.2' + + - 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@v4 + 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@v4 + with: + name: php-app + + - name: Unzip artifact for deployment + run: unzip release.zip + + - name: Login to Azure + uses: azure/login@v2 + with: + client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_6575DEBC62DA4AEFA0FFED8CA37DC54B }} + tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_026168212FA44FDFA0F2E747F57F6B8F }} + subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_80AF4CD3430C4AAAAF4826F6F08A04D2 }} + + - name: 'Deploy to Azure Web App' + uses: azure/webapps-deploy@v3 + id: deploy-to-webapp + with: + app-name: 'FINAL-XYZ' + slot-name: 'Production' + package: . + \ No newline at end of file diff --git a/.github/workflows/main_myphp.yml b/.github/workflows/main_myphp.yml new file mode 100644 index 000000000..c75fc247b --- /dev/null +++ b/.github/workflows/main_myphp.yml @@ -0,0 +1,75 @@ +# 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 - myphp + +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@v4 + 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@v4 + with: + name: php-app + + - name: Unzip artifact for deployment + run: unzip release.zip + + - name: Login to Azure + uses: azure/login@v2 + with: + client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_1B8BFE10874E4DBA8BB43BAF2CB6A0EE }} + tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_970020B4BBDB448F8B6B382FA5AFB882 }} + subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_98D5CD7D18144825A33477D93B51E1B7 }} + + - name: 'Deploy to Azure Web App' + uses: azure/webapps-deploy@v3 + id: deploy-to-webapp + with: + app-name: 'myphp' + slot-name: 'Production' + package: . + \ No newline at end of file diff --git a/config/database.php b/config/database.php index 137ad18ce..59e34f87e 100644 --- a/config/database.php +++ b/config/database.php @@ -35,6 +35,7 @@ 'connections' => [ + 'sqlite' => [ 'driver' => 'sqlite', 'url' => env('DATABASE_URL'), @@ -46,11 +47,11 @@ 'mysql' => [ 'driver' => 'mysql', 'url' => env('DATABASE_URL'), - 'host' => env('DB_HOST', '127.0.0.1'), - 'port' => env('DB_PORT', '3306'), - 'database' => env('DB_DATABASE', 'forge'), - 'username' => env('DB_USERNAME', 'forge'), - 'password' => env('DB_PASSWORD', ''), + 'host' => env('AZURE_MYSQL_HOST', '127.0.0.1'), + 'port' => env('AZURE_MYSQL_PORT', '3306'), + 'database' => env('AZURE_MYSQL_DBNAME', 'forge'), + 'username' => env('AZURE_MYSQL_USERNAME', 'forge'), + 'password' => env('AZURE_MYSQL_PASSWORD', ''), 'unix_socket' => env('DB_SOCKET', ''), 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', @@ -135,15 +136,16 @@ 'password' => env('REDIS_PASSWORD'), 'port' => env('REDIS_PORT', '6379'), 'database' => env('REDIS_DB', '0'), + ], 'cache' => [ - 'url' => env('REDIS_URL'), - 'host' => env('REDIS_HOST', '127.0.0.1'), + 'scheme' => 'tls', + 'host' => env('AZURE_REDIS_HOST', '127.0.0.1'), 'username' => env('REDIS_USERNAME'), - 'password' => env('REDIS_PASSWORD'), - 'port' => env('REDIS_PORT', '6379'), - 'database' => env('REDIS_CACHE_DB', '1'), + 'password' => env('AZURE_REDIS_PASSWORD'), + 'port' => env('AZURE_REDIS_PORT', '6379'), + 'database' => env('AZURE_REDIS_DATABASE', '1'), ], ],