Skip to content

Commit 7504202

Browse files
add prod settings and chart
1 parent 441ac57 commit 7504202

18 files changed

+703
-19
lines changed

.dockerignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.git
2+
vendor
3+
node_modules
4+
tests
5+
var

.env

+2
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,5 @@ SULU_ADMIN_EMAIL=
4141

4242
###> doctrine/phpcr-bundle ###
4343
###< doctrine/phpcr-bundle ###
44+
45+
VARNISH_SERVER=127.0.0.1

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,6 @@ node_modules
4343

4444
# System files
4545
.DS_Store
46+
47+
deploy/secrets.yaml
48+
deploy/charts

Dockerfile

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
FROM php:7.4-apache AS php
2+
3+
WORKDIR /var/www/html
4+
5+
# install packages
6+
# inkscape is recommended for handling svg files with imagemagick
7+
RUN apt-get update && apt-get install -y \
8+
libicu-dev \
9+
libpng-dev \
10+
libmagickwand-dev \
11+
inkscape \
12+
git \
13+
unzip \
14+
libzip-dev
15+
16+
# install PHP extensions
17+
RUN docker-php-ext-configure intl && docker-php-ext-install -j$(nproc) \
18+
intl \
19+
pdo \
20+
pdo_mysql \
21+
zip
22+
23+
RUN pecl install redis apcu imagick && docker-php-ext-enable redis apcu imagick
24+
25+
# install php dependencies in intermediate container
26+
FROM php AS composer
27+
28+
COPY symfony.lock /var/www/html/
29+
COPY composer.* /var/www/html/
30+
31+
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
32+
RUN composer self-update --1
33+
RUN composer install --no-interaction --no-cache --no-scripts --no-dev --prefer-dist --optimize-autoloader --apcu-autoloader
34+
35+
FROM php AS project
36+
37+
# copy project code and results from intermediate containers
38+
COPY --from=composer /var/www/html/vendor/ /var/www/html/vendor/
39+
COPY . /var/www/html/
40+
41+
# apache config
42+
COPY ./deploy/config/apache.conf /etc/apache2/sites-available/000-default.conf

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22

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

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

88
### 1. Build your container
99

1010
```
11-
docker build . -t eu.gcr.io/sulu-io/sulu-cluster:1.0.0
11+
docker build . --target project -t eu.gcr.io/sulu-io/sulu-cluster:1.0.0
1212
docker push eu.gcr.io/sulu-io/sulu-cluster:1.0.0
1313
```
1414

1515
### 2. Create Cluster
1616

1717
```
18-
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
18+
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
1919
```
2020

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

4545
### 7. Upgrade App
4646

4747
```
4848
cd deploy
49-
helm upgrade sulu-cluster . -f secrets.yaml
49+
helm upgrade sulu-cluster . -f secrets.yaml --set=sulu.app.image.tag=1.0.1
5050
```

composer.json

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"handcraftedinthealps/zendsearch": "^2.0",
3535
"jackalope/jackalope-doctrine-dbal": "^1.3",
3636
"sulu/sulu": "~2.1.1",
37+
"superbalist/flysystem-google-storage": "^7.2",
3738
"symfony/config": "^5.1",
3839
"symfony/dotenv": "^5.1",
3940
"symfony/flex": "^1.2",

0 commit comments

Comments
 (0)