Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 6e48731

Browse files
author
Antony MECHIN
committed
Examples: Add hello world.
Signed-off-by: Antony MECHIN <[email protected]>
1 parent c13aff0 commit 6e48731

File tree

4 files changed

+69
-0
lines changed

4 files changed

+69
-0
lines changed

examples/hello-world/README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
## The Docker voting app
2+
3+
### Initialize project
4+
5+
In this example, we will create a one-service application that deploys an web page displaying a message.
6+
7+
Initialize the project using `docker-app init hello-world`.
8+
9+
### Edit metadata
10+
11+
Go to `hello-world.dockerapp/` and open `metadata.yml` and fill the following fields:
12+
- description
13+
- maintainers
14+
15+
### Add variables to the compose file
16+
17+
Open `docker-compose.yml` and add a service `hello`.
18+
19+
```
20+
services:
21+
hello:
22+
image: hashicorp/http-echo
23+
command: ["-text", "${text}"]
24+
ports:
25+
- ${port}:5678
26+
```
27+
28+
### Give variables their default value
29+
30+
Open `settings.yml` and every variables with the default value you want, e.g.:
31+
32+
```
33+
$ cat settings.yml
34+
port: 8080
35+
text: world
36+
```
37+
38+
### Render
39+
40+
You can now render your application by running `docker-app render` or even personalize the rendered compose file by running `docker-app render -s text="hello user"`.
41+
42+
Create a `render` directory and redirect the output of `docker-app render ...` to `render/docker-compose.yml`.
43+
44+
```
45+
mkdir -p render
46+
docker-app render -s text="hello user" > render/docker-compose.yml
47+
```
48+
49+
### Deploy
50+
51+
Deploy your application by running `docker-app deploy -c render/docker-compose.yml`. http://<ip_of_your_node>:8080 will display your message, e.g. http://127.0.0.1:8080 if you deployed locally.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: "3.3"
2+
services:
3+
hello:
4+
image: hashicorp/http-echo
5+
command: ["-text", "${text}"]
6+
ports:
7+
- ${port}:5678
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version: 0.1.0
2+
name: echo
3+
description: "Hello world"
4+
maintainers:
5+
- name: dimrok
6+
7+
targets:
8+
swarm: true
9+
kubernetes: true
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
port: 8080
2+
text: world

0 commit comments

Comments
 (0)