Skip to content

Commit

Permalink
Adapted configurations to latest schema.
Browse files Browse the repository at this point in the history
Added environs to docker-compose and removed from .env-devel hosts and ports (should be hard-coded in docker-compose)
  • Loading branch information
Pedro Crespo committed Nov 12, 2018
1 parent cff674b commit 5098583
Show file tree
Hide file tree
Showing 13 changed files with 167 additions and 132 deletions.
2 changes: 0 additions & 2 deletions .env-devel
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ POSTGRES_ENDPOINT=postgres:5432
POSTGRES_USER=simcore
POSTGRES_PASSWORD=simcore
POSTGRES_DB=simcoredb
POSTGRES_HOST=postgres
POSTGRES_PORT=5432
RABBITMQ_USER=simcore
RABBITMQ_PASSWORD=simcore
RABBITMQ_PROGRESS_CHANNEL=comp.backend.channels.progress
Expand Down
14 changes: 8 additions & 6 deletions services/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ services:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_HOST=${POSTGRES_HOST}
- POSTGRES_PORT=${POSTGRES_PORT}
- POSTGRES_HOST=postgres
- POSTGRES_PORT=5432
- S3_ENDPOINT=${S3_ENDPOINT}
- S3_ACCESS_KEY=${S3_ACCESS_KEY}
- S3_SECRET_KEY=${S3_SECRET_KEY}
Expand All @@ -55,15 +55,17 @@ services:
ports:
- '9081:8080'
environment:
- APIHUB_HOST=apihub
- APIHUB_PORT=8043
- DIRECTOR_HOST=director
- DIRECTOR_PORT=8001
- OSPARC_PUBLIC_URL=${OSPARC_PUBLIC_URL}
- POSTGRES_ENDPOINT=${POSTGRES_ENDPOINT}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_HOST=${POSTGRES_HOST}
- POSTGRES_PORT=${POSTGRES_PORT}
- POSTGRES_HOST=postgres
- POSTGRES_PORT=5432
- RABBITMQ_USER=${RABBITMQ_USER}
- RABBITMQ_PASSWORD=${RABBITMQ_PASSWORD}
- RABBITMQ_PROGRESS_CHANNEL=${RABBITMQ_PROGRESS_CHANNEL}
Expand Down Expand Up @@ -119,8 +121,8 @@ services:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_HOST=${POSTGRES_HOST}
- POSTGRES_PORT=${POSTGRES_PORT}
- POSTGRES_HOST=postgres
- POSTGRES_PORT=5432
- S3_ENDPOINT=${S3_ENDPOINT}
- S3_ACCESS_KEY=${S3_ACCESS_KEY}
- S3_SECRET_KEY=${S3_SECRET_KEY}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
""" app's configuration
This module loads the schema defined by every subsystem and injects it in the
application's configuration scheams
It was designed in a similar fashion to the setup protocol of the application
where every subsystem is imported and queried in a specific order. The application
depends on the subsystem and not the other way around.
The app configuration is created before the application instance exists.
TODO: add more strict checks with re
TODO: add support for versioning.
- check shema fits version
- parse/format version in schema
TODO add simcore_sdk.config.s3 section!!!
TODO: create decorator so every module injects sections in a global schema. This way we avoid cyclic dependencies
TODO: add simcore_sdk.config.s3 section!!!
"""
import logging

Expand All @@ -21,6 +29,8 @@
log = logging.getLogger(__name__)




def create_schema():
"""
Build schema for the configuration's file
Expand All @@ -33,7 +43,7 @@ def create_schema():
"port": T.Int(),
T.Key("public_url", optional=True): T.Or(T.String(), T.List(T.String)), # full url seen by front-end
"client_outdir": T.String(),
"log_level": T.Enum( list(logging._nameToLevel.keys()) ), # pylint: disable=W0212
"log_level": T.Enum(*logging._nameToLevel.keys()), # pylint: disable=protected-access
"testing": T.Bool(),
T.Key("disable_services", default=[], optional=True): T.List(T.String()), # TODO: optional enable function in every section
}),
Expand All @@ -46,7 +56,7 @@ def create_schema():


section_names = [k.name for k in schema.keys]
assert len(section_names) == set(section_names), "Found repeated section names in %s" % section_names
assert len(section_names) == len(set(section_names)), "Found repeated section names in %s" % section_names

return schema

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ main:
public_url: http://localhost:8080
testing: true
disable_services: []
db:
init_tables: True
db:
init_tables: True
postgres:
database: simcoredb
endpoint: postgres:5432
host: localhost
maxsize: 5
minsize: 1
password: simcore
port: 5432
user: simcore
director:
host: director
port: 8001
postgres:
database: simcoredb
endpoint: postgres:5432
host: localhost
maxsize: 5
minsize: 1
password: simcore
port: 5432
user: simcore
rabbit:
channels:
log: comp.backend.channels.log
Expand All @@ -34,8 +34,13 @@ smtp:
tls: False
username: Null
password: Null
s3:
access_key: 'Q3AM3UQ867SPQQA43P2F'
bucket_name: simcore
endpoint: play.minio.io:9000
secret_key: 'zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG'
# s3:
# access_key: 'Q3AM3UQ867SPQQA43P2F'
# bucket_name: simcore
# endpoint: play.minio.io:9000
# secret_key: 'zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG'
rest:
oas:
version: v0
location: ../../../../../../api/specs/webserver/v0
#location: http://localhost:8043/api/specs/webserver/v0
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,39 @@ main:
public_url: http://localhost:9081
testing: true
disable_services: []
db:
init_tables: False
director:
host: director
port: 8001
postgres:
database: simcoredb
endpoint: postgres:5432
host: postgres
maxsize: 5
minsize: 1
password: simcore
port: 5432
user: simcore
db:
init_tables: False
postgres:
database: simcoredb
endpoint: postgres:5432
host: postgres
maxsize: 5
minsize: 1
password: simcore
port: 5432
user: simcore
rabbit:
channels:
log: comp.backend.channels.log
progress: comp.backend.channels.progress
password: simcore
user: simcore
s3:
access_key: 'Q3AM3UQ867SPQQA43P2F'
bucket_name: simcore
endpoint: play.minio.io:9000
secret_key: 'zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG'
# s3:
# access_key: 'Q3AM3UQ867SPQQA43P2F'
# bucket_name: simcore
# endpoint: play.minio.io:9000
# secret_key: 'zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG'
smtp:
sender: 'OSPARC support <[email protected]>'
host: mail.foo.com
port: 25
tls: False
username: Null
password: Null
rest:
oas:
version: v0
location: http://localhost:8043/api/specs/webserver/v0
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,38 @@ main:
log_level: DEBUG
testing: True
# disable_services: [director, postgres, rabbit, s3]
db:
init_tables: True
director:
host: ${DIRECTOR_HOST}
port: ${DIRECTOR_PORT}
postgres:
database: ${POSTGRES_DB}
endpoint: ${POSTGRES_ENDPOINT}
user: ${POSTGRES_USER}
password: ${POSTGRES_PASSWORD}
host: postgres
port: 5432
db:
init_tables: True
postgres:
database: ${POSTGRES_DB}
endpoint: ${POSTGRES_ENDPOINT}
user: ${POSTGRES_USER}
password: ${POSTGRES_PASSWORD}
host: postgres
port: 5432
rabbit:
user: ${RABBITMQ_USER}
password: ${RABBITMQ_PASSWORD}
channels:
progress: ${RABBITMQ_PROGRESS_CHANNEL}
log: ${RABBITMQ_LOG_CHANNEL}
s3:
endpoint: ${S3_ENDPOINT}
access_key: ${S3_ACCESS_KEY}
secret_key: ${S3_SECRET_KEY}
bucket_name: ${S3_BUCKET_NAME}
# s3:
# endpoint: ${S3_ENDPOINT}
# access_key: ${S3_ACCESS_KEY}
# secret_key: ${S3_SECRET_KEY}
# bucket_name: ${S3_BUCKET_NAME}
smtp:
sender: 'OSPARC support <[email protected]>'
host: ${SMTP_HOST}
port: ${SMTP_PORT}
tls: False
username: Null
password: Null
rest:
oas:
version: v0
location: http://${APIHUB_HOST}:${APIHUB_PORT}/api/specs/webserver/v0
...
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,38 @@ main:
client_outdir: ${SIMCORE_WEB_OUTDIR}
log_level: INFO
testing: False
db:
init_tables: True
director:
host: ${DIRECTOR_HOST}
port: ${DIRECTOR_PORT}
postgres:
database: ${POSTGRES_DB}
endpoint: ${POSTGRES_ENDPOINT}
user: ${POSTGRES_USER}
password: ${POSTGRES_PASSWORD}
host: ${POSTGRES_HOST}
port: ${POSTGRES_PORT}
db:
init_tables: True
postgres:
database: ${POSTGRES_DB}
endpoint: ${POSTGRES_ENDPOINT}
user: ${POSTGRES_USER}
password: ${POSTGRES_PASSWORD}
host: ${POSTGRES_HOST}
port: ${POSTGRES_PORT}
rabbit:
user: ${RABBITMQ_USER}
password: ${RABBITMQ_PASSWORD}
channels:
progress: ${RABBITMQ_PROGRESS_CHANNEL}
log: ${RABBITMQ_LOG_CHANNEL}
s3:
endpoint: ${S3_ENDPOINT}
access_key: ${S3_ACCESS_KEY}
secret_key: ${S3_SECRET_KEY}
bucket_name: ${S3_BUCKET_NAME}
# s3:
# endpoint: ${S3_ENDPOINT}
# access_key: ${S3_ACCESS_KEY}
# secret_key: ${S3_SECRET_KEY}
# bucket_name: ${S3_BUCKET_NAME}
smtp:
sender: 'OSPARC support <[email protected]>'
host: ${SMTP_HOST}
port: ${SMTP_PORT}
tls: False
username: Null
password: Null
rest:
oas:
version: v0
location: http://${APIHUB_HOST}:${APIHUB_PORT}/api/specs/webserver/v0
...
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,36 @@ main:
director:
host: ${DIRECTOR_HOST}
port: ${DIRECTOR_PORT}
postgres:
database: ${POSTGRES_DB}
user: ${POSTGRES_USER}
password: ${POSTGRES_PASSWORD}
host: localhost
port: 5432
minsize: 1
maxsize: 5
endpoint: ${POSTGRES_ENDPOINT}
db:
postgres:
database: ${POSTGRES_DB}
user: ${POSTGRES_USER}
password: ${POSTGRES_PASSWORD}
host: localhost
port: 5432
minsize: 1
maxsize: 5
endpoint: ${POSTGRES_ENDPOINT}
rabbit:
user: ${RABBITMQ_USER}
password: ${RABBITMQ_PASSWORD}
channels:
progress: ${RABBITMQ_PROGRESS_CHANNEL}
log: ${RABBITMQ_LOG_CHANNEL}
s3:
endpoint: ${S3_ENDPOINT}
access_key: ${S3_ACCESS_KEY}
secret_key: ${S3_SECRET_KEY}
bucket_name: ${S3_BUCKET_NAME}
# s3:
# endpoint: ${S3_ENDPOINT}
# access_key: ${S3_ACCESS_KEY}
# secret_key: ${S3_SECRET_KEY}
# bucket_name: ${S3_BUCKET_NAME}
smtp:
sender: 'OSPARC support <[email protected]>'
host: ${SMTP_HOST}
port: ${SMTP_PORT}
tls: False
username: Null
password: Null
rest:
oas:
version: v0
location: http://${APIHUB_HOST}:${APIHUB_PORT}/api/specs/webserver/v0
...
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


schema = T.Dict({
"openapi_spec": T.Dict({
"oas": T.Dict({
"version": T.String, # TODO: v0, v1, etc
"location": T.Or(T.String, T.URL) # either path or url should contain version in it
})
Expand Down
Loading

0 comments on commit 5098583

Please sign in to comment.