Skip to content

Commit 2865310

Browse files
committed
break it down in multiple steps
1 parent b893f25 commit 2865310

File tree

5 files changed

+75
-66
lines changed

5 files changed

+75
-66
lines changed

README.md

+4-66
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,12 @@
11
Python Quickstart on Tutum
22
==========================
33

4+
This quickstart for Python applications on Tutum is broken down in different steps with increasing complexity:
45

5-
## Contents
6+
* **Step 1**: single-container web application
7+
* _(TBD)_ **Step 2**: two tier web application with web and database layers
8+
* _(TBD)_ **Step 3**: three tier web application with load balancing, web and database layers
69

7-
Files included in this example:
8-
9-
* `app.py` - the sample "Hello World" application code
10-
* `requirements.txt` - our app's pip dependencies
11-
* `Dockerfile` - [set of instructions](https://docs.docker.com/reference/builder/) to build a Docker image with our app
12-
13-
14-
## Building
15-
16-
In order to build an image with our "Hello World" application, execute the following command in the repository folder:
17-
18-
docker build -t quickstart-python .
19-
20-
This will execute the instructions found in the `Dockerfile` in sequence, and finally it will create a repository called `quickstart-python` which contains our application code and the information needed to launch it.
21-
22-
23-
## Launching locally
24-
25-
To launch our newly created image:
26-
27-
docker run -p 5000:5000 quickstart-python
28-
29-
If you are running Docker locally, go to [http://localhost:5000/](http://localhost:5000/) to check that your container is running. If you are using [boot2docker](http://boot2docker.io), replace `localhost` with the IP returned by the `boot2docker ip` command.
30-
31-
You can also test it by using `curl`:
32-
33-
$ curl http://localhost:5000/
34-
Hello World!
35-
36-
37-
## Pushing
38-
39-
If you want to push it to the [Docker Hub](https://hub.docker.com), first create an account and then execute:
40-
41-
docker tag quickstart-python yourusername/quickstart-python
42-
docker push yourusername/quickstart-python
43-
44-
If you want to push it to [Tutum](https://www.tutum.co)'s private registry, first create an account and then do:
45-
46-
docker login tutum.co
47-
docker tag quickstart-python tutum.co/yourusername/quickstart-python
48-
docker push tutum.co/yourusername/quickstart-python
49-
50-
Alternatively, you can also push it using the [Tutum CLI](https://github.com/tutumcloud/tutum-cli):
51-
52-
tutum image push quickstart-python
53-
54-
55-
## Launching in Tutum
56-
57-
Using the [Tutum CLI](https://github.com/tutumcloud/tutum-cli), execute the following:
58-
59-
tutum service run -p 5000:5000 tutum.co/yourusername/quickstart-python
60-
61-
Then, to retrieve the endpoint where the container is listening to, do:
62-
63-
$ tutum container ps
64-
NAME UUID STATUS IMAGE RUN COMMAND EXIT CODE DEPLOYED PORTS
65-
quickstart-python 8bdc89a2 ▶ Running tutum.co/user/quickstart-python:latest python app.py 5 minutes ago quickstart-python.f3ff91a8-user.node.tutum.io:5000->5000/tcp
66-
67-
Navigate to the endpoint reported, or just use `curl` to test the deployment:
68-
69-
$ curl http://quickstart-python.f3ff91a8-user.node.tutum.io:5000/
70-
Hello World!
71-
7210

7311
## Next steps
7412

File renamed without changes.

step-01/README.md

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
Python Quickstart on Tutum
2+
==========================
3+
4+
5+
## Contents
6+
7+
Files included in this example:
8+
9+
* `app.py` - the sample "Hello World" application code
10+
* `requirements.txt` - our app's pip dependencies
11+
* `Dockerfile` - [set of instructions](https://docs.docker.com/reference/builder/) to build a Docker image with our app
12+
13+
14+
## Building
15+
16+
In order to build an image with our "Hello World" application, execute the following command in the repository folder:
17+
18+
docker build -t quickstart-python .
19+
20+
This will execute the instructions found in the `Dockerfile` in sequence, and finally it will create a repository called `quickstart-python` which contains our application code and the information needed to launch it.
21+
22+
23+
## Launching locally
24+
25+
To launch our newly created image:
26+
27+
docker run -p 5000:5000 quickstart-python
28+
29+
If you are running Docker locally, go to [http://localhost:5000/](http://localhost:5000/) to check that your container is running. If you are using [boot2docker](http://boot2docker.io), replace `localhost` with the IP returned by the `boot2docker ip` command.
30+
31+
You can also test it by using `curl`:
32+
33+
$ curl http://localhost:5000/
34+
Hello World!
35+
36+
37+
## Pushing
38+
39+
If you want to push it to the [Docker Hub](https://hub.docker.com), first create an account and then execute:
40+
41+
docker tag quickstart-python yourusername/quickstart-python
42+
docker push yourusername/quickstart-python
43+
44+
If you want to push it to [Tutum](https://www.tutum.co)'s private registry, first create an account and then do:
45+
46+
docker login tutum.co
47+
docker tag quickstart-python tutum.co/yourusername/quickstart-python
48+
docker push tutum.co/yourusername/quickstart-python
49+
50+
Alternatively, you can also push it using the [Tutum CLI](https://github.com/tutumcloud/tutum-cli):
51+
52+
tutum image push quickstart-python
53+
54+
55+
## Launching in Tutum
56+
57+
Using the [Tutum CLI](https://github.com/tutumcloud/tutum-cli), execute the following:
58+
59+
tutum service run -p 5000:5000 tutum.co/yourusername/quickstart-python
60+
61+
Then, to retrieve the endpoint where the container is listening to, do:
62+
63+
$ tutum container ps
64+
NAME UUID STATUS IMAGE RUN COMMAND EXIT CODE DEPLOYED PORTS
65+
quickstart-python 8bdc89a2 ▶ Running tutum.co/user/quickstart-python:latest python app.py 5 minutes ago quickstart-python.f3ff91a8-user.node.tutum.io:5000->5000/tcp
66+
67+
Navigate to the endpoint reported, or just use `curl` to test the deployment:
68+
69+
$ curl http://quickstart-python.f3ff91a8-user.node.tutum.io:5000/
70+
Hello World!
71+

app.py renamed to step-01/app.py

File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)