Skip to content

Commit 17b8e5c

Browse files
committed
Merge develop into master
2 parents 89dab2c + 252aff2 commit 17b8e5c

36 files changed

+1103
-298
lines changed

.artifactignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.git
2+
.idea
3+
.DS_Store
4+
.artifactignore
5+
.gitignore

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.DS_Store
12

23
# Created by https://www.gitignore.io/api/node,intellij
34
# Edit at https://www.gitignore.io/?templates=node,intellij
@@ -165,6 +166,3 @@ typings/
165166
.dynamodb/
166167

167168
# End of https://www.gitignore.io/api/node,intellij
168-
169-
.DS_Store
170-
/iofog-agent/id_ecdsa*

README.md

Lines changed: 148 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,164 @@
11
# ioFog Demo
22

3-
This repository orchestrates ioFog Agent, Controller, and Connector in a Docker Compose environment for the purpose of demonstrating a deployment of the ioFog stack.
3+
This repository demonstrates the capabilities of ioFog. It spins up the ioFog stack (Agent, Controller, and Connector) on a local machine in a Docker Compose environment. This basic ioFog stack setup constitutes a small, but fully configured Edge Compute Network (ECN).
44

5-
# Usage
5+
Optionally, this demo also creates a sample application (microservices deployed on the ioFog stack).
66

7-
To spin up Agent, Controller, and Connector containers within a virtual network:
8-
```
7+
This demo repository is used as supplementary materials for [ioFog quickstart](https://iofog.org/docs/1.0.0/getting-started/core-concepts.html) and [ioFog tutorial](https://iofog.org/docs/1.0.0/tutorial/introduction.html) guides.
8+
9+
10+
# Prerequisites
11+
12+
The ioFog demo requires one of the following systems and tools to be installed. The scripts in this demo do not install any of these tools, but they check for sufficient versions.
13+
14+
Supported operating systems:
15+
16+
* Linux (kernel v3.10+)
17+
* macOS 10.12+
18+
* Windows 7+
19+
20+
Requires tools:
21+
22+
* Docker 1.10+ ([installation instructions](https://docs.docker.com/install/))
23+
* Docker-compose 1.22+ ([installation instructions](https://docs.docker.com/compose/install/))
24+
25+
26+
# Try ioFog - Simple Edge Compute Network
27+
28+
The main interaction with this demo repository is encapsulated into a set of simple scripts: `start.sh`, `test.sh` and `stop.sh`. Interactions with the ioFog components can be done using a command line interface available in all the services of the stack, or using a REST API.
29+
30+
## Spin Up The ioFog Stack
31+
32+
Spin up the blank ioFog stack (Agent, Controller, and Connector) on the local machine.
33+
34+
```sh
935
./start.sh
1036
```
1137

12-
To verify the services are provisioned correctly:
13-
```
38+
Verify the iofog stack is provisioned correctly. The automated tests run a smoke test suite on the blank ioFog stack, testing basic operations.
39+
40+
```sh
1441
./test.sh
1542
```
1643

17-
To interact with Agent, Controller, and Connector you must exec into each respective container and use the CLI:
44+
You can also verify manually that the ioFog stack containers are correctly started.
45+
```sh
46+
docker ps --filter "name=iofog"
1847
```
19-
docker exec -it iofog-controller /bin/bash
20-
iofog-controller help
48+
49+
When you are finished, tear down the ioFog stack and all services deployed on it.
50+
51+
```sh
52+
./stop.sh
2153
```
2254

23-
Note that if you would like to use Agent, Controller, and Connector's REST APIs, you will have to modify the Compose environment to deploy with network_mode "host".
55+
## Build from local packages
56+
57+
If you have a local version of the Agent, Controller and Connector, you can chose to build the containers using those local packages.
58+
To do so, you will need a debian package (`.deb`) for the Agent and the Connector and a tarball (`.tgz`) for the Controller.
59+
You can provide `start.sh` with an option for each local package you want to use.
2460

