Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: usage guide via slate #536

Merged
merged 43 commits into from Feb 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
365431e
docs: prototype Slate documentation and build scripts
bobheadxi Feb 7, 2019
07f6286
chore: add output to build_docs.sh
bobheadxi Feb 7, 2019
c04e52c
chore: remove docs_build in clean
bobheadxi Feb 7, 2019
e5ff432
wip docs
bobheadxi Feb 7, 2019
4a8e42f
chore: set -e on doc build, check for slate
bobheadxi Feb 7, 2019
bda572e
chore: fix symlinking
bobheadxi Feb 8, 2019
8b7b76f
chore: working symlink live-reload
bobheadxi Feb 8, 2019
ae8e8e7
docs: sync colour scheme with web app design
bobheadxi Feb 8, 2019
3401ec7
More WIP docs
bobheadxi Feb 8, 2019
0a13a48
rebuild docs
bobheadxi Feb 8, 2019
ab67d83
fix makeup
bobheadxi Feb 8, 2019
0bf5b01
note that daemon init is not needed with provision, minor fixes
bobheadxi Feb 8, 2019
cab7bae
grammar
bobheadxi Feb 8, 2019
71c7e1f
rebuild docs
bobheadxi Feb 8, 2019
58a026d
tweaks
bobheadxi Feb 8, 2019
92cd483
rebuild
bobheadxi Feb 8, 2019
99d8546
fuck
bobheadxi Feb 8, 2019
0d3cfbe
adjust breakpoints
bobheadxi Feb 8, 2019
0dc25d8
update 2fa section
bobheadxi Feb 8, 2019
876eba0
update api key section
bobheadxi Feb 8, 2019
892d1cc
update resource management section
bobheadxi Feb 8, 2019
688985c
flesh out misc sections
bobheadxi Feb 8, 2019
7bd5097
more misc stuff
bobheadxi Feb 8, 2019
65dfd49
minor tweaks
bobheadxi Feb 8, 2019
a17554c
tweaks to notices
bobheadxi Feb 8, 2019
c4622bc
flesh out advanced section
bobheadxi Feb 8, 2019
686a384
clean up
bobheadxi Feb 8, 2019
870c960
build
bobheadxi Feb 8, 2019
4442fbb
add ec2 provisioning walkthrough
bobheadxi Feb 8, 2019
513f837
make key notice a warning
bobheadxi Feb 8, 2019
6cdac38
add note about generating access keys
bobheadxi Feb 8, 2019
dfb741b
note that inertia will prompt for keys
bobheadxi Feb 8, 2019
530079d
word
bobheadxi Feb 8, 2019
5edac97
more fixes
bobheadxi Feb 8, 2019
ed53f3c
remove redundant parts from README
bobheadxi Feb 8, 2019
d725515
add 'why use inertia'
bobheadxi Feb 8, 2019
a60b77e
add cname
bobheadxi Feb 8, 2019
1731222
Merge branch 'master' of github.com:ubclaunchpad/inertia into docs/slate
bobheadxi Feb 9, 2019
4611a43
add favicon, improve hacks
bobheadxi Feb 9, 2019
336f93d
adjust README
bobheadxi Feb 9, 2019
100891a
adjust SSL cert information
bobheadxi Feb 9, 2019
008acdd
add documentation issue template
bobheadxi Feb 9, 2019
c6b6009
add section on building documentation in CONTRIBUTING
bobheadxi Feb 9, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitattributes
Expand Up @@ -6,3 +6,6 @@
*.png binary
*.jpg binary
*.pdf binary

# Mark docs as generated
docs/* linguist-generated
15 changes: 15 additions & 0 deletions .github/ISSUE_TEMPLATE/doc-issue.md
@@ -0,0 +1,15 @@
---
name: Documentation issue
about: Let us know if something is wrong with our documentation!
title: 'docs: '
labels: 'type: docs :book:'
assignees: ''

---

**Describe the issue**
A clear and concise description of what the issue is.

**Additional context**
Add any other context about the problem here, such as screenshots and links to
relevant documentation.
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -40,3 +40,6 @@ public/

# JetBrains
.idea

# Doc build
docs_build
68 changes: 68 additions & 0 deletions .scripts/build_docs.sh
@@ -0,0 +1,68 @@
#! /bin/bash

set -e

###
# This script is a wonderful hack I made to get around the fact that Slate
# (https://github.com/lord/slate) documentation recommends that you fork the
# repository and then write your documentation inside it.
#
# To convert Slate into a pure "doc builder", this script does a few things:
# * clone my (Robert's) fork of Slate into temporary /docs_build
# * write and sed custom configuration into the repository
# * symlink our doc assets (primarily in /docs_src, but also a few image assets
# from .static) into the cloned Slate repository
# * build the documentation into /docs, which is deployed by GH-pages
#
# The symlink + config hacks also allows live-reload local dev deployment (using
# the 'make run-docs' target in /Makefile).
###

# Get Slate
echo "[INFO] Getting Slate"
mkdir -p docs_build
cd docs_build
if [ ! -d slate ]; then
# Using Robert's fork for now, for extra swag and configuration options not
# available in vanilla Slate
git clone https://github.com/bobheadxi/slate.git
else
echo "[INFO] Slate already present in docs_build/slate"
fi

# Add custom config to Slate
echo "[INFO] Hacking Slate configuration"
TEMPLATE_FILES_WATCH="files.watch :source, path: File.join(root, '../../docs_src')"
if ! grep -q "$TEMPLATE_FILES_WATCH" slate/config.rb ; then
# We want to symlink our doc assets into the repo, so to retain live reload
# functionality, we want the generator Slate uses (Middleman) to watch our
# symlink sources for changes too
echo "$TEMPLATE_FILES_WATCH" \
>> slate/config.rb
fi
if ! grep -q "<%= favicon_tag 'favicon.ico' %>" slate/source/layouts/layout.erb ; then
# This inserts a favicon reference into the <head /> element of the
# documentation layout
sed -i '' '/<head>/a\
<%= favicon_tag '\''favicon\.ico'\'' %>
' slate/source/layouts/layout.erb
fi

# Set up Slate for build
echo "[INFO] Linking assets"
ln -fs "$(dirname "$(pwd)")"/docs_src/index.html.md \
slate/source/index.html.md
ln -fs "$(dirname "$(pwd)")"/docs_src/stylesheets/_variables.scss \
slate/source/stylesheets/_variables.scss
ln -fs "$(dirname "$(pwd)")"/.static/inertia.png \
slate/source/images/logo.png
ln -fs "$(dirname "$(pwd)")"/.static/favicon.ico \
slate/source/images/favicon.ico
echo "[INFO] Installing Slate dependencies"
cd slate
bundle install

# Execute build
echo "[INFO] Building documentation"
rm -rf docs
bundle exec middleman build --clean --build-dir=../../docs
Binary file added .static/favicon.ico
Binary file not shown.
Binary file added .static/inertia.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion CNAME
@@ -1 +1 @@
inertia.ubclaunchpad.com
inertia.ubclaunchpad.com
12 changes: 12 additions & 0 deletions CONTRIBUTING.md
Expand Up @@ -178,6 +178,18 @@ $> make web-run # run local instance of application

Make sure you have a local daemon set up for this web app to work - see the previous section for more details.

### Documentation

Our [usage documentation website]() is built with [Slate](https://github.com/lord/slate).
The builds are in `/docs`, but the documentation source is in `/docs_src`.

To build and deploy the documentation locally:

```bash
$> make docs
$> make run-docs # visit http://localhost:4567/
```

## Setting up a Testing Environment

You will need Docker installed and running to run whole the Inertia test suite,
Expand Down
9 changes: 9 additions & 0 deletions Makefile
Expand Up @@ -16,6 +16,7 @@ ls:
clean: testenv-clean
go clean -testcache
rm -f ./inertia
rm -rf ./docs_build
find . -type f -name inertia.\* -exec rm {} \;

# Install all dependencies
Expand Down Expand Up @@ -182,3 +183,11 @@ web-run-sandbox:
.PHONY: web-build
web-build:
(cd ./daemon/web; npm install --production; npm run build)

.PHONY: docs
docs:
sh .scripts/build_docs.sh

.PHONY: run-docs
run-docs:
( cd docs_build/slate ; bundle exec middleman server --verbose )
111 changes: 14 additions & 97 deletions README.md
Expand Up @@ -41,7 +41,7 @@
<br>

<p align="center">
<a href="#package-getting-started"><strong>Getting Started</strong></a> Β·
<a href="#package-usage"><strong>Usage</strong></a> Β·
<a href="#bulb-motivation-and-design"><strong>Motivation & Design</strong></a> Β·
<a href="#books-contributing"><strong>Contributing</strong></a> Β·
<a href="https://github.com/ubclaunchpad/inertia/wiki"><strong>Wiki</strong></a>
Expand Down Expand Up @@ -71,107 +71,24 @@ Inertia is a simple cross-platform command line application that enables quick a

<br>

# :package: Getting Started
# :package: Usage

All you need to get started is a [compatible project](https://github.com/ubclaunchpad/inertia/wiki/Project-Compatibility), the Inertia CLI, and access to a virtual private server.
Check out our new **[Inertia Usage Guide](https://inertia.ubclaunchpad.com)** to
get started with using Inertia for your project! The guide will walk you through
installing Inertia, setting up a project, deploying to a remote, managing your
deployment, and advanced usage tips.

MacOS users can install the CLI using [Homebrew](https://brew.sh):
### Why Use Inertia?

```bash
$> brew install ubclaunchpad/tap/inertia
```
If you...

Windows users can install the CLI using [Scoop](http://scoop.sh):
* want a simple utility to quickly build and deploy the latest iterations of your projects
* are new to the concept of "deployment" and related tooling
* are not deploying to production
* are on a tight budget and need to switch between cloud providers as your free trials run out
* want some lightweight team features for managing your deployment

```bash
$> scoop bucket add ubclaunchpad https://github.com/ubclaunchpad/scoop-bucket
$> scoop install inertia
```

For other platforms, you can [download the appropriate binary from the Releases page](https://github.com/ubclaunchpad/inertia/releases).

### Setup

Initializing a project for use with Inertia only takes a few simple steps:

```bash
$> inertia init
```

#### Using an Existing Remote

To use an existing host, you must first add it to your Inertia configuration and initialize it - this will install Inertia on your remote.

```bash
$> inertia remote add $VPS_NAME
$> inertia $VPS_NAME init
$> inertia $VPS_NAME status
# Confirms that the daemon is online and accepting requests
```

See our [wiki](https://github.com/ubclaunchpad/inertia/wiki/VPS-Compatibility) for more details on VPS platform compatibility.

#### Provisioning a New Remote

Inertia offers some tools to easily provision a new VPS instance and set it up for Inertia. For example, to create an EC2 instance and initialize it, just run:

```bash
$> inertia provision ec2 $VPS_NAME
$> inertia $VPS_NAME status
```

### Deployment Management

To manually deploy your project, you must first grant Inertia permission to clone your repository. This can be done by adding the GitHub Deploy Key that is displayed in the output of `inertia $VPS_NAME init` to your repository settings:

```bash
GitHub Deploy Key (add here https://www.github.com/<your_repo>/settings/keys/new):
ssh-rsa <...>
```

Once this is done, you can use Inertia to bring your project online on your remote VPS:

```bash
$> inertia $VPS_NAME up
```

Run `inertia $VPS_NAME --help` to see the other commands Inertia offers for managing your deployment.

Inertia also offers a web application - this can be accessed at `https://$ADDRESS:4303/web` once users have been added through the `inertia $VPS_NAME user` commands.

### Continuous Deployment

To enable continuous deployment, you need the webhook URL that is printed during `inertia $VPS_NAME init`:

```bash
GitHub WebHook URL (add here https://www.github.com/<your_repo>/settings/hooks/new):
http://myhost.com:4303/webhook
Github WebHook Secret: inertia
```

The daemon will accept POST requests from GitHub at the URL provided. Add this webhook URL in your GitHub settings area (at the URL provided) so that the daemon will receive updates from GitHub when your repository is updated. Once this is done, the daemon will automatically build and deploy any changes that are made to the deployed branch.

### Release Streams

The version of Inertia you are using can be seen in Inertia's `.inertia.toml` configuration file, or by running `inertia --version`. The version in `.inertia.toml` is used to determine what version of the Inertia daemon to use when you run `inertia $VPS_NAME init`.

You can manually change the daemon version used by editing the Inertia configuration file. If you are building from source, you can also check out the desired version and run `make inertia-tagged` or `make RELEASE=$STREAM`. Inertia daemon releases are tagged as follows:

- `v0.x.x` denotes [official, tagged releases](https://github.com/ubclaunchpad/inertia/releases) - these are recommended.
- `latest` denotes the newest builds on `master`.
- `canary` denotes experimental builds used for testing and development - do not use this.

The daemon component of an Inertia release can be patched separately from the CLI component - see our [wiki](https://github.com/ubclaunchpad/inertia/wiki/Daemon-Releases) for more details.

### Swag

Add some bling to your Inertia-deployed project :sunglasses:

[![Deployed with Inertia](https://img.shields.io/badge/deploying%20with-inertia-blue.svg)](https://github.com/ubclaunchpad/inertia)

```
[![Deployed with Inertia](https://img.shields.io/badge/deploying%20with-inertia-blue.svg)](https://github.com/ubclaunchpad/inertia)
```
Inertia might be for you!

<br><br>

Expand Down
Binary file added docs/fonts/slate.eot
Binary file not shown.
14 changes: 14 additions & 0 deletions docs/fonts/slate.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/fonts/slate.ttf
Binary file not shown.
Binary file added docs/fonts/slate.woff
Binary file not shown.
Binary file added docs/fonts/slate.woff2
Binary file not shown.
Binary file added docs/images/aws-ec2-iam-add.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/aws-ec2-iam-perm.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/favicon.ico
Binary file not shown.
Binary file added docs/images/logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/navbar.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.