Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
blendb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
22
Issues
22
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
C3SL
blendb
Commits
41da7f69
Commit
41da7f69
authored
Oct 16, 2018
by
rafaelatc3sl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#89
: Add blendb demonstration with postgres
Signed-off-by:
rafaelatc3sl
<
rpd17@c3sl
>
parent
e70ee858
Pipeline
#18218
passed with stages
in 51 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
146 additions
and
49 deletions
+146
-49
.dockerignore
.dockerignore
+2
-1
.gitlab-ci.yml
.gitlab-ci.yml
+2
-2
config/config.env.example
config/config.env.example
+2
-2
config/config.yaml.example
config/config.yaml.example
+73
-15
docker-compose.yml
docker-compose.yml
+26
-28
package.json
package.json
+2
-1
scripts/loadTest.ts
scripts/loadTest.ts
+39
-0
No files found.
.dockerignore
View file @
41da7f69
/artwork
/config
/config/*.yaml
!/config/*.example
/coverage
/database
/doc
...
...
.gitlab-ci.yml
View file @
41da7f69
...
...
@@ -11,7 +11,7 @@ variables:
POSTGRES_USER
:
'
runner'
POSTGRES_PASSWORD
:
'
'
MONETDB_NAME
:
'
blendb_fixture'
PKG_VERSION
:
'
latest
'
PKG_VERSION
:
'
1.0-alpha
'
DOCKER_URL
:
'
dockerregistry.c3sl.ufpr.br:5000/c3sl/blendb:'
cache
:
...
...
@@ -69,5 +69,5 @@ deploy:
-
docker
-
build
only
:
-
master
-
develop
config/config.env.example
View file @
41da7f69
BLENDB_DB_USER=blendb
BLENDB_DB_NAME=blendb-test
BLENDB_DB_USER=blendb
BLENDB_DB_PASSWORD=secret
BLENDB_DB_HOST=localhost
BLENDB_DB_PORT=5432
BLENDB_ADAPTER=postgres
BLENDB_SCHEMA_FILE=config/config.yaml
BLENDB_SCHEMA_FILE=config/config.yaml
.example
PORT=3000
config/config.yaml.example
View file @
41da7f69
connection:
user: 'blendb'
database: 'blendb-test'
password: 'secret'
host: 'localhost'
port: 5432
max: 10
idleTimeoutMillis: 30000
struct:
create: false
insert: false
schema:
views:
metrics:
dimensions:
# gitignore ignores files.yaml in this folder
# however a config file for tests in CI is required
# so this example file in fact is the CI test file
views:
links:
- config/market_views.yaml.example
obj:
-
alias: "Seller"
data: "test/postgres/fixtures/seller.json"
origin: true
dimensions:
- "dim:seller:name"
- "dim:seller:sex"
- "dim:seller:cpf"
- "dim:seller:id"
- "dim:seller:status"
metrics:
- "met:seller:avg:age"
- "met:seller:max:age"
- "met:seller:min:age"
- "met:seller:count:age"
metrics:
links:
- config/market_metrics.yaml.example
obj:
-
name: "met:seller:avg:age"
dataType: "float"
aggregation: "avg"
description: "The seller average age"
dimensions:
links:
- config/market_dimensions.yaml.example
obj:
-
name: "dim:seller:name"
dataType: "string"
description: "Name of the seller from market"
enumTypes:
links:
- config/market_enum.yaml.example
obj:
- []
sources:
links:
- config/market_sources.yaml.example
obj:
-
name: "Seller"
description: "Market worker"
fields:
-
name: "name"
description: "Seller name"
dataType: "string"
-
name: "age"
description: "Seller age"
dataType: "integer"
-
name: "sex"
description: "Seller sex"
enumType: "enumsex"
dataType: "enumtype"
-
name: "CPF"
description: "Seller CPF"
dataType: "string"
-
name: "id"
description: "Seller id"
dataType: "integer"
docker-compose.yml
View file @
41da7f69
version
:
'
3.3'
services
:
blendb-postgres
:
image
:
postgres:10
container_name
:
postgres
environment
:
POSTGRES_PASSWORD
:
passwd
PGDATA
:
/var/lib/postgresql/docker/pgdata
ports
:
-
5432:5432
restart
:
unless-stopped
security_opt
:
-
no-new-privileges
blendb
:
image
:
marula.c3sl.ufpr.br:5000/c3sl/blendb:latest
build
:
.
container_name
:
blendb
# depends_on:
# - db
environment
:
BLENDB_DB_USER
:
${BLENDB_DB_USER}
BLENDB_DB_PASSWORD
:
${BLENDB_DB_PASSWORD}
BLENDB_DB_NAME
:
${BLENDB_DB_NAME}
BLENDB_DB_HOST
:
${BLENDB_DB_HOST}
BLENDB_DB_PORT
:
${BLENDB_DB_PORT}
BLENDB_ST_CREATE
:
${BLENDB_ST_CREATE}
BLENDB_ST_INSERT
:
${BLENDB_ST_INSERT}
BLENDB_ADAPTER
:
${BLENDB_ADAPTER}
volumes
:
-
type
:
bind
source
:
./config
target
:
/home/node/app/config
-
type
:
tmpfs
target
:
/tmp
BLENDB_DB_USER
:
postgres
BLENDB_DB_PASSWORD
:
passwd
BLENDB_DB_NAME
:
postgres
BLENDB_DB_HOST
:
postgres
BLENDB_DB_PORT
:
5432
BLENDB_ADAPTER
:
postgres
BLENDB_SCHEMA_FILE
:
config/config.yaml.example
PORT
:
3000
ports
:
-
3000:3000
command
:
[
"
yarn"
,
"
test-mode"
]
restart
:
unless-stopped
read_only
:
'
true'
security_opt
:
-
no-new-privileges
# db:
# image: postgres:9.6
# container_name: db
# ports:
# - "5432"
# restart: unless-stopped
# #read_only: 'true'
# security_opt:
# - no-new-privileges
volumes
:
-
type
:
tmpfs
target
:
/tmp
package.json
View file @
41da7f69
...
...
@@ -4,13 +4,14 @@
"description"
:
"BlenDB"
,
"main"
:
"index.js"
,
"scripts"
:
{
"start"
:
"env $(cat config/config.env) node index"
,
"start"
:
"env $(cat config/config.env
) node index"
,
"lint"
:
"tslint -s node_modules/tslint-stylish -t stylish src/**/*.ts test/**/*.ts"
,
"test"
:
"env $(cat config/test.env) ts-node node_modules/istanbul/lib/cli.js cover -x
\"
**/*.spec.ts
\"
-e .ts _mocha"
,
"show-coverage"
:
"xdg-open coverage/lcov-report/index.html"
,
"doc-api"
:
"raml2html -i specs/blendb-api-v1.raml -o doc/api-v1-reference.html"
,
"schema"
:
"env $(cat config/config.env ) ts-node scripts/schema.ts config/config.yaml schema.sql"
,
"service"
:
"./scripts/service.sh"
,
"test-mode"
:
"ts-node scripts/loadTest.ts && node index"
,
"doc-code"
:
"typedoc --mode 'file' --module 'commonjs' --target 'ES6' --ignoreCompilerErrors --exclude '**/*.spec.ts' --out 'doc/code' 'src'"
},
"repository"
:
{
...
...
scripts/loadTest.ts
0 → 100644
View file @
41da7f69
#!/usr/bin/env node
/*
* Copyright (C) 2018 Centro de Computacao Cientifica e Software Livre
* Departamento de Informatica - Universidade Federal do Parana
*
* This file is part of blendb.
*
* blendb is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* blendb is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with blendb. If not, see <http://www.gnu.org/licenses/>.
*/
import
{
Fixture
as
FixPostgres
}
from
"
../test/postgres/fixture
"
;
import
{
ConfigParser
}
from
"
../src/util/configParser
"
;
let
config
:
any
;
let
fixture
;
const
configPath
=
process
.
env
.
BLENDB_SCHEMA_FILE
;
config
=
ConfigParser
.
parse
(
configPath
);
fixture
=
new
FixPostgres
(
config
.
connection
);
fixture
.
load
(
config
.
loadViews
,
(
err
)
=>
{
if
(
err
)
{
throw
err
;
}
})
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment