diff --git a/helm-chart/templates/deployment-api.yaml b/helm-chart/templates/deployment-api.yaml index f164c98..584a9fd 100644 --- a/helm-chart/templates/deployment-api.yaml +++ b/helm-chart/templates/deployment-api.yaml @@ -19,7 +19,7 @@ spec: spec: containers: - name: api - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + image: "{{ .Values.api.image.repository }}:{{ .Values.api.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} env: - name: DATABASE_URL diff --git a/helm-chart/templates/deployment-dashboard.yaml b/helm-chart/templates/deployment-dashboard.yaml index 2b6039b..4e4597e 100644 --- a/helm-chart/templates/deployment-dashboard.yaml +++ b/helm-chart/templates/deployment-dashboard.yaml @@ -16,7 +16,7 @@ spec: spec: containers: - name: trading-dashboard - image: your-docker-repo/trading-dashboard:latest + image: "{{ .Values.api.image.repository }}:{{ .Values.api.image.tag }}" ports: - containerPort: 80 env: diff --git a/helm-chart/templates/deployment-trading.yaml b/helm-chart/templates/deployment-trading.yaml index 51f3eca..d79e6ef 100644 --- a/helm-chart/templates/deployment-trading.yaml +++ b/helm-chart/templates/deployment-trading.yaml @@ -19,7 +19,7 @@ spec: spec: containers: - name: trading - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + image: "{{ .Values.trading.image.repository }}:{{ .Values.trading.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} env: - name: DATABASE_URL diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index a163764..47d2333 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -1,18 +1,20 @@ replicaCount: 1 -image: - api: - repository: soad-trading-system - tag: latest - pullPolicy: Always - trading: - repository: soad-trading-system - tag: latest - pullPolicy: Always - dashboard: - repository: soad-trading-dashboard - tag: latest - pullPolicy: Always +api: + image: + repository: soad-trading-system + tag: latest + pullPolicy: Always +trading: + image: + repository: soad-trading-system + tag: latest + pullPolicy: Always +dashboard: + image: + repository: soad-trading-dashboard + tag: latest + pullPolicy: Always service: type: ClusterIP diff --git a/main.py b/main.py index 8ba8533..cad8c82 100644 --- a/main.py +++ b/main.py @@ -29,6 +29,8 @@ def start_trading_system(config_path): # Setup the database engine if 'database' in config and 'url' in config['database']: engine = create_engine(config['database']['url']) + elif os.environ.get("DATABASE_URL", None): + engine = create_engine(os.environ.get("DATABASE_URL")) else: engine = create_engine('sqlite:///default_trading_system.db') logger.info('Database engine created', extra={'db_url': engine.url}) @@ -92,6 +94,8 @@ def start_api_server(config_path=None, local_testing=False): engine = create_engine('sqlite:///trading.db') elif 'database' in config and 'url' in config['database']: engine = create_engine(config['database']['url']) + elif os.environ.get("DATABASE_URL", None): + engine = create_engine(os.environ.get("DATABASE_URL")) else: engine = create_engine('sqlite:///default_trading_system.db') logger.info('Database engine created for API server', extra={'db_url': engine.url})