Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Commit

Permalink
Sync docs with gh-pages (#387)
Browse files Browse the repository at this point in the history
Adds introduction.md as well as syncs all the documentation from /docs
to gh-pages.
  • Loading branch information
cdrage authored Oct 26, 2017
1 parent 5609de7 commit 7abfd62
Show file tree
Hide file tree
Showing 4 changed files with 158 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ env:
matrix:
include:
- go: 1.7
# Build the docs (only once)
env: BUILD_DOCS=yes
- go: 1.8
- go: 1.9

Expand Down Expand Up @@ -45,3 +47,5 @@ after_success:
# gover collects all .coverprofile files and saves it to one file gover.coverprofile
- gover
- goveralls -coverprofile=gover.coverprofile -service=travis-ci
# sync the docs only if everything else was successful
- ./scripts/sync-docs.sh
62 changes: 62 additions & 0 deletions docs/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Simplifying how you define Kubernetes artifacts
{: .center-text }
## Use Kedge to deploy applications with sensible defaults
{: .center-text }

### What's Kedge?

Kedge is a simple, easy and declarative way to define and deploy applications to Kubernetes by writing very concise application definitions.

Why do people love Kedge?

- __Declarative:__ Declarative definitions specifying developer's intent.
- __Simplicity:__ Using a simple and concise specification that is easy to understand and define.
- __Concise:__ Define just the necessary bits and Kedge will do the rest. Kedge will interprolate and pick the best defaults for your application to run on Kubernetes.
- __Multi-container environments:__ Define your containers, services and applications in one simple file, or split them into multiple files.
- __Familiar structure:__ Using a familiar YAML structure as Kubernetes, it's easy to pick-up and understand Kedge.
- __Built on top of Kubernetes Pod definition:__ Leverages Kuberenetes Pod definition (PodSpec) and avoids leaky abstractions.

### Avoid writing long artifact files, deploy an application straight to a Kubernetes cluster

```yaml
name: httpd
containers:
- image: centos/httpd
services:
- name: httpd
type: NodePort
ports:
- port: 8080
targetPort: 80
```
{: .demo-code }
![Demo Gif](/img/demo.gif)
{: .demo-gif }
View our [file reference](/file-reference) for a complete overview on what Kedge can do.
### Install and deploy on Linux, macOS or Windows
Install Kedge with our simple binary!
```sh
# Linux
curl -L https://github.com/kedgeproject/kedge/releases/download/v0.2.0/kedge-linux-amd64 -o kedge

# macOS
curl -L https://github.com/kedgeproject/kedge/releases/download/v0.2.0/kedge-darwin-amd64 -o kedge

chmod +x kedge
sudo mv ./kedge /usr/local/bin/kedge
```

For Windows users, download from the [GitHub release](https://github.com/kedgeproject/kedge/releases/download/v0.2.0/kedge-windows-amd64.exe) and add the binary to your PATH.

### Pick from an example and see what Kedge is all about

Choose from multiple Kedge examples to deploy:

- [Wordpress](https://github.com/kedgeproject/kedge/tree/master/examples/wordpress)
- [GitLab](https://github.com/kedgeproject/kedge/tree/master/examples/gitlab)
- [Kubernetes Guestbook](https://github.com/kedgeproject/kedge/tree/master/examples/guestbook-demo)
Binary file added scripts/deploy_key.enc
Binary file not shown.
92 changes: 92 additions & 0 deletions scripts/sync-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#!/usr/bin/env bash

# Ensures that we run on Travis
if [ "$TRAVIS_BRANCH" != "master" ] || [ "$BUILD_DOCS" != "yes" ] || [ "$TRAVIS_SECURE_ENV_VARS" == "false" ] || [ "$TRAVIS_PULL_REQUEST" != "false" ] ; then
echo "Must be: a merged pr on the master branch, BUILD_DOCS=yes, TRAVIS_SECURE_ENV_VARS=false"
exit 0
fi

DOCS_REPO_NAME="kedge"
DOCS_REPO_URL="[email protected]:kedgeproject/kedge.git"
DOCS_KEY="scripts/deploy_key.enc"
DOCS_USER="kedge-bot"
DOCS_EMAIL="[email protected]"
DOCS_BRANCH="gh-pages"
DOCS_FOLDER="docs"
ENC_KEY=$encrypted_91569b511922_key
ENC_IV=$encrypted_91569b511922_iv

# decrypt the private key
openssl aes-256-cbc -K $ENC_KEY -iv $ENC_IV -in "$DOCS_KEY.enc" -out "$DOCS_KEY" -d
chmod 600 "$DOCS_KEY"
eval `ssh-agent -s`
ssh-add "$DOCS_KEY"

# clone the repo
git clone "$DOCS_REPO_URL" "$DOCS_REPO_NAME"

# change to that directory (to prevent accidental pushing to master, etc.)
cd "$DOCS_REPO_NAME"

# switch to gh-pages and grab the docs folder from master
git checkout gh-pages
git checkout master docs

# Remove README.md from docs folder as it isn't relevant
rm docs/README.md

# Use introduction.md instead as the main index page
mv docs/introduction.md index.md

# Check that index.md has the appropriate Jekyll format
index="index.md"
if cat $index | head -n 1 | grep "\-\-\-";
then
echo "index.md already contains Jekyll format"
else
# Remove ".md" from the name
name=${index::-3}
echo "Adding Jekyll file format to $index"
jekyll="---
layout: default
---
"
echo -e "$jekyll\n$(cat $index)" > $index
fi

# clean-up the docs and convert to jekyll-friendly docs
cd docs
for filename in *.md; do
if cat $filename | head -n 1 | grep "\-\-\-";
then
echo "$filename already contains Jekyll format"
else
# Remove ".md" from the name
name=${filename::-3}
echo "Adding Jekyll file format to $filename"
jekyll="---
layout: default
permalink: /$name/
redirect_from:
- /docs/$name.md/
---
"
echo -e "$jekyll\n$(cat $filename)" > $filename
fi
done
cd ..

# add relevant user information
git config user.name "$DOCS_USER"

# email assigned
git config user.email "$DOCS_EMAIL"
git add --all

# Check if anything changed, and if it's the case, push to origin/master.
if git commit -m 'Update docs' -m "Commit: https://github.com/kedgeproject/kedge/commit/$TRAVIS_COMMIT" ; then
git push
fi

# cd back to the original root folder
cd ..

0 comments on commit 7abfd62

Please sign in to comment.