Quick, immutable (with persistent mongodb), Strapi kubernetes config
This file contains 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 | |
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