Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • iot/platform
1 result
Show changes
Commits on Source (5)
......@@ -7,9 +7,35 @@ stages:
build:
stage: build
only:
- master
- staging
- main
script:
- docker build ./ -t "$CI_REGISTRY_IMAGE:latest" --no-cache
- docker build ./ -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" --no-cache
- docker login $CI_REGISTRY -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD
- docker push "$CI_REGISTRY_IMAGE:latest"
- docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
.deploy: &deploy
stage: portainer
variables:
GIT_CHECKOUT: "false"
script:
- if [[ ! -z "${WEBHOOK_PORTAINER}" ]]; then
for url in $(echo ${WEBHOOK_PORTAINER} | sed "s/,/ /g"); do wget --post-data '' -O - "$url"; done
else
echo "Empty \$WEBHOOK_PORTAINER" ; exit 1;
fi
deploy_main:
<<: *deploy
only:
- main
environment:
name: main
deploy_staging:
<<: *deploy
only:
- staging
environment:
name: staging
openapi: 3.0.3
info:
title: IoT@UFSC
description: |-
Documentação da API da plataforma IoT da UFSC
contact:
email: servicos.ti+iot@sistemas.ufsc.br
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
version: 1.0.11
externalDocs:
description: Mais sobre o serviços
url: https://iot.lisha.ufsc.br
servers:
- url: /
tags:
- name: series
description: |-
Gerenciamento das series temporais
externalDocs:
description: Mais informações
url: https://epos.lisha.ufsc.br/IoT+Platform#SmartData_Series
- name: dados
description: Entrada e saida de dados
externalDocs:
description: Mais informações
url: https://epos.lisha.ufsc.br/IoT+Platform#SmartData
paths:
/api/create:
post:
tags:
- series
summary: Criar uma serie temporal
description: Criar uma serie temporal
#operationId: updatePet
requestBody:
description: Requisição para criar serie
content:
application/json:
schema:
$ref: '#/components/schemas/series'
required: true
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/series'
'401':
description: Credenciais erradas
/api/put:
post:
tags:
- dados
summary: Entrar com dados na plataforma
description: Criar uma serie temporal
#operationId: updatePet
requestBody:
description: Requisição para criar serie
content:
application/json:
schema:
$ref: '#/components/schemas/smartdata'
required: true
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/series'
'401':
description: Credenciais erradas
/api/get:
post:
tags:
- dados
summary: Entrar com dados na plataforma
description: Criar uma serie temporal
requestBody:
description: Requisição para criar serie
content:
application/json:
schema:
$ref: '#/components/schemas/query'
required: true
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/query-response-v12'
'401':
description: Credenciais erradas
components:
schemas:
series:
type: object
properties:
version:
$ref: '#/components/schemas/version'
unit:
$ref: '#/components/schemas/unit'
x:
$ref: '#/components/schemas/ponto'
y:
$ref: '#/components/schemas/ponto'
z:
$ref: '#/components/schemas/ponto'
r:
type: integer
description: Raio
example: 10
t0:
$ref: '#/components/schemas/tempo'
t1:
$ref: '#/components/schemas/tempo'
dev:
type: integer
example: 10
signature:
type: string
example: 10
workflow:
type: integer
example: 0
smartdata:
type: object
properties:
version:
$ref: '#/components/schemas/version'
unit:
$ref: '#/components/schemas/unit'
value:
type: number
format: double
error:
type: integer
format: int64
default: 0
confidence:
type: integer
format: int64
default: 1
x:
$ref: '#/components/schemas/ponto'
y:
$ref: '#/components/schemas/ponto'
z:
$ref: '#/components/schemas/ponto'
r:
type: integer
description: Raio
example: 10
t:
$ref: '#/components/schemas/tempo'
dev:
type: integer
example: 10
signature:
type: string
example: 10
workflow:
type: integer
example: 0
query:
type: object
required:
- version
- unit
- dev
- x
- y
- z
properties:
version:
$ref: '#/components/schemas/version'
unit:
$ref: '#/components/schemas/unit'
dev:
type: integer
example: 10
signature:
type: string
example: 10
x:
$ref: '#/components/schemas/ponto'
y:
$ref: '#/components/schemas/ponto'
z:
$ref: '#/components/schemas/ponto'
r:
type: integer
description: Raio
example: 10
t0:
$ref: '#/components/schemas/tempo'
tf:
$ref: '#/components/schemas/tempo'
query-response-v12:
type: object
properties:
version:
$ref: '#/components/schemas/version'
unit:
$ref: '#/components/schemas/unit'
timestamp:
$ref: '#/components/schemas/tempo'
value:
type: number
format: double
error:
type: integer
format: int64
default: 0
confidence:
type: integer
format: int64
default: 1
gateway:
type: integer
example: 10
type:
type: string
example: 10
period:
type: integer
example: 10
dev:
type: integer
example: 10
signature:
type: string
example: 10
x:
$ref: '#/components/schemas/ponto'
y:
$ref: '#/components/schemas/ponto'
z:
$ref: '#/components/schemas/ponto'
tempo:
type: integer
format: int64
description: |-
- Microsegundos
- UNIX Time * 1.000.000
- Ex.: time.time() * 1000000
ponto:
type: integer
format: int32
description: |-
- Coordenada absoluta (ECEF) da localização do dado.
- Não é Latitude/Longitude (LLH).
- [Converter LLH para ECEF](https://www.oc.nps.edu/oc2902w/coord/llhxyz.htm)
```python
#Python
import pyproj
transformer = pyproj.Transformer.from_crs({"proj":'latlong', "ellps":'WGS84', "datum":'WGS84'},{"proj":'geocent', "ellps":'WGS84', "datum":'WGS84'})
x, y, z = transformer.transform( lng, lat, alt)
```
version:
type: string
enum:
- "1.1"
- "1.2"
description: |-
- A lista de versoes pode se encontrada em:
- https://epos.lisha.ufsc.br/IoT+Platform#SmartData
unit:
type: integer
format: int32
example: 66571993184
description: |-
- A lista de unidades pode se encontrada em:
- https://epos.lisha.ufsc.br/Usefull+SmartData+Units
- https://epos.lisha.ufsc.br/EPOS+2+User+Guide#Unit
......@@ -2133,7 +2133,7 @@ class Backend_V1_1 extends Backend_Common
$time = intval(1000000 * microtime(true));
$this->_initialize_daemon($_wf);
$str_json = $msd->toJson();
$filename = "{$msd->unit_code}{$msd->time}{$msd->x}{$msd->y}{$msd->z}{$time}";
$filename = "{$msd->unit_code}_{$msd->time}_{$msd->x}_{$msd->y}_{$msd->z}_{$time}";
$input = fopen("{$_root}/../workflow/{$this->_domain}/{$_wf}_{$filename}", "w");
fwrite($input, $str_json."\n");
fclose($input);
......@@ -2162,7 +2162,7 @@ class Backend_V1_1 extends Backend_Common
$js = $smart_data->toJson();
if ($compr > 500) {
$time = intval(1000000 * microtime(true));
$filename = "{$smart_data->unit_code}{$smart_data->time}{$smart_data->x}{$smart_data->y}{$smart_data->z}{$time}";
$filename = "{$smart_data->unit_code}_{$smart_data->time}_{$smart_data->x}_{$smart_data->y}_{$smart_data->z}_{$time}";
$input = fopen("{$_root}/../workflow/{$this->_domain}/{$_wf}_".$filename, "w");
fwrite($input, "{\"smartdata\":" . $js . "}\n");
fclose($input);
......@@ -2196,7 +2196,7 @@ class Backend_V1_1 extends Backend_Common
}
$str_json = json_encode($json);
$time = intval(1000000 * microtime(true));
$filename = "{$series->unit}{$series->t0}{$series->t1}{$series->x}{$series->y}{$series->z}{$series->r}{$time}";
$filename = "{$series->unit}_{$series->t0}_{$series->t1}_{$series->x}_{$series->y}_{$series->z}_{$series->r}_{$time}";
$input = fopen("{$_root}/../workflow/{$this->_domain}/{$_wf}_{$filename}", "w");
fwrite($input, "$str_json\n");
fclose($input);
......
......@@ -41,6 +41,7 @@ abstract class Logger
public static function exception(\Exception $e) {
$message = get_class($e) . "> {$e->getFile()}:{$e->getLine()}> {$e->getMessage()}\n";
$message .= $e->getTraceAsString()."\n";
if ( ! isset( $_ENV['DISABLE_USERS_LOG_RETURN'] ) ) echo $e->getMessage()."\n";
self::_log($message, LOG_ERR, true);
}
......
#
<VirtualHost _default_:443>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
......@@ -16,12 +15,6 @@
SSLCACertificateFile /etc/apache2/ssl/ca.crt
SSLVerifyClient optional
SSLVerifyDepth 5
#SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt
#SSLCACertificatePath /etc/ssl/certs/
#SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt
#SSLCARevocationPath /etc/apache2/ssl.crl/
#SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl
#SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
......
<html>
<h3>API: /api </h3>
<a href='/api'>API</>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Plataforma IoT</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/4.1.3/swagger-ui.css" />
</head>
<body>
<div id="swagger-ui"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/4.1.3/swagger-ui-bundle.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/4.1.3/swagger-ui-standalone-preset.js"></script>
<script>
const ui = SwaggerUIBundle({
url: '/api/openapi.yml',
dom_id: '#swagger-ui',
presets: [
SwaggerUIStandalonePreset,
SwaggerUIBundle.presets.apis,
],
layout: "StandaloneLayout",
});
</script>
</body>
</html>