From 8fb8d890cef47080d0215f059863fac7e1877c39 Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Thu, 12 Sep 2019 15:43:38 +0200 Subject: [PATCH 01/55] Move to iofogctl --- README.md | 58 +++---- init/iofog/Dockerfile | 7 - init/iofog/local-stack.yaml | 21 +++ init/iofog/provision.sh | 143 ------------------ init/tutorial/Dockerfile | 7 - init/tutorial/config.yaml | 39 +++++ init/tutorial/provision.sh | 135 ----------------- services/iofog/iofog-agent/.gitignore | 1 - services/iofog/iofog-agent/Dockerfile | 35 ----- services/iofog/iofog-agent/config.xml | 42 ----- services/iofog/iofog-agent/install.sh | 11 -- services/iofog/iofog-agent/supervisord.conf | 12 -- services/iofog/iofog-connector/Dockerfile | 21 --- services/iofog/iofog-connector/install.sh | 11 -- .../iofog-connector/iofog-connector.conf | 10 -- services/iofog/iofog-controller/Dockerfile | 11 -- services/iofog/iofog-controller/install.sh | 10 -- start.sh | 110 ++++++-------- status.sh | 8 +- stop.sh | 9 +- 20 files changed, 132 insertions(+), 569 deletions(-) delete mode 100644 init/iofog/Dockerfile create mode 100644 init/iofog/local-stack.yaml delete mode 100755 init/iofog/provision.sh delete mode 100644 init/tutorial/Dockerfile create mode 100644 init/tutorial/config.yaml delete mode 100755 init/tutorial/provision.sh delete mode 100644 services/iofog/iofog-agent/.gitignore delete mode 100644 services/iofog/iofog-agent/Dockerfile delete mode 100644 services/iofog/iofog-agent/config.xml delete mode 100755 services/iofog/iofog-agent/install.sh delete mode 100644 services/iofog/iofog-agent/supervisord.conf delete mode 100644 services/iofog/iofog-connector/Dockerfile delete mode 100755 services/iofog/iofog-connector/install.sh delete mode 100644 services/iofog/iofog-connector/iofog-connector.conf delete mode 100644 services/iofog/iofog-controller/Dockerfile delete mode 100755 services/iofog/iofog-controller/install.sh diff --git a/README.md b/README.md index 732fc83..e85b37f 100644 --- a/README.md +++ b/README.md @@ -15,12 +15,11 @@ Supported operating systems: * Linux (kernel v3.10+) * macOS 10.12+ -* Windows 7+ Requires tools: * Docker 1.10+ ([installation instructions](https://docs.docker.com/install/)) -* Docker-compose 1.22+ ([installation instructions](https://docs.docker.com/compose/install/)) +* iofogctl 1.3.0+ ([installation instructions](https://github.com/eclipse-iofog/iofogctl/tree/v1.3.0#install)) # Try ioFog - Simple Edge Compute Network @@ -52,38 +51,17 @@ When you are finished, tear down the ioFog stack and all services deployed on it ./stop.sh ``` -## Build from local packages +## Build from local images -If you have a local version of the Agent, Controller and Connector, you can chose to build the containers using those local packages. -To do so, you will need a debian package (`.deb`) for the Agent and the Connector and a tarball (`.tgz`) for the Controller. +If you have a local image version of the Agent, Controller and Connector, you can chose to build the containers using those local images. +To do so, you will need a docker image for the Agent, the Connector and the Controller. You can provide `start.sh` with an option for each local package you want to use. ### Example -Folder structure: -```text -* services -* init -* test -* local-packages # Example folder where you would store your local packages - - iofog-agent_2.0.deb - - iofog-connector_2.0.deb - - iofog-controller_2.0.tgz -* start.sh -* stop.sh -* ... -``` Command: ```sh -./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 -``` - -## Force rebuild -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 - - -```sh -./start.sh --no-cache +./start.sh -a gcr.io/focal-freedom-236620/agent:latest -cn gcr.io/focal-freedom-236620/connector:latest -ct gcr.io/focal-freedom-236620/controller:latest ``` ## ECN Status @@ -94,22 +72,21 @@ If you have previously built the containers using local packages, or remote pack ## Interacting With The ioFog Stack - CLI -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. +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 `iofogctl`. ```sh -docker exec -it iofog-controller iofog-controller help +iofogctl help ``` -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).)_ + +For the purpose of this demo, all ioFog components are spun up in separate Docker containers. The Controller's container is called `iofog-controller`. Names for all the containers created in the demo are `iofog-agent`, `iofog-controller` and `iofog-connector`. The initialization scripts used to setup the ioFog stack / ECN are using the CLI interface. Feel free to refer to these for more inspiration. -Full reference of the CLI for all ioFog stack components is available at the ioFog website: +Full reference of the CLI is available at the iofogctl github repository: -* https://iofog.org/docs/1.0.0/controllers/cli-usage.html -* https://iofog.org/docs/1.0.0/agents/cli-usage.html -* https://iofog.org/docs/1.0.0/connectors/cli-usage.html +* https://github.com/eclipse-iofog/iofogctl/tree/v1.3.0#usage ## Interacting With The ioFog Stack - REST API @@ -136,11 +113,18 @@ First, create all services for a tutorial ioFog application. You don't have to s ./start.sh tutorial ``` -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. +When you are done with the tutorial, you can tear down the sample application together with the ioFog stack. + ```sh ./stop.sh ``` +if you only wish to delete the tutorial application: + +```sh +iofogctl delete application tutorial +``` + # Structure Of This Repository ```text * services # Service Dockerfiles and customization files @@ -149,8 +133,8 @@ When you are done with the tutorial, you can tear down the sample application to + iofog-connector # Connector service files - part of the iofog stack + iofog-controller # Controller service files - part of the iofog stack * init - - iofog # plain ioFog stack initialization service - - tutorial # tutorial initialization service + - iofog # plain ioFog stack initialization yaml file + - tutorial # tutorial initialization yaml file * test + conf # generated test configuration files * azure-pipelines.yml diff --git a/init/iofog/Dockerfile b/init/iofog/Dockerfile deleted file mode 100644 index 9449a73..0000000 --- a/init/iofog/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM docker:dind - -RUN apk add --no-cache curl jq - -ADD ./provision.sh / - -CMD ["sh", "-c", "/provision.sh"] diff --git a/init/iofog/local-stack.yaml b/init/iofog/local-stack.yaml new file mode 100644 index 0000000..984b8c7 --- /dev/null +++ b/init/iofog/local-stack.yaml @@ -0,0 +1,21 @@ +--- +controlplane: + images: + controller: gcr.io/focal-freedom-236620/controller:latest + connector: docker.io/iofog/connector:latest + iofoguser: + name: test + surname: local + email: user@domain.com + password: '#Bugs4Fun' + controllers: + - name: local-controller + host: localhost +connectors: + - name: local-connector + host: localhost +agents: +- name: ioFog Agent + image: gcr.io/focal-freedom-236620/agent:latest + host: localhost + diff --git a/init/iofog/provision.sh b/init/iofog/provision.sh deleted file mode 100755 index d431a66..0000000 --- a/init/iofog/provision.sh +++ /dev/null @@ -1,143 +0,0 @@ -#!/usr/bin/env sh - -set -o errexit -o noclobber -o nounset -cd "$(dirname "$0")" - -function waitForController() { - while true; do - STATUS=$(curl --request GET --url "${CONTROLLER_HOST}/status" 2>/dev/null | jq -r ".status") - [[ "${STATUS}" == "online" ]] && break || echo "Waiting for Controller..." - sleep 2 - done -} - -function waitForAgent() { - while true; do - STATUS=$(docker exec iofog-agent iofog-agent status | awk -F': ' '/ioFog daemon/{print $2}') - [[ "${STATUS}" == "RUNNING" ]] && break || echo "Waiting for Agent..." - sleep 2 - done -} - -function waitForConnector() { - while true; do - STATUS=$(curl --request POST --url "${CONNECTOR_HOST}/status" \ - --header 'Content-Type: application/x-www-form-urlencoded' --data mappingid=all 2>/dev/null \ - | jq -r '.status') - [[ "${STATUS}" == "running" ]] && break || echo "Waiting for Connector..." - sleep 2 - done -} - -function createUser() { - echo -n "Creating user John Doe... " - local RET=$(curl --request POST --url "${CONTROLLER_HOST}/user/signup" \ - --header 'Content-Type: application/json' \ - --data '{"email":"user@domain.com","firstName":"John","lastName":"Doe","password":"#Bugs4Fun"}' \ - 2>/dev/null) - local RET_MSG=$(echo $RET | jq -r '.message') - local RET_UID=$(echo $RET | jq -r '.userId') - [[ "${RET_MSG}" == "null" ]] && echo "${RET_UID}" || echo "${RET_MSG}" -} - -function login() { - echo -n "Logging in as user user@domain.com... " - TOKEN=$(curl --request POST --url "${CONTROLLER_HOST}/user/login" \ - --header 'Content-Type: application/json' \ - --data '{"email":"user@domain.com","password":"#Bugs4Fun"}' 2>/dev/null \ - | jq -r '.accessToken') - echo "${TOKEN}" -} - -function createDefaultFog() { - # Delete all fogs with the same default fog name. This is in case the script is run repeatedly. - local DEFAULT_FOGS=$(curl --request GET --url "${CONTROLLER_HOST}/iofog-list" \ - --header "Authorization: ${TOKEN}" \ - --header 'Content-Type: application/json' 2>/dev/null \ - | jq -r ".fogs[] | select(.name == \"${DEFAULT_FOG}\") | .uuid") - for FOG_UUID in ${DEFAULT_FOGS}; do - echo "Deleting pre-existing default fog: ${FOG_UUID}..." - curl --request DELETE --url "${CONTROLLER_HOST}/iofog/${FOG_UUID}" \ - --header "Authorization: ${TOKEN}" --header 'Content-Type: application/json' 2>/dev/null - done - - # Wait for all the deleted fogs to be actually delete. - while true; do - DEFAULT_FOGS=$(curl --request GET --url "${CONTROLLER_HOST}/iofog-list" \ - --header "Authorization: ${TOKEN}" \ - --header 'Content-Type: application/json' 2>/dev/null \ - | jq -r ".fogs[] | select(.name == \"${DEFAULT_FOG}\") | .uuid") - [[ -z "${DEFAULT_FOGS}" ]] && break || echo "Waiting for pre-existing default fogs to be deleted..." - sleep 2 - done - - echo -n "Creating default fog... " - curl --request POST --url "${CONTROLLER_HOST}/iofog" \ - --header "Authorization: ${TOKEN}" --header 'Content-Type: application/json' \ - --data "{\"name\": \"${DEFAULT_FOG}\",\"fogType\": 1}" 2> /dev/null 1>&2 - echo "${DEFAULT_FOG}" - - echo -n 'Retrieving UUID of default fog... ' - FOG_UUID=$(curl --request GET --url "${CONTROLLER_HOST}/iofog-list" \ - --header "Authorization: ${TOKEN}" --header 'Content-Type: application/json' 2> /dev/null \ - | jq -r ".fogs[] | select(.name == \"${DEFAULT_FOG}\") | .uuid") - echo "${FOG_UUID}" -} - -function configureAgent() { - echo "Configuring Agent..." - docker exec iofog-agent iofog-agent config -idc off > /dev/null - docker exec iofog-agent iofog-agent config -a "${CONTROLLER_HOST}" > /dev/null -} - -function configureController() { - echo "Configuring Controller..." - CONNECTOR_IP=$(getent hosts iofog-connector | awk '{ print $1 }') - # TODO this is the only "docker exec" for controller - needs to be replaced with REST API - docker exec iofog-controller \ - iofog-controller connector add -n iofog-connector -d "${CONNECTOR_IP}" -i "${CONNECTOR_IP}" -H -} - -function provisionAgent() { - echo -n "Retrieving provisioning key for default fog... " - PROVISION_KEY=$(curl --request GET --url "${CONTROLLER_HOST}/iofog/${FOG_UUID}/provisioning-key" \ - --header "Authorization: ${TOKEN}" --header 'Content-Type: application/json' 2> /dev/null \ - | jq -r .key) - echo "${PROVISION_KEY}" - - docker exec iofog-agent iofog-agent provision "${PROVISION_KEY}" -} - -function createDefaultFlow() { - echo -n "Creating default flow... " - curl --request POST --url "${CONTROLLER_HOST}/flow" \ - --header "Authorization: ${TOKEN}" --header 'Content-Type: application/json' \ - --data "{\"name\": \"${DEFAULT_FLOW}\",\"isActivated\":true}" 2> /dev/null 1>&2 - - # Retrieve just created flow's id - FLOW_ID=$(curl --request GET --url "${CONTROLLER_HOST}/flow" \ - --header "Authorization: ${TOKEN}" --header 'Content-Type: application/json' 2> /dev/null \ - | jq -r ".flows[] | select(.name == \"${DEFAULT_FLOW}\") | .id") - echo "${FLOW_ID}" -} - -echo "Initializing ioFog stack. This may take a minute or two." - -docker --version # Check if docker is available. Needs docker socket mapped in order to talk to the Agent -CONTROLLER_HOST="http://iofog-controller:51121/api/v3" -CONNECTOR_HOST="http://iofog-connector:8080/api/v2" -DEFAULT_FOG="ioFog Agent" -DEFAULT_FLOW="Default Flow" - -waitForConnector -waitForController -waitForAgent -configureController -createUser -login -createDefaultFog -configureAgent -provisionAgent -createDefaultFlow - -echo "Successfully initialized ioFog stack." diff --git a/init/tutorial/Dockerfile b/init/tutorial/Dockerfile deleted file mode 100644 index 9449a73..0000000 --- a/init/tutorial/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM docker:dind - -RUN apk add --no-cache curl jq - -ADD ./provision.sh / - -CMD ["sh", "-c", "/provision.sh"] diff --git a/init/tutorial/config.yaml b/init/tutorial/config.yaml new file mode 100644 index 0000000..898c07d --- /dev/null +++ b/init/tutorial/config.yaml @@ -0,0 +1,39 @@ +name: tutorial +microservices: +- name: Sensors + agent: + name: ioFog Agent + config: {} + images: + x86: iofog/sensors:latest + registry: remote + volumes: [] + ports: [] + env: [] +- name: Rest API + agent: + name: ioFog Agent + config: {} + images: + x86: iofog/freeboard-api:latest + registry: remote + volumes: [] + ports: + - internal: 80 + external: 10101 + env: [] +- name: Freeboard + agent: + name: ioFog Agent + config: {} + images: + x86: iofog/freeboard:latest + registry: remote + volumes: [] + ports: + - internal: 80 + external: 10102 + env: [] +routes: +- from: Sensors + to: Rest API \ No newline at end of file diff --git a/init/tutorial/provision.sh b/init/tutorial/provision.sh deleted file mode 100755 index 54d22e6..0000000 --- a/init/tutorial/provision.sh +++ /dev/null @@ -1,135 +0,0 @@ -#!/usr/bin/env sh - -# TODO finish tutorial setup -# TODO split --data into multiple lines - -set -o errexit -o noclobber -o nounset -cd "$(dirname "$0")" - -function waitForController() { - while true; do - local STATUS=$(curl --request GET --url "${CONTROLLER_HOST}/status" 2>/dev/null | jq -r ".status") - [[ "${STATUS}" == "online" ]] && break || echo "Waiting for Controller..." - sleep 2 - done -} - -function login() { - echo -n "Logging in as user user@domain.com... " - TOKEN=$(curl --request POST --url "${CONTROLLER_HOST}/user/login" \ - --header 'Content-Type: application/json' \ - --data '{"email":"user@domain.com","password":"#Bugs4Fun"}' 2>/dev/null \ - | jq -r '.accessToken') - echo "${TOKEN}" -} - -function getDemoFogId() { - echo -n "Looking up default fog... " - FOG_ID=$(curl --request GET --url "${CONTROLLER_HOST}/iofog-list" \ - --header "Authorization: ${TOKEN}" \ - --header 'Content-Type: application/json' 2>/dev/null \ - | jq -r ".fogs[] | select(.name == \"${DEFAULT_FOG}\") | .uuid") - echo "${FOG_ID}" -} - -function getDemoFlowId() { - echo -n "Looking up default flow... " - FLOW_ID=$(curl --request GET --url "${CONTROLLER_HOST}/flow" \ - --header "Authorization: ${TOKEN}" \ - --header 'Content-Type: application/json' 2>/dev/null \ - | jq -r ".flows[] | select(.name == \"${DEFAULT_FLOW}\") | .id") - echo "${FLOW_ID}" -} - -function startMicroserviceSensors() { - echo -n 'Registering Sensor microservice in the catalog... ' - SENSORS_CATALOG_ID=$(curl --request POST --url $CONTROLLER_HOST/catalog/microservices \ - --header "Authorization: ${TOKEN}" --header 'Content-Type: application/json' \ - --data '{"name":"Sensors","category": "DEMO","publisher":"Edgeworx","registryId":1,"images":[{"containerImage":"iofog/sensors:latest","fogTypeId":1}]}' \ - 2> /dev/null | jq -r .id) - echo "${SENSORS_CATALOG_ID}" - - echo -n 'Creating Sensor microservice... ' - SENSORS_UUID=$(curl --request POST --url $CONTROLLER_HOST/microservices \ - --header "Authorization: ${TOKEN}" --header 'Content-Type: application/json' \ - --data '{"name":"Sensors","config":"{}","catalogItemId":'"${SENSORS_CATALOG_ID}"',"flowId":'"${FLOW_ID}"',"iofogUuid":"'"${FOG_ID}"'","rootHostAccess":false,"logSize":5,"volumeMappings":[],"ports":[],"routes":[]}' \ - 2> /dev/null | jq -r .uuid) - echo "${SENSORS_UUID}" -} - -function startMicroserviceRestApi() { - echo -n 'Registering REST API microservice in the catalog... ' - RESTAPI_CATALOG_ID=$(curl --request POST --url $CONTROLLER_HOST/catalog/microservices \ - --header "Authorization: ${TOKEN}" --header 'Content-Type: application/json' \ - --data '{"name":"Rest API","category": "DEMO","publisher":"Edgeworx","registryId":1,"images":[{"containerImage":"iofog/freeboard-api:latest","fogTypeId":1}]}' \ - 2> /dev/null | jq -r .id) - echo "${RESTAPI_CATALOG_ID}" - - echo -n 'Creating REST API microservice... ' - RESTAPI_UUID=$(curl --request POST --url $CONTROLLER_HOST/microservices \ - --header "Authorization: ${TOKEN}" --header 'Content-Type: application/json' \ - --data '{"name":"Rest API","config":"{}","catalogItemId":'"${RESTAPI_CATALOG_ID}"',"flowId":'"${FLOW_ID}"',"iofogUuid":"'"${FOG_ID}"'","rootHostAccess":false,"logSize":5,"volumeMappings":[],"ports":[{"internal":80,"external":10101,"publicMode":false}],"routes":[]}' \ - 2> /dev/null | jq -r .uuid) - echo "${RESTAPI_UUID}" -} - -function startMicroserviceFreeboard() { - echo -n 'Registering Freeboard microservice in the catalog... ' - FREEBOARD_CATALOG_ID=$(curl --request POST --url $CONTROLLER_HOST/catalog/microservices \ - --header "Authorization: ${TOKEN}" --header 'Content-Type: application/json' \ - --data '{"name":"freeboard","category": "DEMO","publisher":"Edgeworx","registryId":1,"images":[{"containerImage":"iofog/freeboard:latest","fogTypeId":1}]}' \ - 2> /dev/null | jq -r .id) - echo "${FREEBOARD_CATALOG_ID}" - - echo -n 'Creating Freeboard microservice... ' - FREEBOARD_UUID=$(curl --request POST --url $CONTROLLER_HOST/microservices \ - --header "Authorization: ${TOKEN}" --header 'Content-Type: application/json' \ - --data '{"name":"Freeboard","config":"{}","catalogItemId":'"${FREEBOARD_CATALOG_ID}"',"flowId":'"${FLOW_ID}"',"iofogUuid":"'"${FOG_ID}"'","rootHostAccess":false,"logSize":5,"volumeMappings":[],"ports":[{"internal":80,"external":10102,"publicMode":false}],"routes":[]}' \ - 2> /dev/null | jq -r .uuid) - echo "${FREEBOARD_UUID}" -} - -function routeSensorsToApi() { - echo 'Creating route between Sensors and REST API microservices...' - curl --request POST --url "${CONTROLLER_HOST}/microservices/${SENSORS_UUID}/routes/${RESTAPI_UUID}" \ - --header "Authorization: ${TOKEN}" --header 'Content-Type: application/json' 2> /dev/null -} - -function waitForService() { - local IMAGE="$1" - echo -n "Waiting service $IMAGE..." - while true; do - local STATUS=$(docker inspect -f {{.State.Running}} $(docker ps -q --filter "ancestor=$IMAGE") 2>/dev/null) - [[ "${STATUS}" == "true" ]] && break || echo -n "." - sleep 2 - done - echo " OK" -} - -function waitForAllServices() { - waitForService "iofog/sensors:latest" - waitForService "iofog/freeboard-api:latest" - waitForService "iofog/freeboard:latest" -} - -echo "Initializing tutorial. This may take a minute or two." - -CONTROLLER_HOST="http://iofog-controller:51121/api/v3" -DEFAULT_FOG="ioFog Agent" -DEFAULT_FLOW="Default Flow" - -waitForController -login -getDemoFogId -getDemoFlowId -startMicroserviceSensors -startMicroserviceRestApi -startMicroserviceFreeboard -routeSensorsToApi -waitForAllServices - -echo "Successfully initialized tutorial." - - - - diff --git a/services/iofog/iofog-agent/.gitignore b/services/iofog/iofog-agent/.gitignore deleted file mode 100644 index cc6078c..0000000 --- a/services/iofog/iofog-agent/.gitignore +++ /dev/null @@ -1 +0,0 @@ -id_ecdsa.pub diff --git a/services/iofog/iofog-agent/Dockerfile b/services/iofog/iofog-agent/Dockerfile deleted file mode 100644 index 1cc3b83..0000000 --- a/services/iofog/iofog-agent/Dockerfile +++ /dev/null @@ -1,35 +0,0 @@ -FROM iofog/ubuntu-16.04-java8 - -ARG LOCAL_AGENT_PACKAGE -# Copy install script and local package if there is one (No conditional copy in docker) -COPY ./install.sh ${LOCAL_AGENT_PACKAGE} /opt/iofog-agent/ - -# Install our deps -RUN apt-get update -qq && apt-get install -qqy \ - sudo \ - curl \ - software-properties-common \ - openssh-server \ - supervisor \ - && rm -rf /var/lib/apt/lists/* - -# Install iofog-agent (script requires sudo, curl and software-properties-common) -RUN /opt/iofog-agent/install.sh ${LOCAL_AGENT_PACKAGE} -RUN rm /opt/iofog-agent/install.sh - -# SSH Magic -# Allows the test's container "test-runner" access to iofog-agent, due to the agent's lack of REST API -COPY id_ecdsa.pub / -RUN mkdir -p /root/.ssh -RUN cat /id_ecdsa.pub > /root/.ssh/authorized_keys -RUN mkdir /var/run/sshd -RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd -ENV NOTVISIBLE "in users profile" -RUN echo "export VISIBLE=now" >> /etc/profile -EXPOSE 22 - -# Copy our configs -COPY config.xml /etc/iofog-agent/config.xml -COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf - -CMD ["/usr/bin/supervisord"] diff --git a/services/iofog/iofog-agent/config.xml b/services/iofog/iofog-agent/config.xml deleted file mode 100644 index 5c55bd5..0000000 --- a/services/iofog/iofog-agent/config.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - http://iofog-controller:51121/api/v3/ - - /etc/iofog-agent/cert.crt - - eth0 - - unix:///var/run/docker.sock - - 50 - - /var/lib/iofog-agent/ - - 4096 - - 80.0 - - 10.0 - - /var/log/iofog-agent/ - - 10 - - 30 - - 60 - - 10 - - off - - 60 - - off - - intel_amd - - on - diff --git a/services/iofog/iofog-agent/install.sh b/services/iofog/iofog-agent/install.sh deleted file mode 100755 index 83c98bc..0000000 --- a/services/iofog/iofog-agent/install.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# If local agent provided, install from local package, otherwise go to packagecloud -if [ ! -z "$1" ] && [ ! "$1" = "./install.sh" ]; then - echo "============> Installing local agent" - dpkg -i /opt/iofog-agent/"$1" - rm -f /opt/iofog-agent/"$1" -else - wget -q -O - https://packagecloud.io/install/repositories/iofog/iofog-agent/script.deb.sh | bash - apt-get install iofog-agent -fi \ No newline at end of file diff --git a/services/iofog/iofog-agent/supervisord.conf b/services/iofog/iofog-agent/supervisord.conf deleted file mode 100644 index 5d55f75..0000000 --- a/services/iofog/iofog-agent/supervisord.conf +++ /dev/null @@ -1,12 +0,0 @@ -[supervisord] -nodaemon=true - -[program:sshd] -command=/usr/sbin/sshd -D - -; TODO supervisor expects non-daemonized program, iofog-agent is daemonized -; http://supervisord.org/subprocess.html#nondaemonizing-of-subprocesses -[program:agent] -command=bash -c 'service iofog-agent start && tail -f /dev/null' -stderr_logfile=/var/log/agent.err.log -stdout_logfile=/var/log/agent.out.log diff --git a/services/iofog/iofog-connector/Dockerfile b/services/iofog/iofog-connector/Dockerfile deleted file mode 100644 index 757dbe3..0000000 --- a/services/iofog/iofog-connector/Dockerfile +++ /dev/null @@ -1,21 +0,0 @@ -FROM iofog/ubuntu-16.04-java8 - -ARG LOCAL_CONNECTOR_PACKAGE -# Copy local package, or default install script (No conditional copy in docker) -COPY ./install.sh ${LOCAL_CONNECTOR_PACKAGE} /opt/iofog-connector/ - -# Install all our deps -RUN apt-get update -qq && apt-get install -qqy \ - sudo \ - curl \ - software-properties-common \ - && rm -rf /var/lib/apt/lists/* - -# Install iofog-connector (script requires sudo, curl and software-properties-common) -RUN /opt/iofog-connector/install.sh ${LOCAL_CONNECTOR_PACKAGE} -RUN rm /opt/iofog-connector/install.sh - -# Copy in the connector configuration -COPY iofog-connector.conf /etc/iofog-connector/iofog-connector.conf - -ENTRYPOINT [ "sh", "-c", "service iofog-connector start && tail -f /dev/null" ] diff --git a/services/iofog/iofog-connector/install.sh b/services/iofog/iofog-connector/install.sh deleted file mode 100755 index 8ac9b94..0000000 --- a/services/iofog/iofog-connector/install.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# If local connector provided, install from local package, otherwise go to packagecloud -if [ ! -z "$1" ] && [ ! "$1" = "./install.sh" ]; then - echo "============> Installing local connector" - dpkg -i /opt/iofog-connector/"$1" - rm -f /opt/iofog-connector/"$1" -else - wget -q -O - https://packagecloud.io/install/repositories/iofog/iofog-connector/script.deb.sh | bash - apt-get install iofog-connector -fi \ No newline at end of file diff --git a/services/iofog/iofog-connector/iofog-connector.conf b/services/iofog/iofog-connector/iofog-connector.conf deleted file mode 100644 index c2d575c..0000000 --- a/services/iofog/iofog-connector/iofog-connector.conf +++ /dev/null @@ -1,10 +0,0 @@ -{ - "ports": [ - "6000-9999", - "30000-49999" - ], - "exclude": [], - "broker": 12345, - "address": "127.0.0.1", - "dev": true -} diff --git a/services/iofog/iofog-controller/Dockerfile b/services/iofog/iofog-controller/Dockerfile deleted file mode 100644 index 2a8dab1..0000000 --- a/services/iofog/iofog-controller/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM node:8.16.0-alpine - -ARG LOCAL_CONTROLLER_PACKAGE -# Copy local package, or default install script (No conditional copy in docker) -COPY ./install.sh ${LOCAL_CONTROLLER_PACKAGE} /opt/iofog-controller/ - -# Install iofog-controller -RUN /opt/iofog-controller/install.sh ${LOCAL_CONTROLLER_PACKAGE} -RUN rm /opt/iofog-controller/install.sh - -ENTRYPOINT [ "sh", "-c", "iofog-controller start && tail -f /dev/null" ] diff --git a/services/iofog/iofog-controller/install.sh b/services/iofog/iofog-controller/install.sh deleted file mode 100755 index 3edfc30..0000000 --- a/services/iofog/iofog-controller/install.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -# If local controller provided, install from local package, otherwise go to npm repository -if [ ! -z "$1" ] && [ ! "$1" = "./install.sh" ]; then - echo "============> Installing local controller" - npm install --unsafe-perm -g /opt/iofog-controller/"$1" - rm -f /opt/iofog-controller/"$1" -else - npm i -g iofogcontroller --unsafe-perm -fi \ No newline at end of file diff --git a/start.sh b/start.sh index 718ec52..0e00911 100755 --- a/start.sh +++ b/start.sh @@ -19,98 +19,80 @@ printHelp() { echo "" echo "Options:" echo " -h, --help print this help / usage" - echo " -a, --agent specify a local agent package" - echo " -ct, --controller specify a local controller package" - echo " -cn, --connector specify a local connector package" - echo " --no-cache prevent the usage of cache during the build step" + echo " -a, --agent specify a local agent image" + echo " -ct, --controller specify a local controller image" + echo " -cn, --connector specify a local connector image" echo "" echo "Arguments:" echo " [environment] setup demo application, optional, default: iofog" echo " supported values: iofog, tutorial" } -checkForComposeFile() { - local ENVIRONMENT="$1" - local COMPOSE_FILE="docker-compose-${ENVIRONMENT}.yml" - if [[ ! -f "${COMPOSE_FILE}" ]]; then - echoError "Environment configuration for \"${ENVIRONMENT}\" does not exist!" - exit 2 - fi -} - startIofog() { - echoInfo "Building containers for ioFog stack..." - local BUILD_ARGS="--build-arg LOCAL_CONTROLLER_PACKAGE=${CONTROLLER_PACKAGE} --build-arg LOCAL_CONNECTOR_PACKAGE=${CONNECTOR_PACKAGE} --build-arg LOCAL_AGENT_PACKAGE=${AGENT_PACKAGE}" - local COMPOSE_BUILD_ARGS="${IOFOG_BUILD_NO_CACHE} ${BUILD_ARGS:=""}" - local SERVICE_LIST="iofog-connector iofog-controller iofog-agent iofog-init" - docker-compose -f "docker-compose-iofog.yml" build ${COMPOSE_BUILD_ARGS} ${SERVICE_LIST} > /dev/null - - echoInfo "Spinning up containers for ioFog stack..." - docker-compose -f "docker-compose-iofog.yml" up --detach --no-recreate - - echoInfo "Initializing iofog stack..." - docker logs -f "iofog-init" # wait for the ioFog stack initialization - RET=$(docker wait "iofog-init") - if [[ "$RET" != "0" ]]; then - echoError "Failed to initialize ioFog stack!" - exit 3 + # If stack is running, skip + local CONTROLLER_CONTAINER_ID=$(docker ps -q --filter="name=iofog-controller") + if ! [[ -z $CONTROLLER_CONTAINER_ID ]]; then + return fi - echoInfo "Successfully initialized ioFog stack." + + echo "--- +controlplane: + images: + controller: $CONTROLLER_IMAGE + connector: $CONNECTOR_IMAGE + iofoguser: + name: test + surname: local + email: user@domain.com + password: '#Bugs4Fun' + controllers: + - name: local-controller + host: localhost +connectors: + - name: local-connector + host: localhost +agents: +- name: ioFog Agent + image: $AGENT_IMAGE + host: localhost +" >| init/iofog/local-stack.yaml + + echoInfo "Deploying containers for ioFog stack..." + iofogctl deploy -f init/iofog/local-stack.yaml } startEnvironment() { local ENVIRONMENT="$1" - local COMPOSE_PARAM="-f docker-compose-${ENVIRONMENT}.yml" - - echoInfo "Building containers for ${ENVIRONMENT} environment..." - docker-compose -f "docker-compose-iofog.yml" -f "docker-compose-${ENVIRONMENT}.yml" \ - build "${ENVIRONMENT}-init" > /dev/null - - echoInfo "Spinning up containers for ${ENVIRONMENT} environment..." - docker-compose -f "docker-compose-iofog.yml" -f "docker-compose-${ENVIRONMENT}.yml" \ - up --detach --no-recreate "${ENVIRONMENT}-init" - - echoInfo "Initializing ${ENVIRONMENT} environment..." - docker logs -f "${ENVIRONMENT}-init" # wait for the ioFog stack initialization - RET=$(docker wait "${ENVIRONMENT}-init") - if [[ "$RET" != "0" ]]; then - echoError "Failed to initialize ${ENVIRONMENT} environment!" - exit 3 - fi - echoInfo "Successfully setup ${ENVIRONMENT} environment." + + echoInfo "Deploying ${ENVIRONMENT} application..." + iofogctl deploy application -f "init/${ENVIRONMENT}/config.yaml" echoInfo "It may take a while before ioFog stack creates all ${ENVIRONMENT} microservices." + echo "" } ENVIRONMENT='' IOFOG_BUILD_NO_CACHE='' -AGENT_PACKAGE='' -CONTROLLER_PACKAGE='' -CONNECTOR_PACKAGE='' +AGENT_IMAGE='docker.io/iofog/agent:latest' +CONTROLLER_IMAGE='docker.io/iofog/controller:latest' +CONNECTOR_IMAGE='docker.io/iofog/connector:latest' while [[ "$#" -ge 1 ]]; do case "$1" in -h|--help) printHelp exit 0 ;; - --no-cache) - IOFOG_BUILD_NO_CACHE="--no-cache" - shift - ;; -a|--agent) - AGENT_PACKAGE="local-agent-package.deb" - cp -i "$2" "./services/iofog/iofog-agent/$AGENT_PACKAGE" || true + AGENT_IMAGE=${2:-$AGENT_IMAGE} shift shift ;; -ct|--controller) - CONTROLLER_PACKAGE="local-controller-package.tgz" - cp -i "$2" "./services/iofog/iofog-controller/$CONTROLLER_PACKAGE" || true + CONTROLLER_IMAGE=${2:-$CONTROLLER_IMAGE} shift shift ;; -cn|--connector) - CONNECTOR_PACKAGE="local-connector-package.deb" - cp -i "$2" "./services/iofog/iofog-connector/$CONNECTOR_PACKAGE" || true + CONNECTOR_IMAGE=${2:-$CONNECTOR_IMAGE} shift shift ;; @@ -131,20 +113,14 @@ prettyHeader "Starting ioFog Demo" # Figure out which environment we are going to be starting. By default, setup only the ioFog stack ENVIRONMENT=${ENVIRONMENT:="iofog"} -checkForComposeFile "iofog" - -if [[ "${ENVIRONMENT}" != "iofog" ]]; then checkForComposeFile "${ENVIRONMENT}"; fi - echoInfo "Starting \"${ENVIRONMENT}\" demo environment..." # Create a new ssh key echoInfo "Creating new ssh key for tests..." rm -f test/conf/id_ecdsa* ssh-keygen -t ecdsa -N "" -f test/conf/id_ecdsa -q -cp -f test/conf/id_ecdsa.pub services/iofog/iofog-agent/ # Start ioFog stack -# TODO check if this environment is up or not startIofog # Optionally start another environment @@ -157,5 +133,5 @@ fi ./status.sh if [[ "${ENVIRONMENT}" == "tutorial" ]]; then - echoSuccess "## Visit https://iofog.org/docs/1.0.0/tutorial/introduction.html to continue with the ioFog tutorial." + echoSuccess "## Visit https://iofog.org/docs/1.3.0/tutorial/introduction.html to continue with the ioFog tutorial." fi diff --git a/status.sh b/status.sh index 82f725d..5b25976 100755 --- a/status.sh +++ b/status.sh @@ -16,10 +16,14 @@ prettyTitle "ioFog Demo Environment Status" echoInfo " $(docker ps --filter 'name=iofog')" echo +prettyTitle "ioFog Demo Edge Cloud Network Status" +echoInfo " $(iofogctl get all)" +echo + CONTROLLER_PORT="$(docker port iofog-controller | awk '{print $1}' | cut -b 1-5)" -if [ ! -z ${CONTROLLER_PORT} ]; then - echoSuccess "## iofog-controller is running at http://localhost:${CONTROLLER_PORT}" +if ! [[ -z ${CONTROLLER_PORT} ]]; then + echoSuccess "## iofog-controller is running at http://localhost:51121" else echoError "No iofog-controller container was found" fi diff --git a/stop.sh b/stop.sh index b27f875..06e8436 100755 --- a/stop.sh +++ b/stop.sh @@ -38,14 +38,9 @@ prettyHeader "Stopping ioFog Demo..." # Stop ioFog stack echoInfo "Stopping all containers..." -docker-compose -f "docker-compose-iofog.yml" -f "docker-compose-tutorial.yml" down -v -# TODO stopping the ioFog stack leaves its microservices running - fix this properly -REMAINING_MSVC=`docker ps -q --filter 'name=iofog*'` - -if [ ! -z "${REMAINING_MSVC}" ]; then - docker rm -f ${REMAINING_MSVC} -fi +iofogctl delete all +iofogctl disconnect # Remove generated files find test/conf -type f -not -name ".gitignore" -exec rm -f {} \; From 6140d32f47350b1fe26b701fc093bfe5cec9f457 Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Thu, 12 Sep 2019 15:48:11 +0200 Subject: [PATCH 02/55] Install iofogctl in CI pipeline --- azure-pipelines.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 23bf058..bfa0eed 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -16,6 +16,13 @@ steps: dockerVersion: 18.09.2 releaseType: stable +- script: | + # https://packagecloud.io/install/repositories/iofog/iofogctl/script.deb.sh | sudo bash + # Using dev version of iofogctl until 1.3.0 release + curl -s https://8c90601638aff0b3fb520971175089bbaba2cf7f29be9528:@packagecloud.io/install/repositories/iofog/iofogctl-snapshots/script.deb.sh | sudo bash + sudo apt install iofogctl + displayName: 'Install iofogctl' + - script: | echo $(gcp.svcacc) | docker login -u _json_key --password-stdin https://gcr.io displayName: 'Docker connect to Registry' From 0bbf6522b1b5975987598781febc373cdac8a66f Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Thu, 12 Sep 2019 17:28:44 +0200 Subject: [PATCH 03/55] Move SSH magic to test to work with iofogctl --- init/iofog/local-stack.yaml | 4 ++-- start.sh | 5 ----- stop.sh | 3 +-- test.sh | 32 ++++++++++++++++++++++++-------- 4 files changed, 27 insertions(+), 17 deletions(-) diff --git a/init/iofog/local-stack.yaml b/init/iofog/local-stack.yaml index 984b8c7..a8f092d 100644 --- a/init/iofog/local-stack.yaml +++ b/init/iofog/local-stack.yaml @@ -1,7 +1,7 @@ --- controlplane: images: - controller: gcr.io/focal-freedom-236620/controller:latest + controller: docker.io/iofog/controller:latest connector: docker.io/iofog/connector:latest iofoguser: name: test @@ -16,6 +16,6 @@ connectors: host: localhost agents: - name: ioFog Agent - image: gcr.io/focal-freedom-236620/agent:latest + image: docker.io/iofog/agent:latest host: localhost diff --git a/start.sh b/start.sh index 0e00911..ca600c8 100755 --- a/start.sh +++ b/start.sh @@ -115,11 +115,6 @@ ENVIRONMENT=${ENVIRONMENT:="iofog"} echoInfo "Starting \"${ENVIRONMENT}\" demo environment..." -# Create a new ssh key -echoInfo "Creating new ssh key for tests..." -rm -f test/conf/id_ecdsa* -ssh-keygen -t ecdsa -N "" -f test/conf/id_ecdsa -q - # Start ioFog stack startIofog diff --git a/stop.sh b/stop.sh index 06e8436..5bd2812 100755 --- a/stop.sh +++ b/stop.sh @@ -39,8 +39,7 @@ prettyHeader "Stopping ioFog Demo..." # Stop ioFog stack echoInfo "Stopping all containers..." -iofogctl delete all -iofogctl disconnect +iofogctl delete all || iofogctl disconnect # Remove generated files find test/conf -type f -not -name ".gitignore" -exec rm -f {} \; diff --git a/test.sh b/test.sh index dec4cc1..efc64ab 100755 --- a/test.sh +++ b/test.sh @@ -35,17 +35,33 @@ else exit 2 fi -echoInfo "Retrieving endpoints for ioFog stack" -AGENT_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' iofog-agent) -CONTROLLER_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' iofog-controller) -CONNECTOR_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' iofog-connector) +# Create a new ssh key +echoInfo "Creating new ssh key for tests..." +rm -f test/conf/id_ecdsa* +ssh-keygen -t ecdsa -N "" -f test/conf/id_ecdsa -q + +# SSH Magic +# Allows the test's container "test-runner" access to iofog-agent, due to the agent's lack of REST API +AGENT_CONTAINER_ID=$(docker ps -q --filter="name=iofog-agent") + +# Configuring ssh on the agent +echoInfo "Configuring ssh on the Agent" +docker exec iofog-agent apt install -y openssh-server > /dev/null 2>&1 +docker exec iofog-agent mkdir -p /root/.ssh > /dev/null 2>&1 +docker exec iofog-agent chmod 700 /root/.ssh > /dev/null 2>&1 +docker cp test/conf/id_ecdsa.pub "$AGENT_CONTAINER_ID:/root/.ssh/authorized_keys" > /dev/null 2>&1 +docker exec iofog-agent chmod 644 /root/.ssh/authorized_keys > /dev/null 2>&1 +docker exec iofog-agent mkdir -p /var/run/sshd > /dev/null 2>&1 +docker exec iofog-agent sudo sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd > /dev/null 2>&1 +docker exec iofog-agent sudo sed 's@#AuthorizedKeysFile %h/.ssh/authorized_keys@AuthorizedKeysFile %h/.ssh/authorized_keys@g' -i /etc/ssh/sshd_config > /dev/null 2>&1 +docker exec iofog-agent /bin/bash -c 'service ssh restart' > /dev/null 2>&1 echoInfo "Running Test Runner..." -docker run --rm --name test-runner --network bridge \ +docker run --rm --name test-runner --network local-iofog-network \ -v "$(pwd)/test/conf/id_ecdsa:/root/.ssh/id_ecdsa" \ - -e CONTROLLER="${CONTROLLER_IP}:51121" \ - -e CONNECTOR="${CONNECTOR_IP}:8080" \ - -e AGENTS="root@${AGENT_IP}:22" \ + -e CONTROLLER="iofog-controller:51121" \ + -e CONNECTOR="iofog-connector:8080" \ + -e AGENTS="root@iofog-agent:22" \ iofog/test-runner:1.2 echoNotify "## Test Runner Tests complete" From 27391287065c8245a8a78467e1d89c57b82d370b Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Thu, 12 Sep 2019 17:49:16 +0200 Subject: [PATCH 04/55] Add apt-get update for agent in test.sh --- test.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test.sh b/test.sh index efc64ab..da872ac 100755 --- a/test.sh +++ b/test.sh @@ -46,7 +46,9 @@ AGENT_CONTAINER_ID=$(docker ps -q --filter="name=iofog-agent") # Configuring ssh on the agent echoInfo "Configuring ssh on the Agent" -docker exec iofog-agent apt install -y openssh-server > /dev/null 2>&1 +docker exec iofog-agent sudo rm /var/lib/apt/lists/lock > /dev/null 2>&1 +docker exec iofog-agent apt-get update -qq > /dev/null 2>&1 +docker exec iofog-agent apt-get install -qqy openssh-server > /dev/null 2>&1 docker exec iofog-agent mkdir -p /root/.ssh > /dev/null 2>&1 docker exec iofog-agent chmod 700 /root/.ssh > /dev/null 2>&1 docker cp test/conf/id_ecdsa.pub "$AGENT_CONTAINER_ID:/root/.ssh/authorized_keys" > /dev/null 2>&1 From ca64ef22b8eb24aedcdd7e4854444e7dd1af2ca0 Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Fri, 13 Sep 2019 10:18:05 +0200 Subject: [PATCH 05/55] Update owner of authorized_keys in agent --- test.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/test.sh b/test.sh index da872ac..24c8156 100755 --- a/test.sh +++ b/test.sh @@ -53,6 +53,7 @@ docker exec iofog-agent mkdir -p /root/.ssh > /dev/null 2>&1 docker exec iofog-agent chmod 700 /root/.ssh > /dev/null 2>&1 docker cp test/conf/id_ecdsa.pub "$AGENT_CONTAINER_ID:/root/.ssh/authorized_keys" > /dev/null 2>&1 docker exec iofog-agent chmod 644 /root/.ssh/authorized_keys > /dev/null 2>&1 +docker exec iofog-agent chown root:root /root/.ssh/authorized_keys > /dev/null 2>&1 docker exec iofog-agent mkdir -p /var/run/sshd > /dev/null 2>&1 docker exec iofog-agent sudo sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd > /dev/null 2>&1 docker exec iofog-agent sudo sed 's@#AuthorizedKeysFile %h/.ssh/authorized_keys@AuthorizedKeysFile %h/.ssh/authorized_keys@g' -i /etc/ssh/sshd_config > /dev/null 2>&1 From 5b4d766393e7867f17feaf72aa4630a72c0fb6ab Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Fri, 13 Sep 2019 10:37:03 +0200 Subject: [PATCH 06/55] Use latest images --- azure-pipelines.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index bfa0eed..79ee9df 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -28,7 +28,14 @@ steps: displayName: 'Docker connect to Registry' - script: | - ./start.sh + docker pull gcr.io/focal-freedom-236620/controller:latest + docker pull gcr.io/focal-freedom-236620/agent:latest + displayName: 'Pull latest images' + +- script: | + # ./start.sh + # Use dev version of agent and controller until 1.3.0 release + ./start.sh -ct gcr.io/focal-freedom-236620/controller:latest -a gcr.io/focal-freedom-236620/agent:latest displayName: 'Start Connector, Controller, and Agent' - script: | From 91c818ae77e171ff1f4a4405e0f3e38ed0f56113 Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Fri, 13 Sep 2019 11:01:30 +0200 Subject: [PATCH 07/55] Refactor to have all resource name alphanumeric, lower case --- init/tutorial/config.yaml | 6 +++--- start.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/init/tutorial/config.yaml b/init/tutorial/config.yaml index 898c07d..dd47860 100644 --- a/init/tutorial/config.yaml +++ b/init/tutorial/config.yaml @@ -2,7 +2,7 @@ name: tutorial microservices: - name: Sensors agent: - name: ioFog Agent + name: local-agent config: {} images: x86: iofog/sensors:latest @@ -12,7 +12,7 @@ microservices: env: [] - name: Rest API agent: - name: ioFog Agent + name: local-agent config: {} images: x86: iofog/freeboard-api:latest @@ -24,7 +24,7 @@ microservices: env: [] - name: Freeboard agent: - name: ioFog Agent + name: local-agent config: {} images: x86: iofog/freeboard:latest diff --git a/start.sh b/start.sh index ca600c8..56ab968 100755 --- a/start.sh +++ b/start.sh @@ -52,7 +52,7 @@ connectors: - name: local-connector host: localhost agents: -- name: ioFog Agent +- name: local-agent image: $AGENT_IMAGE host: localhost " >| init/iofog/local-stack.yaml From 8d08eb85886d0d1ea21d52008c823fdbfb33c0d1 Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Fri, 13 Sep 2019 15:52:51 +0200 Subject: [PATCH 08/55] Use develop images in pipeline --- azure-pipelines.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 79ee9df..1695eb6 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -13,7 +13,7 @@ steps: - task: DockerInstaller@0 displayName: Docker Installer inputs: - dockerVersion: 18.09.2 + dockerVersion: 19.03.2 releaseType: stable - script: | @@ -28,14 +28,14 @@ steps: displayName: 'Docker connect to Registry' - script: | - docker pull gcr.io/focal-freedom-236620/controller:latest - docker pull gcr.io/focal-freedom-236620/agent:latest + docker pull gcr.io/focal-freedom-236620/controller:develop + docker pull gcr.io/focal-freedom-236620/agent:develop displayName: 'Pull latest images' - script: | # ./start.sh # Use dev version of agent and controller until 1.3.0 release - ./start.sh -ct gcr.io/focal-freedom-236620/controller:latest -a gcr.io/focal-freedom-236620/agent:latest + ./start.sh -ct gcr.io/focal-freedom-236620/controller:develop -a gcr.io/focal-freedom-236620/agent:develop displayName: 'Start Connector, Controller, and Agent' - script: | From 38a512628102992f151c1ab8ac48be58da83283b Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Thu, 19 Sep 2019 11:54:35 +0200 Subject: [PATCH 09/55] Check provisioning --- init/iofog/local-stack.yaml | 8 ++++---- start.sh | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/init/iofog/local-stack.yaml b/init/iofog/local-stack.yaml index a8f092d..28cb0df 100644 --- a/init/iofog/local-stack.yaml +++ b/init/iofog/local-stack.yaml @@ -1,8 +1,7 @@ --- controlplane: images: - controller: docker.io/iofog/controller:latest - connector: docker.io/iofog/connector:latest + controller: gcr.io/focal-freedom-236620/controller:1.3.0-rc1 iofoguser: name: test surname: local @@ -14,8 +13,9 @@ controlplane: connectors: - name: local-connector host: localhost + image: gcr.io/focal-freedom-236620/connector:1.3.0-rc1 agents: -- name: ioFog Agent - image: docker.io/iofog/agent:latest +- name: local-agent host: localhost + image: gcr.io/focal-freedom-236620/agent:1.3.0-rc1 diff --git a/start.sh b/start.sh index 56ab968..a19f26a 100755 --- a/start.sh +++ b/start.sh @@ -39,7 +39,6 @@ startIofog() { controlplane: images: controller: $CONTROLLER_IMAGE - connector: $CONNECTOR_IMAGE iofoguser: name: test surname: local @@ -51,16 +50,26 @@ controlplane: connectors: - name: local-connector host: localhost + image: $CONNECTOR_IMAGE agents: - name: local-agent - image: $AGENT_IMAGE host: localhost + image: $AGENT_IMAGE " >| init/iofog/local-stack.yaml echoInfo "Deploying containers for ioFog stack..." iofogctl deploy -f init/iofog/local-stack.yaml } +checkProvisioning() { + AGENT_UUID=$(docker exec -it iofog-agent iofog-agent info | grep 'UUID' | awk '{print $4}') + + if [ "$AGENT_UUID" == "not" ]; then + echoError "Failed to provision the agent" + return 1 + fi +} + startEnvironment() { local ENVIRONMENT="$1" @@ -117,6 +126,7 @@ echoInfo "Starting \"${ENVIRONMENT}\" demo environment..." # Start ioFog stack startIofog +checkProvisioning # Optionally start another environment if [[ "${ENVIRONMENT}" != "iofog" ]]; then From 51f710933181f51c81fbf30518c2b120d18bb41b Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Thu, 19 Sep 2019 18:13:55 +0200 Subject: [PATCH 10/55] Remove -it option for CI --- start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/start.sh b/start.sh index a19f26a..84542a5 100755 --- a/start.sh +++ b/start.sh @@ -62,7 +62,7 @@ agents: } checkProvisioning() { - AGENT_UUID=$(docker exec -it iofog-agent iofog-agent info | grep 'UUID' | awk '{print $4}') + AGENT_UUID=$(docker exec iofog-agent iofog-agent info | grep 'UUID' | awk '{print $4}') if [ "$AGENT_UUID" == "not" ]; then echoError "Failed to provision the agent" From b91a63ae07c17713dcefe68e5ae1521c4dbcb07b Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Mon, 30 Sep 2019 11:09:18 +1300 Subject: [PATCH 11/55] Add changelog --- azure-pipelines.yml | 3 +- docker-compose-iofog.yml | 60 ------------------------------------- docker-compose-tutorial.yml | 12 -------- 3 files changed, 2 insertions(+), 73 deletions(-) delete mode 100644 docker-compose-iofog.yml delete mode 100644 docker-compose-tutorial.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 1695eb6..ac4794a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -29,13 +29,14 @@ steps: - script: | docker pull gcr.io/focal-freedom-236620/controller:develop + docker pull gcr.io/focal-freedom-236620/connector:develop docker pull gcr.io/focal-freedom-236620/agent:develop displayName: 'Pull latest images' - script: | # ./start.sh # Use dev version of agent and controller until 1.3.0 release - ./start.sh -ct gcr.io/focal-freedom-236620/controller:develop -a gcr.io/focal-freedom-236620/agent:develop + ./start.sh -ct gcr.io/focal-freedom-236620/controller:develop -a gcr.io/focal-freedom-236620/agent:develop -cn gcr.io/focal-freedom-236620/connector:develop displayName: 'Start Connector, Controller, and Agent' - script: | diff --git a/docker-compose-iofog.yml b/docker-compose-iofog.yml deleted file mode 100644 index 5d58dd2..0000000 --- a/docker-compose-iofog.yml +++ /dev/null @@ -1,60 +0,0 @@ -version: "3" -services: - iofog-connector: - image: iofog-connector:local - build: - context: ./services/iofog/iofog-connector - args: - - LOCAL_CONNECTOR_PACKAGE - container_name: iofog-connector - ports: - - "53321:8080" - network_mode: bridge - - iofog-controller: - image: iofog-controller:local - build: - context: ./services/iofog/iofog-controller - args: - - LOCAL_CONTROLLER_PACKAGE - container_name: iofog-controller - depends_on: - - iofog-connector - ports: - - "51121:51121" - environment: - - NODE_ENV=development - links: - - iofog-connector:iofog-connector - network_mode: bridge - - iofog-agent: - image: iofog-agent:local - build: - context: ./services/iofog/iofog-agent - args: - - LOCAL_AGENT_PACKAGE - depends_on: - - iofog-controller - privileged: true - volumes: - - /var/run/docker.sock:/var/run/docker.sock - container_name: iofog-agent - ports: - - "8081:22" - - "54321:54321" - links: - - iofog-controller:iofog-controller - network_mode: bridge - - iofog-init: - build: ./init/iofog - container_name: iofog-init - depends_on: - - iofog-controller - volumes: - - /var/run/docker.sock:/var/run/docker.sock - links: - - iofog-controller:iofog-controller - - iofog-connector:iofog-connector - network_mode: bridge diff --git a/docker-compose-tutorial.yml b/docker-compose-tutorial.yml deleted file mode 100644 index 36755dd..0000000 --- a/docker-compose-tutorial.yml +++ /dev/null @@ -1,12 +0,0 @@ -version: "3" -services: - tutorial-init: - build: ./init/tutorial - container_name: tutorial-init - depends_on: - - iofog-controller - volumes: - - /var/run/docker.sock:/var/run/docker.sock - links: - - iofog-controller:iofog-controller - network_mode: bridge From 221a298af1c385898ea991d5a23e29c682d51015 Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Tue, 1 Oct 2019 08:11:03 +1300 Subject: [PATCH 12/55] Add changelog --- CHANGELOG-1.3.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 CHANGELOG-1.3.md diff --git a/CHANGELOG-1.3.md b/CHANGELOG-1.3.md new file mode 100644 index 0000000..3b65538 --- /dev/null +++ b/CHANGELOG-1.3.md @@ -0,0 +1,5 @@ +## v1.3.0 +* Use iofogctl and yaml file for deploying ioFog resources +* Remove Dockerfiles and docker-compose files +* Update test script to set up agent ssh access +* Improve logging \ No newline at end of file From d825f8e5aa42faed9646cb8759a470baf427f55b Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Fri, 4 Oct 2019 12:09:54 +1300 Subject: [PATCH 13/55] Use 1.3.0-beta packages --- azure-pipelines.yml | 18 +++++++++--------- start.sh | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ac4794a..166d9a2 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -17,9 +17,9 @@ steps: releaseType: stable - script: | - # https://packagecloud.io/install/repositories/iofog/iofogctl/script.deb.sh | sudo bash + https://packagecloud.io/install/repositories/iofog/iofogctl/script.deb.sh | sudo bash # Using dev version of iofogctl until 1.3.0 release - curl -s https://8c90601638aff0b3fb520971175089bbaba2cf7f29be9528:@packagecloud.io/install/repositories/iofog/iofogctl-snapshots/script.deb.sh | sudo bash + # curl -s https://8c90601638aff0b3fb520971175089bbaba2cf7f29be9528:@packagecloud.io/install/repositories/iofog/iofogctl-snapshots/script.deb.sh | sudo bash sudo apt install iofogctl displayName: 'Install iofogctl' @@ -27,16 +27,16 @@ steps: echo $(gcp.svcacc) | docker login -u _json_key --password-stdin https://gcr.io displayName: 'Docker connect to Registry' -- script: | - docker pull gcr.io/focal-freedom-236620/controller:develop - docker pull gcr.io/focal-freedom-236620/connector:develop - docker pull gcr.io/focal-freedom-236620/agent:develop - displayName: 'Pull latest images' +# - script: | +# docker pull gcr.io/focal-freedom-236620/controller:develop +# docker pull gcr.io/focal-freedom-236620/connector:develop +# docker pull gcr.io/focal-freedom-236620/agent:develop +# displayName: 'Pull latest images' - script: | - # ./start.sh + ./start.sh # Use dev version of agent and controller until 1.3.0 release - ./start.sh -ct gcr.io/focal-freedom-236620/controller:develop -a gcr.io/focal-freedom-236620/agent:develop -cn gcr.io/focal-freedom-236620/connector:develop + # ./start.sh -ct gcr.io/focal-freedom-236620/controller:develop -a gcr.io/focal-freedom-236620/agent:develop -cn gcr.io/focal-freedom-236620/connector:develop displayName: 'Start Connector, Controller, and Agent' - script: | diff --git a/start.sh b/start.sh index 84542a5..9ae6eb2 100755 --- a/start.sh +++ b/start.sh @@ -81,9 +81,9 @@ startEnvironment() { ENVIRONMENT='' IOFOG_BUILD_NO_CACHE='' -AGENT_IMAGE='docker.io/iofog/agent:latest' -CONTROLLER_IMAGE='docker.io/iofog/controller:latest' -CONNECTOR_IMAGE='docker.io/iofog/connector:latest' +AGENT_IMAGE='docker.io/iofog/agent:1.3.0-beta' +CONTROLLER_IMAGE='docker.io/iofog/controller:1.3.0-beta' +CONNECTOR_IMAGE='docker.io/iofog/connector:1.3.0-beta' while [[ "$#" -ge 1 ]]; do case "$1" in -h|--help) From cd8ec34887e7e1dfe65bce0e6c5260f4cde7487e Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Tue, 15 Oct 2019 17:46:54 +1300 Subject: [PATCH 14/55] Update init file --- init/iofog/local-stack.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/init/iofog/local-stack.yaml b/init/iofog/local-stack.yaml index 28cb0df..c2bfc41 100644 --- a/init/iofog/local-stack.yaml +++ b/init/iofog/local-stack.yaml @@ -1,7 +1,7 @@ --- controlplane: images: - controller: gcr.io/focal-freedom-236620/controller:1.3.0-rc1 + controller: docker.io/iofog/controller:1.3.0-beta iofoguser: name: test surname: local @@ -13,9 +13,9 @@ controlplane: connectors: - name: local-connector host: localhost - image: gcr.io/focal-freedom-236620/connector:1.3.0-rc1 + image: docker.io/iofog/connector:1.3.0-beta agents: - name: local-agent host: localhost - image: gcr.io/focal-freedom-236620/agent:1.3.0-rc1 + image: docker.io/iofog/agent:1.3.0-beta From 711148d98ed9d7b24afbdb34e09e3ffabdac8036 Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Tue, 15 Oct 2019 17:43:26 +1300 Subject: [PATCH 15/55] Update to K8s yaml --- init/iofog/local-stack.yaml | 23 +++++++---- init/tutorial/config.yaml | 82 +++++++++++++++++++------------------ start.sh | 23 +++++++---- 3 files changed, 75 insertions(+), 53 deletions(-) diff --git a/init/iofog/local-stack.yaml b/init/iofog/local-stack.yaml index c2bfc41..d2f0fda 100644 --- a/init/iofog/local-stack.yaml +++ b/init/iofog/local-stack.yaml @@ -1,5 +1,8 @@ --- -controlplane: +kind: ControlPlane +metadata: + name: local-ecn +spec: images: controller: docker.io/iofog/controller:1.3.0-beta iofoguser: @@ -10,12 +13,18 @@ controlplane: controllers: - name: local-controller host: localhost -connectors: - - name: local-connector - host: localhost - image: docker.io/iofog/connector:1.3.0-beta -agents: -- name: local-agent +--- +kind: Connector +metadata: + name: local-connector +spec: + host: localhost + image: docker.io/iofog/connector:1.3.0-beta +--- +kind: Agent +metadata: + name: local-agent +spec: host: localhost image: docker.io/iofog/agent:1.3.0-beta diff --git a/init/tutorial/config.yaml b/init/tutorial/config.yaml index dd47860..4759562 100644 --- a/init/tutorial/config.yaml +++ b/init/tutorial/config.yaml @@ -1,39 +1,43 @@ -name: tutorial -microservices: -- name: Sensors - agent: - name: local-agent - config: {} - images: - x86: iofog/sensors:latest - registry: remote - volumes: [] - ports: [] - env: [] -- name: Rest API - agent: - name: local-agent - config: {} - images: - x86: iofog/freeboard-api:latest - registry: remote - volumes: [] - ports: - - internal: 80 - external: 10101 - env: [] -- name: Freeboard - agent: - name: local-agent - config: {} - images: - x86: iofog/freeboard:latest - registry: remote - volumes: [] - ports: - - internal: 80 - external: 10102 - env: [] -routes: -- from: Sensors - to: Rest API \ No newline at end of file +--- +kind: Application +metadata: + name: tutorial +spec: + microservices: + - name: Sensors + agent: + name: local-agent + config: {} + images: + x86: iofog/sensors:latest + registry: remote + volumes: [] + ports: [] + env: [] + - name: Rest API + agent: + name: local-agent + config: {} + images: + x86: iofog/freeboard-api:latest + registry: remote + volumes: [] + ports: + - internal: 80 + external: 10101 + env: [] + - name: Freeboard + agent: + name: local-agent + config: {} + images: + x86: iofog/freeboard:latest + registry: remote + volumes: [] + ports: + - internal: 80 + external: 10102 + env: [] + routes: + - from: Sensors + to: Rest API \ No newline at end of file diff --git a/start.sh b/start.sh index 9ae6eb2..20b6d83 100755 --- a/start.sh +++ b/start.sh @@ -36,7 +36,10 @@ startIofog() { fi echo "--- -controlplane: +kind: ControlPlane +metadata: + name: local-ecn +spec: images: controller: $CONTROLLER_IMAGE iofoguser: @@ -47,12 +50,18 @@ controlplane: controllers: - name: local-controller host: localhost -connectors: - - name: local-connector - host: localhost - image: $CONNECTOR_IMAGE -agents: -- name: local-agent +--- +kind: Connector +metadata: + name: local-connector +spec: + host: localhost + image: $CONNECTOR_IMAGE +--- +kind: Agent +metadata: + name: local-agent +spec: host: localhost image: $AGENT_IMAGE " >| init/iofog/local-stack.yaml From e36022e0950a6a9051d9d648513619ceb24638c1 Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Wed, 16 Oct 2019 11:52:43 +1300 Subject: [PATCH 16/55] Update yamls to match new format --- azure-pipelines.yml | 4 ++-- init/iofog/local-stack.yaml | 2 +- start.sh | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 166d9a2..5a1b5f0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -34,10 +34,10 @@ steps: # displayName: 'Pull latest images' - script: | - ./start.sh + ./start.sh tutorial # Use dev version of agent and controller until 1.3.0 release # ./start.sh -ct gcr.io/focal-freedom-236620/controller:develop -a gcr.io/focal-freedom-236620/agent:develop -cn gcr.io/focal-freedom-236620/connector:develop - displayName: 'Start Connector, Controller, and Agent' + displayName: 'Start Connector, Controller, Agent, and tutorial microservices' - script: | ./test.sh diff --git a/init/iofog/local-stack.yaml b/init/iofog/local-stack.yaml index d2f0fda..a1d6544 100644 --- a/init/iofog/local-stack.yaml +++ b/init/iofog/local-stack.yaml @@ -5,7 +5,7 @@ metadata: spec: images: controller: docker.io/iofog/controller:1.3.0-beta - iofoguser: + iofogUser: name: test surname: local email: user@domain.com diff --git a/start.sh b/start.sh index 20b6d83..8cfc824 100755 --- a/start.sh +++ b/start.sh @@ -42,7 +42,7 @@ metadata: spec: images: controller: $CONTROLLER_IMAGE - iofoguser: + iofogUser: name: test surname: local email: user@domain.com From 7d2e3b18ac9654fea2bf37899c1201e50efe2c08 Mon Sep 17 00:00:00 2001 From: lkrcal Date: Tue, 22 Oct 2019 17:46:41 +0200 Subject: [PATCH 17/55] Azure Pipelines - move scheduled builds from classic editor to yaml --- azure-pipelines.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 23bf058..f35321c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,9 +1,17 @@ trigger: - master - develop + - release/* pr: - master - develop +schedules: +- cron: "0 0 * * *" + displayName: Daily build (UTC) + branches: + include: + - master + - develop pool: vmImage: 'ubuntu-16.04' From 7b379d6742f3a9ca08e8c56862f681c8ca478923 Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Wed, 23 Oct 2019 11:17:38 +1300 Subject: [PATCH 18/55] Add API Version --- init/iofog/local-stack.yaml | 3 +++ init/tutorial/config.yaml | 1 + start.sh | 3 +++ 3 files changed, 7 insertions(+) diff --git a/init/iofog/local-stack.yaml b/init/iofog/local-stack.yaml index a1d6544..21073b6 100644 --- a/init/iofog/local-stack.yaml +++ b/init/iofog/local-stack.yaml @@ -1,4 +1,5 @@ --- +apiVersion: iofog.org/v1 kind: ControlPlane metadata: name: local-ecn @@ -14,6 +15,7 @@ spec: - name: local-controller host: localhost --- +apiVersion: iofog.org/v1 kind: Connector metadata: name: local-connector @@ -21,6 +23,7 @@ spec: host: localhost image: docker.io/iofog/connector:1.3.0-beta --- +apiVersion: iofog.org/v1 kind: Agent metadata: name: local-agent diff --git a/init/tutorial/config.yaml b/init/tutorial/config.yaml index 4759562..a21540f 100644 --- a/init/tutorial/config.yaml +++ b/init/tutorial/config.yaml @@ -1,4 +1,5 @@ --- +apiVersion: iofog.org/v1 kind: Application metadata: name: tutorial diff --git a/start.sh b/start.sh index 8cfc824..1ed6c44 100755 --- a/start.sh +++ b/start.sh @@ -36,6 +36,7 @@ startIofog() { fi echo "--- +apiVersion: iofog.org/v1 kind: ControlPlane metadata: name: local-ecn @@ -51,6 +52,7 @@ spec: - name: local-controller host: localhost --- +apiVersion: iofog.org/v1 kind: Connector metadata: name: local-connector @@ -58,6 +60,7 @@ spec: host: localhost image: $CONNECTOR_IMAGE --- +apiVersion: iofog.org/v1 kind: Agent metadata: name: local-agent From 74567ed0fbc6a93096369b13c5081172e3b4fbe4 Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Wed, 23 Oct 2019 17:10:36 +1300 Subject: [PATCH 19/55] Update test.sh --- test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.sh b/test.sh index 24c8156..b7d07fc 100755 --- a/test.sh +++ b/test.sh @@ -48,7 +48,7 @@ AGENT_CONTAINER_ID=$(docker ps -q --filter="name=iofog-agent") echoInfo "Configuring ssh on the Agent" docker exec iofog-agent sudo rm /var/lib/apt/lists/lock > /dev/null 2>&1 docker exec iofog-agent apt-get update -qq > /dev/null 2>&1 -docker exec iofog-agent apt-get install -qqy openssh-server > /dev/null 2>&1 +docker exec iofog-agent apt-get install -qqy openssh-server > /dev/null 2>&1 || docker exec iofog-agent apt-get install -qqfy > /dev/null 2>&1 docker exec iofog-agent mkdir -p /root/.ssh > /dev/null 2>&1 docker exec iofog-agent chmod 700 /root/.ssh > /dev/null 2>&1 docker cp test/conf/id_ecdsa.pub "$AGENT_CONTAINER_ID:/root/.ssh/authorized_keys" > /dev/null 2>&1 From 05fb19f7c87598f11aee5c8876a4322d01c87419 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Kr=C4=8D=C3=A1l?= Date: Wed, 23 Oct 2019 14:04:17 +0200 Subject: [PATCH 20/55] Install sudo in controller docker image because iofog-controller@1.3.0-beta needs it for postinstall step --- services/iofog/iofog-controller/Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/services/iofog/iofog-controller/Dockerfile b/services/iofog/iofog-controller/Dockerfile index 2a8dab1..1b39a3d 100644 --- a/services/iofog/iofog-controller/Dockerfile +++ b/services/iofog/iofog-controller/Dockerfile @@ -1,6 +1,9 @@ FROM node:8.16.0-alpine ARG LOCAL_CONTROLLER_PACKAGE + +RUN set -ex && apk --no-cache add sudo + # Copy local package, or default install script (No conditional copy in docker) COPY ./install.sh ${LOCAL_CONTROLLER_PACKAGE} /opt/iofog-controller/ From a4aa9a3f8d5bc0c0b44a8a3fff23151a6edc4f54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Kr=C4=8D=C3=A1l?= Date: Wed, 23 Oct 2019 14:43:17 +0200 Subject: [PATCH 21/55] Upgrade test runner to 1.2 --- test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.sh b/test.sh index 24ea1c8..dec4cc1 100755 --- a/test.sh +++ b/test.sh @@ -46,6 +46,6 @@ docker run --rm --name test-runner --network bridge \ -e CONTROLLER="${CONTROLLER_IP}:51121" \ -e CONNECTOR="${CONNECTOR_IP}:8080" \ -e AGENTS="root@${AGENT_IP}:22" \ - iofog/test-runner:1.1.0 + iofog/test-runner:1.2 echoNotify "## Test Runner Tests complete" From 17cb028dd596d86f3f61da3fca05b366113cd59f Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Thu, 12 Sep 2019 15:43:38 +0200 Subject: [PATCH 22/55] Move to iofogctl --- README.md | 58 +++---- init/iofog/Dockerfile | 7 - init/iofog/local-stack.yaml | 21 +++ init/iofog/provision.sh | 143 ------------------ init/tutorial/Dockerfile | 7 - init/tutorial/config.yaml | 39 +++++ init/tutorial/provision.sh | 135 ----------------- services/iofog/iofog-agent/.gitignore | 1 - services/iofog/iofog-agent/Dockerfile | 35 ----- services/iofog/iofog-agent/config.xml | 42 ----- services/iofog/iofog-agent/install.sh | 11 -- services/iofog/iofog-agent/supervisord.conf | 12 -- services/iofog/iofog-connector/Dockerfile | 21 --- services/iofog/iofog-connector/install.sh | 11 -- .../iofog-connector/iofog-connector.conf | 10 -- services/iofog/iofog-controller/Dockerfile | 14 -- services/iofog/iofog-controller/install.sh | 10 -- start.sh | 110 ++++++-------- status.sh | 8 +- stop.sh | 9 +- 20 files changed, 132 insertions(+), 572 deletions(-) delete mode 100644 init/iofog/Dockerfile create mode 100644 init/iofog/local-stack.yaml delete mode 100755 init/iofog/provision.sh delete mode 100644 init/tutorial/Dockerfile create mode 100644 init/tutorial/config.yaml delete mode 100755 init/tutorial/provision.sh delete mode 100644 services/iofog/iofog-agent/.gitignore delete mode 100644 services/iofog/iofog-agent/Dockerfile delete mode 100644 services/iofog/iofog-agent/config.xml delete mode 100755 services/iofog/iofog-agent/install.sh delete mode 100644 services/iofog/iofog-agent/supervisord.conf delete mode 100644 services/iofog/iofog-connector/Dockerfile delete mode 100755 services/iofog/iofog-connector/install.sh delete mode 100644 services/iofog/iofog-connector/iofog-connector.conf delete mode 100644 services/iofog/iofog-controller/Dockerfile delete mode 100755 services/iofog/iofog-controller/install.sh diff --git a/README.md b/README.md index 732fc83..e85b37f 100644 --- a/README.md +++ b/README.md @@ -15,12 +15,11 @@ Supported operating systems: * Linux (kernel v3.10+) * macOS 10.12+ -* Windows 7+ Requires tools: * Docker 1.10+ ([installation instructions](https://docs.docker.com/install/)) -* Docker-compose 1.22+ ([installation instructions](https://docs.docker.com/compose/install/)) +* iofogctl 1.3.0+ ([installation instructions](https://github.com/eclipse-iofog/iofogctl/tree/v1.3.0#install)) # Try ioFog - Simple Edge Compute Network @@ -52,38 +51,17 @@ When you are finished, tear down the ioFog stack and all services deployed on it ./stop.sh ``` -## Build from local packages +## Build from local images -If you have a local version of the Agent, Controller and Connector, you can chose to build the containers using those local packages. -To do so, you will need a debian package (`.deb`) for the Agent and the Connector and a tarball (`.tgz`) for the Controller. +If you have a local image version of the Agent, Controller and Connector, you can chose to build the containers using those local images. +To do so, you will need a docker image for the Agent, the Connector and the Controller. You can provide `start.sh` with an option for each local package you want to use. ### Example -Folder structure: -```text -* services -* init -* test -* local-packages # Example folder where you would store your local packages - - iofog-agent_2.0.deb - - iofog-connector_2.0.deb - - iofog-controller_2.0.tgz -* start.sh -* stop.sh -* ... -``` Command: ```sh -./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 -``` - -## Force rebuild -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 - - -```sh -./start.sh --no-cache +./start.sh -a gcr.io/focal-freedom-236620/agent:latest -cn gcr.io/focal-freedom-236620/connector:latest -ct gcr.io/focal-freedom-236620/controller:latest ``` ## ECN Status @@ -94,22 +72,21 @@ If you have previously built the containers using local packages, or remote pack ## Interacting With The ioFog Stack - CLI -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. +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 `iofogctl`. ```sh -docker exec -it iofog-controller iofog-controller help +iofogctl help ``` -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).)_ + +For the purpose of this demo, all ioFog components are spun up in separate Docker containers. The Controller's container is called `iofog-controller`. Names for all the containers created in the demo are `iofog-agent`, `iofog-controller` and `iofog-connector`. The initialization scripts used to setup the ioFog stack / ECN are using the CLI interface. Feel free to refer to these for more inspiration. -Full reference of the CLI for all ioFog stack components is available at the ioFog website: +Full reference of the CLI is available at the iofogctl github repository: -* https://iofog.org/docs/1.0.0/controllers/cli-usage.html -* https://iofog.org/docs/1.0.0/agents/cli-usage.html -* https://iofog.org/docs/1.0.0/connectors/cli-usage.html +* https://github.com/eclipse-iofog/iofogctl/tree/v1.3.0#usage ## Interacting With The ioFog Stack - REST API @@ -136,11 +113,18 @@ First, create all services for a tutorial ioFog application. You don't have to s ./start.sh tutorial ``` -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. +When you are done with the tutorial, you can tear down the sample application together with the ioFog stack. + ```sh ./stop.sh ``` +if you only wish to delete the tutorial application: + +```sh +iofogctl delete application tutorial +``` + # Structure Of This Repository ```text * services # Service Dockerfiles and customization files @@ -149,8 +133,8 @@ When you are done with the tutorial, you can tear down the sample application to + iofog-connector # Connector service files - part of the iofog stack + iofog-controller # Controller service files - part of the iofog stack * init - - iofog # plain ioFog stack initialization service - - tutorial # tutorial initialization service + - iofog # plain ioFog stack initialization yaml file + - tutorial # tutorial initialization yaml file * test + conf # generated test configuration files * azure-pipelines.yml diff --git a/init/iofog/Dockerfile b/init/iofog/Dockerfile deleted file mode 100644 index 9449a73..0000000 --- a/init/iofog/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM docker:dind - -RUN apk add --no-cache curl jq - -ADD ./provision.sh / - -CMD ["sh", "-c", "/provision.sh"] diff --git a/init/iofog/local-stack.yaml b/init/iofog/local-stack.yaml new file mode 100644 index 0000000..984b8c7 --- /dev/null +++ b/init/iofog/local-stack.yaml @@ -0,0 +1,21 @@ +--- +controlplane: + images: + controller: gcr.io/focal-freedom-236620/controller:latest + connector: docker.io/iofog/connector:latest + iofoguser: + name: test + surname: local + email: user@domain.com + password: '#Bugs4Fun' + controllers: + - name: local-controller + host: localhost +connectors: + - name: local-connector + host: localhost +agents: +- name: ioFog Agent + image: gcr.io/focal-freedom-236620/agent:latest + host: localhost + diff --git a/init/iofog/provision.sh b/init/iofog/provision.sh deleted file mode 100755 index d431a66..0000000 --- a/init/iofog/provision.sh +++ /dev/null @@ -1,143 +0,0 @@ -#!/usr/bin/env sh - -set -o errexit -o noclobber -o nounset -cd "$(dirname "$0")" - -function waitForController() { - while true; do - STATUS=$(curl --request GET --url "${CONTROLLER_HOST}/status" 2>/dev/null | jq -r ".status") - [[ "${STATUS}" == "online" ]] && break || echo "Waiting for Controller..." - sleep 2 - done -} - -function waitForAgent() { - while true; do - STATUS=$(docker exec iofog-agent iofog-agent status | awk -F': ' '/ioFog daemon/{print $2}') - [[ "${STATUS}" == "RUNNING" ]] && break || echo "Waiting for Agent..." - sleep 2 - done -} - -function waitForConnector() { - while true; do - STATUS=$(curl --request POST --url "${CONNECTOR_HOST}/status" \ - --header 'Content-Type: application/x-www-form-urlencoded' --data mappingid=all 2>/dev/null \ - | jq -r '.status') - [[ "${STATUS}" == "running" ]] && break || echo "Waiting for Connector..." - sleep 2 - done -} - -function createUser() { - echo -n "Creating user John Doe... " - local RET=$(curl --request POST --url "${CONTROLLER_HOST}/user/signup" \ - --header 'Content-Type: application/json' \ - --data '{"email":"user@domain.com","firstName":"John","lastName":"Doe","password":"#Bugs4Fun"}' \ - 2>/dev/null) - local RET_MSG=$(echo $RET | jq -r '.message') - local RET_UID=$(echo $RET | jq -r '.userId') - [[ "${RET_MSG}" == "null" ]] && echo "${RET_UID}" || echo "${RET_MSG}" -} - -function login() { - echo -n "Logging in as user user@domain.com... " - TOKEN=$(curl --request POST --url "${CONTROLLER_HOST}/user/login" \ - --header 'Content-Type: application/json' \ - --data '{"email":"user@domain.com","password":"#Bugs4Fun"}' 2>/dev/null \ - | jq -r '.accessToken') - echo "${TOKEN}" -} - -function createDefaultFog() { - # Delete all fogs with the same default fog name. This is in case the script is run repeatedly. - local DEFAULT_FOGS=$(curl --request GET --url "${CONTROLLER_HOST}/iofog-list" \ - --header "Authorization: ${TOKEN}" \ - --header 'Content-Type: application/json' 2>/dev/null \ - | jq -r ".fogs[] | select(.name == \"${DEFAULT_FOG}\") | .uuid") - for FOG_UUID in ${DEFAULT_FOGS}; do - echo "Deleting pre-existing default fog: ${FOG_UUID}..." - curl --request DELETE --url "${CONTROLLER_HOST}/iofog/${FOG_UUID}" \ - --header "Authorization: ${TOKEN}" --header 'Content-Type: application/json' 2>/dev/null - done - - # Wait for all the deleted fogs to be actually delete. - while true; do - DEFAULT_FOGS=$(curl --request GET --url "${CONTROLLER_HOST}/iofog-list" \ - --header "Authorization: ${TOKEN}" \ - --header 'Content-Type: application/json' 2>/dev/null \ - | jq -r ".fogs[] | select(.name == \"${DEFAULT_FOG}\") | .uuid") - [[ -z "${DEFAULT_FOGS}" ]] && break || echo "Waiting for pre-existing default fogs to be deleted..." - sleep 2 - done - - echo -n "Creating default fog... " - curl --request POST --url "${CONTROLLER_HOST}/iofog" \ - --header "Authorization: ${TOKEN}" --header 'Content-Type: application/json' \ - --data "{\"name\": \"${DEFAULT_FOG}\",\"fogType\": 1}" 2> /dev/null 1>&2 - echo "${DEFAULT_FOG}" - - echo -n 'Retrieving UUID of default fog... ' - FOG_UUID=$(curl --request GET --url "${CONTROLLER_HOST}/iofog-list" \ - --header "Authorization: ${TOKEN}" --header 'Content-Type: application/json' 2> /dev/null \ - | jq -r ".fogs[] | select(.name == \"${DEFAULT_FOG}\") | .uuid") - echo "${FOG_UUID}" -} - -function configureAgent() { - echo "Configuring Agent..." - docker exec iofog-agent iofog-agent config -idc off > /dev/null - docker exec iofog-agent iofog-agent config -a "${CONTROLLER_HOST}" > /dev/null -} - -function configureController() { - echo "Configuring Controller..." - CONNECTOR_IP=$(getent hosts iofog-connector | awk '{ print $1 }') - # TODO this is the only "docker exec" for controller - needs to be replaced with REST API - docker exec iofog-controller \ - iofog-controller connector add -n iofog-connector -d "${CONNECTOR_IP}" -i "${CONNECTOR_IP}" -H -} - -function provisionAgent() { - echo -n "Retrieving provisioning key for default fog... " - PROVISION_KEY=$(curl --request GET --url "${CONTROLLER_HOST}/iofog/${FOG_UUID}/provisioning-key" \ - --header "Authorization: ${TOKEN}" --header 'Content-Type: application/json' 2> /dev/null \ - | jq -r .key) - echo "${PROVISION_KEY}" - - docker exec iofog-agent iofog-agent provision "${PROVISION_KEY}" -} - -function createDefaultFlow() { - echo -n "Creating default flow... " - curl --request POST --url "${CONTROLLER_HOST}/flow" \ - --header "Authorization: ${TOKEN}" --header 'Content-Type: application/json' \ - --data "{\"name\": \"${DEFAULT_FLOW}\",\"isActivated\":true}" 2> /dev/null 1>&2 - - # Retrieve just created flow's id - FLOW_ID=$(curl --request GET --url "${CONTROLLER_HOST}/flow" \ - --header "Authorization: ${TOKEN}" --header 'Content-Type: application/json' 2> /dev/null \ - | jq -r ".flows[] | select(.name == \"${DEFAULT_FLOW}\") | .id") - echo "${FLOW_ID}" -} - -echo "Initializing ioFog stack. This may take a minute or two." - -docker --version # Check if docker is available. Needs docker socket mapped in order to talk to the Agent -CONTROLLER_HOST="http://iofog-controller:51121/api/v3" -CONNECTOR_HOST="http://iofog-connector:8080/api/v2" -DEFAULT_FOG="ioFog Agent" -DEFAULT_FLOW="Default Flow" - -waitForConnector -waitForController -waitForAgent -configureController -createUser -login -createDefaultFog -configureAgent -provisionAgent -createDefaultFlow - -echo "Successfully initialized ioFog stack." diff --git a/init/tutorial/Dockerfile b/init/tutorial/Dockerfile deleted file mode 100644 index 9449a73..0000000 --- a/init/tutorial/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM docker:dind - -RUN apk add --no-cache curl jq - -ADD ./provision.sh / - -CMD ["sh", "-c", "/provision.sh"] diff --git a/init/tutorial/config.yaml b/init/tutorial/config.yaml new file mode 100644 index 0000000..898c07d --- /dev/null +++ b/init/tutorial/config.yaml @@ -0,0 +1,39 @@ +name: tutorial +microservices: +- name: Sensors + agent: + name: ioFog Agent + config: {} + images: + x86: iofog/sensors:latest + registry: remote + volumes: [] + ports: [] + env: [] +- name: Rest API + agent: + name: ioFog Agent + config: {} + images: + x86: iofog/freeboard-api:latest + registry: remote + volumes: [] + ports: + - internal: 80 + external: 10101 + env: [] +- name: Freeboard + agent: + name: ioFog Agent + config: {} + images: + x86: iofog/freeboard:latest + registry: remote + volumes: [] + ports: + - internal: 80 + external: 10102 + env: [] +routes: +- from: Sensors + to: Rest API \ No newline at end of file diff --git a/init/tutorial/provision.sh b/init/tutorial/provision.sh deleted file mode 100755 index 54d22e6..0000000 --- a/init/tutorial/provision.sh +++ /dev/null @@ -1,135 +0,0 @@ -#!/usr/bin/env sh - -# TODO finish tutorial setup -# TODO split --data into multiple lines - -set -o errexit -o noclobber -o nounset -cd "$(dirname "$0")" - -function waitForController() { - while true; do - local STATUS=$(curl --request GET --url "${CONTROLLER_HOST}/status" 2>/dev/null | jq -r ".status") - [[ "${STATUS}" == "online" ]] && break || echo "Waiting for Controller..." - sleep 2 - done -} - -function login() { - echo -n "Logging in as user user@domain.com... " - TOKEN=$(curl --request POST --url "${CONTROLLER_HOST}/user/login" \ - --header 'Content-Type: application/json' \ - --data '{"email":"user@domain.com","password":"#Bugs4Fun"}' 2>/dev/null \ - | jq -r '.accessToken') - echo "${TOKEN}" -} - -function getDemoFogId() { - echo -n "Looking up default fog... " - FOG_ID=$(curl --request GET --url "${CONTROLLER_HOST}/iofog-list" \ - --header "Authorization: ${TOKEN}" \ - --header 'Content-Type: application/json' 2>/dev/null \ - | jq -r ".fogs[] | select(.name == \"${DEFAULT_FOG}\") | .uuid") - echo "${FOG_ID}" -} - -function getDemoFlowId() { - echo -n "Looking up default flow... " - FLOW_ID=$(curl --request GET --url "${CONTROLLER_HOST}/flow" \ - --header "Authorization: ${TOKEN}" \ - --header 'Content-Type: application/json' 2>/dev/null \ - | jq -r ".flows[] | select(.name == \"${DEFAULT_FLOW}\") | .id") - echo "${FLOW_ID}" -} - -function startMicroserviceSensors() { - echo -n 'Registering Sensor microservice in the catalog... ' - SENSORS_CATALOG_ID=$(curl --request POST --url $CONTROLLER_HOST/catalog/microservices \ - --header "Authorization: ${TOKEN}" --header 'Content-Type: application/json' \ - --data '{"name":"Sensors","category": "DEMO","publisher":"Edgeworx","registryId":1,"images":[{"containerImage":"iofog/sensors:latest","fogTypeId":1}]}' \ - 2> /dev/null | jq -r .id) - echo "${SENSORS_CATALOG_ID}" - - echo -n 'Creating Sensor microservice... ' - SENSORS_UUID=$(curl --request POST --url $CONTROLLER_HOST/microservices \ - --header "Authorization: ${TOKEN}" --header 'Content-Type: application/json' \ - --data '{"name":"Sensors","config":"{}","catalogItemId":'"${SENSORS_CATALOG_ID}"',"flowId":'"${FLOW_ID}"',"iofogUuid":"'"${FOG_ID}"'","rootHostAccess":false,"logSize":5,"volumeMappings":[],"ports":[],"routes":[]}' \ - 2> /dev/null | jq -r .uuid) - echo "${SENSORS_UUID}" -} - -function startMicroserviceRestApi() { - echo -n 'Registering REST API microservice in the catalog... ' - RESTAPI_CATALOG_ID=$(curl --request POST --url $CONTROLLER_HOST/catalog/microservices \ - --header "Authorization: ${TOKEN}" --header 'Content-Type: application/json' \ - --data '{"name":"Rest API","category": "DEMO","publisher":"Edgeworx","registryId":1,"images":[{"containerImage":"iofog/freeboard-api:latest","fogTypeId":1}]}' \ - 2> /dev/null | jq -r .id) - echo "${RESTAPI_CATALOG_ID}" - - echo -n 'Creating REST API microservice... ' - RESTAPI_UUID=$(curl --request POST --url $CONTROLLER_HOST/microservices \ - --header "Authorization: ${TOKEN}" --header 'Content-Type: application/json' \ - --data '{"name":"Rest API","config":"{}","catalogItemId":'"${RESTAPI_CATALOG_ID}"',"flowId":'"${FLOW_ID}"',"iofogUuid":"'"${FOG_ID}"'","rootHostAccess":false,"logSize":5,"volumeMappings":[],"ports":[{"internal":80,"external":10101,"publicMode":false}],"routes":[]}' \ - 2> /dev/null | jq -r .uuid) - echo "${RESTAPI_UUID}" -} - -function startMicroserviceFreeboard() { - echo -n 'Registering Freeboard microservice in the catalog... ' - FREEBOARD_CATALOG_ID=$(curl --request POST --url $CONTROLLER_HOST/catalog/microservices \ - --header "Authorization: ${TOKEN}" --header 'Content-Type: application/json' \ - --data '{"name":"freeboard","category": "DEMO","publisher":"Edgeworx","registryId":1,"images":[{"containerImage":"iofog/freeboard:latest","fogTypeId":1}]}' \ - 2> /dev/null | jq -r .id) - echo "${FREEBOARD_CATALOG_ID}" - - echo -n 'Creating Freeboard microservice... ' - FREEBOARD_UUID=$(curl --request POST --url $CONTROLLER_HOST/microservices \ - --header "Authorization: ${TOKEN}" --header 'Content-Type: application/json' \ - --data '{"name":"Freeboard","config":"{}","catalogItemId":'"${FREEBOARD_CATALOG_ID}"',"flowId":'"${FLOW_ID}"',"iofogUuid":"'"${FOG_ID}"'","rootHostAccess":false,"logSize":5,"volumeMappings":[],"ports":[{"internal":80,"external":10102,"publicMode":false}],"routes":[]}' \ - 2> /dev/null | jq -r .uuid) - echo "${FREEBOARD_UUID}" -} - -function routeSensorsToApi() { - echo 'Creating route between Sensors and REST API microservices...' - curl --request POST --url "${CONTROLLER_HOST}/microservices/${SENSORS_UUID}/routes/${RESTAPI_UUID}" \ - --header "Authorization: ${TOKEN}" --header 'Content-Type: application/json' 2> /dev/null -} - -function waitForService() { - local IMAGE="$1" - echo -n "Waiting service $IMAGE..." - while true; do - local STATUS=$(docker inspect -f {{.State.Running}} $(docker ps -q --filter "ancestor=$IMAGE") 2>/dev/null) - [[ "${STATUS}" == "true" ]] && break || echo -n "." - sleep 2 - done - echo " OK" -} - -function waitForAllServices() { - waitForService "iofog/sensors:latest" - waitForService "iofog/freeboard-api:latest" - waitForService "iofog/freeboard:latest" -} - -echo "Initializing tutorial. This may take a minute or two." - -CONTROLLER_HOST="http://iofog-controller:51121/api/v3" -DEFAULT_FOG="ioFog Agent" -DEFAULT_FLOW="Default Flow" - -waitForController -login -getDemoFogId -getDemoFlowId -startMicroserviceSensors -startMicroserviceRestApi -startMicroserviceFreeboard -routeSensorsToApi -waitForAllServices - -echo "Successfully initialized tutorial." - - - - diff --git a/services/iofog/iofog-agent/.gitignore b/services/iofog/iofog-agent/.gitignore deleted file mode 100644 index cc6078c..0000000 --- a/services/iofog/iofog-agent/.gitignore +++ /dev/null @@ -1 +0,0 @@ -id_ecdsa.pub diff --git a/services/iofog/iofog-agent/Dockerfile b/services/iofog/iofog-agent/Dockerfile deleted file mode 100644 index 1cc3b83..0000000 --- a/services/iofog/iofog-agent/Dockerfile +++ /dev/null @@ -1,35 +0,0 @@ -FROM iofog/ubuntu-16.04-java8 - -ARG LOCAL_AGENT_PACKAGE -# Copy install script and local package if there is one (No conditional copy in docker) -COPY ./install.sh ${LOCAL_AGENT_PACKAGE} /opt/iofog-agent/ - -# Install our deps -RUN apt-get update -qq && apt-get install -qqy \ - sudo \ - curl \ - software-properties-common \ - openssh-server \ - supervisor \ - && rm -rf /var/lib/apt/lists/* - -# Install iofog-agent (script requires sudo, curl and software-properties-common) -RUN /opt/iofog-agent/install.sh ${LOCAL_AGENT_PACKAGE} -RUN rm /opt/iofog-agent/install.sh - -# SSH Magic -# Allows the test's container "test-runner" access to iofog-agent, due to the agent's lack of REST API -COPY id_ecdsa.pub / -RUN mkdir -p /root/.ssh -RUN cat /id_ecdsa.pub > /root/.ssh/authorized_keys -RUN mkdir /var/run/sshd -RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd -ENV NOTVISIBLE "in users profile" -RUN echo "export VISIBLE=now" >> /etc/profile -EXPOSE 22 - -# Copy our configs -COPY config.xml /etc/iofog-agent/config.xml -COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf - -CMD ["/usr/bin/supervisord"] diff --git a/services/iofog/iofog-agent/config.xml b/services/iofog/iofog-agent/config.xml deleted file mode 100644 index 5c55bd5..0000000 --- a/services/iofog/iofog-agent/config.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - http://iofog-controller:51121/api/v3/ - - /etc/iofog-agent/cert.crt - - eth0 - - unix:///var/run/docker.sock - - 50 - - /var/lib/iofog-agent/ - - 4096 - - 80.0 - - 10.0 - - /var/log/iofog-agent/ - - 10 - - 30 - - 60 - - 10 - - off - - 60 - - off - - intel_amd - - on - diff --git a/services/iofog/iofog-agent/install.sh b/services/iofog/iofog-agent/install.sh deleted file mode 100755 index 83c98bc..0000000 --- a/services/iofog/iofog-agent/install.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# If local agent provided, install from local package, otherwise go to packagecloud -if [ ! -z "$1" ] && [ ! "$1" = "./install.sh" ]; then - echo "============> Installing local agent" - dpkg -i /opt/iofog-agent/"$1" - rm -f /opt/iofog-agent/"$1" -else - wget -q -O - https://packagecloud.io/install/repositories/iofog/iofog-agent/script.deb.sh | bash - apt-get install iofog-agent -fi \ No newline at end of file diff --git a/services/iofog/iofog-agent/supervisord.conf b/services/iofog/iofog-agent/supervisord.conf deleted file mode 100644 index 5d55f75..0000000 --- a/services/iofog/iofog-agent/supervisord.conf +++ /dev/null @@ -1,12 +0,0 @@ -[supervisord] -nodaemon=true - -[program:sshd] -command=/usr/sbin/sshd -D - -; TODO supervisor expects non-daemonized program, iofog-agent is daemonized -; http://supervisord.org/subprocess.html#nondaemonizing-of-subprocesses -[program:agent] -command=bash -c 'service iofog-agent start && tail -f /dev/null' -stderr_logfile=/var/log/agent.err.log -stdout_logfile=/var/log/agent.out.log diff --git a/services/iofog/iofog-connector/Dockerfile b/services/iofog/iofog-connector/Dockerfile deleted file mode 100644 index 757dbe3..0000000 --- a/services/iofog/iofog-connector/Dockerfile +++ /dev/null @@ -1,21 +0,0 @@ -FROM iofog/ubuntu-16.04-java8 - -ARG LOCAL_CONNECTOR_PACKAGE -# Copy local package, or default install script (No conditional copy in docker) -COPY ./install.sh ${LOCAL_CONNECTOR_PACKAGE} /opt/iofog-connector/ - -# Install all our deps -RUN apt-get update -qq && apt-get install -qqy \ - sudo \ - curl \ - software-properties-common \ - && rm -rf /var/lib/apt/lists/* - -# Install iofog-connector (script requires sudo, curl and software-properties-common) -RUN /opt/iofog-connector/install.sh ${LOCAL_CONNECTOR_PACKAGE} -RUN rm /opt/iofog-connector/install.sh - -# Copy in the connector configuration -COPY iofog-connector.conf /etc/iofog-connector/iofog-connector.conf - -ENTRYPOINT [ "sh", "-c", "service iofog-connector start && tail -f /dev/null" ] diff --git a/services/iofog/iofog-connector/install.sh b/services/iofog/iofog-connector/install.sh deleted file mode 100755 index 8ac9b94..0000000 --- a/services/iofog/iofog-connector/install.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# If local connector provided, install from local package, otherwise go to packagecloud -if [ ! -z "$1" ] && [ ! "$1" = "./install.sh" ]; then - echo "============> Installing local connector" - dpkg -i /opt/iofog-connector/"$1" - rm -f /opt/iofog-connector/"$1" -else - wget -q -O - https://packagecloud.io/install/repositories/iofog/iofog-connector/script.deb.sh | bash - apt-get install iofog-connector -fi \ No newline at end of file diff --git a/services/iofog/iofog-connector/iofog-connector.conf b/services/iofog/iofog-connector/iofog-connector.conf deleted file mode 100644 index c2d575c..0000000 --- a/services/iofog/iofog-connector/iofog-connector.conf +++ /dev/null @@ -1,10 +0,0 @@ -{ - "ports": [ - "6000-9999", - "30000-49999" - ], - "exclude": [], - "broker": 12345, - "address": "127.0.0.1", - "dev": true -} diff --git a/services/iofog/iofog-controller/Dockerfile b/services/iofog/iofog-controller/Dockerfile deleted file mode 100644 index 1b39a3d..0000000 --- a/services/iofog/iofog-controller/Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -FROM node:8.16.0-alpine - -ARG LOCAL_CONTROLLER_PACKAGE - -RUN set -ex && apk --no-cache add sudo - -# Copy local package, or default install script (No conditional copy in docker) -COPY ./install.sh ${LOCAL_CONTROLLER_PACKAGE} /opt/iofog-controller/ - -# Install iofog-controller -RUN /opt/iofog-controller/install.sh ${LOCAL_CONTROLLER_PACKAGE} -RUN rm /opt/iofog-controller/install.sh - -ENTRYPOINT [ "sh", "-c", "iofog-controller start && tail -f /dev/null" ] diff --git a/services/iofog/iofog-controller/install.sh b/services/iofog/iofog-controller/install.sh deleted file mode 100755 index 3edfc30..0000000 --- a/services/iofog/iofog-controller/install.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -# If local controller provided, install from local package, otherwise go to npm repository -if [ ! -z "$1" ] && [ ! "$1" = "./install.sh" ]; then - echo "============> Installing local controller" - npm install --unsafe-perm -g /opt/iofog-controller/"$1" - rm -f /opt/iofog-controller/"$1" -else - npm i -g iofogcontroller --unsafe-perm -fi \ No newline at end of file diff --git a/start.sh b/start.sh index 718ec52..0e00911 100755 --- a/start.sh +++ b/start.sh @@ -19,98 +19,80 @@ printHelp() { echo "" echo "Options:" echo " -h, --help print this help / usage" - echo " -a, --agent specify a local agent package" - echo " -ct, --controller specify a local controller package" - echo " -cn, --connector specify a local connector package" - echo " --no-cache prevent the usage of cache during the build step" + echo " -a, --agent specify a local agent image" + echo " -ct, --controller specify a local controller image" + echo " -cn, --connector specify a local connector image" echo "" echo "Arguments:" echo " [environment] setup demo application, optional, default: iofog" echo " supported values: iofog, tutorial" } -checkForComposeFile() { - local ENVIRONMENT="$1" - local COMPOSE_FILE="docker-compose-${ENVIRONMENT}.yml" - if [[ ! -f "${COMPOSE_FILE}" ]]; then - echoError "Environment configuration for \"${ENVIRONMENT}\" does not exist!" - exit 2 - fi -} - startIofog() { - echoInfo "Building containers for ioFog stack..." - local BUILD_ARGS="--build-arg LOCAL_CONTROLLER_PACKAGE=${CONTROLLER_PACKAGE} --build-arg LOCAL_CONNECTOR_PACKAGE=${CONNECTOR_PACKAGE} --build-arg LOCAL_AGENT_PACKAGE=${AGENT_PACKAGE}" - local COMPOSE_BUILD_ARGS="${IOFOG_BUILD_NO_CACHE} ${BUILD_ARGS:=""}" - local SERVICE_LIST="iofog-connector iofog-controller iofog-agent iofog-init" - docker-compose -f "docker-compose-iofog.yml" build ${COMPOSE_BUILD_ARGS} ${SERVICE_LIST} > /dev/null - - echoInfo "Spinning up containers for ioFog stack..." - docker-compose -f "docker-compose-iofog.yml" up --detach --no-recreate - - echoInfo "Initializing iofog stack..." - docker logs -f "iofog-init" # wait for the ioFog stack initialization - RET=$(docker wait "iofog-init") - if [[ "$RET" != "0" ]]; then - echoError "Failed to initialize ioFog stack!" - exit 3 + # If stack is running, skip + local CONTROLLER_CONTAINER_ID=$(docker ps -q --filter="name=iofog-controller") + if ! [[ -z $CONTROLLER_CONTAINER_ID ]]; then + return fi - echoInfo "Successfully initialized ioFog stack." + + echo "--- +controlplane: + images: + controller: $CONTROLLER_IMAGE + connector: $CONNECTOR_IMAGE + iofoguser: + name: test + surname: local + email: user@domain.com + password: '#Bugs4Fun' + controllers: + - name: local-controller + host: localhost +connectors: + - name: local-connector + host: localhost +agents: +- name: ioFog Agent + image: $AGENT_IMAGE + host: localhost +" >| init/iofog/local-stack.yaml + + echoInfo "Deploying containers for ioFog stack..." + iofogctl deploy -f init/iofog/local-stack.yaml } startEnvironment() { local ENVIRONMENT="$1" - local COMPOSE_PARAM="-f docker-compose-${ENVIRONMENT}.yml" - - echoInfo "Building containers for ${ENVIRONMENT} environment..." - docker-compose -f "docker-compose-iofog.yml" -f "docker-compose-${ENVIRONMENT}.yml" \ - build "${ENVIRONMENT}-init" > /dev/null - - echoInfo "Spinning up containers for ${ENVIRONMENT} environment..." - docker-compose -f "docker-compose-iofog.yml" -f "docker-compose-${ENVIRONMENT}.yml" \ - up --detach --no-recreate "${ENVIRONMENT}-init" - - echoInfo "Initializing ${ENVIRONMENT} environment..." - docker logs -f "${ENVIRONMENT}-init" # wait for the ioFog stack initialization - RET=$(docker wait "${ENVIRONMENT}-init") - if [[ "$RET" != "0" ]]; then - echoError "Failed to initialize ${ENVIRONMENT} environment!" - exit 3 - fi - echoInfo "Successfully setup ${ENVIRONMENT} environment." + + echoInfo "Deploying ${ENVIRONMENT} application..." + iofogctl deploy application -f "init/${ENVIRONMENT}/config.yaml" echoInfo "It may take a while before ioFog stack creates all ${ENVIRONMENT} microservices." + echo "" } ENVIRONMENT='' IOFOG_BUILD_NO_CACHE='' -AGENT_PACKAGE='' -CONTROLLER_PACKAGE='' -CONNECTOR_PACKAGE='' +AGENT_IMAGE='docker.io/iofog/agent:latest' +CONTROLLER_IMAGE='docker.io/iofog/controller:latest' +CONNECTOR_IMAGE='docker.io/iofog/connector:latest' while [[ "$#" -ge 1 ]]; do case "$1" in -h|--help) printHelp exit 0 ;; - --no-cache) - IOFOG_BUILD_NO_CACHE="--no-cache" - shift - ;; -a|--agent) - AGENT_PACKAGE="local-agent-package.deb" - cp -i "$2" "./services/iofog/iofog-agent/$AGENT_PACKAGE" || true + AGENT_IMAGE=${2:-$AGENT_IMAGE} shift shift ;; -ct|--controller) - CONTROLLER_PACKAGE="local-controller-package.tgz" - cp -i "$2" "./services/iofog/iofog-controller/$CONTROLLER_PACKAGE" || true + CONTROLLER_IMAGE=${2:-$CONTROLLER_IMAGE} shift shift ;; -cn|--connector) - CONNECTOR_PACKAGE="local-connector-package.deb" - cp -i "$2" "./services/iofog/iofog-connector/$CONNECTOR_PACKAGE" || true + CONNECTOR_IMAGE=${2:-$CONNECTOR_IMAGE} shift shift ;; @@ -131,20 +113,14 @@ prettyHeader "Starting ioFog Demo" # Figure out which environment we are going to be starting. By default, setup only the ioFog stack ENVIRONMENT=${ENVIRONMENT:="iofog"} -checkForComposeFile "iofog" - -if [[ "${ENVIRONMENT}" != "iofog" ]]; then checkForComposeFile "${ENVIRONMENT}"; fi - echoInfo "Starting \"${ENVIRONMENT}\" demo environment..." # Create a new ssh key echoInfo "Creating new ssh key for tests..." rm -f test/conf/id_ecdsa* ssh-keygen -t ecdsa -N "" -f test/conf/id_ecdsa -q -cp -f test/conf/id_ecdsa.pub services/iofog/iofog-agent/ # Start ioFog stack -# TODO check if this environment is up or not startIofog # Optionally start another environment @@ -157,5 +133,5 @@ fi ./status.sh if [[ "${ENVIRONMENT}" == "tutorial" ]]; then - echoSuccess "## Visit https://iofog.org/docs/1.0.0/tutorial/introduction.html to continue with the ioFog tutorial." + echoSuccess "## Visit https://iofog.org/docs/1.3.0/tutorial/introduction.html to continue with the ioFog tutorial." fi diff --git a/status.sh b/status.sh index 82f725d..5b25976 100755 --- a/status.sh +++ b/status.sh @@ -16,10 +16,14 @@ prettyTitle "ioFog Demo Environment Status" echoInfo " $(docker ps --filter 'name=iofog')" echo +prettyTitle "ioFog Demo Edge Cloud Network Status" +echoInfo " $(iofogctl get all)" +echo + CONTROLLER_PORT="$(docker port iofog-controller | awk '{print $1}' | cut -b 1-5)" -if [ ! -z ${CONTROLLER_PORT} ]; then - echoSuccess "## iofog-controller is running at http://localhost:${CONTROLLER_PORT}" +if ! [[ -z ${CONTROLLER_PORT} ]]; then + echoSuccess "## iofog-controller is running at http://localhost:51121" else echoError "No iofog-controller container was found" fi diff --git a/stop.sh b/stop.sh index b27f875..06e8436 100755 --- a/stop.sh +++ b/stop.sh @@ -38,14 +38,9 @@ prettyHeader "Stopping ioFog Demo..." # Stop ioFog stack echoInfo "Stopping all containers..." -docker-compose -f "docker-compose-iofog.yml" -f "docker-compose-tutorial.yml" down -v -# TODO stopping the ioFog stack leaves its microservices running - fix this properly -REMAINING_MSVC=`docker ps -q --filter 'name=iofog*'` - -if [ ! -z "${REMAINING_MSVC}" ]; then - docker rm -f ${REMAINING_MSVC} -fi +iofogctl delete all +iofogctl disconnect # Remove generated files find test/conf -type f -not -name ".gitignore" -exec rm -f {} \; From 08f4513dccc75d25d055bbdd3ee3382ba7af2d70 Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Thu, 12 Sep 2019 15:48:11 +0200 Subject: [PATCH 23/55] Install iofogctl in CI pipeline --- azure-pipelines.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f35321c..4d2856a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -24,6 +24,13 @@ steps: dockerVersion: 18.09.2 releaseType: stable +- script: | + # https://packagecloud.io/install/repositories/iofog/iofogctl/script.deb.sh | sudo bash + # Using dev version of iofogctl until 1.3.0 release + curl -s https://8c90601638aff0b3fb520971175089bbaba2cf7f29be9528:@packagecloud.io/install/repositories/iofog/iofogctl-snapshots/script.deb.sh | sudo bash + sudo apt install iofogctl + displayName: 'Install iofogctl' + - script: | echo $(gcp.svcacc) | docker login -u _json_key --password-stdin https://gcr.io displayName: 'Docker connect to Registry' From e666f9c7be2ae1f1f5e95fb8b63ea0e670ee9920 Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Thu, 12 Sep 2019 17:28:44 +0200 Subject: [PATCH 24/55] Move SSH magic to test to work with iofogctl --- init/iofog/local-stack.yaml | 4 ++-- start.sh | 5 ----- stop.sh | 3 +-- test.sh | 32 ++++++++++++++++++++++++-------- 4 files changed, 27 insertions(+), 17 deletions(-) diff --git a/init/iofog/local-stack.yaml b/init/iofog/local-stack.yaml index 984b8c7..a8f092d 100644 --- a/init/iofog/local-stack.yaml +++ b/init/iofog/local-stack.yaml @@ -1,7 +1,7 @@ --- controlplane: images: - controller: gcr.io/focal-freedom-236620/controller:latest + controller: docker.io/iofog/controller:latest connector: docker.io/iofog/connector:latest iofoguser: name: test @@ -16,6 +16,6 @@ connectors: host: localhost agents: - name: ioFog Agent - image: gcr.io/focal-freedom-236620/agent:latest + image: docker.io/iofog/agent:latest host: localhost diff --git a/start.sh b/start.sh index 0e00911..ca600c8 100755 --- a/start.sh +++ b/start.sh @@ -115,11 +115,6 @@ ENVIRONMENT=${ENVIRONMENT:="iofog"} echoInfo "Starting \"${ENVIRONMENT}\" demo environment..." -# Create a new ssh key -echoInfo "Creating new ssh key for tests..." -rm -f test/conf/id_ecdsa* -ssh-keygen -t ecdsa -N "" -f test/conf/id_ecdsa -q - # Start ioFog stack startIofog diff --git a/stop.sh b/stop.sh index 06e8436..5bd2812 100755 --- a/stop.sh +++ b/stop.sh @@ -39,8 +39,7 @@ prettyHeader "Stopping ioFog Demo..." # Stop ioFog stack echoInfo "Stopping all containers..." -iofogctl delete all -iofogctl disconnect +iofogctl delete all || iofogctl disconnect # Remove generated files find test/conf -type f -not -name ".gitignore" -exec rm -f {} \; diff --git a/test.sh b/test.sh index dec4cc1..efc64ab 100755 --- a/test.sh +++ b/test.sh @@ -35,17 +35,33 @@ else exit 2 fi -echoInfo "Retrieving endpoints for ioFog stack" -AGENT_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' iofog-agent) -CONTROLLER_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' iofog-controller) -CONNECTOR_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' iofog-connector) +# Create a new ssh key +echoInfo "Creating new ssh key for tests..." +rm -f test/conf/id_ecdsa* +ssh-keygen -t ecdsa -N "" -f test/conf/id_ecdsa -q + +# SSH Magic +# Allows the test's container "test-runner" access to iofog-agent, due to the agent's lack of REST API +AGENT_CONTAINER_ID=$(docker ps -q --filter="name=iofog-agent") + +# Configuring ssh on the agent +echoInfo "Configuring ssh on the Agent" +docker exec iofog-agent apt install -y openssh-server > /dev/null 2>&1 +docker exec iofog-agent mkdir -p /root/.ssh > /dev/null 2>&1 +docker exec iofog-agent chmod 700 /root/.ssh > /dev/null 2>&1 +docker cp test/conf/id_ecdsa.pub "$AGENT_CONTAINER_ID:/root/.ssh/authorized_keys" > /dev/null 2>&1 +docker exec iofog-agent chmod 644 /root/.ssh/authorized_keys > /dev/null 2>&1 +docker exec iofog-agent mkdir -p /var/run/sshd > /dev/null 2>&1 +docker exec iofog-agent sudo sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd > /dev/null 2>&1 +docker exec iofog-agent sudo sed 's@#AuthorizedKeysFile %h/.ssh/authorized_keys@AuthorizedKeysFile %h/.ssh/authorized_keys@g' -i /etc/ssh/sshd_config > /dev/null 2>&1 +docker exec iofog-agent /bin/bash -c 'service ssh restart' > /dev/null 2>&1 echoInfo "Running Test Runner..." -docker run --rm --name test-runner --network bridge \ +docker run --rm --name test-runner --network local-iofog-network \ -v "$(pwd)/test/conf/id_ecdsa:/root/.ssh/id_ecdsa" \ - -e CONTROLLER="${CONTROLLER_IP}:51121" \ - -e CONNECTOR="${CONNECTOR_IP}:8080" \ - -e AGENTS="root@${AGENT_IP}:22" \ + -e CONTROLLER="iofog-controller:51121" \ + -e CONNECTOR="iofog-connector:8080" \ + -e AGENTS="root@iofog-agent:22" \ iofog/test-runner:1.2 echoNotify "## Test Runner Tests complete" From 380ca1299d92caea6d96a1f8a2582748f9fcbe24 Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Thu, 12 Sep 2019 17:49:16 +0200 Subject: [PATCH 25/55] Add apt-get update for agent in test.sh --- test.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test.sh b/test.sh index efc64ab..da872ac 100755 --- a/test.sh +++ b/test.sh @@ -46,7 +46,9 @@ AGENT_CONTAINER_ID=$(docker ps -q --filter="name=iofog-agent") # Configuring ssh on the agent echoInfo "Configuring ssh on the Agent" -docker exec iofog-agent apt install -y openssh-server > /dev/null 2>&1 +docker exec iofog-agent sudo rm /var/lib/apt/lists/lock > /dev/null 2>&1 +docker exec iofog-agent apt-get update -qq > /dev/null 2>&1 +docker exec iofog-agent apt-get install -qqy openssh-server > /dev/null 2>&1 docker exec iofog-agent mkdir -p /root/.ssh > /dev/null 2>&1 docker exec iofog-agent chmod 700 /root/.ssh > /dev/null 2>&1 docker cp test/conf/id_ecdsa.pub "$AGENT_CONTAINER_ID:/root/.ssh/authorized_keys" > /dev/null 2>&1 From 4ead6c04531e31b6250027e4b06ac904cb4f0258 Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Fri, 13 Sep 2019 10:18:05 +0200 Subject: [PATCH 26/55] Update owner of authorized_keys in agent --- test.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/test.sh b/test.sh index da872ac..24c8156 100755 --- a/test.sh +++ b/test.sh @@ -53,6 +53,7 @@ docker exec iofog-agent mkdir -p /root/.ssh > /dev/null 2>&1 docker exec iofog-agent chmod 700 /root/.ssh > /dev/null 2>&1 docker cp test/conf/id_ecdsa.pub "$AGENT_CONTAINER_ID:/root/.ssh/authorized_keys" > /dev/null 2>&1 docker exec iofog-agent chmod 644 /root/.ssh/authorized_keys > /dev/null 2>&1 +docker exec iofog-agent chown root:root /root/.ssh/authorized_keys > /dev/null 2>&1 docker exec iofog-agent mkdir -p /var/run/sshd > /dev/null 2>&1 docker exec iofog-agent sudo sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd > /dev/null 2>&1 docker exec iofog-agent sudo sed 's@#AuthorizedKeysFile %h/.ssh/authorized_keys@AuthorizedKeysFile %h/.ssh/authorized_keys@g' -i /etc/ssh/sshd_config > /dev/null 2>&1 From 3fa6e9efef902bb02d4d9c562ac811d2f7d10f56 Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Fri, 13 Sep 2019 10:37:03 +0200 Subject: [PATCH 27/55] Use latest images --- azure-pipelines.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 4d2856a..f61ae82 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -36,7 +36,14 @@ steps: displayName: 'Docker connect to Registry' - script: | - ./start.sh + docker pull gcr.io/focal-freedom-236620/controller:latest + docker pull gcr.io/focal-freedom-236620/agent:latest + displayName: 'Pull latest images' + +- script: | + # ./start.sh + # Use dev version of agent and controller until 1.3.0 release + ./start.sh -ct gcr.io/focal-freedom-236620/controller:latest -a gcr.io/focal-freedom-236620/agent:latest displayName: 'Start Connector, Controller, and Agent' - script: | From f19e2ee04b0ddd891984d051a09b701466009ba0 Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Fri, 13 Sep 2019 11:01:30 +0200 Subject: [PATCH 28/55] Refactor to have all resource name alphanumeric, lower case --- init/tutorial/config.yaml | 6 +++--- start.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/init/tutorial/config.yaml b/init/tutorial/config.yaml index 898c07d..dd47860 100644 --- a/init/tutorial/config.yaml +++ b/init/tutorial/config.yaml @@ -2,7 +2,7 @@ name: tutorial microservices: - name: Sensors agent: - name: ioFog Agent + name: local-agent config: {} images: x86: iofog/sensors:latest @@ -12,7 +12,7 @@ microservices: env: [] - name: Rest API agent: - name: ioFog Agent + name: local-agent config: {} images: x86: iofog/freeboard-api:latest @@ -24,7 +24,7 @@ microservices: env: [] - name: Freeboard agent: - name: ioFog Agent + name: local-agent config: {} images: x86: iofog/freeboard:latest diff --git a/start.sh b/start.sh index ca600c8..56ab968 100755 --- a/start.sh +++ b/start.sh @@ -52,7 +52,7 @@ connectors: - name: local-connector host: localhost agents: -- name: ioFog Agent +- name: local-agent image: $AGENT_IMAGE host: localhost " >| init/iofog/local-stack.yaml From 0bb042190c6b7790f78f045c3f40cb74760333c3 Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Fri, 13 Sep 2019 15:52:51 +0200 Subject: [PATCH 29/55] Use develop images in pipeline --- azure-pipelines.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f61ae82..d895706 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -21,7 +21,7 @@ steps: - task: DockerInstaller@0 displayName: Docker Installer inputs: - dockerVersion: 18.09.2 + dockerVersion: 19.03.2 releaseType: stable - script: | @@ -36,14 +36,14 @@ steps: displayName: 'Docker connect to Registry' - script: | - docker pull gcr.io/focal-freedom-236620/controller:latest - docker pull gcr.io/focal-freedom-236620/agent:latest + docker pull gcr.io/focal-freedom-236620/controller:develop + docker pull gcr.io/focal-freedom-236620/agent:develop displayName: 'Pull latest images' - script: | # ./start.sh # Use dev version of agent and controller until 1.3.0 release - ./start.sh -ct gcr.io/focal-freedom-236620/controller:latest -a gcr.io/focal-freedom-236620/agent:latest + ./start.sh -ct gcr.io/focal-freedom-236620/controller:develop -a gcr.io/focal-freedom-236620/agent:develop displayName: 'Start Connector, Controller, and Agent' - script: | From 41123197fa23d62f709b2ea103011fdeb8531366 Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Thu, 19 Sep 2019 11:54:35 +0200 Subject: [PATCH 30/55] Check provisioning --- init/iofog/local-stack.yaml | 8 ++++---- start.sh | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/init/iofog/local-stack.yaml b/init/iofog/local-stack.yaml index a8f092d..28cb0df 100644 --- a/init/iofog/local-stack.yaml +++ b/init/iofog/local-stack.yaml @@ -1,8 +1,7 @@ --- controlplane: images: - controller: docker.io/iofog/controller:latest - connector: docker.io/iofog/connector:latest + controller: gcr.io/focal-freedom-236620/controller:1.3.0-rc1 iofoguser: name: test surname: local @@ -14,8 +13,9 @@ controlplane: connectors: - name: local-connector host: localhost + image: gcr.io/focal-freedom-236620/connector:1.3.0-rc1 agents: -- name: ioFog Agent - image: docker.io/iofog/agent:latest +- name: local-agent host: localhost + image: gcr.io/focal-freedom-236620/agent:1.3.0-rc1 diff --git a/start.sh b/start.sh index 56ab968..a19f26a 100755 --- a/start.sh +++ b/start.sh @@ -39,7 +39,6 @@ startIofog() { controlplane: images: controller: $CONTROLLER_IMAGE - connector: $CONNECTOR_IMAGE iofoguser: name: test surname: local @@ -51,16 +50,26 @@ controlplane: connectors: - name: local-connector host: localhost + image: $CONNECTOR_IMAGE agents: - name: local-agent - image: $AGENT_IMAGE host: localhost + image: $AGENT_IMAGE " >| init/iofog/local-stack.yaml echoInfo "Deploying containers for ioFog stack..." iofogctl deploy -f init/iofog/local-stack.yaml } +checkProvisioning() { + AGENT_UUID=$(docker exec -it iofog-agent iofog-agent info | grep 'UUID' | awk '{print $4}') + + if [ "$AGENT_UUID" == "not" ]; then + echoError "Failed to provision the agent" + return 1 + fi +} + startEnvironment() { local ENVIRONMENT="$1" @@ -117,6 +126,7 @@ echoInfo "Starting \"${ENVIRONMENT}\" demo environment..." # Start ioFog stack startIofog +checkProvisioning # Optionally start another environment if [[ "${ENVIRONMENT}" != "iofog" ]]; then From 9fc1526753d954591d697a81fa55ddaa8d202dcc Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Thu, 19 Sep 2019 18:13:55 +0200 Subject: [PATCH 31/55] Remove -it option for CI --- start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/start.sh b/start.sh index a19f26a..84542a5 100755 --- a/start.sh +++ b/start.sh @@ -62,7 +62,7 @@ agents: } checkProvisioning() { - AGENT_UUID=$(docker exec -it iofog-agent iofog-agent info | grep 'UUID' | awk '{print $4}') + AGENT_UUID=$(docker exec iofog-agent iofog-agent info | grep 'UUID' | awk '{print $4}') if [ "$AGENT_UUID" == "not" ]; then echoError "Failed to provision the agent" From cc40b19eaf5387ead0452c56c6d338ce46b7c021 Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Mon, 30 Sep 2019 11:09:18 +1300 Subject: [PATCH 32/55] Add changelog --- azure-pipelines.yml | 3 +- docker-compose-iofog.yml | 60 ------------------------------------- docker-compose-tutorial.yml | 12 -------- 3 files changed, 2 insertions(+), 73 deletions(-) delete mode 100644 docker-compose-iofog.yml delete mode 100644 docker-compose-tutorial.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d895706..094ff43 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -37,13 +37,14 @@ steps: - script: | docker pull gcr.io/focal-freedom-236620/controller:develop + docker pull gcr.io/focal-freedom-236620/connector:develop docker pull gcr.io/focal-freedom-236620/agent:develop displayName: 'Pull latest images' - script: | # ./start.sh # Use dev version of agent and controller until 1.3.0 release - ./start.sh -ct gcr.io/focal-freedom-236620/controller:develop -a gcr.io/focal-freedom-236620/agent:develop + ./start.sh -ct gcr.io/focal-freedom-236620/controller:develop -a gcr.io/focal-freedom-236620/agent:develop -cn gcr.io/focal-freedom-236620/connector:develop displayName: 'Start Connector, Controller, and Agent' - script: | diff --git a/docker-compose-iofog.yml b/docker-compose-iofog.yml deleted file mode 100644 index 5d58dd2..0000000 --- a/docker-compose-iofog.yml +++ /dev/null @@ -1,60 +0,0 @@ -version: "3" -services: - iofog-connector: - image: iofog-connector:local - build: - context: ./services/iofog/iofog-connector - args: - - LOCAL_CONNECTOR_PACKAGE - container_name: iofog-connector - ports: - - "53321:8080" - network_mode: bridge - - iofog-controller: - image: iofog-controller:local - build: - context: ./services/iofog/iofog-controller - args: - - LOCAL_CONTROLLER_PACKAGE - container_name: iofog-controller - depends_on: - - iofog-connector - ports: - - "51121:51121" - environment: - - NODE_ENV=development - links: - - iofog-connector:iofog-connector - network_mode: bridge - - iofog-agent: - image: iofog-agent:local - build: - context: ./services/iofog/iofog-agent - args: - - LOCAL_AGENT_PACKAGE - depends_on: - - iofog-controller - privileged: true - volumes: - - /var/run/docker.sock:/var/run/docker.sock - container_name: iofog-agent - ports: - - "8081:22" - - "54321:54321" - links: - - iofog-controller:iofog-controller - network_mode: bridge - - iofog-init: - build: ./init/iofog - container_name: iofog-init - depends_on: - - iofog-controller - volumes: - - /var/run/docker.sock:/var/run/docker.sock - links: - - iofog-controller:iofog-controller - - iofog-connector:iofog-connector - network_mode: bridge diff --git a/docker-compose-tutorial.yml b/docker-compose-tutorial.yml deleted file mode 100644 index 36755dd..0000000 --- a/docker-compose-tutorial.yml +++ /dev/null @@ -1,12 +0,0 @@ -version: "3" -services: - tutorial-init: - build: ./init/tutorial - container_name: tutorial-init - depends_on: - - iofog-controller - volumes: - - /var/run/docker.sock:/var/run/docker.sock - links: - - iofog-controller:iofog-controller - network_mode: bridge From 72d412ab6710d0c8ea37336fa5cd23237c6354f1 Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Tue, 1 Oct 2019 08:11:03 +1300 Subject: [PATCH 33/55] Add changelog --- CHANGELOG-1.3.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 CHANGELOG-1.3.md diff --git a/CHANGELOG-1.3.md b/CHANGELOG-1.3.md new file mode 100644 index 0000000..3b65538 --- /dev/null +++ b/CHANGELOG-1.3.md @@ -0,0 +1,5 @@ +## v1.3.0 +* Use iofogctl and yaml file for deploying ioFog resources +* Remove Dockerfiles and docker-compose files +* Update test script to set up agent ssh access +* Improve logging \ No newline at end of file From a146a86ec60c2b173450ad0563d858b0a7ae96d7 Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Fri, 4 Oct 2019 12:09:54 +1300 Subject: [PATCH 34/55] Use 1.3.0-beta packages --- azure-pipelines.yml | 18 +++++++++--------- start.sh | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 094ff43..b3a2f0f 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -25,9 +25,9 @@ steps: releaseType: stable - script: | - # https://packagecloud.io/install/repositories/iofog/iofogctl/script.deb.sh | sudo bash + https://packagecloud.io/install/repositories/iofog/iofogctl/script.deb.sh | sudo bash # Using dev version of iofogctl until 1.3.0 release - curl -s https://8c90601638aff0b3fb520971175089bbaba2cf7f29be9528:@packagecloud.io/install/repositories/iofog/iofogctl-snapshots/script.deb.sh | sudo bash + # curl -s https://8c90601638aff0b3fb520971175089bbaba2cf7f29be9528:@packagecloud.io/install/repositories/iofog/iofogctl-snapshots/script.deb.sh | sudo bash sudo apt install iofogctl displayName: 'Install iofogctl' @@ -35,16 +35,16 @@ steps: echo $(gcp.svcacc) | docker login -u _json_key --password-stdin https://gcr.io displayName: 'Docker connect to Registry' -- script: | - docker pull gcr.io/focal-freedom-236620/controller:develop - docker pull gcr.io/focal-freedom-236620/connector:develop - docker pull gcr.io/focal-freedom-236620/agent:develop - displayName: 'Pull latest images' +# - script: | +# docker pull gcr.io/focal-freedom-236620/controller:develop +# docker pull gcr.io/focal-freedom-236620/connector:develop +# docker pull gcr.io/focal-freedom-236620/agent:develop +# displayName: 'Pull latest images' - script: | - # ./start.sh + ./start.sh # Use dev version of agent and controller until 1.3.0 release - ./start.sh -ct gcr.io/focal-freedom-236620/controller:develop -a gcr.io/focal-freedom-236620/agent:develop -cn gcr.io/focal-freedom-236620/connector:develop + # ./start.sh -ct gcr.io/focal-freedom-236620/controller:develop -a gcr.io/focal-freedom-236620/agent:develop -cn gcr.io/focal-freedom-236620/connector:develop displayName: 'Start Connector, Controller, and Agent' - script: | diff --git a/start.sh b/start.sh index 84542a5..9ae6eb2 100755 --- a/start.sh +++ b/start.sh @@ -81,9 +81,9 @@ startEnvironment() { ENVIRONMENT='' IOFOG_BUILD_NO_CACHE='' -AGENT_IMAGE='docker.io/iofog/agent:latest' -CONTROLLER_IMAGE='docker.io/iofog/controller:latest' -CONNECTOR_IMAGE='docker.io/iofog/connector:latest' +AGENT_IMAGE='docker.io/iofog/agent:1.3.0-beta' +CONTROLLER_IMAGE='docker.io/iofog/controller:1.3.0-beta' +CONNECTOR_IMAGE='docker.io/iofog/connector:1.3.0-beta' while [[ "$#" -ge 1 ]]; do case "$1" in -h|--help) From 6a55b8a4d6be499d863e222a01071906d40e9e7d Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Tue, 15 Oct 2019 17:46:54 +1300 Subject: [PATCH 35/55] Update init file --- init/iofog/local-stack.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/init/iofog/local-stack.yaml b/init/iofog/local-stack.yaml index 28cb0df..c2bfc41 100644 --- a/init/iofog/local-stack.yaml +++ b/init/iofog/local-stack.yaml @@ -1,7 +1,7 @@ --- controlplane: images: - controller: gcr.io/focal-freedom-236620/controller:1.3.0-rc1 + controller: docker.io/iofog/controller:1.3.0-beta iofoguser: name: test surname: local @@ -13,9 +13,9 @@ controlplane: connectors: - name: local-connector host: localhost - image: gcr.io/focal-freedom-236620/connector:1.3.0-rc1 + image: docker.io/iofog/connector:1.3.0-beta agents: - name: local-agent host: localhost - image: gcr.io/focal-freedom-236620/agent:1.3.0-rc1 + image: docker.io/iofog/agent:1.3.0-beta From 7462aa63918daa240537919dc9d81a3bc5a4d61c Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Tue, 15 Oct 2019 17:43:26 +1300 Subject: [PATCH 36/55] Update to K8s yaml --- init/iofog/local-stack.yaml | 23 +++++++---- init/tutorial/config.yaml | 82 +++++++++++++++++++------------------ start.sh | 23 +++++++---- 3 files changed, 75 insertions(+), 53 deletions(-) diff --git a/init/iofog/local-stack.yaml b/init/iofog/local-stack.yaml index c2bfc41..d2f0fda 100644 --- a/init/iofog/local-stack.yaml +++ b/init/iofog/local-stack.yaml @@ -1,5 +1,8 @@ --- -controlplane: +kind: ControlPlane +metadata: + name: local-ecn +spec: images: controller: docker.io/iofog/controller:1.3.0-beta iofoguser: @@ -10,12 +13,18 @@ controlplane: controllers: - name: local-controller host: localhost -connectors: - - name: local-connector - host: localhost - image: docker.io/iofog/connector:1.3.0-beta -agents: -- name: local-agent +--- +kind: Connector +metadata: + name: local-connector +spec: + host: localhost + image: docker.io/iofog/connector:1.3.0-beta +--- +kind: Agent +metadata: + name: local-agent +spec: host: localhost image: docker.io/iofog/agent:1.3.0-beta diff --git a/init/tutorial/config.yaml b/init/tutorial/config.yaml index dd47860..4759562 100644 --- a/init/tutorial/config.yaml +++ b/init/tutorial/config.yaml @@ -1,39 +1,43 @@ -name: tutorial -microservices: -- name: Sensors - agent: - name: local-agent - config: {} - images: - x86: iofog/sensors:latest - registry: remote - volumes: [] - ports: [] - env: [] -- name: Rest API - agent: - name: local-agent - config: {} - images: - x86: iofog/freeboard-api:latest - registry: remote - volumes: [] - ports: - - internal: 80 - external: 10101 - env: [] -- name: Freeboard - agent: - name: local-agent - config: {} - images: - x86: iofog/freeboard:latest - registry: remote - volumes: [] - ports: - - internal: 80 - external: 10102 - env: [] -routes: -- from: Sensors - to: Rest API \ No newline at end of file +--- +kind: Application +metadata: + name: tutorial +spec: + microservices: + - name: Sensors + agent: + name: local-agent + config: {} + images: + x86: iofog/sensors:latest + registry: remote + volumes: [] + ports: [] + env: [] + - name: Rest API + agent: + name: local-agent + config: {} + images: + x86: iofog/freeboard-api:latest + registry: remote + volumes: [] + ports: + - internal: 80 + external: 10101 + env: [] + - name: Freeboard + agent: + name: local-agent + config: {} + images: + x86: iofog/freeboard:latest + registry: remote + volumes: [] + ports: + - internal: 80 + external: 10102 + env: [] + routes: + - from: Sensors + to: Rest API \ No newline at end of file diff --git a/start.sh b/start.sh index 9ae6eb2..20b6d83 100755 --- a/start.sh +++ b/start.sh @@ -36,7 +36,10 @@ startIofog() { fi echo "--- -controlplane: +kind: ControlPlane +metadata: + name: local-ecn +spec: images: controller: $CONTROLLER_IMAGE iofoguser: @@ -47,12 +50,18 @@ controlplane: controllers: - name: local-controller host: localhost -connectors: - - name: local-connector - host: localhost - image: $CONNECTOR_IMAGE -agents: -- name: local-agent +--- +kind: Connector +metadata: + name: local-connector +spec: + host: localhost + image: $CONNECTOR_IMAGE +--- +kind: Agent +metadata: + name: local-agent +spec: host: localhost image: $AGENT_IMAGE " >| init/iofog/local-stack.yaml From ed6709a3fd1b6509bf089eacd583b5a53d5f5701 Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Wed, 16 Oct 2019 11:52:43 +1300 Subject: [PATCH 37/55] Update yamls to match new format --- azure-pipelines.yml | 4 ++-- init/iofog/local-stack.yaml | 2 +- start.sh | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b3a2f0f..3b64fc8 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -42,10 +42,10 @@ steps: # displayName: 'Pull latest images' - script: | - ./start.sh + ./start.sh tutorial # Use dev version of agent and controller until 1.3.0 release # ./start.sh -ct gcr.io/focal-freedom-236620/controller:develop -a gcr.io/focal-freedom-236620/agent:develop -cn gcr.io/focal-freedom-236620/connector:develop - displayName: 'Start Connector, Controller, and Agent' + displayName: 'Start Connector, Controller, Agent, and tutorial microservices' - script: | ./test.sh diff --git a/init/iofog/local-stack.yaml b/init/iofog/local-stack.yaml index d2f0fda..a1d6544 100644 --- a/init/iofog/local-stack.yaml +++ b/init/iofog/local-stack.yaml @@ -5,7 +5,7 @@ metadata: spec: images: controller: docker.io/iofog/controller:1.3.0-beta - iofoguser: + iofogUser: name: test surname: local email: user@domain.com diff --git a/start.sh b/start.sh index 20b6d83..8cfc824 100755 --- a/start.sh +++ b/start.sh @@ -42,7 +42,7 @@ metadata: spec: images: controller: $CONTROLLER_IMAGE - iofoguser: + iofogUser: name: test surname: local email: user@domain.com From c7f51a3f5426f33cf49a7ed0b3c9cce93dfa02f3 Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Wed, 23 Oct 2019 11:17:38 +1300 Subject: [PATCH 38/55] Add API Version --- init/iofog/local-stack.yaml | 3 +++ init/tutorial/config.yaml | 1 + start.sh | 3 +++ 3 files changed, 7 insertions(+) diff --git a/init/iofog/local-stack.yaml b/init/iofog/local-stack.yaml index a1d6544..21073b6 100644 --- a/init/iofog/local-stack.yaml +++ b/init/iofog/local-stack.yaml @@ -1,4 +1,5 @@ --- +apiVersion: iofog.org/v1 kind: ControlPlane metadata: name: local-ecn @@ -14,6 +15,7 @@ spec: - name: local-controller host: localhost --- +apiVersion: iofog.org/v1 kind: Connector metadata: name: local-connector @@ -21,6 +23,7 @@ spec: host: localhost image: docker.io/iofog/connector:1.3.0-beta --- +apiVersion: iofog.org/v1 kind: Agent metadata: name: local-agent diff --git a/init/tutorial/config.yaml b/init/tutorial/config.yaml index 4759562..a21540f 100644 --- a/init/tutorial/config.yaml +++ b/init/tutorial/config.yaml @@ -1,4 +1,5 @@ --- +apiVersion: iofog.org/v1 kind: Application metadata: name: tutorial diff --git a/start.sh b/start.sh index 8cfc824..1ed6c44 100755 --- a/start.sh +++ b/start.sh @@ -36,6 +36,7 @@ startIofog() { fi echo "--- +apiVersion: iofog.org/v1 kind: ControlPlane metadata: name: local-ecn @@ -51,6 +52,7 @@ spec: - name: local-controller host: localhost --- +apiVersion: iofog.org/v1 kind: Connector metadata: name: local-connector @@ -58,6 +60,7 @@ spec: host: localhost image: $CONNECTOR_IMAGE --- +apiVersion: iofog.org/v1 kind: Agent metadata: name: local-agent From e34e5ce3d01b14c46f71fcdba775594434116dc0 Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Wed, 23 Oct 2019 17:10:36 +1300 Subject: [PATCH 39/55] Update test.sh --- test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.sh b/test.sh index 24c8156..b7d07fc 100755 --- a/test.sh +++ b/test.sh @@ -48,7 +48,7 @@ AGENT_CONTAINER_ID=$(docker ps -q --filter="name=iofog-agent") echoInfo "Configuring ssh on the Agent" docker exec iofog-agent sudo rm /var/lib/apt/lists/lock > /dev/null 2>&1 docker exec iofog-agent apt-get update -qq > /dev/null 2>&1 -docker exec iofog-agent apt-get install -qqy openssh-server > /dev/null 2>&1 +docker exec iofog-agent apt-get install -qqy openssh-server > /dev/null 2>&1 || docker exec iofog-agent apt-get install -qqfy > /dev/null 2>&1 docker exec iofog-agent mkdir -p /root/.ssh > /dev/null 2>&1 docker exec iofog-agent chmod 700 /root/.ssh > /dev/null 2>&1 docker cp test/conf/id_ecdsa.pub "$AGENT_CONTAINER_ID:/root/.ssh/authorized_keys" > /dev/null 2>&1 From 4185352c5608adbc79ee19b1f2e6371fe27b9d84 Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Tue, 29 Oct 2019 10:08:00 +1300 Subject: [PATCH 40/55] Update pipeline --- azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 3b64fc8..3ef342b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -25,9 +25,9 @@ steps: releaseType: stable - script: | - https://packagecloud.io/install/repositories/iofog/iofogctl/script.deb.sh | sudo bash + # curl -s https://packagecloud.io/install/repositories/iofog/iofogctl/script.deb.sh | sudo bash # Using dev version of iofogctl until 1.3.0 release - # curl -s https://8c90601638aff0b3fb520971175089bbaba2cf7f29be9528:@packagecloud.io/install/repositories/iofog/iofogctl-snapshots/script.deb.sh | sudo bash + curl -s https://8c90601638aff0b3fb520971175089bbaba2cf7f29be9528:@packagecloud.io/install/repositories/iofog/iofogctl-snapshots/script.deb.sh | sudo bash sudo apt install iofogctl displayName: 'Install iofogctl' From b835877ed2afb19f86c5bad9ebe82ba571d14e53 Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Tue, 29 Oct 2019 11:13:13 +1300 Subject: [PATCH 41/55] Debug pipeline --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 3ef342b..f8c434f 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -42,7 +42,7 @@ steps: # displayName: 'Pull latest images' - script: | - ./start.sh tutorial + ./start.sh tutorial || iofogctl version # Use dev version of agent and controller until 1.3.0 release # ./start.sh -ct gcr.io/focal-freedom-236620/controller:develop -a gcr.io/focal-freedom-236620/agent:develop -cn gcr.io/focal-freedom-236620/connector:develop displayName: 'Start Connector, Controller, Agent, and tutorial microservices' From 9e6e750d6911378f965817f3f41008b4d5e9a85b Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Tue, 29 Oct 2019 11:18:35 +1300 Subject: [PATCH 42/55] Debug pipeline --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f8c434f..dac1061 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -28,7 +28,7 @@ steps: # curl -s https://packagecloud.io/install/repositories/iofog/iofogctl/script.deb.sh | sudo bash # Using dev version of iofogctl until 1.3.0 release curl -s https://8c90601638aff0b3fb520971175089bbaba2cf7f29be9528:@packagecloud.io/install/repositories/iofog/iofogctl-snapshots/script.deb.sh | sudo bash - sudo apt install iofogctl + sudo apt install iofogctl=1.3.0-dev displayName: 'Install iofogctl' - script: | From 4803608ffc514fe4211ff03b6ad4fc5faf8cce7b Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Tue, 29 Oct 2019 14:16:45 +1300 Subject: [PATCH 43/55] Update test to show error output --- test.sh | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/test.sh b/test.sh index b7d07fc..464008e 100755 --- a/test.sh +++ b/test.sh @@ -46,18 +46,29 @@ AGENT_CONTAINER_ID=$(docker ps -q --filter="name=iofog-agent") # Configuring ssh on the agent echoInfo "Configuring ssh on the Agent" -docker exec iofog-agent sudo rm /var/lib/apt/lists/lock > /dev/null 2>&1 -docker exec iofog-agent apt-get update -qq > /dev/null 2>&1 -docker exec iofog-agent apt-get install -qqy openssh-server > /dev/null 2>&1 || docker exec iofog-agent apt-get install -qqfy > /dev/null 2>&1 -docker exec iofog-agent mkdir -p /root/.ssh > /dev/null 2>&1 -docker exec iofog-agent chmod 700 /root/.ssh > /dev/null 2>&1 -docker cp test/conf/id_ecdsa.pub "$AGENT_CONTAINER_ID:/root/.ssh/authorized_keys" > /dev/null 2>&1 -docker exec iofog-agent chmod 644 /root/.ssh/authorized_keys > /dev/null 2>&1 -docker exec iofog-agent chown root:root /root/.ssh/authorized_keys > /dev/null 2>&1 -docker exec iofog-agent mkdir -p /var/run/sshd > /dev/null 2>&1 -docker exec iofog-agent sudo sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd > /dev/null 2>&1 -docker exec iofog-agent sudo sed 's@#AuthorizedKeysFile %h/.ssh/authorized_keys@AuthorizedKeysFile %h/.ssh/authorized_keys@g' -i /etc/ssh/sshd_config > /dev/null 2>&1 -docker exec iofog-agent /bin/bash -c 'service ssh restart' > /dev/null 2>&1 +# Init log file +configureSSHLogFile=/tmp/configure_ssh.log +if [ -f $configureSSHLogFile ]; then + rm $configureSSHLogFile +fi +echo '' > $configureSSHLogFile +{ + docker exec iofog-agent sudo rm /var/lib/apt/lists/lock >> $configureSSHLogFile 2>&1 + docker exec iofog-agent apt-get update -y >> $configureSSHLogFile 2>&1 + docker exec iofog-agent apt-get install -y openssh-server >> $configureSSHLogFile 2>&1 || docker exec iofog-agent apt-get install -fy >> $configureSSHLogFile 2>&1 + docker exec iofog-agent mkdir -p /root/.ssh >> $configureSSHLogFile 2>&1 + docker exec iofog-agent chmod 700 /root/.ssh >> $configureSSHLogFile 2>&1 + docker cp test/conf/id_ecdsa.pub "$AGENT_CONTAINER_ID:/root/.ssh/authorized_keys" >> $configureSSHLogFile 2>&1 + docker exec iofog-agent chmod 644 /root/.ssh/authorized_keys >> $configureSSHLogFile 2>&1 + docker exec iofog-agent chown root:root /root/.ssh/authorized_keys >> $configureSSHLogFile 2>&1 + docker exec iofog-agent mkdir -p /var/run/sshd >> $configureSSHLogFile 2>&1 + docker exec iofog-agent sudo sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd >> $configureSSHLogFile 2>&1 + docker exec iofog-agent sudo sed 's@#AuthorizedKeysFile %h/.ssh/authorized_keys@AuthorizedKeysFile %h/.ssh/authorized_keys@g' -i /etc/ssh/sshd_config >> $configureSSHLogFile 2>&1 + docker exec iofog-agent /bin/bash -c 'service ssh restart' >> $configureSSHLogFile 2>&1 +} || { + echoError "Failed to configure ssh on agent container" + cat $configureSSHLogFile +} echoInfo "Running Test Runner..." docker run --rm --name test-runner --network local-iofog-network \ From 25763e01acbc5f3e4c8b7be5735ece6c7c4f0421 Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Tue, 29 Oct 2019 14:30:19 +1300 Subject: [PATCH 44/55] Debug pipeline --- test.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/test.sh b/test.sh index 464008e..c8cc7b2 100755 --- a/test.sh +++ b/test.sh @@ -31,7 +31,7 @@ IOFOG_RUNNING=$(docker inspect -f '{{.State.Running}}' iofog-agent iofog-connect if [[ "${IOFOG_RUNNING}" == "truetruetrue" ]]; then echoInfo "ioFog stack is running" else - echoError 'ioFog stack is not running! Please run `./start.sh iofog` first' + echoError 'ioFog stack is not running! Please run `./start.sh` first' exit 2 fi @@ -53,17 +53,28 @@ if [ -f $configureSSHLogFile ]; then fi echo '' > $configureSSHLogFile { + echo 'Removing /var/lib/apt/lists/lock' >> $configureSSHLogFile docker exec iofog-agent sudo rm /var/lib/apt/lists/lock >> $configureSSHLogFile 2>&1 + echo 'Updating apt-get' >> $configureSSHLogFile docker exec iofog-agent apt-get update -y >> $configureSSHLogFile 2>&1 - docker exec iofog-agent apt-get install -y openssh-server >> $configureSSHLogFile 2>&1 || docker exec iofog-agent apt-get install -fy >> $configureSSHLogFile 2>&1 + echo 'Installing Openssh-server' >> $configureSSHLogFile + docker exec iofog-agent apt-get install -y openssh-server >> $configureSSHLogFile 2>&1 + echo 'Running apt-get install -fy' >> $configureSSHLogFile + docker exec iofog-agent apt-get install -fy >> $configureSSHLogFile 2>&1 + echo 'Creating ~/.ssh' >> $configureSSHLogFile docker exec iofog-agent mkdir -p /root/.ssh >> $configureSSHLogFile 2>&1 docker exec iofog-agent chmod 700 /root/.ssh >> $configureSSHLogFile 2>&1 + echo 'Copying public key to ~/.ssh/authorized_keys' >> $configureSSHLogFile docker cp test/conf/id_ecdsa.pub "$AGENT_CONTAINER_ID:/root/.ssh/authorized_keys" >> $configureSSHLogFile 2>&1 docker exec iofog-agent chmod 644 /root/.ssh/authorized_keys >> $configureSSHLogFile 2>&1 docker exec iofog-agent chown root:root /root/.ssh/authorized_keys >> $configureSSHLogFile 2>&1 + echo 'Creating /var/run/.sshd' >> $configureSSHLogFile docker exec iofog-agent mkdir -p /var/run/sshd >> $configureSSHLogFile 2>&1 + echo 'Updating /etc/pam.d/sshd' >> $configureSSHLogFile docker exec iofog-agent sudo sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd >> $configureSSHLogFile 2>&1 + echo 'Updating /etc/ssh/sshd_config' >> $configureSSHLogFile docker exec iofog-agent sudo sed 's@#AuthorizedKeysFile %h/.ssh/authorized_keys@AuthorizedKeysFile %h/.ssh/authorized_keys@g' -i /etc/ssh/sshd_config >> $configureSSHLogFile 2>&1 + echo 'Restarting ssh service' >> $configureSSHLogFile docker exec iofog-agent /bin/bash -c 'service ssh restart' >> $configureSSHLogFile 2>&1 } || { echoError "Failed to configure ssh on agent container" From c16b5c6876fe3066626fc5ccc549f2784629892d Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Tue, 29 Oct 2019 14:58:53 +1300 Subject: [PATCH 45/55] Debug pipeline --- test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.sh b/test.sh index c8cc7b2..022e888 100755 --- a/test.sh +++ b/test.sh @@ -58,7 +58,7 @@ echo '' > $configureSSHLogFile echo 'Updating apt-get' >> $configureSSHLogFile docker exec iofog-agent apt-get update -y >> $configureSSHLogFile 2>&1 echo 'Installing Openssh-server' >> $configureSSHLogFile - docker exec iofog-agent apt-get install -y openssh-server >> $configureSSHLogFile 2>&1 + docker exec iofog-agent apt-get install -y --fix-missing openssh-server >> $configureSSHLogFile 2>&1 echo 'Running apt-get install -fy' >> $configureSSHLogFile docker exec iofog-agent apt-get install -fy >> $configureSSHLogFile 2>&1 echo 'Creating ~/.ssh' >> $configureSSHLogFile From 3ef6b9e521bc7792b5909351d610bb4a0cb689bd Mon Sep 17 00:00:00 2001 From: Alex de Wergifosse Date: Tue, 29 Oct 2019 15:06:33 +1300 Subject: [PATCH 46/55] Debug pipeline --- test.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/test.sh b/test.sh index 022e888..8927f38 100755 --- a/test.sh +++ b/test.sh @@ -79,6 +79,7 @@ echo '' > $configureSSHLogFile } || { echoError "Failed to configure ssh on agent container" cat $configureSSHLogFile + exit 1 } echoInfo "Running Test Runner..." From 46d5e17b770f6a90bf201afaa9d3292ab15a1682 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Kr=C4=8D=C3=A1l?= Date: Wed, 6 Nov 2019 17:43:08 +1300 Subject: [PATCH 47/55] Fix syntax warnings in bash scripts --- start.sh | 2 +- test.sh | 56 ++++++++++++++++++++++++++++---------------------------- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/start.sh b/start.sh index 1ed6c44..359b8a1 100755 --- a/start.sh +++ b/start.sh @@ -31,7 +31,7 @@ printHelp() { startIofog() { # If stack is running, skip local CONTROLLER_CONTAINER_ID=$(docker ps -q --filter="name=iofog-controller") - if ! [[ -z $CONTROLLER_CONTAINER_ID ]]; then + if ! [[ -z "${CONTROLLER_CONTAINER_ID}" ]]; then return fi diff --git a/test.sh b/test.sh index 8927f38..0135f46 100755 --- a/test.sh +++ b/test.sh @@ -47,38 +47,38 @@ AGENT_CONTAINER_ID=$(docker ps -q --filter="name=iofog-agent") # Configuring ssh on the agent echoInfo "Configuring ssh on the Agent" # Init log file -configureSSHLogFile=/tmp/configure_ssh.log -if [ -f $configureSSHLogFile ]; then - rm $configureSSHLogFile +CONFIGURE_SSH_LOG_FILE=/tmp/configure_ssh.log +if [[ -f "${CONFIGURE_SSH_LOG_FILE}" ]]; then + rm "${CONFIGURE_SSH_LOG_FILE}" fi -echo '' > $configureSSHLogFile +echo '' > "${CONFIGURE_SSH_LOG_FILE}" { - echo 'Removing /var/lib/apt/lists/lock' >> $configureSSHLogFile - docker exec iofog-agent sudo rm /var/lib/apt/lists/lock >> $configureSSHLogFile 2>&1 - echo 'Updating apt-get' >> $configureSSHLogFile - docker exec iofog-agent apt-get update -y >> $configureSSHLogFile 2>&1 - echo 'Installing Openssh-server' >> $configureSSHLogFile - docker exec iofog-agent apt-get install -y --fix-missing openssh-server >> $configureSSHLogFile 2>&1 - echo 'Running apt-get install -fy' >> $configureSSHLogFile - docker exec iofog-agent apt-get install -fy >> $configureSSHLogFile 2>&1 - echo 'Creating ~/.ssh' >> $configureSSHLogFile - docker exec iofog-agent mkdir -p /root/.ssh >> $configureSSHLogFile 2>&1 - docker exec iofog-agent chmod 700 /root/.ssh >> $configureSSHLogFile 2>&1 - echo 'Copying public key to ~/.ssh/authorized_keys' >> $configureSSHLogFile - docker cp test/conf/id_ecdsa.pub "$AGENT_CONTAINER_ID:/root/.ssh/authorized_keys" >> $configureSSHLogFile 2>&1 - docker exec iofog-agent chmod 644 /root/.ssh/authorized_keys >> $configureSSHLogFile 2>&1 - docker exec iofog-agent chown root:root /root/.ssh/authorized_keys >> $configureSSHLogFile 2>&1 - echo 'Creating /var/run/.sshd' >> $configureSSHLogFile - docker exec iofog-agent mkdir -p /var/run/sshd >> $configureSSHLogFile 2>&1 - echo 'Updating /etc/pam.d/sshd' >> $configureSSHLogFile - docker exec iofog-agent sudo sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd >> $configureSSHLogFile 2>&1 - echo 'Updating /etc/ssh/sshd_config' >> $configureSSHLogFile - docker exec iofog-agent sudo sed 's@#AuthorizedKeysFile %h/.ssh/authorized_keys@AuthorizedKeysFile %h/.ssh/authorized_keys@g' -i /etc/ssh/sshd_config >> $configureSSHLogFile 2>&1 - echo 'Restarting ssh service' >> $configureSSHLogFile - docker exec iofog-agent /bin/bash -c 'service ssh restart' >> $configureSSHLogFile 2>&1 + echo 'Removing /var/lib/apt/lists/lock' >> "${CONFIGURE_SSH_LOG_FILE}" + docker exec iofog-agent sudo rm /var/lib/apt/lists/lock >> "${CONFIGURE_SSH_LOG_FILE}" 2>&1 + echo 'Updating apt-get' >> "${CONFIGURE_SSH_LOG_FILE}" + docker exec iofog-agent apt-get update -y >> "${CONFIGURE_SSH_LOG_FILE}" 2>&1 + echo 'Installing Openssh-server' >> "${CONFIGURE_SSH_LOG_FILE}" + docker exec iofog-agent apt-get install -y --fix-missing openssh-server >> "${CONFIGURE_SSH_LOG_FILE}" 2>&1 + echo 'Running apt-get install -fy' >> "${CONFIGURE_SSH_LOG_FILE}" + docker exec iofog-agent apt-get install -fy >> "${CONFIGURE_SSH_LOG_FILE}" 2>&1 + echo 'Creating ~/.ssh' >> "${CONFIGURE_SSH_LOG_FILE}" + docker exec iofog-agent mkdir -p /root/.ssh >> "${CONFIGURE_SSH_LOG_FILE}" 2>&1 + docker exec iofog-agent chmod 700 /root/.ssh >> "${CONFIGURE_SSH_LOG_FILE}" 2>&1 + echo 'Copying public key to ~/.ssh/authorized_keys' >> "${CONFIGURE_SSH_LOG_FILE}" + docker cp test/conf/id_ecdsa.pub "$AGENT_CONTAINER_ID:/root/.ssh/authorized_keys" >> "${CONFIGURE_SSH_LOG_FILE}" 2>&1 + docker exec iofog-agent chmod 644 /root/.ssh/authorized_keys >> "${CONFIGURE_SSH_LOG_FILE}" 2>&1 + docker exec iofog-agent chown root:root /root/.ssh/authorized_keys >> "${CONFIGURE_SSH_LOG_FILE}" 2>&1 + echo 'Creating /var/run/.sshd' >> "${CONFIGURE_SSH_LOG_FILE}" + docker exec iofog-agent mkdir -p /var/run/sshd >> "${CONFIGURE_SSH_LOG_FILE}" 2>&1 + echo 'Updating /etc/pam.d/sshd' >> "${CONFIGURE_SSH_LOG_FILE}" + docker exec iofog-agent sudo sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd >> "${CONFIGURE_SSH_LOG_FILE}" 2>&1 + echo 'Updating /etc/ssh/sshd_config' >> "${CONFIGURE_SSH_LOG_FILE}" + docker exec iofog-agent sudo sed 's@#AuthorizedKeysFile %h/.ssh/authorized_keys@AuthorizedKeysFile %h/.ssh/authorized_keys@g' -i /etc/ssh/sshd_config >> "${CONFIGURE_SSH_LOG_FILE}" 2>&1 + echo 'Restarting ssh service' >> "${CONFIGURE_SSH_LOG_FILE}" + docker exec iofog-agent /bin/bash -c 'service ssh restart' >> "${CONFIGURE_SSH_LOG_FILE}" 2>&1 } || { echoError "Failed to configure ssh on agent container" - cat $configureSSHLogFile + cat "${CONFIGURE_SSH_LOG_FILE}" exit 1 } From ece000d295c6f43d95eb4f819c962f91da01ecca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Kr=C4=8D=C3=A1l?= Date: Wed, 6 Nov 2019 17:43:56 +1300 Subject: [PATCH 48/55] Bump up image versions to 1.3.0-rc1 --- start.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/start.sh b/start.sh index 359b8a1..66e69fc 100755 --- a/start.sh +++ b/start.sh @@ -93,9 +93,9 @@ startEnvironment() { ENVIRONMENT='' IOFOG_BUILD_NO_CACHE='' -AGENT_IMAGE='docker.io/iofog/agent:1.3.0-beta' -CONTROLLER_IMAGE='docker.io/iofog/controller:1.3.0-beta' -CONNECTOR_IMAGE='docker.io/iofog/connector:1.3.0-beta' +AGENT_IMAGE='docker.io/iofog/agent:1.3.0-rc1' +CONTROLLER_IMAGE='docker.io/iofog/controller:1.3.0-rc1' +CONNECTOR_IMAGE='docker.io/iofog/connector:1.3.0-rc1' while [[ "$#" -ge 1 ]]; do case "$1" in -h|--help) From e0c93bdf2285b4172b7a0bc779d53a9e91c970c7 Mon Sep 17 00:00:00 2001 From: SergeRadinovich Date: Thu, 7 Nov 2019 11:30:13 +1300 Subject: [PATCH 49/55] Update YAML with nested fields --- init/iofog/local-stack.yaml | 10 ++++++---- start.sh | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/init/iofog/local-stack.yaml b/init/iofog/local-stack.yaml index 21073b6..fc2e2d9 100644 --- a/init/iofog/local-stack.yaml +++ b/init/iofog/local-stack.yaml @@ -4,8 +4,6 @@ kind: ControlPlane metadata: name: local-ecn spec: - images: - controller: docker.io/iofog/controller:1.3.0-beta iofogUser: name: test surname: local @@ -14,6 +12,8 @@ spec: controllers: - name: local-controller host: localhost + container: + image: docker.io/iofog/controller:1.3.0-beta --- apiVersion: iofog.org/v1 kind: Connector @@ -21,7 +21,8 @@ metadata: name: local-connector spec: host: localhost - image: docker.io/iofog/connector:1.3.0-beta + container: + image: docker.io/iofog/connector:1.3.0-beta --- apiVersion: iofog.org/v1 kind: Agent @@ -29,5 +30,6 @@ metadata: name: local-agent spec: host: localhost - image: docker.io/iofog/agent:1.3.0-beta + container: + image: docker.io/iofog/agent:1.3.0-beta diff --git a/start.sh b/start.sh index 1ed6c44..7017ce3 100755 --- a/start.sh +++ b/start.sh @@ -41,8 +41,6 @@ kind: ControlPlane metadata: name: local-ecn spec: - images: - controller: $CONTROLLER_IMAGE iofogUser: name: test surname: local @@ -51,6 +49,8 @@ spec: controllers: - name: local-controller host: localhost + container: + image: $CONTROLLER_IMAGE --- apiVersion: iofog.org/v1 kind: Connector @@ -58,7 +58,8 @@ metadata: name: local-connector spec: host: localhost - image: $CONNECTOR_IMAGE + container: + image: $CONNECTOR_IMAGE --- apiVersion: iofog.org/v1 kind: Agent @@ -66,7 +67,8 @@ metadata: name: local-agent spec: host: localhost - image: $AGENT_IMAGE + container: + image: $AGENT_IMAGE " >| init/iofog/local-stack.yaml echoInfo "Deploying containers for ioFog stack..." From 9d8ba620dfb4e531c27119360d14066c9e49fbd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Kr=C4=8D=C3=A1l?= Date: Thu, 7 Nov 2019 17:05:34 +1300 Subject: [PATCH 50/55] Add version check for iofogctl when running all scripts --- utils.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/utils.sh b/utils.sh index a58b17d..b3be816 100755 --- a/utils.sh +++ b/utils.sh @@ -101,6 +101,22 @@ checkOSPlatform() { export ID D_NUM } +versionCompare() { + test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"; +} + +checkIofogctl() { + IOFOGCTL_MINIMAL_VERSION="1.3.0" + if [[ -z "$(command -v iofogctl)" ]] ; then + echoError "iofogctl not found!" + exit 1; + fi + IOFOGCTL_VERSION=$(iofogctl version | sed -n 's/version: \([0-9]*\.[0-9]*\.[0-9]*\).*/\1/p') + if versionCompare "${IOFOGCTL_MINIMAL_VERSION}" "${IOFOGCTL_VERSION}"; then + echoError "iofogctl version not sufficient!" + exit 1; + fi +} # # The following are a bunch or pretty printing echo methods # @@ -139,3 +155,4 @@ echoError() { # Are we in debug mode? checkForDebug +checkIofogctl From ddc58e6cec8efe7ef5a7a388a0c7a797546841da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Kr=C4=8D=C3=A1l?= Date: Thu, 7 Nov 2019 17:10:08 +1300 Subject: [PATCH 51/55] Remove generated file local-stack.yaml --- init/iofog/.gitignore | 1 + init/iofog/local-stack.yaml | 35 ----------------------------------- 2 files changed, 1 insertion(+), 35 deletions(-) create mode 100644 init/iofog/.gitignore delete mode 100644 init/iofog/local-stack.yaml diff --git a/init/iofog/.gitignore b/init/iofog/.gitignore new file mode 100644 index 0000000..9fa6d25 --- /dev/null +++ b/init/iofog/.gitignore @@ -0,0 +1 @@ +local-stack.yaml diff --git a/init/iofog/local-stack.yaml b/init/iofog/local-stack.yaml deleted file mode 100644 index fc2e2d9..0000000 --- a/init/iofog/local-stack.yaml +++ /dev/null @@ -1,35 +0,0 @@ ---- -apiVersion: iofog.org/v1 -kind: ControlPlane -metadata: - name: local-ecn -spec: - iofogUser: - name: test - surname: local - email: user@domain.com - password: '#Bugs4Fun' - controllers: - - name: local-controller - host: localhost - container: - image: docker.io/iofog/controller:1.3.0-beta ---- -apiVersion: iofog.org/v1 -kind: Connector -metadata: - name: local-connector -spec: - host: localhost - container: - image: docker.io/iofog/connector:1.3.0-beta ---- -apiVersion: iofog.org/v1 -kind: Agent -metadata: - name: local-agent -spec: - host: localhost - container: - image: docker.io/iofog/agent:1.3.0-beta - From 610dae5e270f5ab14b0a86781f843f2416afda96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Kr=C4=8D=C3=A1l?= Date: Thu, 7 Nov 2019 17:14:56 +1300 Subject: [PATCH 52/55] Fix Controller image version to 1.3.0-rc3 --- start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/start.sh b/start.sh index 1aeaf8b..0e5e7f6 100755 --- a/start.sh +++ b/start.sh @@ -96,7 +96,7 @@ startEnvironment() { ENVIRONMENT='' IOFOG_BUILD_NO_CACHE='' AGENT_IMAGE='docker.io/iofog/agent:1.3.0-rc1' -CONTROLLER_IMAGE='docker.io/iofog/controller:1.3.0-rc1' +CONTROLLER_IMAGE='docker.io/iofog/controller:1.3.0-rc3' CONNECTOR_IMAGE='docker.io/iofog/connector:1.3.0-rc1' while [[ "$#" -ge 1 ]]; do case "$1" in From e4a70bedff28bd824de8607ee335143cedcd84fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Kr=C4=8D=C3=A1l?= Date: Thu, 7 Nov 2019 18:25:37 +1300 Subject: [PATCH 53/55] Update test runner to 1.3 --- test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.sh b/test.sh index 0135f46..a073ee0 100755 --- a/test.sh +++ b/test.sh @@ -88,6 +88,6 @@ docker run --rm --name test-runner --network local-iofog-network \ -e CONTROLLER="iofog-controller:51121" \ -e CONNECTOR="iofog-connector:8080" \ -e AGENTS="root@iofog-agent:22" \ - iofog/test-runner:1.2 + iofog/test-runner:1.3 echoNotify "## Test Runner Tests complete" From bc02ef6a89f52c9276126aaa729e559e72c24e2f Mon Sep 17 00:00:00 2001 From: SergeRadinovich Date: Wed, 20 Nov 2019 15:47:55 +1300 Subject: [PATCH 54/55] Update version versions to 1.3.0 --- start.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/start.sh b/start.sh index 0e5e7f6..2fd75a5 100755 --- a/start.sh +++ b/start.sh @@ -95,9 +95,9 @@ startEnvironment() { ENVIRONMENT='' IOFOG_BUILD_NO_CACHE='' -AGENT_IMAGE='docker.io/iofog/agent:1.3.0-rc1' -CONTROLLER_IMAGE='docker.io/iofog/controller:1.3.0-rc3' -CONNECTOR_IMAGE='docker.io/iofog/connector:1.3.0-rc1' +AGENT_IMAGE='docker.io/iofog/agent:1.3.0' +CONTROLLER_IMAGE='docker.io/iofog/controller:1.3.0' +CONNECTOR_IMAGE='docker.io/iofog/connector:1.3.0' while [[ "$#" -ge 1 ]]; do case "$1" in -h|--help) From aa0cd51ccd8fe0da691fa71d5881b3e495cb30dd Mon Sep 17 00:00:00 2001 From: SergeRadinovich Date: Wed, 20 Nov 2019 17:04:54 +1300 Subject: [PATCH 55/55] Bump controller version to 1.3.1 --- start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/start.sh b/start.sh index 2fd75a5..5dd4156 100755 --- a/start.sh +++ b/start.sh @@ -96,7 +96,7 @@ startEnvironment() { ENVIRONMENT='' IOFOG_BUILD_NO_CACHE='' AGENT_IMAGE='docker.io/iofog/agent:1.3.0' -CONTROLLER_IMAGE='docker.io/iofog/controller:1.3.0' +CONTROLLER_IMAGE='docker.io/iofog/controller:1.3.1' CONNECTOR_IMAGE='docker.io/iofog/connector:1.3.0' while [[ "$#" -ge 1 ]]; do case "$1" in