Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change2 #98

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
75 changes: 75 additions & 0 deletions .github/workflows/main_final-xyz.yml
Original file line number Diff line number Diff line change
@@ -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: .

75 changes: 75 additions & 0 deletions .github/workflows/main_myphp.yml
Original file line number Diff line number Diff line change
@@ -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: .

22 changes: 12 additions & 10 deletions config/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

'connections' => [


'sqlite' => [
'driver' => 'sqlite',
'url' => env('DATABASE_URL'),
Expand All @@ -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',
Expand Down Expand Up @@ -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'),
],

],
Expand Down