zeit / now
- суббота, 15 июля 2017 г. в 03:13:23
Universal, serverless, single-command deployment
Now enables instant immutable deployments to any cloud provider with a simple API that's scalable, intuitive and optimized for collaboration.
This is all it takes to deploy, for example, a Node.js project:
cd my-project
cat server.js
require('http').createServer((req, res) => {
res.end('▲ Hello World')
}).listen(process.env.PORT)
and deploy!
now
The output of the now
command will be a unique url to the deployment. No need for git.
now
.now
, a new deployment is provisioned.now gcp deploy && now aws deploy
now [provider] login
now project/repo
, gitlab with gitlab://
. PRs welcome!To install the latest version:
npm install -g now@beta
Note: while the API has been in production for over a year, the different providers are still under heavy development
Optionally, you can clone this repo and run npm run build
to
produce the pkg binaries.
Configuration of one or more providers via login
command is necessary. If no logins are active and now
Global configuration is stored as ~/.now/config.json
. Your default provider will be the first one you log in to.
now login
To skip the configuration steps and deploy to https://now.sh
execute now login
without any parameters, defaulting to the sh
provider (equivalent to: now sh login
).
Now.sh is free for open-source projects and static deployments. It supports Dockerfile
, package.json
and static sites out of the box. All builds are reproducible and executed in the cloud.
aws
)Run:
now aws login
If you have already run aws configure
before, you will be offered
to synchronize your credentials.
Serverless deployments are provisioned by using:
gcp
)$ now gcp login
and follow the instructions!
az
)$ now az login
and follow the instructions!
We welcome feedback from the community! |
The v1 release of now.json
includes the following specification:
name
(optional, recommended) String
description
(optional, recommended) String
type
(optional, recommended). One of:
String
an unique identifier for the project type. The following
are recommended choices to be supported by every provider:
docker
nodejs
static
Object
when it's necessary to specify a version or multiple interacting runtimes. It's a dictionary of runtime identifier and SemVer-compatible version. For example:
{ "type": { "docker": "1.x.x" } }
provider
(optional) indicates affinity to a certain providertarget
(optional) String
static
) has an output target, like an out
or dist
directory.env
(optional). One of
Object
a dictionary mapping the name of the environmental variable
to expose to the deployment and its value.
If the value begins with @
, it's considered aArray
a list of suggested environmental variables that the project
might require to be deployed and function correctlyregions
- Array
of String
files
- Array
of String
To supply provider-specific configuration, you can include an arbitrary Object
and use the provider identifier as the key.
The client will initialize a .now
directory in the user's home
directory upon first running.
There, two files can be found:
config.json
credentials.json
Now is directly modeled after UNIX. It's useful to think of the primary subcommands deploy
, alias
and rm
as being the "cloud equivalents" of cp
, ln
and rm
.
The minimal set of commands that providers must supply are:
[] / deploy |
the default command to launch a deployment |
remove / rm |
remove a deployment identified by its unique URL |
Recommended, but not required, commands are:
logs | ln |
associates a URL with a permanent domain name |
secrets ls rm add |
associates a URL with a permanent domain name |
domains ls / add / rm |
manage domains |
dns ls / add / rm |
manage dns records |
certs ls / add / rm |
manage certificates |
The build
step for serverless deployments is implemented locally and is compatible with projects configured with the type
nodejs
, and others are on the way!
Each time you write now
a new deployment is provisioned. Whenever
possible, providers should strive to make deployments idempotent in the
absence of changes to:
All projects expose a HTTP/1.1-compatible interface. A port is provided
via the standard process.env.PORT
.
Whenever possible, deployments are strongly encouraged to be served over SSL. The process of provisioning certificates should be transparent to the user.
Whenever possible, projects should be deployable with minimal or no configuration.
If the configuration or conventions imposed by a programming language or framework are present, attempt to provide sane defaults.
Examples of this is the presence of Dockerfile
or package.json
. When
publishing a project it's recommended that the type
is strictly
configured in now.json
to avoid
All feedback and suggestions are welcome!
#now-client
.Please note: we adhere to the contributor coventant for all interactions in our community.
To get started contributing, make sure you're running node
8.x.x
. Clone this repository:
git clone https://github.com/zeit/now
To test the pkg
binary distribution, run:
npm run build
now <file>
, with support for:
Now is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.