Skip to content

Commit a3b1d3c

Browse files
committed
Merge 2.3 into 2.4
2 parents 8f46bb4 + a8ae4b4 commit a3b1d3c

File tree

1 file changed

+39
-21
lines changed

1 file changed

+39
-21
lines changed

deployment/kubernetes.md

Lines changed: 39 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,58 +18,72 @@ package manager) chart to deploy in a wink on any of these platforms.
1818

1919
1. Build the PHP and Nginx Docker images:
2020

21-
docker build -t gcr.io/test-api-platform/php -t gcr.io/test-api-platform/php:latest api --target api_platform_php
22-
docker build -t gcr.io/test-api-platform/nginx -t gcr.io/test-api-platform/nginx:latest api --target api_platform_nginx
23-
docker build -t gcr.io/test-api-platform/varnish -t gcr.io/test-api-platform/varnish:latest api --target api_platform_varnish
21+
```
22+
docker build -t gcr.io/test-api-platform/php -t gcr.io/test-api-platform/php:latest api --target api_platform_php
23+
docker build -t gcr.io/test-api-platform/nginx -t gcr.io/test-api-platform/nginx:latest api --target api_platform_nginx
24+
docker build -t gcr.io/test-api-platform/varnish -t gcr.io/test-api-platform/varnish:latest api --target api_platform_varnish
25+
```
2426

2527
2. Push your images to your Docker registry, example with [Google Container Registry](https://cloud.google.com/container-registry/):
2628

27-
Docker client versions <= 18.03:
28-
29-
gcloud docker -- push gcr.io/test-api-platform/php
30-
gcloud docker -- push gcr.io/test-api-platform/nginx
31-
gcloud docker -- push gcr.io/test-api-platform/varnish
32-
33-
Docker client versions > 18.03:
34-
35-
gcloud auth configure-docker
36-
docker push gcr.io/test-api-platform/php
37-
docker push gcr.io/test-api-platform/nginx
38-
docker push gcr.io/test-api-platform/varnish
29+
Docker client versions <= 18.03:
30+
31+
```
32+
gcloud docker -- push gcr.io/test-api-platform/php
33+
gcloud docker -- push gcr.io/test-api-platform/nginx
34+
gcloud docker -- push gcr.io/test-api-platform/varnish
35+
```
36+
37+
Docker client versions > 18.03:
38+
39+
```
40+
gcloud auth configure-docker
41+
docker push gcr.io/test-api-platform/php
42+
docker push gcr.io/test-api-platform/nginx
43+
docker push gcr.io/test-api-platform/varnish
44+
```
3945

4046
## Deploying
4147

4248
Firstly you need to update helm dependencies by running:
4349

50+
```
4451
helm dependency update ./api/helm/api
52+
```
4553

4654
You are now ready to deploy the API!
4755

4856
Deploy your API to the container:
4957

58+
```
5059
helm install ./api/helm/api --namespace=baz --name baz \
5160
--set php.repository=gcr.io/test-api-platform/php \
5261
--set nginx.repository=gcr.io/test-api-platform/nginx \
5362
--set secret=MyAppSecretKey \
5463
--set postgresql.postgresPassword=MyPgPassword \
5564
--set postgresql.persistence.enabled=true \
5665
--set corsAllowOrigin='^https?://[a-z\]*\.mywebsite.com$'
66+
```
5767

5868
If you prefer to use a managed DBMS like [Heroku Postgres](https://www.heroku.com/postgres) or
5969
[Google Cloud SQL](https://cloud.google.com/sql/docs/postgres/) (recommended):
6070

71+
```
6172
helm install --name api ./api/helm/api \
6273
# ...
6374
--set postgresql.enabled=false \
6475
--set postgresql.url=pgsql://username:password@host/database?serverVersion=9.6
76+
```
6577

6678
If you want to use a managed Varnish such as [Fastly](https://www.fastly.com) for the invalidation cache mechanism
6779
provided by API Platform:
6880

81+
```
6982
helm install --name api ./api/helm/api \
7083
# ...
7184
--set varnish.enabled=false \
7285
--set varnish.url=https://myvarnish.com
86+
```
7387

7488
Finally, build the `client` and `admin` JavaScript apps and [deploy them on a static
7589
website hosting service](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#deployment).
@@ -78,21 +92,25 @@ website hosting service](https://github.com/facebookincubator/create-react-app/b
7892

7993
Before running your application for the first time, be sure to create the database schema:
8094

95+
```
8196
PHP_POD=$(kubectl --namespace=bar get pods -l app=php -o jsonpath="{.items[0].metadata.name}")
8297
kubectl --namespace=bar exec -it $PHP_POD -- bin/console doctrine:schema:create
98+
```
8399

84100
## Tiller RBAC Issue
85101

86102
We noticed that some tiller RBAC trouble occurred. You can usually resolve it by running:
87103

88-
kubectl create serviceaccount --namespace kube-system tiller
89-
serviceaccount "tiller" created
104+
```
105+
kubectl create serviceaccount --namespace kube-system tiller
106+
serviceaccount "tiller" created
90107
91-
kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
92-
clusterrolebinding "tiller-cluster-rule" created
108+
kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
109+
clusterrolebinding "tiller-cluster-rule" created
93110
94-
kubectl patch deploy --namespace kube-system tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}'
95-
deployment "tiller-deploy" patched
111+
kubectl patch deploy --namespace kube-system tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}'
112+
deployment "tiller-deploy" patched
113+
```
96114

97115
Please, see the [related issue](https://github.com/kubernetes/helm/issues/3130) for further details / information.
98116
You can also take a look at the [related documentation](https://github.com/kubernetes/helm/blob/master/docs/rbac.md)

0 commit comments

Comments
 (0)