Skip to content

Commit

Permalink
dna 2.0 - compose is dead, long live skaffold
Browse files Browse the repository at this point in the history
  • Loading branch information
erulabs committed Feb 23, 2020
1 parent 7a3a721 commit 0c1ac77
Show file tree
Hide file tree
Showing 22 changed files with 546 additions and 702 deletions.
11 changes: 3 additions & 8 deletions .eslintrc.json
@@ -1,15 +1,10 @@
{
"parser": "babel-eslint",
"extends": ["standard", "plugin:flowtype/recommended", "plugin:security/recommended"],
"extends": ["standard", "plugin:security/recommended"],
"parserOptions": {
"ecmaVersion": 7,
"ecmaFeatures": {
"jsx": true,
"modules": true
}
"ecmaVersion": 7
},
"rules": {
"flowtype/require-valid-file-annotation": 0,
"no-console": ["warn", { "allow": ["warn", "error"] }],
"no-return-assign": 0,
"require-await": ["error"],
Expand All @@ -29,6 +24,6 @@
"security/detect-non-literal-fs-filename": 0,
"security/detect-unsafe-regex": 0
},
"plugins": ["flowtype", "prettier", "security"],
"plugins": ["prettier", "security"],
"settings": {}
}
17 changes: 0 additions & 17 deletions .flowconfig

This file was deleted.

90 changes: 32 additions & 58 deletions README.md
Expand Up @@ -2,10 +2,11 @@

