Skip to content

Commit c8bdfbc

Browse files
committed
Adapt Upsun config for Gally v2.0
1 parent 3f346b4 commit c8bdfbc

File tree

3 files changed

+25
-79
lines changed

3 files changed

+25
-79
lines changed

.upsun/config.yaml

Lines changed: 20 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ applications:
33
source:
44
root: "/front"
55
type: "nodejs:18"
6+
variables:
7+
env:
8+
NEXT_PUBLIC_API_ROUTE_PREFIX: 'api'
9+
NEXT_PUBLIC_API_URL: 'https://upsun-deployment-config-3xlvpkq-kxux3rltbhsgo.fr-3.platformsh.site/api'
610
mounts:
711
"/.npm":
812
source: "storage"
@@ -26,10 +30,12 @@ applications:
2630
api:
2731
source:
2832
root: "/api"
29-
type: "php:8.1"
33+
type: "php:8.3"
3034
variables:
3135
env:
3236
APP_ENV: 'prod'
37+
API_ROUTE_PREFIX: 'api'
38+
ELASTICSEARCH_SSL_VERIFICATION: false
3339

3440
dependencies:
3541
php:
@@ -49,12 +55,16 @@ applications:
4955
"/":
5056
root: "public"
5157
passthru: "/index.php"
58+
rules:
59+
'^/api/bundles/(?<resourceName>.*)$':
60+
passthru: '/bundles/$resourceName'
5261
build:
5362
flavor: composer
5463
hooks:
5564
build: |
5665
bin/console lexik:jwt:generate-keypair --skip-if-exists --no-interaction
5766
bin/console --env=prod assets:install --no-debug
67+
sed -i '/BAN/d' vendor/api-platform/core/src/HttpCache/VarnishPurger.php
5868
sed -i '/VectorSearch/d' config/bundles.php
5969
[ -z "${MEDIA_URL}" ] || echo "gally:\n base_url:\n media: '${MEDIA_URL}'" > config/packages/gally_configuration.yaml
6070
@@ -79,46 +89,13 @@ services:
7989
plugins:
8090
- analysis-icu
8191
- analysis-phonetic
82-
83-
92+
- opensearch-ml-plugin
93+
- neural-search
94+
- opensearch-knn
95+
8496
routes:
97+
# Route / to default React App.
8598
https://{default}/:
86-
cache:
87-
enabled: false
88-
ssi:
89-
enabled: false
90-
type: upstream
91-
upstream: api:http
92-
93-
https://{default}/admin:
94-
cache:
95-
cookies:
96-
- '*'
97-
default_ttl: 0
98-
enabled: true
99-
headers:
100-
- Accept
101-
- Accept-Language
102-
ssi:
103-
enabled: false
104-
type: upstream
105-
upstream: admin:http
106-
107-
https://{default}/login:
108-
cache:
109-
cookies:
110-
- '*'
111-
default_ttl: 0
112-
enabled: true
113-
headers:
114-
- Accept
115-
- Accept-Language
116-
ssi:
117-
enabled: false
118-
type: upstream
119-
upstream: admin:http
120-
121-
https://{default}/_next:
12299
cache:
123100
cookies:
124101
- '*'
@@ -131,46 +108,12 @@ routes:
131108
enabled: false
132109
type: upstream
133110
upstream: admin:http
134-
135-
https://{default}/locales:
136-
cache:
137-
cookies:
138-
- '*'
139-
default_ttl: 0
140-
enabled: true
141-
headers:
142-
- Accept
143-
- Accept-Language
144-
ssi:
145-
enabled: false
146-
type: upstream
147-
upstream: admin:http
148-
149-
https://{default}/images:
150-
cache:
151-
cookies:
152-
- '*'
153-
default_ttl: 0
154-
enabled: true
155-
headers:
156-
- Accept
157-
- Accept-Language
158-
ssi:
159-
enabled: false
160-
type: upstream
161-
upstream: admin:http
162111

163-
https://{default}/favicon.ico:
112+
# Route /api to Api platform app.
113+
https://{default}/api:
164114
cache:
165-
cookies:
166-
- '*'
167-
default_ttl: 0
168-
enabled: true
169-
headers:
170-
- Accept
171-
- Accept-Language
115+
enabled: false
172116
ssi:
173117
enabled: false
174118
type: upstream
175-
upstream: admin:http
176-
119+
upstream: api:http

api/.environment

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ export REDIS_SERVER=$(echo $PLATFORM_RELATIONSHIPS | base64 --decode | jq -r ".r
3232

3333
export TRUSTED_HOSTS=^$(echo $PLATFORM_ROUTES | base64 --decode | jq -r "keys[0]" | awk -F[/:] '{print $4}')$
3434
export SERVER_NAME=$(echo $PLATFORM_ROUTES | base64 --decode | jq -r "keys[0]" | awk -F[/:] '{print $4}')
35-
export VARNISH_URL=$(echo $PLATFORM_ROUTES | base64 --decode | jq -r "keys[0]" | awk -F[/:] '{print $4}')
35+
export VARNISH_URL=http://$(echo $PLATFORM_ROUTES | base64 --decode | jq -r "keys[0]" | awk -F[/:] '{print $4}')

front/.environment

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,7 @@
33
#### THIS FILE IS USED ONLY WHEN DEPLOYING GALLY ON PLATFORM.SH
44
#############################################################################################
55

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

0 commit comments

Comments
 (0)