Skip to content

Instantly share code, notes, and snippets.

@psaia
Created February 8, 2020 20:49
Show Gist options
  • Save psaia/b12b39557fa7694c3f26ec5276816ebf to your computer and use it in GitHub Desktop.
Save psaia/b12b39557fa7694c3f26ec5276816ebf to your computer and use it in GitHub Desktop.
Quick, immutable (with persistent mongodb), Strapi kubernetes config
apiVersion: v1
data:
database.json: |
{
"defaultConnection": "default",
"connections": {
"default": {
"connector": "mongoose",
"settings": {
"uri": "mongodb://..."
},
"options": {
"ssl": true
}
}
}
}
kind: ConfigMap
metadata:
name: strapi-configmap
---
apiVersion: v1
data:
build-strapi.sh: |
#!/bin/sh
/usr/local/bin/docker-entrypoint.sh strapi version
cp /tmp/config/database.json /srv/app/config/environments/production/
yarn add strapi-connector-mongoose strapi-provider-upload-google-cloud-storage
strapi build
strapi start
kind: ConfigMap
metadata:
name: strapi-buildscript
---
apiVersion: v1
kind: Service
metadata:
name: strapi-service
spec:
type: LoadBalancer
ports:
- port: 1337
targetPort: 1337
selector:
app: strapi
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: strapi-deployment
spec:
replicas: 1
strategy:
type: RollingUpdate
template:
metadata:
labels:
app: strapi
spec:
volumes:
- name: strapi-configmap
configMap:
name: strapi-configmap
defaultMode: 0777
- name: strapi-buildscript
configMap:
name: strapi-buildscript
defaultMode: 0777
containers:
- image: strapi/strapi:3.0.0-beta.18.7-node12
env:
- name: NODE_ENV
value: "production"
name: strapi
imagePullPolicy: Always
volumeMounts:
- name: strapi-configmap
mountPath: /tmp/config
- name: strapi-buildscript
mountPath: /tmp/init
resources:
limits:
cpu: "1000m"
memory: "1Gi"
requests:
cpu: "100m"
memory: "500Mi"
ports:
- containerPort: 1337
command: ["/tmp/init/build-strapi.sh"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment