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

[v0.0.0-beta] Release #7

Draft
wants to merge 63 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
c7771fe
npm init
petermikitsh Nov 12, 2018
a9ab8f4
'secrets', 'ls' subcommands
petermikitsh Nov 12, 2018
9e7b46f
Update README
petermikitsh Nov 12, 2018
02d99e1
remove deployment
petermikitsh Nov 13, 2018
1600dda
deploy command (wip)
petermikitsh Nov 13, 2018
4d445ef
split cli cmds into separate files; add 'install' cmd
petermikitsh Dec 19, 2018
f29118a
[README.md] update docs to discuss Kaniko
petermikitsh Dec 19, 2018
d1f365e
[create] minikube: conditionally create deployment; add build-context…
petermikitsh Dec 19, 2018
7ed5fc6
LICENSE
petermikitsh Dec 19, 2018
6ef9833
[utils] add logging methods
petermikitsh Dec 29, 2018
8d1a8bd
[install] prefer 'run' utility cmd
petermikitsh Dec 29, 2018
5df520f
[login] implementation
petermikitsh Dec 29, 2018
e3a178c
[logout] implementation
petermikitsh Dec 29, 2018
6c5e4bc
[index] expose login, logout methods
petermikitsh Dec 29, 2018
5355204
[create] prefer 'run' util cmd; add some checks
petermikitsh Dec 29, 2018
79a59cc
[ls] fix base case (no deployment name specified)
petermikitsh Dec 29, 2018
6e35e7c
[scale] implementation
petermikitsh Dec 29, 2018
c954db6
[domains]: list functionality
petermikitsh Dec 29, 2018
78963f9
[utils] run: add new fn arg
petermikitsh Dec 29, 2018
9b8d939
[create]: init helm/tiller with TLS
petermikitsh Dec 29, 2018
e7c5c99
[create] install traefik using helm
petermikitsh Jan 1, 2019
275e832
[create] traefik with ssl
petermikitsh Jan 2, 2019
64efa3c
[ip] cmd implementation
petermikitsh Jan 2, 2019
6490382
[create] swap traefik with nginx-ingress and cert-manager
petermikitsh Jan 2, 2019
71b364a
[README] updates
petermikitsh Jan 2, 2019
e819654
add prettier
hipstersmoothie Jan 2, 2019
a24b0b4
incremental adoption
hipstersmoothie Jan 2, 2019
6510ead
add tslint
hipstersmoothie Jan 2, 2019
5b9eab6
move types to devdeps
hipstersmoothie Jan 2, 2019
8f0711e
add watch script
hipstersmoothie Jan 2, 2019
95ab13b
change main
hipstersmoothie Jan 2, 2019
5deadfe
add prettier (#1)
hipstersmoothie Jan 4, 2019
308ea2b
[utils.js] fix compilation error
petermikitsh Jan 4, 2019
34a5406
[src] javascript => typescript
petermikitsh Jan 4, 2019
7c053d2
merge ts into secrets
petermikitsh Jan 4, 2019
fc489af
[src] resolve linter errs
petermikitsh Jan 4, 2019
dbc5943
update README
petermikitsh Jan 4, 2019
1839557
update README
petermikitsh Jan 4, 2019
8cf6922
update README
petermikitsh Jan 4, 2019
cf4d1e4
[domains] add, rm functionality & docs
petermikitsh Jan 5, 2019
17a7cf0
[docs] add comparison between snow vs. now
petermikitsh Jan 7, 2019
ea532af
[Comparison] add Digital Ocean costs
petermikitsh Jan 9, 2019
58b73e5
typescript improvements - cloud providers (#5)
hipstersmoothie Jan 9, 2019
8daa0ff
alias/certs cmds; secrets rename cmd; docs updates
petermikitsh Jan 17, 2019
bc147b7
[commands] escape special chars in headers
petermikitsh Jan 17, 2019
a068337
[login] gcp: set default project
petermikitsh Jan 22, 2019
7e10c04
[create] fix linter warnings
petermikitsh Jan 22, 2019
9247c8c
[alias] don't apply suffix to kubernetes object names
petermikitsh Jan 22, 2019
3fb9d4e
[commands] update cmd docs
petermikitsh Jan 22, 2019
ae7cdb0
[deploy] implementation
petermikitsh Jan 22, 2019
b8928c9
[README] update supported cmds table
petermikitsh Jan 22, 2019
212de51
[deploy] set first revision to 1
petermikitsh Jan 22, 2019
67ae396
[index] proper source maps for stack traces
petermikitsh Mar 2, 2019
9cd5083
[utils] run: add silent option
petermikitsh Mar 2, 2019
df67b01
[src] digital ocean support
petermikitsh Mar 2, 2019
54202bc
[create] copy docker cert to pods daily
petermikitsh Mar 4, 2019
02de461
add demo image
petermikitsh Mar 6, 2019
e70bb52
[README] shell syntax highlighting
petermikitsh Mar 6, 2019
6276b26
Secrets (#20)
0xflotus May 2, 2019
c15b455
chore: watch mode - don't clear console
petermikitsh Aug 19, 2019
f6fea99
fix(deploy): use v0.7.0 kaniko image
petermikitsh Aug 19, 2019
2be0eb8
fix(config): add port to Dockerfile
petermikitsh Aug 19, 2019
9ae1404
feat(create): Add azure support, --skip-provision option
petermikitsh Aug 19, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
config/build-context/context.tar.gz
node_modules
dist
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
registry=https://registry.npmjs.org/
save-exact=true
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 Peter Mikitsh

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
107 changes: 81 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,93 @@
<div align="center">
<img height="300" src="./logo.svg">
<img src="./demo.png">
</div>

> :snowflake: **S**elf-hosted **now** deployments
> :snowflake: **S**elf-hosted **now** deployments

Enjoy effortless deployments with a clone of [now](https://github.com/zeit/now-cli) on your own hardware.
Enjoy effortless deployments with a clone of [now] on a cloud of your choosing.

### Features

- ⚡️ Deploy docker images via `snow` (or `snow deploy`)
- 🔒 Auto-configured SSL
- 🔃 Auto-scaling

### This is Magic 🔮

No, it isn't. This CLI abstracts away the complexities of using [Kubernetes], [cert-manager], [Kaniko], and a private [Docker Registry] together, replicating the functionality provided by `now`.

### Getting started

```
curl -sSL https://get.snowjs.app/ | sh
npm i -g snow-cli
snow
```sh
> npm i -g @snowjs/cli

# Install CLI tools
> snow install

# Create your kubernetes cluster (GCP)
> snow create

# Get your deployment's IP address
# And create a DNS 'A' record (e.g., myapp.com A 1.2.3.4)
> snow ip

# Deploy
> snow
```

### Supported commands

Without arguments, deploys just like `now`.

| Support | Command | Description |
|---------|------------------------|-------------------|
| :x: | \<none\> | Deploy |
| :x: | `alias` | Alias deployment |
| :x: | `deploy` | Deploy |
| :x: | `domains` | List domains |
| :x: | `domains add [domain]` | Add domain |
| :x: | `domains rm [domain]` | Remove domain |
| :x: | `login` | Login |
| :x: | `logout` | Logout |
| :x: | `ls` | List deployments |
| :x: | `rm [name]` | Remove deployment |
### Flags

| Support | Command | Flag | Description |
|---------|---------|-------------------|----------------------|
| :x: | \<all\> | `--token [token]` | Authentication token |
| :x: | `login` | `--host [host]` | Snow server hostname |
**Detailed** descriptions of supported commands at [docs/commands.md](docs/commands.md).

| Support | Command | Description |
| ------------------ | ------------------------------------ | ----------------------------- |
| :white_check_mark: | \<none\> | Deploy |
| :white_check_mark: | `alias [ls]` | List aliases |
| :white_check_mark: | `alias set <deployment> <alias>` | Create alias |
| :white_check_mark: | `alias rm <alias>` | Remove alias |
| :white_check_mark: | `certs [ls]` | List SSL Certificates |
| :white_check_mark: | `certs issue <cn> [<cn>]` | Issue certificate |
| :white_check_mark: | `certs rm <cn>` | Remove a certificate |
| :new: | `create` | Create Kubernetes cluster |
| :white_check_mark: | `deploy` | Deploy |
| :white_check_mark: | `domains [ls]` | List domains |
| :white_check_mark: | `domains add <domain>` | Add domain |
| :no_entry: | `domains buy <domain>` | Buy domain |
| :white_check_mark: | `domains rm <domain>` | Remove domain |
| :white_check_mark: | `login` | Login |
| :white_check_mark: | `logout` | Logout |
| :white_check_mark: | `ls` | List deployments |
| :new: | `install` | Install CLI tools (via brew) |
| :new: | `ip` | Get IP Address of deployments |
| :white_check_mark: | `rm <name>` | Remove deployment |
| :white_check_mark: | `scale <deployment> <min> [<max>]` | Scale deployment |
| :white_check_mark: | `secrets [ls]` | List secrets |
| :white_check_mark: | `secrets add <key> <value>` | Create secret |
| :white_check_mark: | `secrets rename <old-key> <new-key>` | Rename secret |
| :white_check_mark: | `secrets rm <key>` | Remove secret |

### Tell me more

The essential CLI commands to understand are `snow create` and `snow deploy`.

### Dependencies

The following CLI tools (installable via `snow install`) are necessary to orchestrate the entire end-to-end process, from Kubernetes cluster creation to managing your deployments:

- `kubectl` (for managing deployments, secrets)
- `helm` (for installing [tiller], [cert-manager], and [ingress-nginx] on your cluster)
- CLI tool for your cloud provider (e.g., `gcloud`).

If running Kubernetes locally on Minikube, you will additionally need these cli tools:

- `docker` (for running local registry)
- `minikube` (for running Kubernetes locally)
- `virtualbox` (for creating docker images)

[cert-manager]: https://github.com/jetstack/cert-manager
[docker registry]: https://github.com/helm/charts/tree/master/stable/docker-registry
[now]: https://github.com/zeit/now-cli
[ingress-nginx]: https://github.com/kubernetes/ingress-nginx
[kaniko]: https://github.com/GoogleContainerTools/kaniko
[kubernetes]: https://kubernetes.io/
3 changes: 3 additions & 0 deletions config/build-context/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM nginx:alpine
COPY index.html /usr/share/nginx/html/index.html
EXPOSE 80
3 changes: 3 additions & 0 deletions config/build-context/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# build-context

This directory is a minimal example of everything you need to create a deployment.
18 changes: 18 additions & 0 deletions config/build-context/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Hello World - Nginx Docker</title>
<style>
h1 {
font-weight:lighter;
font-family: Arial, Helvetica, sans-serif;
}
</style>
</head>
<body>
<h1>Hello World - Deployed with Snow</h1>
</body>
</html>
9 changes: 9 additions & 0 deletions config/build-context/now.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "my-example",
"files": [
"index.html"
],
"alias": [
"my-example.minikube"
]
}
50 changes: 50 additions & 0 deletions config/deployment-gcp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: helloweb
labels:
app: hello
spec:
selector:
matchLabels:
app: hello
tier: web
template:
metadata:
labels:
app: hello
tier: web
spec:
containers:
- name: hello-app
image: gcr.io/google-samples/hello-app:1.0
ports:
- containerPort: 8080
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: helloweb
annotations:
kubernetes.io/ingress.global-static-ip-name: helloweb-ip
labels:
app: hello
spec:
backend:
serviceName: helloweb-backend
servicePort: 8080
---
apiVersion: v1
kind: Service
metadata:
name: helloweb-backend
labels:
app: hello
spec:
type: NodePort
selector:
app: hello
tier: web
ports:
- port: 8080
targetPort: 8080
63 changes: 63 additions & 0 deletions config/deployment-minikube.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: whoami-deployment
spec:
replicas: 5
selector:
matchLabels:
app: whoami
template:
metadata:
labels:
app: whoami
spec:
containers:
- name: whoami-container
image: containous/whoami
---
apiVersion: v1
kind: Service
metadata:
name: whoami-clusterip-service
spec:
type: ClusterIP
ports:
- name: http
targetPort: 80
port: 80
selector:
app: whoami
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: whoami
# annotations:
# kubernetes.io/ingress.class: traefik
spec:
# THE Below will make a 'global default service'
# backend:
# serviceName: whoami
# servicePort: 80
rules:
# whoami.minikube must be in your hosts file (pointing to `minikube ip`)
- host: whoami.minikube
http:
paths:
- path: /
backend:
serviceName: whoami-clusterip-service
servicePort: 80
# whoami.com must be in your hosts file (pointing to `minikube ip`)
- host: whoami.com
http:
paths:
- path: /
backend:
serviceName: whoami-clusterip-service
servicePort: 80
# tls:
# - hosts:
# - whoami.com
# - whoami.minikube
71 changes: 71 additions & 0 deletions config/kaniko.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
apiVersion: v1
kind: Pod
metadata:
name: kaniko
spec:
initContainers:
- name: kaniko-init
image: alpine
args:
- "sh"
- "-c"
- "while true; do sleep 1; if [ -f /tmp/complete ]; then break; fi done"
volumeMounts:
- name: empty-folder
mountPath: /kaniko/build-context
- name: empty-folder
mountPath: /kaniko/.docker
containers:
- name: kaniko
image: gcr.io/kaniko-project/executor:latest
args:
- "--context=dir:///kaniko/build-context"
- "--destination=172.17.0.15:5000/foobar:latest"
- "--insecure"
volumeMounts:
- name: empty-folder
mountPath: /kaniko/build-context
- name: empty-folder
mountPath: /kaniko/.docker
volumes:
- name: empty-folder
emptyDir: {}

# apiVersion: v1
# kind: Pod
# metadata:
# name: kaniko
# spec:
# initContainers:
# - name: kaniko-init
# image: alpine
# args:
# - "sh"
# - "-c"
# - "while true; do sleep 1; if [ -f /tmp/complete ]; then break; fi done"
# volumeMounts:
# - name: build-context
# mountPath: /kaniko/build-context
# containers:
# - name: kaniko
# image: gcr.io/kaniko-project/executor:latest
# args:
# - "--dockerfile=Dockerfile"
# - "--context=dir:///kaniko/build-context"
# - "--destination=172.17.0.15:5000/foobar:latest"
# - "--insecure"
# # - "--skip-tls-verify"
# # - "--tarPath=dir://kaniko/foo.tar"
# # - "--no-push"
# # - "--destination=mytag:latest"
# volumeMounts:
# - name: build-context
# mountPath: /kaniko/build-context
# - name: docker-config
# mountPath: /kaniko/.docker
# volumes:
# - name: docker-config
# configMap:
# name: docker-config
# - name: build-context
# emptyDir: {}
Binary file added demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading