Yadav122 commited on
Commit
a8c0833
·
1 Parent(s): cb2a233
.env CHANGED
@@ -13,7 +13,8 @@ CACHE_TTL=300
13
  UVICORN_HOST=0.0.0.0
14
  UVICORN_PORT=7860
15
 
16
- LOG_LEVEL=INFO
 
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
- # A generic, single database configuration.
2
-
3
  [alembic]
4
- # path to migration scripts
5
- script_location = /opt/MailPilot/MailPilot_ai_agents/app/migrations
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", "revmigrate"),
11
- "pass": quote_plus(env.get("DATABASE_PASSWORD", "revmigrate")),
12
- "database": env.get("DATABASE_DB", "revmigrate_ai_agent_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
- db = psycopg2.connect(dsn)
20
- except (Exception, psycopg2.DatabaseError):
 
 
 
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
+ 2025-04-18T11:37:11.663928Z [info ] Application started  [app.main] filename=main.py func_name=<module> lineno=37 project=MailPilot_ai_agents version=0.1.0-alpha
2
+ 2025-04-18T11:37:11.669495Z [info ] Started server process [8]  [uvicorn.error] filename=server.py func_name=serve lineno=76
3
+ 2025-04-18T11:37:11.670944Z [info ] Waiting for application startup. [uvicorn.error] filename=on.py func_name=startup lineno=48
4
+ 2025-04-18T11:37:11.676298Z [info ] Application startup complete.  [uvicorn.error] filename=on.py func_name=startup lineno=62