@@ -18,49 +18,61 @@ package manager) chart to deploy in a wink on any of these platforms.
18
18
19
19
1 . Build the PHP and Nginx Docker images:
20
20
21
+ ```
21
22
docker build -t gcr.io/test-api-platform/php -t gcr.io/test-api-platform/php:latest api
22
23
docker build -t gcr.io/test-api-platform/nginx -t gcr.io/test-api-platform/nginx:latest -f api/Dockerfile.nginx api
23
24
docker build -t gcr.io/test-api-platform/varnish -t gcr.io/test-api-platform/varnish:latest -f api/Dockerfile.varnish api
25
+ ```
24
26
25
27
2 . Push your images to your Docker registry, example with [ Google Container Registry] ( https://cloud.google.com/container-registry/ ) :
26
28
29
+ ```
27
30
gcloud docker -- push gcr.io/test-api-platform/php
28
31
gcloud docker -- push gcr.io/test-api-platform/nginx
29
32
gcloud docker -- push gcr.io/test-api-platform/varnish
33
+ ```
30
34
31
35
## Deploying
32
36
33
37
Firstly you need to update helm dependencies by running:
34
38
39
+ ```
35
40
helm dependency update ./api/helm/api
41
+ ```
36
42
37
43
You are now ready to deploy the API!
38
44
39
45
Deploy your API to the container:
40
46
47
+ ```
41
48
helm install ./api/helm/api --namespace=baz --name baz \
42
49
--set php.repository=gcr.io/test-api-platform/php \
43
50
--set nginx.repository=gcr.io/test-api-platform/nginx \
44
51
--set secret=MyAppSecretKey \
45
52
--set postgresql.postgresPassword=MyPgPassword \
46
53
--set postgresql.persistence.enabled=true \
47
54
--set corsAllowOrigin='^https?://[a-z\]*\.mywebsite.com$'
55
+ ```
48
56
49
57
If you prefer to use a managed DBMS like [ Heroku Postgres] ( https://www.heroku.com/postgres ) or
50
58
[ Google Cloud SQL] ( https://cloud.google.com/sql/docs/postgres/ ) (recommended):
51
59
60
+ ```
52
61
helm install --name api ./api/helm/api \
53
62
# ...
54
63
--set postgresql.enabled=false \
55
64
--set postgresql.url=pgsql://username:password@host/database?serverVersion=9.6
65
+ ```
56
66
57
67
If you want to use a managed Varnish such as [ Fastly] ( https://www.fastly.com ) for the invalidation cache mechanism
58
68
provided by API Platform:
59
69
70
+ ```
60
71
helm install --name api ./api/helm/api \
61
72
# ...
62
73
--set varnish.enabled=false \
63
74
--set varnish.url=https://myvarnish.com
75
+ ```
64
76
65
77
Finally, build the ` client ` and ` admin ` JavaScript apps and [ deploy them on a static
66
78
website hosting service] ( https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#deployment ) .
@@ -69,5 +81,7 @@ website hosting service](https://github.com/facebookincubator/create-react-app/b
69
81
70
82
Before running your application for the first time, be sure to create the database schema:
71
83
84
+ ```
72
85
PHP_POD=$(kubectl --namespace=bar get pods -l app=php -o jsonpath="{.items[0].metadata.name}")
73
86
kubectl --namespace=bar exec -it $PHP_POD -- bin/console doctrine:schema:create
87
+ ```
0 commit comments