25-
When you are finished, it is recommended that you teardown:
61+
### Example
62+
Folder structure:
63+
```text
64+
* services
65+
* init
66+
* test
67+
* local-packages # Example folder where you would store your local packages
68+
- iofog-agent_2.0.deb
69+
- iofog-connector_2.0.deb
70+
- iofog-controller_2.0.tgz
71+
* start.sh
72+
* stop.sh
73+
* ...
2674
```
75+
76+
Command:
77+
```sh
78+
./start.sh -a ./local-packages/iofog-agent_2.0.deb -cn ./local-packages/iofog-connector_2.0.deb -ct ./local-packages/iofog-controller_2.0.tgz
79+
```
80+
81+
## Force rebuild
82+
If you have previously built the containers using local packages, or remote packages and you want to ensure that running `start.sh` will rebuild the images, you can also provide the `--no-cache` option
83+
84+
85+
```sh
86+
./start.sh --no-cache
87+
```
88+
89+
## ECN Status
90+
91+
```sh
92+
./status.sh # Will show you all iofog-related containers currently running.
93+
```
94+
95+
## Interacting With The ioFog Stack - CLI
96+
97+
The simplest way to interact with Agent, Controller, and Connector deployed on a machine you have access to is to use the command line interface. The main interaction point for users is the Controller.
98+
99+
```sh
100+
docker exec -it iofog-controller iofog-controller help
101+
```
102+
For the purpose of this demo, all ioFog components are spun up in separate Docker containers. The Controller's container is called `iofog-controller` (the first occurrence in the above command) and the executable inside the container is also called `iofog-controller` (the second occurrence).)_
103+
104+
Names for all the containers created in the demo are `iofog-agent`, `iofog-controller` and `iofog-connector`.
105+
106+
The initialization scripts used to setup the ioFog stack / ECN are using the CLI interface. Feel free to refer to these for more inspiration.
107+
108+
Full reference of the CLI for all ioFog stack components is available at the ioFog website:
109+
110+
* https://iofog.org/docs/1.0.0/controllers/cli-usage.html
111+
* https://iofog.org/docs/1.0.0/agents/cli-usage.html
112+
* https://iofog.org/docs/1.0.0/connectors/cli-usage.html
113+
114+
## Interacting With The ioFog Stack - REST API
115+
116+
117+
Full reference of the REST API for all ioFog stack components is available at the ioFog website:
118+
119+
* https://iofog.org/docs/1.0.0/controllers/rest-api.html
120+
* https://iofog.org/docs/1.0.0/agents/local-api.html
121+
* https://iofog.org/docs/1.0.0/connectors/api-reference.html
122+
123+
You can try using the REST API directly on your machine with the ioFog stack running.
124+
```sh
125+
curl --url 'http://0.0.0.0:51121/api/v3/status'
126+
```
127+
128+
129+
# Try ioFog - Tutorial Application Deployed On ioFog
130+
131+
Apart from creating just the ioFog stack, we can also deploy an ioFog application on the stack. Here we demonstrate it on the tutorial application from the ioFog website.
132+
133+
First, create all services for a tutorial ioFog application. You don't have to start the iofog stack manually, it will be created if necessary.
134+
135+
```sh
136+
./start.sh tutorial
137+
```
138+
139+
When you are done with the tutorial, you can tear down the sample application together with the ioFog stack. Note there is currently no wya in the demo to tear down just the tutorial application.
140+
```sh
27141
./stop.sh
28-
```
142+
```
143+
144+
# Structure Of This Repository
145+
```text
146+
* services # Service Dockerfiles and customization files
147+
- iofog
148+
+ iofog-agent # Agent service files - part of the iofog stack
149+
+ iofog-connector # Connector service files - part of the iofog stack
150+
+ iofog-controller # Controller service files - part of the iofog stack
151+
* init
152+
- iofog # plain ioFog stack initialization service
153+
- tutorial # tutorial initialization service
154+
* test
155+
+ conf # generated test configuration files
156+
* azure-pipelines.yml
157+
* docker-compose-iofog.yml
158+
* docker-compose-tutorial.yml
159+
* docker-compose-test.yml
160+
* start.sh
161+
* stop.sh
162+
* test.sh
163+
* utils.sh
164+
```

azure-pipelines.yml

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
trigger:
2-
- master
3-
- develop
4-
- blank-environment
5-
- demo-environment
2+
- master
3+
- develop
4+
pr:
5+
- master
6+
- develop
67

78
pool:
89
vmImage: 'ubuntu-16.04'
@@ -19,11 +20,6 @@ steps:
1920
echo $(gcp.svcacc) | docker login -u _json_key --password-stdin https://gcr.io
2021
displayName: 'Docker connect to Registry'
2122

22-
- script: |
23-
sed -i "s|image:.*|image: $(images.runner)|" docker-compose-test.yml
24-
cat docker-compose-test.yml
25-
displayName: 'Configure Test Runner image'
26-
2723
- script: |
2824
./start.sh
2925
displayName: 'Start Connector, Controller, and Agent'
@@ -34,4 +30,18 @@ steps:
3430

3531
- script: |
3632
./stop.sh
37-
displayName: 'Stop Connector, Controller, and Agent'
33+
displayName: 'Stop Connector, Controller, and Agent'
34+
35+
- script: |
36+
tar -c --transform 's,^\.,demo,' --exclude-from=.artifactignore -v --bzip2 -f $BUILD_ARTIFACTSTAGINGDIRECTORY/demo.tar.bz2 .
37+
38+
- task: PublishBuildArtifacts@1
39+
inputs:
40+
pathtoPublish: '$(Build.ArtifactStagingDirectory)/demo.tar.bz2'
41+
artifactName: 'demo.$(Build.BuildId).tar.bz2'
42+
43+
- script: |
44+
echo "===== IOFOG AGENT LOG ====="
45+
docker exec iofog-agent cat /var/log/agent.out.log
46+
displayName: 'Print logs'
47+
condition: failed()

conf/.gitignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

docker-compose-iofog.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
version: "3"
2+
services:
3+
iofog-connector:
4+
image: iofog-connector:local
5+
build:
6+
context: ./services/iofog/iofog-connector
7+
args:
8+
- LOCAL_CONNECTOR_PACKAGE
9+
container_name: iofog-connector
10+
ports:
11+
- "53321:8080"
12+
network_mode: bridge
13+
14+
iofog-controller:
15+
image: iofog-controller:local
16+
build:
17+
context: ./services/iofog/iofog-controller
18+
args:
19+
- LOCAL_CONTROLLER_PACKAGE
20+
container_name: iofog-controller
21+
depends_on:
22+
- iofog-connector
23+
ports:
24+
- "51121:51121"
25+
environment:
26+
- NODE_ENV=development
27+
links:
28+
- iofog-connector:iofog-connector
29+
network_mode: bridge
30+
31+
iofog-agent:
32+
image: iofog-agent:local
33+
build:
34+
context: ./services/iofog/iofog-agent
35+
args:
36+
- LOCAL_AGENT_PACKAGE
37+
depends_on:
38+
- iofog-controller
39+
privileged: true
40+
volumes:
41+
- /var/run/docker.sock:/var/run/docker.sock
42+
container_name: iofog-agent
43+
ports:
44+
- "8081:22"
45+
- "54321:54321"
46+
links:
47+
- iofog-controller:iofog-controller
48+
network_mode: bridge
49+
50+
iofog-init:
51+
build: ./init/iofog
52+
container_name: iofog-init
53+
depends_on:
54+
- iofog-controller
55+
volumes:
56+
- /var/run/docker.sock:/var/run/docker.sock
57+
links:
58+
- iofog-controller:iofog-controller
59+
- iofog-connector:iofog-connector
60+
network_mode: bridge

docker-compose-test.yml

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
1-
services:
2-
test-runner:
3-
container_name: test-runner
4-
environment:
5-
- LOCAL=1
6-
image: iofog/test-runner:latest
7-
networks:
8-
- iofog
9-
volumes:
10-
- ./conf:/conf
111
version: '3'
12-
volumes:
13-
conf: null
14-
networks:
15-
iofog: null
2+
services:
3+
# Test Harness image
4+
test-runner:
5+
container_name: test-runner
6+
environment:
7+
- LOCAL=1
8+
image: iofog/test-runner:latest
9+
volumes:
10+
- ./test/conf:/conf
11+
network_mode: bridge

docker-compose-tutorial.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: "3"
2+
services:
3+
tutorial-init:
4+
build: ./init/tutorial
5+
container_name: tutorial-init
6+
depends_on:
7+
- iofog-controller
8+
volumes:
9+
- /var/run/docker.sock:/var/run/docker.sock
10+
links:
11+
- iofog-controller:iofog-controller
12+
network_mode: bridge

docker-compose.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

init/iofog/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM docker:dind
2+
3+
RUN apk add --no-cache curl jq
4+
5+
ADD ./provision.sh /
6+
7+
CMD ["sh", "-c", "/provision.sh"]

0 commit comments

Comments
 (0)