mbonea-ewallet godwin
commited on
Commit
·
cd66269
1
Parent(s):
fa99625
using a localpostgress db
Browse files- App/modelInit.py +5 -1
- docker-compose.yml +25 -32
App/modelInit.py
CHANGED
@@ -2,8 +2,12 @@ import databases
|
|
2 |
import orm
|
3 |
import psycopg2
|
4 |
|
|
|
|
|
|
|
5 |
database = databases.Database(
|
6 |
-
"postgresql+asyncpg://
|
7 |
)
|
|
|
8 |
# databases = databases.Database(**args)
|
9 |
models = orm.ModelRegistry(database=database)
|
|
|
2 |
import orm
|
3 |
import psycopg2
|
4 |
|
5 |
+
# database = databases.Database(
|
6 |
+
# "postgresql+asyncpg://postgres:[email protected]:5432/postgres"
|
7 |
+
# )
|
8 |
database = databases.Database(
|
9 |
+
"postgresql+asyncpg://user:password@db:5432/mydatabase"
|
10 |
)
|
11 |
+
|
12 |
# databases = databases.Database(**args)
|
13 |
models = orm.ModelRegistry(database=database)
|
docker-compose.yml
CHANGED
@@ -1,37 +1,30 @@
|
|
1 |
-
version: '3
|
|
|
2 |
services:
|
3 |
-
|
4 |
-
image:
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
6 |
volumes:
|
7 |
-
-
|
|
|
|
|
|
|
|
|
|
|
8 |
ports:
|
9 |
-
-
|
10 |
-
restart: always
|
11 |
-
environment:
|
12 |
-
- xpack.security.enabled=true
|
13 |
-
- discovery.type=single-node
|
14 |
-
# kibana:
|
15 |
-
# depends_on:
|
16 |
-
# - elasticsearch
|
17 |
-
# image: docker.elastic.co/kibana/kibana:8.1.0
|
18 |
-
# container_name: kibana
|
19 |
-
# volumes:
|
20 |
-
# - kibana-data:/usr/share/kibana/data
|
21 |
-
# ports:
|
22 |
-
# - 5601:5601
|
23 |
-
# restart: always
|
24 |
-
# environment:
|
25 |
-
# - ELASTICSEARCH_HOSTS=http://elasticsearch:9200
|
26 |
-
fastapi:
|
27 |
-
build: ./
|
28 |
depends_on:
|
29 |
-
-
|
30 |
-
|
31 |
-
-
|
32 |
-
|
|
|
|
|
|
|
33 |
volumes:
|
34 |
-
|
35 |
-
driver: local
|
36 |
-
kibana-data:
|
37 |
-
driver: local
|
|
|
1 |
+
version: '3'
|
2 |
+
|
3 |
services:
|
4 |
+
db:
|
5 |
+
image: postgres
|
6 |
+
environment:
|
7 |
+
POSTGRES_USER: user
|
8 |
+
POSTGRES_PASSWORD: password
|
9 |
+
POSTGRES_DB: mydatabase
|
10 |
+
ports:
|
11 |
+
- "5432:5432"
|
12 |
volumes:
|
13 |
+
- postgres_data:/var/lib/postgresql/data
|
14 |
+
|
15 |
+
|
16 |
+
app:
|
17 |
+
build:
|
18 |
+
context: .
|
19 |
ports:
|
20 |
+
- "8000:8000"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
depends_on:
|
22 |
+
- db
|
23 |
+
environment:
|
24 |
+
- DATABASE_URL=postgresql://user:password@db:5432/mydatabase
|
25 |
+
command: uvicorn App.app:app --host 0.0.0.0 --port 8000
|
26 |
+
|
27 |
+
|
28 |
+
|
29 |
volumes:
|
30 |
+
postgres_data:
|
|
|
|
|
|