1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

deisへのアプリケーションデプロイ

1
Last updated at Posted at 2017-09-06

deisへのアプリケーションデプロイについて調べたのでメモ。

deis CLIのインストール

$ curl https://deis.io/deis-cli/install-v2.sh | sh
Downloading deis-stable-darwin-amd64 From Google Cloud Storage...

The Deis Workflow CLI (deis) is now available in your current directory.

To learn more about Deis Workflow, execute:

    $ ./deis --help

これでカレントディレクトリにdeisバイナリができるので、他のディレクトリからでも実行できるようにする。

$ sudo mv $PWD/deis /usr/local/bin/deis
$ deis version
v2.16.0

deisへのアカウント登録

$ ./deis auth:register http://xxxxxxxx/
username: bwtakacy
password: 
password (confirm): 
email: 
Registered bwtakacy
Logged in as bwtakacy
Configuration file written to /Users/bwtakacy/.deis/client.json

サンプルアプリケーションのデプロイ

適当なサンプルを見つけてデプロイしてみる。

$ git clone https://github.com/deis/example-dockerfile-python
$ cd example-dockerfile-python/

deisへのアプリケーション登録。

$ deis create
Creating Application... done, created unbent-jokester
Git remote deis successfully created for app unbent-jokester.

このとき、アプリケーション名を明示的に指定しないと勝手に振られる。
今回だと unbent-jokester

アプリケーションにHTTPでアクセスできるようにPORTをdeisに設定

$ deis config:set PORT=5000 -a unbent-jokester
Creating config... done

=== unbent-jokester Config
PORT      5000

deis にgit push するためのSSH鍵登録

$ deis keys:add

アプリケーションのデプロイ。

$ git push deis master
Counting objects: 68, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (66/66), done.
Writing objects: 100% (68/68), 12.69 KiB | 0 bytes/s, done.
Total 68 (delta 15), reused 0 (delta 0)
Starting build... but first, coffee!
Step 1 : FROM gliderlabs/alpine:3.4
 ---> bce0a5935f2d
Step 2 : RUN apk-install python
 ---> Running in 39b182ebd73e
fetch http://alpine.gliderlabs.com/alpine/v3.4/main/x86_64/APKINDEX.tar.gz
fetch http://alpine.gliderlabs.com/alpine/v3.4/community/x86_64/APKINDEX.tar.gz
(1/10) Installing libbz2 (1.0.6-r5)
(2/10) Installing expat (2.2.0-r1)
(3/10) Installing libffi (3.2.1-r2)
(4/10) Installing gdbm (1.11-r1)
(5/10) Installing ncurses-terminfo-base (6.0-r8)
(6/10) Installing ncurses-terminfo (6.0-r8)
(7/10) Installing ncurses-libs (6.0-r8)
(8/10) Installing readline (6.3.008-r4)
(9/10) Installing sqlite-libs (3.13.0-r0)
(10/10) Installing python (2.7.12-r0)
Executing busybox-1.24.2-r13.trigger
OK: 52 MiB in 21 packages
 ---> 20f585223e30
Removing intermediate container 39b182ebd73e
Step 3 : ADD . /app
 ---> 4fb02e9751e9
Removing intermediate container 6e8943ff69ba
Step 4 : WORKDIR /app
 ---> Running in 7da5d19981da
 ---> 081a91eb3d6d
Removing intermediate container 7da5d19981da
Step 5 : CMD python -m SimpleHTTPServer 5000
 ---> Running in 80fb8c715eee
 ---> 53340a72183e
Removing intermediate container 80fb8c715eee
Step 6 : EXPOSE 5000
 ---> Running in c75ebd04d132
 ---> 21f465826ef3
Removing intermediate container c75ebd04d132
Successfully built 21f465826ef3
Pushing to registry
Build complete.
Launching App...
...
...
Done, unbent-jokester:v3 deployed to Workflow

Use 'deis open' to view this application in your browser

To learn more, use 'deis help' or visit https://deis.com/

deis openでアプリケーションにブラウザでアクセスできる。

$ deis open
$ deis releases
=== unbent-jokester Releases
v3	2017-09-06T14:20:43Z	bwtakacy deployed 0b416f0
v2	2017-09-06T14:18:32Z	bwtakacy added PORT
v1	2017-09-06T14:14:11Z	bwtakacy created initial release
$ deis info
=== unbent-jokester Application
updated:  2017-09-06T14:20:43Z
uuid:     d7ea5ea0-3457-4832-b07a-06d5145a3d34
created:  2017-09-06T14:14:11Z
url:      unbent-jokester.xxxxxxxxxxxxx
owner:    bwtakacy
id:       unbent-jokester

=== unbent-jokester Processes
--- cmd:
unbent-jokester-cmd-1501091100-bd1hf up (v3)

=== unbent-jokester Domains
unbent-jokester

=== unbent-jokester Label
No labels found.

アプリケーションの削除は

$ deis destroy
 !    WARNING: Potentially Destructive Action
 !    This command will destroy the application: unbent-jokester
 !    To proceed, type "unbent-jokester" or re-run this command with --confirm=unbent-jokester

> unbent-jokester
Destroying unbent-jokester...
done in 0s
Git remotes for app unbent-jokester removed.
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?