Skip to content

Commit

Permalink
deploy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
r0fls committed Jun 10, 2024
1 parent 626e79a commit 425eea5
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 16 deletions.
2 changes: 1 addition & 1 deletion helm-chart/templates/deployment-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion helm-chart/templates/deployment-dashboard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion helm-chart/templates/deployment-trading.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 15 additions & 13 deletions helm-chart/values.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 4 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down Expand Up @@ -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})
Expand Down

0 comments on commit 425eea5

Please sign in to comment.