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

feat: upgrade from distribution #346

Merged
merged 51 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
22a75a3
Update from distribution (#344)
vincentchalamon Oct 26, 2023
702719a
fix: helm dependencies
vincentchalamon Oct 26, 2023
78618d0
fix: upgrade to postgresql 16
vincentchalamon Oct 26, 2023
eb3a453
fix: PWA hostname
vincentchalamon Oct 26, 2023
dd1b136
fix: fixtures should be prod dependencies as they are loaded on produ…
vincentchalamon Oct 26, 2023
763bd13
fix: lint pwa dockerfile
vincentchalamon Oct 26, 2023
0372661
fix: fixtures load
vincentchalamon Oct 26, 2023
add41ca
Add resources req limit on all component (#345)
ThomasSamson Nov 3, 2023
ff02b4b
chore: bump symfony/security-http from 6.3.6 to 6.3.8 in /api (#347)
dependabot[bot] Nov 13, 2023
038aeeb
chore: bump symfony/twig-bridge from 6.3.5 to 6.3.8 in /api (#348)
dependabot[bot] Nov 13, 2023
2ab9f49
chore: bump next-auth from 4.24.3 to 4.24.5 in /pwa (#350)
dependabot[bot] Nov 21, 2023
42c5456
chore: bump google-github-actions/auth from 1 to 2 (#351)
dependabot[bot] Dec 1, 2023
f4d965b
test: enable Caddy debug mode
vincentchalamon Nov 6, 2023
031764d
test: enable Caddy metrics
vincentchalamon Nov 6, 2023
2776df1
fix: remove update CD
vincentchalamon Nov 15, 2023
b1c02b3
chore: increase php k8s memory
vincentchalamon Nov 15, 2023
f3719b5
chore: configure ingress for Keycloak
vincentchalamon Nov 15, 2023
ac62aaf
chore: upgrade api to PHP 8.3
vincentchalamon Dec 1, 2023
a34aef4
fix: replace tabs by spaces
vincentchalamon Dec 1, 2023
59edfac
chore: update API dependencies and upgrade to Symfony 6.4
vincentchalamon Dec 1, 2023
ad00b1f
chore: migrate from eu.gcr.io to europe-docker.pkg.dev
vincentchalamon Dec 1, 2023
1305b62
fix: enable doctrine use_savepoints
vincentchalamon Dec 6, 2023
b8384ab
chore: improve trusted_proxies
vincentchalamon Dec 6, 2023
0e98caa
ci: fix cd permissions
dunglas Dec 6, 2023
9ec1e36
ci: login to GAR
dunglas Dec 6, 2023
8e5b9b9
cleanup
dunglas Dec 6, 2023
0e743e2
fix zone
dunglas Dec 6, 2023
d7fb155
various repo fixes
dunglas Dec 6, 2023
5284fd6
set framework.yaml and trusted* as main
vincentchalamon Dec 6, 2023
7d85b97
chore: migrate to ingress nginx
vincentchalamon Dec 6, 2023
29bc24b
chore: use cloudflare strict ssl
vincentchalamon Dec 6, 2023
12cffcf
chore: increase ingress proxy-buffer-size
vincentchalamon Dec 6, 2023
25a2c9d
chore: use helm -f values.yaml to inherit default values
vincentchalamon Dec 6, 2023
cb2eaf3
fix: api-platform/core#6015
vincentchalamon Dec 6, 2023
8594ec1
fix: make psalm happy
vincentchalamon Dec 6, 2023
92ac487
fix: deploy
vincentchalamon Dec 7, 2023
d9ef741
use default backends
jfcoz Dec 7, 2023
455c388
chore: fix qa
vincentchalamon Dec 7, 2023
85bd1e8
fix: make phpstan happy
vincentchalamon Dec 7, 2023
a4d625b
merge deploy and feature deploy
jfcoz Dec 7, 2023
4f91b6a
fix: make php-cs-fixer happy
vincentchalamon Dec 7, 2023
ba054c2
chore: try super-linter
vincentchalamon Dec 7, 2023
1d8794d
fix: lint + phpstan
vincentchalamon Dec 7, 2023
603eaec
fix cors
jfcoz Dec 7, 2023
56accbe
Revert "fix: lint + phpstan"
vincentchalamon Dec 7, 2023
0032640
Revert "chore: try super-linter"
vincentchalamon Dec 7, 2023
bd63cac
add check job after deployment (#362)
jfcoz Dec 7, 2023
4b49dcd
fix: phpstan run on CI
vincentchalamon Dec 7, 2023
22eaa61
increase pwa memory request
jfcoz Dec 7, 2023
b07abc4
fix: remaining todos
vincentchalamon Dec 7, 2023
f3a0fb8
fix: make phpstan happy
vincentchalamon Dec 7, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 6 additions & 21 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,61 +16,46 @@ trim_trailing_whitespace = true
insert_final_newline = true

[*.{js,html,ts,tsx}]
indent_style = space
indent_size = 2

[*.json]
indent_style = space
indent_size = 4
indent_size = 2

[*.md]
trim_trailing_whitespace = false

[*.php]
indent_style = space
indent_size = 4

[*.sh]
indent_style = tab
indent_size = 4

[*.xml{,.dist}]
indent_style = space
indent_size = 4

[*.{yaml,yml}]
indent_style = space
indent_size = 4
trim_trailing_whitespace = false

[helm/api-platform/**.yaml]
indent_style = space
indent_size = 2

[.github/workflows/*.yml]
indent_style = space
indent_size = 2

[.gitmodules]
indent_style = tab
indent_size = 4

[.php_cs{,.dist}]
indent_style = space
indent_size = 4

[.travis.yml]
indent_style = space
indent_size = 2

[composer.json]
indent_style = space
indent_size = 4

[docker-compose{,.*}.{yaml,yml}]
[{,docker-}compose{,.*}.{yaml,yml}]
indent_style = space
indent_size = 2

[Dockerfile]
[{,*.*}Dockerfile]
indent_style = tab

[{,*.*}Caddyfile]
indent_style = tab
indent_size = 4
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*.yml text eol=lf
bin/console text eol=lf
composer.lock text eol=lf merge=ours
pnpm-lock.yaml text eol=lf merge=ours

*.ico binary
*.png binary
Expand Down
76 changes: 27 additions & 49 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ jobs:
if: ${{ github.repository == 'api-platform/demo' && (github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'deploy')) }}
runs-on: ubuntu-latest
env:
PHP_DOCKER_IMAGE: eu.gcr.io/${{ secrets.GKE_PROJECT }}/php:${{ github.sha }}
PWA_DOCKER_IMAGE: eu.gcr.io/${{ secrets.GKE_PROJECT }}/pwa:${{ github.sha }}
CADDY_DOCKER_IMAGE: eu.gcr.io/${{ secrets.GKE_PROJECT }}/caddy:${{ github.sha }}
KEYCLOAK_DOCKER_IMAGE: eu.gcr.io/${{ secrets.GKE_PROJECT }}/keycloak:${{ github.sha }}
PHP_DOCKER_IMAGE: europe-west1-docker.pkg.dev/${{ secrets.GKE_PROJECT }}/${{ secrets.GKE_PROJECT }}/php:${{ github.sha }}
PWA_DOCKER_IMAGE: europe-west1-docker.pkg.dev/${{ secrets.GKE_PROJECT }}/${{ secrets.GKE_PROJECT }}/pwa:${{ github.sha }}
KEYCLOAK_DOCKER_IMAGE: europe-west1-docker.pkg.dev/${{ secrets.GKE_PROJECT }}/${{ secrets.GKE_PROJECT }}/keycloak:${{ github.sha }}
permissions:
contents: 'read'
id-token: 'write'
steps:
-
name: Checkout
Expand All @@ -33,19 +35,18 @@ jobs:
python-version: 3.9.15
-
name: Auth gcloud
uses: google-github-actions/auth@v1
id: auth
uses: google-github-actions/auth@v2
with:
token_format: access_token
credentials_json: ${{ secrets.GKE_SA_KEY }}
-
name: Setup gcloud
uses: google-github-actions/setup-gcloud@v1
name: Login to GAR
uses: docker/login-action@v3
with:
project_id: ${{ secrets.GKE_PROJECT }}
-
name: Configure gcloud
run: |
gcloud --quiet auth configure-docker
gcloud container clusters get-credentials api-platform-demo --zone europe-west1-c
registry: europe-west1-docker.pkg.dev
username: oauth2accesstoken
password: ${{ steps.auth.outputs.access_token }}
-
name: Build Docker images
uses: docker/bake-action@v4
Expand All @@ -55,8 +56,8 @@ jobs:
pull: true
load: true
files: |
docker-compose.yml
docker-compose.prod.yml
compose.yaml
compose.prod.yaml
set: |
*.cache-from=type=gha,scope=${{github.ref}}
*.cache-from=type=gha,scope=refs/heads/main
Expand All @@ -66,33 +67,24 @@ jobs:
run: |
docker push $PHP_DOCKER_IMAGE
docker push $PWA_DOCKER_IMAGE
docker push $CADDY_DOCKER_IMAGE
docker push $KEYCLOAK_DOCKER_IMAGE
-
name: Docker tag and push latest
if: github.event_name == 'push'
run: |
docker tag $PHP_DOCKER_IMAGE eu.gcr.io/${{ secrets.GKE_PROJECT }}/php:latest
docker tag $PWA_DOCKER_IMAGE eu.gcr.io/${{ secrets.GKE_PROJECT }}/pwa:latest
docker tag $CADDY_DOCKER_IMAGE eu.gcr.io/${{ secrets.GKE_PROJECT }}/caddy:latest
docker tag $KEYCLOAK_DOCKER_IMAGE eu.gcr.io/${{ secrets.GKE_PROJECT }}/keycloak:latest
docker push eu.gcr.io/${{ secrets.GKE_PROJECT }}/php:latest
docker push eu.gcr.io/${{ secrets.GKE_PROJECT }}/pwa:latest
docker push eu.gcr.io/${{ secrets.GKE_PROJECT }}/caddy:latest
docker push eu.gcr.io/${{ secrets.GKE_PROJECT }}/keycloak:latest
docker tag $PHP_DOCKER_IMAGE europe-west1-docker.pkg.dev/${{ secrets.GKE_PROJECT }}/${{ secrets.GKE_PROJECT }}/php:latest
docker tag $PWA_DOCKER_IMAGE europe-west1-docker.pkg.dev/${{ secrets.GKE_PROJECT }}/${{ secrets.GKE_PROJECT }}/pwa:latest
docker tag $KEYCLOAK_DOCKER_IMAGE europe-west1-docker.pkg.dev/${{ secrets.GKE_PROJECT }}/${{ secrets.GKE_PROJECT }}/keycloak:latest
docker push europe-west1-docker.pkg.dev/${{ secrets.GKE_PROJECT }}/${{ secrets.GKE_PROJECT }}/php:latest
docker push europe-west1-docker.pkg.dev/${{ secrets.GKE_PROJECT }}/${{ secrets.GKE_PROJECT }}/pwa:latest
docker push europe-west1-docker.pkg.dev/${{ secrets.GKE_PROJECT }}/${{ secrets.GKE_PROJECT }}/keycloak:latest

deploy:
name: Deploy
needs: [ build ]
if: github.event_name == 'push'
uses: ./.github/workflows/deploy.yml
with:
environment: prod
url: demo.api-platform.com
docker-images-version: ${{ github.sha }}
cors: '["https://demo.api-platform.com", "http://localhost", "https://localhost", "http://localhost:3000"]'
release: main
namespace: main
gke-cluster: api-platform-demo
gke-zone: europe-west1-c
secrets:
Expand All @@ -102,23 +94,9 @@ jobs:
cloudflare-zone-id: ${{ secrets.CF_ZONE_ID }}
keycloak-admin-password: ${{ secrets.KEYCLOAK_ADMIN_PASSWORD }}

feature-deploy:
name: Feature Deploy
needs: [ build ]
if: github.event_name == 'pull_request'
uses: ./.github/workflows/deploy.yml
check:
name: Check
needs: [ deploy ]
uses: ./.github/workflows/check.yml
with:
environment: pr-${{ github.event.pull_request.number }}
url: pr-${{ github.event.pull_request.number }}-demo.api-platform.com
docker-images-version: ${{ github.sha }}
cors: '["https://pr-${{ github.event.pull_request.number }}-demo.api-platform.com", "http://localhost", "https://localhost", "http://localhost:3000"]'
release: pr-${{ github.event.pull_request.number }}
namespace: pr-${{ github.event.pull_request.number }}
gke-cluster: api-platform-demo
gke-zone: europe-west1-c
secrets:
gke-credentials: ${{ secrets.GKE_SA_KEY }}
gke-project: ${{ secrets.GKE_PROJECT }}
cloudflare-api-token: ${{ secrets.CF_API_TOKEN }}
cloudflare-zone-id: ${{ secrets.CF_ZONE_ID }}
keycloak-admin-password: ${{ secrets.KEYCLOAK_ADMIN_PASSWORD }}
url: ${{needs.deploy.outputs.url}}
28 changes: 28 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Deploy

on:
workflow_call:
inputs:
url:
type: string
description: URL

jobs:
check:
name: Check
runs-on: ubuntu-latest
permissions:
contents: 'read'
id-token: 'write'
steps:
-
name: Checkout
uses: actions/checkout@v4

- name: Run local k6 test
uses: grafana/[email protected]
with:
filename: k6/script.js
flags: --out json=results.json
env:
TARGET: ${{ inputs.url }}
50 changes: 25 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,52 +26,53 @@ jobs:
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build Docker Images
name: Build Docker images
uses: docker/bake-action@v4
with:
pull: true
load: true
files: |
docker-compose.yml
docker-compose.override.yml
compose.yaml
compose.override.yaml
set: |
*.cache-from=type=gha,scope=${{github.ref}}
*.cache-from=type=gha,scope=refs/heads/main
*.cache-to=type=gha,scope=${{github.ref}},mode=max
-
name: Start Services
name: Start services
run: docker compose up --wait --no-build
-
name: Debug Services
name: Debug services
if: failure()
run: |
docker compose ps
docker compose logs
-
name: Check HTTP Reachability
name: Check HTTP reachability
run: curl -v -o /dev/null http://localhost
-
name: Check API Reachability
name: Check API reachability
run: curl -vk -o /dev/null https://localhost
-
name: Check PWA Reachability
name: Check PWA reachability
run: "curl -vk -o /dev/null -H 'Accept: text/html' https://localhost"
-
name: Create Test Database
run: |
docker compose exec -T php bin/console -e test doctrine:database:create
docker compose exec -T php bin/console -e test doctrine:migrations:migrate --no-interaction
name: Create test database
run: docker compose exec -T php bin/console -e test doctrine:database:create
-
name: Run migrations
run: docker compose exec -T php bin/console -e test doctrine:migrations:migrate --no-interaction
-
name: Run PHPUnit Tests
name: Run PHPUnit
run: docker compose exec -T php bin/phpunit
-
name: Doctrine Schema Validator
run: docker compose exec -T php bin/console doctrine:schema:validate
run: docker compose exec -T php bin/console -e test doctrine:schema:validate
-
name: Run Psalm Analysis
run: docker compose exec -T php vendor/bin/psalm
name: Run PHPStan
run: docker compose exec -T php vendor/bin/phpstan --memory-limit=256M
-
name: Run PWA Lint
name: Lint PWA
run: docker compose exec -T pwa pnpm lint

# run e2e tests iso-prod
Expand All @@ -82,10 +83,9 @@ jobs:
contents: 'read'
id-token: 'write'
env:
PHP_DOCKER_IMAGE: eu.gcr.io/${{ secrets.GKE_PROJECT }}/php:latest
PWA_DOCKER_IMAGE: eu.gcr.io/${{ secrets.GKE_PROJECT }}/pwa:latest
CADDY_DOCKER_IMAGE: eu.gcr.io/${{ secrets.GKE_PROJECT }}/caddy:latest
KEYCLOAK_DOCKER_IMAGE: eu.gcr.io/${{ secrets.GKE_PROJECT }}/keycloak:latest
PHP_DOCKER_IMAGE: europe-west1-docker.pkg.dev/${{ secrets.GKE_PROJECT }}/${{ secrets.GKE_PROJECT }}/php:latest
PWA_DOCKER_IMAGE: europe-west1-docker.pkg.dev/${{ secrets.GKE_PROJECT }}/${{ secrets.GKE_PROJECT }}/pwa:latest
KEYCLOAK_DOCKER_IMAGE: europe-west1-docker.pkg.dev/${{ secrets.GKE_PROJECT }}/${{ secrets.GKE_PROJECT }}/keycloak:latest
APP_SECRET: ba63418865d58089f7f070e0a437b6d16b1fb970
CADDY_MERCURE_JWT_SECRET: 33b04d361e437e0d7d715600fc24fdefba317154
NEXTAUTH_SECRET: 77e4c3f5a6fb652b6245a5df8a704e04ad90bc7e
Expand All @@ -95,7 +95,7 @@ jobs:
KEYCLOAK_HTTPS_CERTIFICATE_FILE: ./helm/api-platform/keycloak/certs/tls.crt
KEYCLOAK_HTTPS_CERTIFICATE_KEY_FILE: ./helm/api-platform/keycloak/certs/tls.pem
# https://docs.docker.com/compose/environment-variables/envvars/#compose_file
COMPOSE_FILE: docker-compose.yml:docker-compose.prod.yml:docker-compose.e2e.yml
COMPOSE_FILE: compose.yaml:compose.prod.yaml:compose.e2e.yaml
steps:
-
name: Checkout
Expand All @@ -110,8 +110,8 @@ jobs:
pull: true
load: true
files: |
docker-compose.yml
docker-compose.prod.yml
compose.yaml
compose.prod.yaml
set: |
*.cache-from=type=gha,scope=${{github.ref}}-e2e
*.cache-from=type=gha,scope=${{github.ref}}
Expand All @@ -128,7 +128,7 @@ jobs:
docker compose logs
-
name: Load Fixtures
run: docker compose run --rm --env APP_ENV=dev php bin/console doctrine:fixtures:load --no-interaction
run: docker compose run --rm php bin/console doctrine:fixtures:load --no-interaction
-
name: Cache Playwright Binaries
uses: actions/cache@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
python-version: 3.9.15
-
name: Auth gcloud
uses: google-github-actions/auth@v1
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GKE_SA_KEY }}
-
Expand Down
Loading
Loading