Skip to content

fix(kubernetes): missing code blocks #1812

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions deployment/kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,49 +18,61 @@ package manager) chart to deploy in a wink on any of these platforms.

1. Build the PHP and Nginx Docker images:

```
docker build -t gcr.io/test-api-platform/php -t gcr.io/test-api-platform/php:latest api
docker build -t gcr.io/test-api-platform/nginx -t gcr.io/test-api-platform/nginx:latest -f api/Dockerfile.nginx api
docker build -t gcr.io/test-api-platform/varnish -t gcr.io/test-api-platform/varnish:latest -f api/Dockerfile.varnish api
```

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

```
gcloud docker -- push gcr.io/test-api-platform/php
gcloud docker -- push gcr.io/test-api-platform/nginx
gcloud docker -- push gcr.io/test-api-platform/varnish
```

## Deploying

Firstly you need to update helm dependencies by running:

```
helm dependency update ./api/helm/api
```

You are now ready to deploy the API!

Deploy your API to the container:

```
helm install ./api/helm/api --namespace=baz --name baz \
--set php.repository=gcr.io/test-api-platform/php \
--set nginx.repository=gcr.io/test-api-platform/nginx \
--set secret=MyAppSecretKey \
--set postgresql.postgresPassword=MyPgPassword \
--set postgresql.persistence.enabled=true \
--set corsAllowOrigin='^https?://[a-z\]*\.mywebsite.com$'
```

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

```
helm install --name api ./api/helm/api \
# ...
--set postgresql.enabled=false \
--set postgresql.url=pgsql://username:password@host/database?serverVersion=9.6
```

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

```
helm install --name api ./api/helm/api \
# ...
--set varnish.enabled=false \
--set varnish.url=https://myvarnish.com
```

Finally, build the `client` and `admin` JavaScript apps and [deploy them on a static
website hosting service](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#deployment).
Expand All @@ -69,5 +81,7 @@ website hosting service](https://github.com/facebookincubator/create-react-app/b

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

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