Docker PaaS - Deis 使用


1. Installing Deis Client
$ curl -sSL http://deis.io/deis-cli/install.sh | sh
$ ln -fs $PWD/deis  /usr/local/bin/deis
$ deis help

The Deis command-line client issues API calls to a Deis controller.
Usage: deis <command> [<args>...]

Auth commands::
register      register a new user with a controller
login         login to a controller
logout        logout from the current controller

Subcommands, use ``deis help [subcommand]`` to learn more::
...

$ deis help apps

Valid commands for apps:
apps:create        create a new application
apps:list          list accessible applications
apps:info          view info about an application
apps:open          open the application in a browser
apps:logs          view aggregated application logs
apps:run           run a command in an ephemeral app container
apps:destroy       destroy an application

Use `deis help [command]` to learn more
Register a user
$ deis register http://deis.mycompany.com
username: deis
password:
password (confirm):
email:

Registered deis
Logged in as deis

2. Deploy app using Docker images
$ git clone https://github.com/deis/example-go.git

$ cd example-go

$ git checkout docker

$ docker build -t qishione/example-go .

$ docker push qishione/example-go

$ mkdir -p /tmp/example-go && cd  /tmp/example-go

$ deis create
Creating application... done, created example-go

$ deis pull deis/example-go:latest

Creating build...  done, v2

root@ec2-55-30-185-42:/tmp/example-go# deis info

=== example-go Application

{
"updated": "2015-01-16T08:36:14UTC",
"uuid": "09961802-5e2b-4d2b-a362-e828fe89ec97",
"created": "2015-01-15T09:04:13UTC",
"url": "example-go.mycompany.com",
"owner": "deis",
"id": "example-go",
"structure": {
"cmd": 1
}
}

=== example-go Processes

--- cmd:
cmd.1 up (v15)

=== example-go Domains
No domains

$ curl example-go.mycompany.com
Powered by Deis

$ deis apps
=== Apps
example-go


$ deis apps:logs

2015-01-16T08:35:16UTC deis[api]: example-go: build example-go-1f21755 created
2015-01-16T08:35:16UTC deis[api]: example-go: release example-go-v14 created
2015-01-16T08:35:16UTC deis[api]: deis deployed qishione/example-go:latest
2015-01-16T08:35:36UTC deis[api]: example-go: build example-go-4069a0f created
2015-01-16T08:35:36UTC deis[api]: example-go: release example-go-v15 created
2015-01-16T08:35:36UTC deis[api]: deis deployed deis/example-go:latest
2015-01-16T08:36:02UTC deis[api]: example-go: deis scaled containers cmd=1
2015-01-16T08:36:12UTC example-go[cmd.1]: 2015/01/16 08:36:12 server is listening on 8080...
2015-01-16T08:36:50UTC example-go[cmd.1]: 2015/01/16 08:36:50 10.21.1.152:49705 GET /

$ deis config:set "MYSQL_IP=109.106.1.17"

Creating config... done, v16
=== example-go
DEIS_APP: example-go
DEIS_RELEASE: v16
MYSQL_IP: 109.10

$ deis domains:add knight.mycompany.org
Adding knight.samsungcloud.org to example-go... done 

$ root@ec2-54-80-185-42:/tmp/example-go# deis info

=== example-go Application
{
"updated": "2015-01-16T08:36:14UTC",
"uuid": "09961802-5e2b-4d2b-a362-e828fe89ec97",
"created": "2015-01-15T09:04:13UTC",
"url": "example-go.mycompany.org",
"owner": "deis",
"id": "example-go",
"structure": {
"cmd": 1
}
}

=== example-go Processes

--- cmd:
cmd.1 up (v16)

=== example-go Domains
knight.mycompany.org

$ deis releases

=== example-go Releases
v16     8 minutes ago            deis added MYSQL_IP
v15     21 minutes ago           deis deployed deis/example-go:latest
v14     22 minutes ago           deis deployed qishione/example-go:latest
v13     Yesterday at 09:29:36 AM deis deployed qishione/example-go:latest
v12     Yesterday at 09:29:19 AM deis deployed qishione/example-go
v11     Yesterday at 09:28:09 AM deis deployed qishione/example-go:latest
v10     Yesterday at 09:26:06 AM deis deployed gabrtv/example-go:latest
v9      Yesterday at 09:25:18 AM deis deployed qishione/example-go:latest
v8      Yesterday at 09:20:06 AM deis deployed qishione/example-go:latest
v7      Yesterday at 09:19:49 AM deis deployed qishione/example-go
v6      Yesterday at 09:15:45 AM deis deployed qishione/example-go:latest
v5      Yesterday at 09:14:37 AM deis deployed qishione/example-go:latest
v4      Yesterday at 09:13:53 AM deis deployed qishione/example-go
v3      Yesterday at 09:11:51 AM deis deployed qishione/example-go:latest
v2      Yesterday at 09:04:28 AM deis deployed gabrtv/example-go:latest
v1      Yesterday at 09:04:13 AM deis created initial release

$ deis rollback v15
Rolling back to v15... done, v17

$ deis releases
=== example-go Releases
v17     Just now                 deis rolled back to v15
v16     10 minutes ago           deis added MYSQL_IP
v15     23 minutes ago           deis deployed deis/example-go:latest
v14     23 minutes ago           deis deployed qishione/example-go:latest
v13     Yesterday at 09:29:36 AM deis deployed qishione/example-go:latest
v12     Yesterday at 09:29:19 AM deis deployed qishione/example-go
v11     Yesterday at 09:28:09 AM deis deployed qishione/example-go:latest
v10     Yesterday at 09:26:06 AM deis deployed gabrtv/example-go:latest
v9      Yesterday at 09:25:18 AM deis deployed qishione/example-go:latest
v8      Yesterday at 09:20:06 AM deis deployed qishione/example-go:latest
v7      Yesterday at 09:19:49 AM deis deployed qishione/example-go
v6      Yesterday at 09:15:45 AM deis deployed qishione/example-go:latest
v5      Yesterday at 09:14:37 AM deis deployed qishione/example-go:latest
v4      Yesterday at 09:13:53 AM deis deployed qishione/example-go
v3      Yesterday at 09:11:51 AM deis deployed qishione/example-go:latest
v2      Yesterday at 09:04:28 AM deis deployed gabrtv/example-go:latest
v1      Yesterday at 09:04:13 AM deis created initial release

$ deis scale cmd=2
Scaling processes... but first, coffee!
done in 12s
=== example-go Processes
  • --- cmd:
    cmd.1 up (v17)
    cmd.2 up (v17)

$ deis limits:set cmd=512m
Applying limits... done, v18

=== example-go Limits
--- Memory
cmd      512m

--- CPU
Unlimited

0 个评论

要回复文章请先登录注册