Last active
December 19, 2023 06:10
-
-
Save kyleferguson/52d0c44bfec2914f8f934454f438c4de to your computer and use it in GitHub Desktop.
Example Laravel deployment for Kubernetes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: extensions/v1beta1 | |
kind: Deployment | |
metadata: | |
name: platform-api | |
spec: | |
replicas: 3 | |
selector: | |
matchLabels: | |
app: platform-api | |
template: | |
metadata: | |
labels: | |
app: platform-api | |
commit: [INSERTED_DURING_CI] | |
spec: | |
containers: | |
- name: app | |
image: us.gcr.io/nexmillio/platform-api:latest | |
imagePullPolicy: Always | |
ports: | |
- {containerPort: 80} | |
env: | |
- { name: "APP_ENV", value: "production" } | |
- { name: "APP_DEBUG", value: "false" } | |
- { name: "APP_KEY", valueFrom: { secretKeyRef: { name: platform-api-secrets, key: app.key }} } | |
- { name: "APP_TIMEZONE", value: "UTC" } | |
- { name: "HASH_ID_SECRET", valueFrom: { secretKeyRef: { name: platform-api-secrets, key: hash.id.secret }} } | |
livenessProbe: | |
httpGet: | |
path: /healthz | |
port: 80 | |
initialDelaySeconds: 10 | |
timeoutSeconds: 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM php:7.1-apache | |
ADD . /var/www | |
ADD ./site.conf /etc/apache2/sites-enabled/000-default.conf | |
RUN apt-get update && apt-get install -y libmcrypt-dev mysql-client && \ | |
docker-php-ext-install mcrypt pdo_mysql opcache && \ | |
pecl install redis-3.1.2 && docker-php-ext-enable redis && \ | |
a2enmod rewrite | |
WORKDIR /var/www |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Secret | |
metadata: | |
name: platform-api-secrets | |
data: | |
app.key: [BASE64_VALUE] | |
hash.id.secret: [BASE64_VALUE] | |
db.password: [BASE64_VALUE] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: platform-api | |
spec: | |
selector: | |
app: platform-api | |
ports: | |
- protocol: TCP | |
port: 80 | |
type: NodePort |
Nice work. Would be good to have a reference laravel project in Helm (https://kubeapps.com/) if you find the time!
Edit - so I found the time to put it together myself, see here for an end to end example:
https://github.com/EamonKeane/laravel5-5-example
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Could you share your
site.conf
file?