Ejemplo n.º 1
0
import os

#
# Add module to Nuvla server.
#
# The following environmental variables can/must be defined:
#
# NUVLA_ENDPOINT: endpoint of Nuvla server, defaults to localhost
# NUVLA_USERNAME: username to access Nuvla
# NUVLA_PASSWORD: password to access Nuvla
#

from nuvla.api import Api as nuvla_Api

nuvla_api = nuvla_Api(os.environ['NUVLA_ENDPOINT'], insecure=True)

nuvla_api.login_password(os.environ['NUVLA_USERNAME'],
                         os.environ['NUVLA_PASSWORD'])

description = """An application composed of two services for demonstration and
learning purposes. The goal is to show how the application developer
can use environmental variables, secrets, configuration files, urls,
and output parameters. To make everything visible in this application
definition, no custom images have been used."""


def relative_file(filename):
    return os.path.join(os.path.dirname(__file__), filename)


with open(relative_file('docker-compose.yml')) as x:
Ejemplo n.º 2
0
#!/usr/bin/env python

import json

from os import listdir
from os.path import isfile, join

from nuvla.api import Api as nuvla_Api

nuvla_api = nuvla_Api('https://localhost', insecure=True)

nuvla_api.login_internal('super', 'supeR8-supeR8')

#
# set the swarm infrastructure-service
#

response = nuvla_api.search('infrastructure-service', filter="type='swarm'")
swarm_id = response.data['resources'][0]['id']

print("SWARM ID: %s" % swarm_id)

#
# collect all of the JSON files in gnss subdirectory
#

path = "gnss"
json_files = [f for f in listdir(path) if isfile(join(path, f))]

#
# read and store entries