Deploy script upgrades release with kubectl

This commit is contained in:
Benoit Schweblin 2019-07-02 21:22:14 +01:00
parent b2158fc1c3
commit d2867ea1c0
5 changed files with 67 additions and 24 deletions

View File

@ -6,14 +6,24 @@ node_js:
services:
- docker
variables:
KUBECONFIG: /etc/deploy/config
before_deploy:
# Run docker build
- docker build -t benweet/stackedit .
# Install Kubectl
- curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
- mkdir -p /etc/deploy
- echo ${KUBE_CONFIG} | base64 -d > ${KUBECONFIG}
- kubectl config use-context gke_stackedit-project_us-central1-a_stackedit-cluster
# Install Helm
- curl -SLO https://git.io/get_helm.sh
- chmod 700 get_helm.sh
- ./get_helm.sh
- helm init --client-only
- helm repo add stackedit https://benweet.github.io/stackedit-charts/
- helm repo update
# Update the chart
- npm run chart

View File

@ -13,7 +13,7 @@ https://stackedit.io/
- NEW! [Chrome extension](https://chrome.google.com/webstore/detail/ajehldoplanpchfokmeempkekhnhmoha) that uses stackedit.js
- [Community](https://community.stackedit.io/)
### Build Setup
### Build
``` bash
# install dependencies
@ -29,26 +29,53 @@ npm run build
npm run build --report
```
### StackEdit can:
### Deploy with Helm
- Manage multiple Markdown files online or offline
- Export your files in Markdown, HTML, PDF, Word, EPUB...
- Synchronize your Markdown files in the Cloud
- Edit existing Markdown files from Google Drive, Dropbox and your local hard drive
- Post your Markdown file on Blogger/Blogspot, WordPress, Zendesk
- Publish your Markdown file on GitHub, Gist, Google Drive, Dropbox
- Share a workspace over Google Drive, CouchDB
StackEdit Helm chart allows easy StackEdit deployment to any Kubernetes cluster.
You can use it to configure deployment with your existing ingress controller and cert-manager.
### Features:
```bash
# Add the StackEdit Helm repository
helm repo add stackedit https://benweet.github.io/stackedit-charts/
- Real-time HTML preview with Scroll Sync feature to bind editor and preview scrollbars
- Markdown Extra/GitHub Flavored Markdown support and Prism.js syntax highlighting
- LaTeX mathematical expressions using KaTeX
- Diagrams and flowcharts using Mermaid
- WYSIWYG control buttons
- Smart layout
- Offline editing
- Online synchronization using Google Drive, Dropbox and GitHub
- One click publish to Blogger, Dropbox, Gist, GitHub, Google Drive, WordPress, Zendesk
# Update your local Helm chart repository cache
helm repo update
> **NOTE:** This page has been written and published with [StackEdit](https://stackedit.io/ "StackEdit").
# Deploy StackEdit chart to your cluster
helm install --name stackedit stackedit/stackedit \
--set dropboxAppKey=$DROPBOX_API_KEY \
--set dropboxAppKeyFull=$DROPBOX_FULL_ACCESS_API_KEY \
--set googleClientId=$GOOGLE_CLIENT_ID \
--set googleApiKey=$GOOGLE_API_KEY \
--set githubClientId=$GITHUB_CLIENT_ID \
--set githubClientSecret=$GITHUB_CLIENT_SECRET \
--set wordpressClientId=\"$WORDPRESS_CLIENT_ID\" \
--set wordpressSecret=$WORDPRESS_CLIENT_SECRET
# Upgrade to the latest version
helm repo update
helm upgrade stackedit stackedit/stackedit
# Uninstall StackEdit
helm delete --purge stackedit
# Deploy using your existing ingress controller and cert-manager
# See https://docs.cert-manager.io/en/latest/tutorials/acme/quick-start/index.html
helm install --name stackedit stackedit/stackedit \
--set dropboxAppKey=$DROPBOX_API_KEY \
--set dropboxAppKeyFull=$DROPBOX_FULL_ACCESS_API_KEY \
--set googleClientId=$GOOGLE_CLIENT_ID \
--set googleApiKey=$GOOGLE_API_KEY \
--set githubClientId=$GITHUB_CLIENT_ID \
--set githubClientSecret=$GITHUB_CLIENT_SECRET \
--set wordpressClientId=\"$WORDPRESS_CLIENT_ID\" \
--set wordpressSecret=$WORDPRESS_CLIENT_SECRET \
--set ingress.enabled=true \
--set ingress.annotations."kubernetes\.io/ingress\.class"=nginx \
--set ingress.annotations."certmanager\.k8s\.io/issuer"=letsencrypt-prod \
--set ingress.annotations."certmanager\.k8s\.io/acme-challenge-type"=http01 \
--set ingress.hosts[0].host=stackedit.exemple.com \
--set ingress.hosts[0].paths[0]=/ \
--set ingress.tls[0].secretName=stackedit-tls \
--set ingress.tls[0].hosts[0]=stackedit.exemple.com
```

View File

@ -1,17 +1,24 @@
#!/bin/bash
set -e
# Tag and push docker image
docker login -u benweet -p "$DOCKER_PASSWORD"
docker tag benweet/stackedit "benweet/stackedit:$TRAVIS_TAG"
docker push benweet/stackedit:$TRAVIS_TAG
docker tag benweet/stackedit:$TRAVIS_TAG benweet/stackedit:latest
docker push benweet/stackedit:latest
# Add chart to helm repository
git clone "https://benweet:$GITHUB_TOKEN@github.com/benweet/stackedit-charts.git" charts
cd charts
helm package ../chart
helm package ../dist/stackedit
helm repo index --url https://benweet.github.io/stackedit-charts/ .
git config user.name "Benoit Schweblin"
git config user.email "benoit.schweblin@gmail.com"
git add .
git commit -m "Added $TRAVIS_TAG"
git push origin master
# Upgrade the deployed release
helm repo update
helm upgrade stackedit stackedit/stackedit

View File

@ -33,7 +33,7 @@ ingress:
enabled: false
annotations:
# kubernetes.io/ingress.class: nginx
# certmanager.k8s.io/cluster-issuer: letsencrypt-prod
# certmanager.k8s.io/issuer: letsencrypt-prod
# certmanager.k8s.io/acme-challenge-type: http01
hosts: []
# - host: stackedit.exemple.com

View File

@ -22,8 +22,7 @@
"patch": "npm version patch -m \"Tag v%s\"",
"minor": "npm version minor -m \"Tag v%s\"",
"major": "npm version major -m \"Tag v%s\"",
"chart": "replace-in-file STACKEDIT_VERSION $npm_package_version chart/*.yaml",
"deploy": "kubectl --record deployment.apps/stackedit-deployment set image deployment.v1.apps/stackedit-deployment stackedit=benweet/stackedit:v$npm_package_version"
"chart": "rm -rf dist/stackedit && cp -r chart dist/stackedit && sed -i.bak -e s/STACKEDIT_VERSION/$npm_package_version/g dist/stackedit/*.yaml && rm dist/stackedit/*.yaml.bak"
},
"dependencies": {
"@vue/test-utils": "^1.0.0-beta.16",