diff --git a/CHANGELOG.md b/CHANGELOG.md index 908bac2..5d5fd7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## 0.2.1 - 2019-08-14 + +- Adds a `push` command (See #2) + ## 0.2.0 - 2019-08-12 - Adds export command (See [#1013](https://github.com/outline/outline/pull/1013) for corresponding Outline PR) diff --git a/README.md b/README.md index fe117b6..f72a1bc 100644 --- a/README.md +++ b/README.md @@ -81,10 +81,27 @@ docker run --env OUTLINE_BASE_URI="https://kb.example.com" \ import "/data" "Archive" ``` +### Push + +Note: Push is currently only available as a Docker Command + +```bash +docker run --env OUTLINE_BASE_URI="https://kb.example.com" \ + --env OUTLINE_TOKEN="PUT YOUR TOKEN HERE" \ + --env OUTLINE_TOKEN="PUT YOUR TOKEN HERE" \ + --env GIT_BRANCH=outline \ + --env GIT_REMOTE_URL=git@example.com:org/outline.backup.git + --volume /etc/ssh/private.key:/root/.ssh/id_rsa + captn3m0/outliner \ + push +``` + #### Limitations - Images are currently not imported. Host them externally for this to work. - Only `.md` files are currently supported +- `push` doesn't sync file-history, but is meant to push a one-time backup to Git. +- `StrictHostKeyChecking` is currently disabled for `push`, please only run this in trusted networks. ## Development diff --git a/entrypoint.sh b/entrypoint.sh index 66439b1..4ac69cb 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,13 +1,14 @@ #!/bin/sh set -eu - if [ $# -eq 0 ]; then - echo "Please run with outliner [export|import] arguments" + echo "Please run with outliner [export|import|sync] arguments" exit fi setup_git() { if [ -f "$HOME/.ssh/id_rsa" ]; then + # This is required because Kubernetes secret mounts can't + # have file permissions set chmod 0400 "$HOME/.ssh/id_rsa" if [ ! -d "$HOME/.ssh/id_rsa.pub" ]; then @@ -51,10 +52,11 @@ case $1 in git init update_git_config git add . - git commit --message "Backup: $(date)" + git commit --message "Backup: $(date)" > /dev/null BRANCH=${GIT_BRANCH:-master} git checkout -b "$BRANCH" - git push origin --force "$BRANCH" + git status + git push origin --force "HEAD:$BRANCH" fi ;; *)