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