@@ -18,58 +18,72 @@ 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
- 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
+ ```
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
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
+ ```
39
45
40
46
## Deploying
41
47
42
48
Firstly you need to update helm dependencies by running:
43
49
50
+ ```
44
51
helm dependency update ./api/helm/api
52
+ ```
45
53
46
54
You are now ready to deploy the API!
47
55
48
56
Deploy your API to the container:
49
57
58
+ ```
50
59
helm install ./api/helm/api --namespace=baz --name baz \
51
60
--set php.repository=gcr.io/test-api-platform/php \
52
61
--set nginx.repository=gcr.io/test-api-platform/nginx \
53
62
--set secret=MyAppSecretKey \
54
63
--set postgresql.postgresPassword=MyPgPassword \
55
64
--set postgresql.persistence.enabled=true \
56
65
--set corsAllowOrigin='^https?://[a-z\]*\.mywebsite.com$'
66
+ ```
57
67
58
68
If you prefer to use a managed DBMS like [ Heroku Postgres] ( https://www.heroku.com/postgres ) or
59
69
[ Google Cloud SQL] ( https://cloud.google.com/sql/docs/postgres/ ) (recommended):
60
70
71
+ ```
61
72
helm install --name api ./api/helm/api \
62
73
# ...
63
74
--set postgresql.enabled=false \
64
75
--set postgresql.url=pgsql://username:password@host/database?serverVersion=9.6
76
+ ```
65
77
66
78
If you want to use a managed Varnish such as [ Fastly] ( https://www.fastly.com ) for the invalidation cache mechanism
67
79
provided by API Platform:
68
80
81
+ ```
69
82
helm install --name api ./api/helm/api \
70
83
# ...
71
84
--set varnish.enabled=false \
72
85
--set varnish.url=https://myvarnish.com
86
+ ```
73
87
74
88
Finally, build the ` client ` and ` admin ` JavaScript apps and [ deploy them on a static
75
89
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
78
92
79
93
Before running your application for the first time, be sure to create the database schema:
80
94
95
+ ```
81
96
PHP_POD=$(kubectl --namespace=bar get pods -l app=php -o jsonpath="{.items[0].metadata.name}")
82
97
kubectl --namespace=bar exec -it $PHP_POD -- bin/console doctrine:schema:create
98
+ ```
83
99
84
100
## Tiller RBAC Issue
85
101
86
102
We noticed that some tiller RBAC trouble occurred. You can usually resolve it by running:
87
103
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
90
107
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
93
110
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
+ ```
96
114
97
115
Please, see the [ related issue] ( https://github.com/kubernetes/helm/issues/3130 ) for further details / information.
98
116
You can also take a look at the [ related documentation] ( https://github.com/kubernetes/helm/blob/master/docs/rbac.md )
0 commit comments