boyinfuture commited on
Commit
24f4709
·
1 Parent(s): ea2c971

adding the render file

Browse files
Files changed (2) hide show
  1. frontend/src/services/api.js +31 -2
  2. render.yaml +59 -0
frontend/src/services/api.js CHANGED
@@ -1,7 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import axios from 'axios';
2
 
 
 
 
 
3
  const apiClient = axios.create({
4
- baseURL: 'http://localhost:8000',
5
  headers: {
6
  'Content-Type': 'application/json',
7
  },
@@ -15,7 +45,6 @@ export const getJob = (jobId) => {
15
  return apiClient.get(`/jobs/${jobId}`);
16
  };
17
 
18
-
19
  export const getJobsHistory = () => {
20
  return apiClient.get('/jobs');
21
  };
 
1
+ // import axios from 'axios';
2
+
3
+ // const apiClient = axios.create({
4
+ // baseURL: 'http://localhost:8000',
5
+ // headers: {
6
+ // 'Content-Type': 'application/json',
7
+ // },
8
+ // });
9
+
10
+ // export const createJob = (ticker) => {
11
+ // return apiClient.post('/jobs', { ticker });
12
+ // };
13
+
14
+ // export const getJob = (jobId) => {
15
+ // return apiClient.get(`/jobs/${jobId}`);
16
+ // };
17
+
18
+
19
+ // export const getJobsHistory = () => {
20
+ // return apiClient.get('/jobs');
21
+ // };
22
+
23
+
24
+
25
+
26
+
27
  import axios from 'axios';
28
 
29
+ // this line will use the production URL when deployed,
30
+ // and the local URL when you're running it on your machine.
31
+ const API_URL = import.meta.env.VITE_API_URL || 'http://localhost:8000';
32
+
33
  const apiClient = axios.create({
34
+ baseURL: API_URL,
35
  headers: {
36
  'Content-Type': 'application/json',
37
  },
 
45
  return apiClient.get(`/jobs/${jobId}`);
46
  };
47
 
 
48
  export const getJobsHistory = () => {
49
  return apiClient.get('/jobs');
50
  };
render.yaml ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ services:
2
+ # The Redis Service
3
+ - type: redis
4
+ name: redis
5
+ plan: free
6
+
7
+ # The Backend API Service
8
+ - type: web
9
+ name: backend
10
+ plan: free
11
+ env: docker
12
+ dockerfilePath: ./backend/Dockerfile
13
+ dockerContext: .
14
+ # Health check to ensure the service is running before accepting traffic
15
+ healthCheckPath: /
16
+ envVars:
17
+ - key: DATABASE_URL
18
+ fromDatabase:
19
+ name: YOUR_NEON_DB_NAME # You'll replace this
20
+ property: connectionString
21
+ - key: CELERY_BROKER_URL
22
+ fromService:
23
+ type: redis
24
+ name: redis
25
+ property: connectionString
26
+ - key: CELERY_RESULT_BACKEND
27
+ fromService:
28
+ type: redis
29
+ name: redis
30
+ property: connectionString
31
+ - key: GOOGLE_API_KEY
32
+ sync: false # We will set this secret manually
33
+
34
+ # The Celery Worker Service
35
+ - type: worker
36
+ name: worker
37
+ plan: free
38
+ env: docker
39
+ dockerfilePath: ./backend/Dockerfile
40
+ dockerContext: .
41
+ # The command to start the worker
42
+ startCommand: python -m celery -A celery_worker.celery worker --loglevel=info
43
+ envVars:
44
+ - key: DATABASE_URL
45
+ fromDatabase:
46
+ name: YOUR_NEON_DB_NAME # You'll replace this
47
+ property: connectionString
48
+ - key: CELERY_BROKER_URL
49
+ fromService:
50
+ type: redis
51
+ name: redis
52
+ property: connectionString
53
+ - key: CELERY_RESULT_BACKEND
54
+ fromService:
55
+ type: redis
56
+ name: redis
57
+ property: connectionString
58
+ - key: GOOGLE_API_KEY
59
+ sync: false