[![npm version](https://img.shields.io/npm/v/deploy-node-app.svg?style=flat-square)](https://www.npmjs.com/package/deploy-node-app)

Deploy your node.js app to Kubernetes or Docker with a single command. No config required.
Develop and deploy Node.js apps with Kubernetes, with zero config!

Supports any Kubernetes cluster, including the following:

- Minikube
- Google Kubernetes Engine
- Amazon EKS
- DigitalOcean Kubernetes
Expand All @@ -21,92 +22,65 @@ Just run `npx deploy-node-app` in your node project.
### Prerequisites

- [Docker](https://www.docker.com/get-started)
- [NodeJS / npm](https://nodejs.org/en/) - NPM includes the `npx` utility needed to run this package without being installed
- [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) - required for creating your deployment, and recommended for managing your deployment after created
- [Skaffold](https://skaffold.dev/docs/install/) - Kubernetes workflow utility

### What does this tool do?

After answering a few questions about your app, this tool can:

1. Create a Dockerfile (if needed)
1. Build a Docker image
1. Create a Kubernetes deployment file
1. Deploy your app on a Kubernetes cluster
- Configure a free namespace on [KubeSail](https://kubesail.com) (if desired)
1. Create a Dockerfile and all the YAML for developing on and deploying to Kubernetes!
2. Automatically provision common dependencies (like redis and postgres)!
3. Deploy your app on any Kubernetes cluster

Essentially, `deploy-node-app` supercharges any Node application with awesome tools and best practices. With `deploy-node-app`, any codebase can have:

1. Local and remote development!
2. Infrastructure-as-code with no effort!
3. Zero downtime, rolling deployments!
4. Free hosting, including SSL and custom domains! (provided by [KubeSail](https://kubesail.com))

### Usage and examples

```
Usage: deploy-node-app [env]
Usage: deploy-node-app [env] [action] [options]
Examples:
# Deploy to production
deploy-node-app
deploy-node-app production deploy
# Develop your app!
deploy-node-app local dev
Options:
-V, --version output the version number
--generate-default-env Generates default environment variables, like database passwords
--generate-local-ports-env Generates environment variables for connecting to docker-compose services
-n, --no-build Don't build and push docker container
-N, --no-confirm Skip public docker hub confirmation prompt
-d, --no-push Don't push to docker registry
-D, --no-deploy Don't deploy to kubernetes
-O, --overwrite Overwrite local files
-s, --skip metamodule name of metamodule to skip
-S, --safe Do not overwrite local files
-f, --format [type] Output config format [k8s|compose] (default: "k8s")
-o, --output [filename] File for config output. "-" will write to stdout. Default is docker-compose.yaml or deployment.yaml depending on format
-h, --help output usage information
-V, --version output the version number
-h, --help output usage information
-n, --no-write dont write anything to the repo, just use defaults
-u, --update Update existing files (Dockerfile, skaffold.yaml, etc.)
```

By default, `deploy-node-app` will write a few files to your directory, depending on the chosen output. You will be prompted if any files need to be updated or overwritten (use --overwrite to ignore prompts).
By default, `deploy-node-app` will write a few files to your directory, and by default files won't be touched if they've been modified.

# Simplest Usage

Simply run `npx deploy-node-app` in your Node.js repository. The tool will attempt to prompt you when it needs answers to questions, but should happily support almost all Node.js applications, including static front-end's created by `create-react-app`.

# Local Development

`deploy-node-app` can deploy to either a Docker or Kubernetes installation locally:

Deploying to local docker-compose:

`deploy-node-app local -f compose`

- Writes a local Dockerfile
- Scans dependencies for [metamodules](https://github.com/create-node/create-node-app#metamodules), adding services automatically
- Writes a local **docker-compose.yaml** based on your needs
- Builds container image
- Pushes container image to chosen repository
- Calls `docker-compose up ...`

`deploy-node-app local -f k8s`

- Writes a local Dockerfile
- Scans dependencies for [metamodules](https://github.com/create-node/create-node-app#metamodules), adding services automatically
- Writes a local **kustomization.yaml** file based on your needs
- Builds container image
- Pushes container image to chosen repository
- Calls `kubectl apply -k ...`

# Meta Modules

Metamodules are NPM modules with a bit of metadata which allows `deploy-node-app` to properly provision backend services. For example, installing `@metamodules/postgres` [github](https://github.com/metamodules/postgres) installs both the Node.js `pg` driver and a Docker/Kubernetes powered Postgres instance! It also helps bind and auto-generate environment variables - for example, the Postgres metamodule automatically generates and saves a random database password on installation! We consider metamodules the next logical step for npm modules - they do not define just the _drivers_ your app needs, but also the _services_ that those drivers connect to.

Deploy-node-app will automatically write Kubernetes or Compose configuration based on installed metamodules. Try `npm install @nodeapp/redis` and then re-run `deploy-node-app`! A local redis container will be started for you with a pre-configured driver!

Read more about metamodules [here](https://github.com/create-node/create-node-app#metamodules)

# Create Node App
# Dependencies

`deploy-node-app` aims to be able to deploy almost anything written in JavaScript, including back-ends, static-sites (like those created by `create-react-app`), and code-bases that do both. However, in order to get started _even faster_, we've also created [create-node-app](https://github.com/kubesail/create-node-app) - which we consider a first-class citizen of DNA. `create-node-app` combines `create-react-app` and a solid Node.js backend boiler plate, along with everything required for `deploy-node-app` to _just work_. This tool is in beta, and we would greatly appreciate any feedback!
`deploy-node-app` knows about dependencies! For example, if you install `redis`, or `pg`, `deploy-node-app` will automatically create Redis or Postgres deployments that work with your app!

---

deploy-node-app is maintained by

[<img src="docs/kubesail-logo.png" alt="Kubesail" width="160">
<br/>
KubeSail - as easy as Heroku, as powerful as Kubernetes](https://kubesail.com)
KubeSail - Kubernetes for Human Beings](https://kubesail.com)

---

### Contributing

If you feel that this tool can be improved in any way, feel free to open an issue or pull request! We'd absolutely love to add additional metamodules as well - so let us know what services you use with Node.js and we'll build you a metamodule!
If you feel that this tool can be improved in any way, feel free to open an issue or pull request!
6 changes: 0 additions & 6 deletions docs/TODOs.md

This file was deleted.

Binary file modified docs/kubesail-logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion docs/terminal-example-1.svg

This file was deleted.

14 changes: 6 additions & 8 deletions package.json
@@ -1,7 +1,7 @@
{
"name": "deploy-node-app",
"version": "1.5.4",
"description": "Easily deploy Node.js applications to Kubernetes or Docker, with one command",
"version": "2.0.0",
"description": "Develop and deploy Node.js apps with Kubernetes, with zero config!",
"main": "src/index.js",
"repository": "https://github.com/kubesail/deploy-node-app",
"license": "MIT",
Expand All @@ -22,8 +22,7 @@
"test": "./bin/test.sh"
},
"bin": {
"deploy-node-app": "src/index.js",
"deploy-to-kube": "src/index.js"
"deploy-node-app": "src/index.js"
},
"authors": [
"Seandon Mooy <seandon@kubesail.com>",
Expand All @@ -36,7 +35,7 @@
"eslint-config-standard": "^14.1.0",
"eslint-plugin-flowtype": "^4.3.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-node": "^9.2.0",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-prettier": "^3.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-security": "^1.4.0",
Expand All @@ -46,10 +45,9 @@
"prettier-eslint-cli": "^5.0.0"
},
"dependencies": {
"@nodeapp/redis": "^2.1.0",
"ansi-styles": "^4.1.0",
"command-exists": "^1.2.8",
"commander": "^3.0.1",
"commander": "^4.1.1",
"diff": "^4.0.1",
"dotenv": "^8.1.0",
"get-kubesail-config": "^1.0.4",
Expand All @@ -58,7 +56,7 @@
"is-valid-domain": "^0.0.11",
"js-yaml": "^3.13.1",
"lodash": "^4.17.15",
"mkdirp": "^0.5.1"
"mkdirp": "^1.0.3"
},
"prettier": {
"printWidth": 100
Expand Down
6 changes: 0 additions & 6 deletions src/defaults/.dockerignore

This file was deleted.

23 changes: 0 additions & 23 deletions src/defaults/Dockerfile

This file was deleted.

49 changes: 0 additions & 49 deletions src/defaults/backend-deployment.yaml

This file was deleted.

14 changes: 0 additions & 14 deletions src/defaults/backend-service.yaml

This file was deleted.

5 changes: 0 additions & 5 deletions src/defaults/frontend-configmap.yaml

This file was deleted.

55 changes: 0 additions & 55 deletions src/defaults/frontend-deployment.yaml

This file was deleted.

0 comments on commit 0c1ac77

Please sign in to comment.