Skip to content

Deploy dev #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
site
.idea
.DS_Store
deploy/logs
70 changes: 70 additions & 0 deletions deploy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Deploy example

In order to launch a local deployment of the platform, you can do the following:

## Add Keycloak to the local hosts file

In order for the Portal to connect to Keycloak correctly, they need to be added
to the local hosts file pointing to the local IP.
Open `/etc/hosts` and add them like so:

```
0.0.0.0 keycloak
0.0.0.0 portal
```

## Start the containers

All the containers can be started and configured using the script included

```
./deploy.sh
```

and for stopping the containers, there's another script for that as well

```
./clean.sh
```

## Set up Keycloak from the Admin UI

There's a few necessary steps to setup Keycloak to work with the Portal:

1. Access the Admin UI from http://localhost:8080
2. Login with the default admin user (USERNAME: admin, PASSWORD: password)
3. Under clients, find the admin-cli client. Under Service Account Roles, add
all the available unassigned roles to the client.
4. Under users, create a new user. Give it a username and email at least, and
set a password for it. Ensure to tick the box for verified email, and untick
the box for temporary password. Add the user to the groups
/EnvironmentManagement/Demo and Admin under the Town group.

## Log into the Portal

You can now log into the portal at http://localhost:8000 using the newly created
user. An example Device and Group has been created and filled with a basic
air quality attribute.

## Send some data to the UL IoT Agent

With the script send_payload_to_agent.sh you can send an air quality reading to
a device called Device. The script can be invoked as:

```
./send_payload_to_agent.sh 51
```

Where 51 is the air quality reading to send for example. You can see the changes
reflect onto the map in Grafana.

## Log into Grafana

The Grafana dashboards can be found at http://localhost:3000 . Login with the
default admin user (USERNAME: admin, PASSWORD: admin). An example dashboard
can be found under the general group showing a map with the example device for
air quality. It should appear as an icon in Switzerland.

# Todo (next)
- Use newer keycloak and load scripts
- Use newer grafana
2 changes: 2 additions & 0 deletions deploy/clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
docker-compose down -v
File renamed without changes.
42 changes: 42 additions & 0 deletions deploy/crate-datasource/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
node_modules
npm-debug.log
coverage/
.aws-config.json
awsconfig
/emails/dist
/public_gen
/tmp
vendor/phantomjs/phantomjs

# Builded dist
# /dist

# Test artifacts
/dist/test
/dist/spec

docs/AWS_S3_BUCKET
docs/GIT_BRANCH
docs/VERSION
docs/GITCOMMIT
docs/changed-files
docs/changed-files

# locally required config files
public/css/*.min.css

# Editor junk
*.sublime-workspace
*.sublime-project
*.swp
.idea/
*.iml

/data/*
/bin/*

conf/custom.ini
fig.yml
profile.cov
grafana
.notouch
13 changes: 13 additions & 0 deletions deploy/crate-datasource/.jscsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"disallowImplicitTypeConversion": ["string"],
"disallowKeywords": ["with"],
"disallowMultipleLineBreaks": true,
"disallowMixedSpacesAndTabs": true,
"disallowTrailingWhitespace": true,
"requireSpacesInFunctionExpression": {
"beforeOpeningCurlyBrace": true
},
"disallowSpacesInsideArrayBrackets": true,
"disallowSpacesInsideParentheses": true,
"validateIndentation": 2
}
46 changes: 46 additions & 0 deletions deploy/crate-datasource/.jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"browser": true,

"bitwise":false,
"curly": true,
"eqnull": true,
"strict": true,
"module": true,
"devel": true,
"eqeqeq": true,
"forin": false,
"immed": true,
"supernew": true,
"expr": true,
"indent": 2,
"latedef": false,
"newcap": true,
"noarg": true,
"noempty": true,
"undef": true,
"boss": true,
"trailing": true,
"laxbreak": true,
"laxcomma": true,
"sub": true,
"unused": true,
"maxdepth": 6,
"maxlen": 140,
"esnext": true,

"globals": {
"System": true,
"Promise": true,
"define": true,
"require": true,
"Chromath": false,
"setImmediate": true,
"expect": true,
"it": true,
"describe": true,
"sinon": true,
"module": true,
"beforeEach": true,
"inject": true
}
}
49 changes: 49 additions & 0 deletions deploy/crate-datasource/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Change Log


## [Unreleased]


## [0.5.1] - 2017-04-05
### Changed
- Use date_trunk() when interval set to second, minute, etc
- Override limit only for Raw agg queries.


## [0.5.0] - 2017-03-22
### Added
- Checks schema and table (prevent queries to different source).


## [0.4.0] - 2017-03-19
### Added
- 'Auto' (uses date_trunk()) and 'Auto (Grafana)' (uses floor()) time intervals.

### Fixed
- 10K issue

### Changed
- Use explicit aggregation by time interval based on floor() instead date_trunk()

## [0.3.0] - 2017-03-02
### Added
- Table mode support
- Ad-hoc filters support
- $timeFilter variable support
- Quote column names with capital letters [#28](https://github.com/raintank/crate-datasource/issues/28)
- Support GROUP BY in raw queries, issue [#30](https://github.com/raintank/crate-datasource/issues/30)

### Fixed
- Schema queries (changed in Crate 1.0)


## [0.2.0] - 2016-11-29
### Added
- Special "Raw" aggregation type [#9](https://github.com/raintank/crate-datasource/issues/9)
- Alias for each field in SELECT


## [0.1.0] - 2016-07-10
- Initial release
- Implementation by [raintank](http://raintank.io)
- Documentation contributions from [Crate.io](https://crate.io)
121 changes: 121 additions & 0 deletions deploy/crate-datasource/Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
module.exports = function(grunt) {

require('load-grunt-tasks')(grunt);

grunt.loadNpmTasks('grunt-execute');
grunt.loadNpmTasks('grunt-contrib-clean');

grunt.initConfig({

clean: ["dist"],

copy: {
src_to_dist: {
cwd: 'src',
expand: true,
src: ['**/*', '!**/*.js', '!**/*.scss'],
dest: 'dist'
},
pluginDef: {
expand: true,
src: ['README.md'],
dest: 'dist'
}
},

watch: {
rebuild_all: {
files: ['src/**/*'],
tasks: ['watch-ts'],
options: {spawn: false}
}
},

typescript: {
build: {
src: ['dist/**/*.ts', "!src/spec/**/*", "!**/*.d.ts"],
dest: 'dist/',
options: {
module: 'system', //or commonjs
target: 'es3', //or es5
rootDir: 'dist/',
keepDirectoryHierarchy: false,
declaration: true,
emitDecoratorMetadata: true,
experimentalDecorators: true,
sourceMap: true,
noImplicitAny: false,
}
},
distTests: {
src: ['src/**/*.ts', "!src/spec/**/*", "!**/*.d.ts"],
dest: 'dist/test/',
options: {
module: 'commonjs', //or commonjs
target: 'es5', //or es5
rootDir: 'src/',
sourceRoot: 'src/',
declaration: true,
emitDecoratorMetadata: true,
experimentalDecorators: true,
sourceMap: true,
noImplicitAny: false,
}
},
// distTestsSpecs: {
// src: ['src/spec/**/*.ts'],
// dest: 'dist/test/',
// options: {
// module: 'commonjs', //or commonjs
// target: 'es5', //or es5
// declaration: true,
// emitDecoratorMetadata: true,
// experimentalDecorators: true,
// sourceMap: true,
// noImplicitAny: false,
// }
// }
},

babel: {
options: {
sourceMap: true,
presets: ['es2015']
},
distTestsSpecsNoSystemJs: {
files: [{
expand: true,
cwd: 'src/spec',
src: ['**/*.js'],
dest: 'dist/test/spec',
ext:'.js'
}]
}
},

mochaTest: {
test: {
options: {
reporter: 'spec'
},
src: ['dist/test/spec/test-main.js', 'dist/test/spec/*_specs.js']
}
}
});

grunt.registerTask('default', [
'clean',
'copy',
'typescript:build',
'typescript:distTests',
'babel',
'mochaTest'
]);

grunt.registerTask('watch-ts', [
'clean',
'copy:src_to_dist',
'copy:pluginDef',
'typescript:build'
]);
};
Loading