Skip to content

Commit

Permalink
Adapt Upsun config for Gally v2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
romainruaud committed Jan 22, 2025
1 parent 57bf3c5 commit 6a1bf05
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 79 deletions.
94 changes: 17 additions & 77 deletions .upsun/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ applications:
source:
root: "/front"
type: "nodejs:18"
variables:
env:
NEXT_PUBLIC_API_ROUTE_PREFIX: 'api'
NEXT_PUBLIC_API_URL: 'https://upsun-deployment-config-3xlvpkq-kxux3rltbhsgo.fr-3.platformsh.site/api'
mounts:
"/.npm":
source: "storage"
Expand All @@ -26,10 +30,12 @@ applications:
api:
source:
root: "/api"
type: "php:8.1"
type: "php:8.3"
variables:
env:
APP_ENV: 'prod'
API_ROUTE_PREFIX: 'api'
ELASTICSEARCH_SSL_VERIFICATION: false

dependencies:
php:
Expand All @@ -49,12 +55,16 @@ applications:
"/":
root: "public"
passthru: "/index.php"
rules:
'^/api/bundles/(?<resourceName>.*)$':
passthru: '/bundles/$resourceName'
build:
flavor: composer
hooks:
build: |
bin/console lexik:jwt:generate-keypair --skip-if-exists --no-interaction
bin/console --env=prod assets:install --no-debug
sed -i '/BAN/d' vendor/api-platform/core/src/HttpCache/VarnishPurger.php
sed -i '/VectorSearch/d' config/bundles.php
[ -z "${MEDIA_URL}" ] || echo "gally:\n base_url:\n media: '${MEDIA_URL}'" > config/packages/gally_configuration.yaml
Expand All @@ -79,46 +89,10 @@ services:
plugins:
- analysis-icu
- analysis-phonetic



routes:
# Route / to default React App.
https://{default}/:
cache:
enabled: false
ssi:
enabled: false
type: upstream
upstream: api:http

https://{default}/admin:
cache:
cookies:
- '*'
default_ttl: 0
enabled: true
headers:
- Accept
- Accept-Language
ssi:
enabled: false
type: upstream
upstream: admin:http

https://{default}/login:
cache:
cookies:
- '*'
default_ttl: 0
enabled: true
headers:
- Accept
- Accept-Language
ssi:
enabled: false
type: upstream
upstream: admin:http

https://{default}/_next:
cache:
cookies:
- '*'
Expand All @@ -131,46 +105,12 @@ routes:
enabled: false
type: upstream
upstream: admin:http

https://{default}/locales:
cache:
cookies:
- '*'
default_ttl: 0
enabled: true
headers:
- Accept
- Accept-Language
ssi:
enabled: false
type: upstream
upstream: admin:http

https://{default}/images:
cache:
cookies:
- '*'
default_ttl: 0
enabled: true
headers:
- Accept
- Accept-Language
ssi:
enabled: false
type: upstream
upstream: admin:http

https://{default}/favicon.ico:
# Route /api to Api platform app.
https://{default}/api:
cache:
cookies:
- '*'
default_ttl: 0
enabled: true
headers:
- Accept
- Accept-Language
enabled: false
ssi:
enabled: false
type: upstream
upstream: admin:http

upstream: api:http
2 changes: 1 addition & 1 deletion api/.environment
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ export REDIS_SERVER=$(echo $PLATFORM_RELATIONSHIPS | base64 --decode | jq -r ".r

export TRUSTED_HOSTS=^$(echo $PLATFORM_ROUTES | base64 --decode | jq -r "keys[0]" | awk -F[/:] '{print $4}')$
export SERVER_NAME=$(echo $PLATFORM_ROUTES | base64 --decode | jq -r "keys[0]" | awk -F[/:] '{print $4}')
export VARNISH_URL=$(echo $PLATFORM_ROUTES | base64 --decode | jq -r "keys[0]" | awk -F[/:] '{print $4}')
export VARNISH_URL=http://$(echo $PLATFORM_ROUTES | base64 --decode | jq -r "keys[0]" | awk -F[/:] '{print $4}')
5 changes: 4 additions & 1 deletion front/.environment
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@
#### THIS FILE IS USED ONLY WHEN DEPLOYING GALLY ON PLATFORM.SH
#############################################################################################

export SERVER_NAME=api.$PLATFORM_ENVIRONMENT-$PLATFORM_PROJECT.eu.platformsh.site
export SERVER_NAME=$(echo $PLATFORM_ROUTES | base64 --decode | jq -r "keys[0]" | awk -F[/:] '{print $4}')
export NEXT_PUBLIC_ENTRYPOINT=$(echo $PLATFORM_ROUTES | base64 --decode | jq -r "keys[0]" | awk -F[/:] '{print $4}')
export NEXT_PUBLIC_API_URL=https://$SERVER_NAME/$NEXT_PUBLIC_API_ROUTE_PREFIX
export REACT_APP_API_URL=https://$SERVER_NAME/$NEXT_PUBLIC_API_ROUTE_PREFIX

0 comments on commit 6a1bf05

Please sign in to comment.