Skip to content

Commit

Permalink
add prod settings and chart
Browse files Browse the repository at this point in the history
  • Loading branch information
wachterjohannes committed Jun 10, 2021
1 parent 441ac57 commit 7504202
Show file tree
Hide file tree
Showing 18 changed files with 703 additions and 19 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.git
vendor
node_modules
tests
var
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@ SULU_ADMIN_EMAIL=

###> doctrine/phpcr-bundle ###
###< doctrine/phpcr-bundle ###

VARNISH_SERVER=127.0.0.1
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,6 @@ node_modules

# System files
.DS_Store

deploy/secrets.yaml
deploy/charts
42 changes: 42 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
FROM php:7.4-apache AS php

WORKDIR /var/www/html

# install packages
# inkscape is recommended for handling svg files with imagemagick
RUN apt-get update && apt-get install -y \
libicu-dev \
libpng-dev \
libmagickwand-dev \
inkscape \
git \
unzip \
libzip-dev

# install PHP extensions
RUN docker-php-ext-configure intl && docker-php-ext-install -j$(nproc) \
intl \
pdo \
pdo_mysql \
zip

RUN pecl install redis apcu imagick && docker-php-ext-enable redis apcu imagick

# install php dependencies in intermediate container
FROM php AS composer

COPY symfony.lock /var/www/html/
COPY composer.* /var/www/html/

RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN composer self-update --1
RUN composer install --no-interaction --no-cache --no-scripts --no-dev --prefer-dist --optimize-autoloader --apcu-autoloader

FROM php AS project

# copy project code and results from intermediate containers
COPY --from=composer /var/www/html/vendor/ /var/www/html/vendor/
COPY . /var/www/html/

# apache config
COPY ./deploy/config/apache.conf /etc/apache2/sites-available/000-default.conf
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@

This repository demonstrates how to deploy a Sulu application to a Kubernetes cluster using the [sulu/helm-charts](https://github.com/sulu/helm-charts).

The default branch of the repository contains a clean Sulu application based on the [sulu/skeleton](https://github.com/sulu/skeleton).
The default branch of the repository contains a clean Sulu application based on the [sulu/skeleton](https://github.com/sulu/skeleton).
The changes for adding the deployment are shown in the [pull request #1](https://github.com/sulu/k8s-example-deployment/pull/1).

### 1. Build your container

```
docker build . -t eu.gcr.io/sulu-io/sulu-cluster:1.0.0
docker build . --target project -t eu.gcr.io/sulu-io/sulu-cluster:1.0.0
docker push eu.gcr.io/sulu-io/sulu-cluster:1.0.0
```

### 2. Create Cluster

```
gcloud beta container --project "sulu-io" clusters create "my-first-cluster-1" --zone "europe-west3-c" --no-enable-basic-auth --cluster-version "1.15.12-gke.2" --release-channel "stable" --machine-type "g1-small" --image-type "COS" --disk-type "pd-standard" --disk-size "32" --metadata disable-legacy-endpoints=true --scopes "https://www.googleapis.com/auth/devstorage.read_only","https://www.googleapis.com/auth/logging.write","https://www.googleapis.com/auth/monitoring","https://www.googleapis.com/auth/servicecontrol","https://www.googleapis.com/auth/service.management.readonly","https://www.googleapis.com/auth/trace.append" --num-nodes "3" --no-enable-stackdriver-kubernetes --enable-ip-alias --network "projects/sulu-io/global/networks/default" --subnetwork "projects/sulu-io/regions/europe-west3/subnetworks/default" --default-max-pods-per-node "110" --no-enable-master-authorized-networks --addons HorizontalPodAutoscaling,HttpLoadBalancing --enable-autoupgrade --enable-autorepair --max-surge-upgrade 1 --max-unavailable-upgrade 0
gcloud beta container --project "sulu-io" clusters create "my-first-cluster-1" --zone "europe-west3-c" --no-enable-basic-auth --cluster-version "1.19.9-gke.1900" --release-channel "regular" --machine-type "g1-small" --image-type "COS" --disk-type "pd-standard" --disk-size "32" --metadata disable-legacy-endpoints=true --scopes "https://www.googleapis.com/auth/devstorage.read_only","https://www.googleapis.com/auth/logging.write","https://www.googleapis.com/auth/monitoring","https://www.googleapis.com/auth/servicecontrol","https://www.googleapis.com/auth/service.management.readonly","https://www.googleapis.com/auth/trace.append" --num-nodes "3" --no-enable-stackdriver-kubernetes --enable-ip-alias --network "projects/sulu-io/global/networks/default" --subnetwork "projects/sulu-io/regions/europe-west3/subnetworks/default" --default-max-pods-per-node "110" --no-enable-master-authorized-networks --addons HorizontalPodAutoscaling,HttpLoadBalancing --enable-autoupgrade --enable-autorepair --max-surge-upgrade 1 --max-unavailable-upgrade 0
```

### 3. Connect to cluster
Expand All @@ -39,12 +39,12 @@ Configure the redis password and the google cloud credentials in the secrets fil
```
cd deploy
helm dep build
helm install sulu-cluster . -f secrets.yaml
helm install sulu-cluster . -f secrets.yaml --set=sulu.app.image.tag=1.0.0
```

### 7. Upgrade App

```
cd deploy
helm upgrade sulu-cluster . -f secrets.yaml
helm upgrade sulu-cluster . -f secrets.yaml --set=sulu.app.image.tag=1.0.1
```
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"handcraftedinthealps/zendsearch": "^2.0",
"jackalope/jackalope-doctrine-dbal": "^1.3",
"sulu/sulu": "~2.1.1",
"superbalist/flysystem-google-storage": "^7.2",
"symfony/config": "^5.1",
"symfony/dotenv": "^5.1",
"symfony/flex": "^1.2",
Expand Down
Loading

0 comments on commit 7504202

Please sign in to comment.