Skip to content
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

deploy fixes #23

Merged
merged 1 commit into from
Jun 10, 2024
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading