push code
Browse files- .env +3 -1
- app/__pycache__/main.cpython-312.pyc +0 -0
- app/core/__pycache__/logger.cpython-312.pyc +0 -0
- app/migrations/alembic.ini +4 -7
- app/pg_isready.py +9 -9
- docker-compose.yml +30 -0
- logs/app.log +4 -0
.env
CHANGED
@@ -13,7 +13,8 @@ CACHE_TTL=300
|
|
13 |
UVICORN_HOST=0.0.0.0
|
14 |
UVICORN_PORT=7860
|
15 |
|
16 |
-
|
|
|
17 |
LOG_JSON_FORMAT=False
|
18 |
ROOT_PATH=/
|
19 |
|
@@ -29,3 +30,4 @@ AWS_SECRET_KEY=
|
|
29 |
AWS_REGION=us-east-1
|
30 |
|
31 |
|
|
|
|
13 |
UVICORN_HOST=0.0.0.0
|
14 |
UVICORN_PORT=7860
|
15 |
|
16 |
+
ENVIRONMENT=DEV
|
17 |
+
LOG_LEVEL=DEBUG
|
18 |
LOG_JSON_FORMAT=False
|
19 |
ROOT_PATH=/
|
20 |
|
|
|
30 |
AWS_REGION=us-east-1
|
31 |
|
32 |
|
33 |
+
|
app/__pycache__/main.cpython-312.pyc
CHANGED
Binary files a/app/__pycache__/main.cpython-312.pyc and b/app/__pycache__/main.cpython-312.pyc differ
|
|
app/core/__pycache__/logger.cpython-312.pyc
CHANGED
Binary files a/app/core/__pycache__/logger.cpython-312.pyc and b/app/core/__pycache__/logger.cpython-312.pyc differ
|
|
app/migrations/alembic.ini
CHANGED
@@ -1,8 +1,7 @@
|
|
1 |
-
#
|
2 |
-
|
3 |
[alembic]
|
4 |
-
|
5 |
-
|
6 |
|
7 |
# template used to generate migration files
|
8 |
file_template = %%(year)d%%(month).2d%%(day).2d%%(minute).2d_%%(slug)s_%%(rev)s
|
@@ -50,8 +49,6 @@ version_path_separator = os # default: use os.pathsep
|
|
50 |
# are written from script.py.mako
|
51 |
# output_encoding = utf-8
|
52 |
|
53 |
-
sqlalchemy.url = driver://user:pass@localhost/dbname
|
54 |
-
|
55 |
|
56 |
[post_write_hooks]
|
57 |
# post_write_hooks defines scripts or Python functions that are run
|
@@ -98,4 +95,4 @@ formatter = generic
|
|
98 |
|
99 |
[formatter_generic]
|
100 |
format = %(levelname)-5.5s [%(name)s] %(message)s
|
101 |
-
datefmt = %H:%M:%S
|
|
|
1 |
+
# Generic single-database configuration.
|
|
|
2 |
[alembic]
|
3 |
+
script_location = app/migrations
|
4 |
+
sqlalchemy.url = postgresql://neondb_owner:npg_Kuh24FTfEsrx@ep-royal-meadow-a4zzp6z8-pooler.us-east-1.aws.neon.tech/neondb?sslmode=require
|
5 |
|
6 |
# template used to generate migration files
|
7 |
file_template = %%(year)d%%(month).2d%%(day).2d%%(minute).2d_%%(slug)s_%%(rev)s
|
|
|
49 |
# are written from script.py.mako
|
50 |
# output_encoding = utf-8
|
51 |
|
|
|
|
|
52 |
|
53 |
[post_write_hooks]
|
54 |
# post_write_hooks defines scripts or Python functions that are run
|
|
|
95 |
|
96 |
[formatter_generic]
|
97 |
format = %(levelname)-5.5s [%(name)s] %(message)s
|
98 |
+
datefmt = %H:%M:%S
|
app/pg_isready.py
CHANGED
@@ -7,17 +7,17 @@ import psycopg2
|
|
7 |
config = {
|
8 |
"host": env.get("DATABASE_HOSTNAME"),
|
9 |
"port": env.get("DATABASE_PORT", 5432),
|
10 |
-
"user": env.get("DATABASE_USER"
|
11 |
-
"
|
12 |
-
"database": env.get("DATABASE_DB"
|
|
|
13 |
}
|
14 |
|
15 |
-
dsn = "postgresql://%(user)s:%(pass)s@%(host)s:%(port)s/%(db)s" % config
|
16 |
-
|
17 |
if __name__ == "__main__":
|
18 |
try:
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
21 |
exit(1)
|
22 |
-
|
23 |
-
exit(0)
|
|
|
7 |
config = {
|
8 |
"host": env.get("DATABASE_HOSTNAME"),
|
9 |
"port": env.get("DATABASE_PORT", 5432),
|
10 |
+
"user": env.get("DATABASE_USER"),
|
11 |
+
"password": env.get("DATABASE_PASSWORD"),
|
12 |
+
"database": env.get("DATABASE_DB"),
|
13 |
+
"sslmode": "require"
|
14 |
}
|
15 |
|
|
|
|
|
16 |
if __name__ == "__main__":
|
17 |
try:
|
18 |
+
conn = psycopg2.connect(**config)
|
19 |
+
conn.close()
|
20 |
+
exit(0)
|
21 |
+
except (Exception, psycopg2.DatabaseError) as e:
|
22 |
+
print(f"Database connection error: {e}")
|
23 |
exit(1)
|
|
|
|
docker-compose.yml
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
version: "3.8"
|
2 |
+
|
3 |
+
services:
|
4 |
+
MailPilot_db:
|
5 |
+
image: postgres:latest
|
6 |
+
container_name: MailPilot_db_container
|
7 |
+
environment:
|
8 |
+
POSTGRES_DB: ${DATABASE_DB}
|
9 |
+
POSTGRES_USER: ${DATABASE_USER}
|
10 |
+
POSTGRES_PASSWORD: ${DATABASE_PASSWORD}
|
11 |
+
ports:
|
12 |
+
- "5432:5432"
|
13 |
+
volumes:
|
14 |
+
- ./local_pgdata:/opt/analysis/analysis_agents/db/pgdata
|
15 |
+
|
16 |
+
analysis_memcached:
|
17 |
+
image: memcached:latest
|
18 |
+
container_name: analysis_memcached_container
|
19 |
+
ports:
|
20 |
+
- "11211:11211"
|
21 |
+
|
22 |
+
analysis_migration:
|
23 |
+
build: .
|
24 |
+
env_file: .env
|
25 |
+
volumes:
|
26 |
+
- .:/opt/MailPilot/MailPilot_ai_agents
|
27 |
+
depends_on:
|
28 |
+
- MailPilot_db
|
29 |
+
entrypoint: ["/usr/local/bin/docker-entrypoint.sh"]
|
30 |
+
command: ["migration"]
|
logs/app.log
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[2m2025-04-18T11:37:11.663928Z[0m [[32m[1minfo [0m] [1mApplication started [0m [[0m[1m[34mapp.main[0m][0m [36mfilename[0m=[35mmain.py[0m [36mfunc_name[0m=[35m<module>[0m [36mlineno[0m=[35m37[0m [36mproject[0m=[35mMailPilot_ai_agents[0m [36mversion[0m=[35m0.1.0-alpha[0m
|
2 |
+
[2m2025-04-18T11:37:11.669495Z[0m [[32m[1minfo [0m] [1mStarted server process [8] [0m [[0m[1m[34muvicorn.error[0m][0m [36mfilename[0m=[35mserver.py[0m [36mfunc_name[0m=[35mserve[0m [36mlineno[0m=[35m76[0m
|
3 |
+
[2m2025-04-18T11:37:11.670944Z[0m [[32m[1minfo [0m] [1mWaiting for application startup.[0m [[0m[1m[34muvicorn.error[0m][0m [36mfilename[0m=[35mon.py[0m [36mfunc_name[0m=[35mstartup[0m [36mlineno[0m=[35m48[0m
|
4 |
+
[2m2025-04-18T11:37:11.676298Z[0m [[32m[1minfo [0m] [1mApplication startup complete. [0m [[0m[1m[34muvicorn.error[0m][0m [36mfilename[0m=[35mon.py[0m [36mfunc_name[0m=[35mstartup[0m [36mlineno[0m=[35m62[0m
|