This repository has been archived by the owner on Apr 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: transfer deployment to concourse (#811) * chore(Dockerfile): add LABEL values * chore: transfer deployment to concourse * fix: last tweaks * refactor: rename to deployment * fix(travis): tests deployment * fix(kernel): create views within migration phase (#814) * fix: .dockerignore files (#813) * chore: upgrade dependencies (#818) * chore: fix docker and scripts (#820) * chore: fix ui volumes * chore: upgrade keycloak 9.0.0 * chore: fix wait_for script * chore: drop if exists * fix: wget dry run * feat(producer): access kernel via REST API (#817) * fix(producer): reorganize code I * fix(producer): reorganize code II * fix: cleaning * fix: more cleaning * fix: more cleaning * fix: more cleaning * fix(integration): add KAFKA_URL * fix: drop readonly user * fix: more cleaning * feat(producer): access kernel via REST API * fix: last tweaks * fix(producer): default server port is 5005 Co-authored-by: Obdulia Losantos <obdulia.losantos@ehealthnigeria.org> Co-authored-by: obdulia <obdulia.losantos@gmail.com>
- Loading branch information
1 parent
ed3e08f
commit 551cd56
Showing
61 changed files
with
1,997 additions
and
1,827 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
**/.dockerignore | ||
**/Dockerfile | ||
**/*.Dockerfile | ||
|
||
**/__pycache__ | ||
**/*.pyc | ||
**/*.pyo | ||
**/*.pyd | ||
**/.Python | ||
|
||
**/env | ||
**/.env | ||
|
||
**/.tox | ||
**/.coverage | ||
**/.coverage.* | ||
**/.cache | ||
**/coverage.xml | ||
**/*.cover | ||
|
||
**/*.log | ||
|
||
**/node_modules | ||
|
||
!.git/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,7 +82,7 @@ htmlcov/ | |
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*,cover | ||
*.cover | ||
|
||
# Translations | ||
*.mo | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,16 @@ | ||
.dockerignore | ||
Dockerfile | ||
db.sqlite3 | ||
__pycache__ | ||
*.pyc | ||
*.pyo | ||
*.pyd | ||
.Python | ||
env | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
.tox | ||
.coverage | ||
.coverage.* | ||
.cache | ||
coverage.xml | ||
*,cover | ||
*.log | ||
.git | ||
|
||
**/__pycache__ | ||
**/*.pyc | ||
**/*.pyo | ||
**/*.pyd | ||
**/.Python | ||
|
||
**/.coverage | ||
**/.coverage.* | ||
**/.cache | ||
**/coverage.xml | ||
**/*.cover | ||
|
||
**/*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,16 @@ | ||
.dockerignore | ||
Dockerfile | ||
db.sqlite3 | ||
__pycache__ | ||
*.pyc | ||
*.pyo | ||
*.pyd | ||
.Python | ||
env | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
.tox | ||
.coverage | ||
.coverage.* | ||
.cache | ||
coverage.xml | ||
*,cover | ||
*.log | ||
.git | ||
|
||
**/__pycache__ | ||
**/*.pyc | ||
**/*.pyo | ||
**/*.pyd | ||
**/.Python | ||
|
||
**/.coverage | ||
**/.coverage.* | ||
**/.cache | ||
**/coverage.xml | ||
**/*.cover | ||
|
||
**/*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
# Copyright (C) 2019 by eHealth Africa : http://www.eHealthAfrica.org | ||
# | ||
# See the NOTICE file distributed with this work for additional information | ||
# regarding copyright ownership. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
# The purpose of this file is to tell django that there are models linked to | ||
# this module then it runs the `pre_migrate` and `post_migrate` signals, | ||
# otherwise they will be ignored. | ||
|
||
from django.db import connection | ||
from django.conf import settings | ||
|
||
|
||
_DROP_VIEWS = ''' | ||
DROP VIEW IF EXISTS kernel_entity_vw CASCADE; | ||
DROP VIEW IF EXISTS kernel_schema_vw CASCADE; | ||
DROP VIEW IF EXISTS multitenancy_mtinstance_vw CASCADE; | ||
''' | ||
|
||
_CREATE_MT_VIEW_YES = ''' | ||
CREATE OR REPLACE VIEW multitenancy_mtinstance_vw AS | ||
SELECT realm, instance_id | ||
FROM multitenancy_mtinstance | ||
; | ||
''' | ||
|
||
_CREATE_MT_VIEW_NOT = f''' | ||
CREATE OR REPLACE VIEW multitenancy_mtinstance_vw AS | ||
SELECT '{settings.NO_MULTITENANCY_REALM}' AS realm, id AS instance_id | ||
FROM kernel_project | ||
; | ||
''' | ||
|
||
_CREATE_SCHEMA_VIEW = ''' | ||
CREATE OR REPLACE VIEW kernel_schema_vw AS | ||
SELECT | ||
GREATEST(sd.modified, s.modified) AS modified, | ||
sd.id AS schemadecorator_id, | ||
sd.name AS schemadecorator_name, | ||
s.id AS schema_id, | ||
s.name AS schema_name, | ||
s.definition AS schema_definition, | ||
s.revision AS schema_revision, | ||
mt.realm AS realm, | ||
(s.family = sd.project_id::text) AS is_identity | ||
FROM kernel_schemadecorator AS sd | ||
INNER JOIN kernel_schema AS s | ||
ON sd.schema_id = s.id | ||
INNER JOIN multitenancy_mtinstance_vw AS mt | ||
ON sd.project_id = mt.instance_id | ||
ORDER BY 1 ASC | ||
; | ||
''' | ||
|
||
_CREATE_ENTITY_VIEW = ''' | ||
CREATE OR REPLACE VIEW kernel_entity_vw AS | ||
SELECT | ||
e.id, | ||
e.revision, | ||
e.payload, | ||
e.modified, | ||
e.status, | ||
s.schemadecorator_id, | ||
s.schemadecorator_name, | ||
s.schema_name, | ||
s.schema_id, | ||
s.schema_revision, | ||
s.realm | ||
FROM kernel_entity AS e | ||
INNER JOIN kernel_schema_vw AS s | ||
ON e.schemadecorator_id = s.schemadecorator_id | ||
ORDER BY e.modified ASC | ||
; | ||
''' | ||
|
||
|
||
def pre_migrate_signal(**kwargs): | ||
with connection.cursor() as cursor: | ||
cursor.execute(_DROP_VIEWS) | ||
|
||
|
||
def post_migrate_signal(**kwargs): | ||
if settings.MULTITENANCY: | ||
create_sql = _CREATE_MT_VIEW_YES | ||
else: | ||
create_sql = _CREATE_MT_VIEW_NOT | ||
create_sql += _CREATE_SCHEMA_VIEW | ||
create_sql += _CREATE_ENTITY_VIEW | ||
|
||
with connection.cursor() as cursor: | ||
cursor.execute(create_sql) |
Oops, something went wrong.